Compare commits

...

11 Commits
master ... main

Author SHA1 Message Date
2a701e3ce2 test_main
Some checks failed
Backend_main / build (push) Successful in 21s
Backend_develop / build (push) Has been cancelled
2025-02-24 22:08:08 +08:00
319aed04f7 開啟swagger
All checks were successful
Backend_develop / build (push) Successful in 21s
2025-02-24 21:15:59 +08:00
9762e793cb test
All checks were successful
Backend_develop / build (push) Successful in 20s
2025-02-24 21:11:42 +08:00
6618b04a26 test
Some checks failed
Backend_develop / build (push) Failing after 12s
2025-02-24 21:07:58 +08:00
a88862d6b0 發布
Some checks failed
Backend_develop / build (push) Failing after 10s
2025-02-24 21:02:55 +08:00
272a3328be 發布
Some checks failed
Backend_develop / build (push) Failing after 11s
2025-02-24 20:58:04 +08:00
1a71ef9f24 發布
Some checks failed
Backend_develop / build (push) Failing after 11s
2025-02-24 20:48:20 +08:00
20da8d1acb .NET 發布
All checks were successful
Backend_develop / build (push) Successful in 26s
2025-02-24 20:44:57 +08:00
50c4cfd10b .NET 發布
Some checks failed
Backend_develop / build (push) Failing after 10s
2025-02-24 20:42:35 +08:00
1858a7439f testCI01
All checks were successful
Backend_develop / build (push) Successful in 14s
2025-02-24 20:27:01 +08:00
a946293f16 順序依時間排序 2025-02-22 19:38:02 +08:00
5 changed files with 131 additions and 9 deletions

View File

@ -0,0 +1,56 @@
name: Backend_develop # 工作流的名称
# 当有代码推送到仓库的 develop 分支时,这个 Actions 工作流会被触发并执行
on:
push:
branches:
- develop
jobs:
build:
runs-on: "backend_runner"
steps:
- name: test
shell: powershell
run: |
echo "Git clone_start"
# 設定變數
$projectPath = "D:\Code\Project\TCM"
$backendPath = "D:\Code\Project\TCM\Backend"
$apiPath = "D:\Code\Server\TCM\API"
cd D:\Code\Project\TCM
if (Test-Path "Backend") { Remove-Item -Recurse -Force "Backend" } # 刪除原資料
if (-not (Test-Path "Backend")) {New-Item -Path "Backend" -ItemType Directory -Force} # 建立資料夾
echo " Cloneing ..."
git clone -b develop http://leovip125.ddns.net:8418/TCM/Backend.git
echo "Clone End"
# .NET 發布
echo "發布 start"
# 切換到 Backend 目錄
cd $backendPath
if ($LASTEXITCODE -ne 0) { exit 1}
# 還原與建置
dotnet restore
if ($LASTEXITCODE -ne 0) {exit 1 }
dotnet build --configuration Release
if ($LASTEXITCODE -ne 0) { exit 1}
# 移除舊的 API 發布資料夾
if (Test-Path $apiPath) { Remove-Item -Recurse -Force $apiPath }
# 確保目標資料夾存在
New-Item -Path $apiPath -ItemType Directory -Force | Out-Null
# 發布
dotnet publish -c Release -o $apiPath
if ($LASTEXITCODE -ne 0) {exit 1 }
echo "發布 end"

56
.gitea/workflows/main.yml Normal file
View File

@ -0,0 +1,56 @@
name: Backend_main # 工作流的名称
# 当有代码推送到仓库的 develop 分支时,这个 Actions 工作流会被触发并执行
on:
push:
branches:
- main
jobs:
build:
runs-on: "backend_runner"
steps:
- name: test
shell: powershell
run: |
echo "Git clone_start"
# 設定變數
$projectPath = "D:\Code\Project\TCM_main"
$backendPath = "D:\Code\Project\TCM_main\Backend"
$apiPath = "D:\Code\Server\TCM\API_main"
cd D:\Code\Project\TCM_main
if (Test-Path "Backend") { Remove-Item -Recurse -Force "Backend" } # 刪除原資料
if (-not (Test-Path "Backend")) {New-Item -Path "Backend" -ItemType Directory -Force} # 建立資料夾
echo " Cloneing ..."
git clone -b main http://leovip125.ddns.net:8418/TCM/Backend.git
echo "Clone End"
# .NET 發布
echo "發布 start"
# 切換到 Backend 目錄
cd $backendPath
if ($LASTEXITCODE -ne 0) { exit 1}
# 還原與建置
dotnet restore
if ($LASTEXITCODE -ne 0) {exit 1 }
dotnet build --configuration Release
if ($LASTEXITCODE -ne 0) { exit 1}
# 移除舊的 API 發布資料夾
if (Test-Path $apiPath) { Remove-Item -Recurse -Force $apiPath }
# 確保目標資料夾存在
New-Item -Path $apiPath -ItemType Directory -Force | Out-Null
# 發布
dotnet publish -c Release -o $apiPath
if ($LASTEXITCODE -ne 0) {exit 1 }
echo "發布 end"

View File

@ -36,6 +36,7 @@ namespace TCM_API.Controllers.lamiter
var data = await(from a in _context.company_detail_table
join b in _context.user_table on a.guid equals b.guid into joined
from b in joined.DefaultIfEmpty()
orderby a.data_create_time
select new
{
company_name = a.company_name,

View File

@ -33,6 +33,7 @@ namespace TCM_API.Controllers.manage
{
var data = await (from c in _context.health_detail_table
orderby c.data_create_time
select new
{
health_name = c.health_name,
@ -52,15 +53,16 @@ namespace TCM_API.Controllers.manage
{
var data = await (from a in _context.health_detail_table
join b in _context.user_table on a.guid equals b.guid into joined
from b in joined.DefaultIfEmpty() // LEFT JOIN
where a.company_guid == guid
select new
{
health_name = a.health_name,
guid = a.guid,
level = b.level
}).ToListAsync();
join b in _context.user_table on a.guid equals b.guid into joined
from b in joined.DefaultIfEmpty() // LEFT JOIN
where a.company_guid == guid
orderby a.data_create_time
select new
{
health_name = a.health_name,
guid = a.guid,
level = b.level
}).ToListAsync();
return Ok(data);
}

View File

@ -125,6 +125,13 @@ if (app.Environment.IsDevelopment())
c.SwaggerEndpoint("/swagger/v1/swagger.json", "TCM_API");
});
}
app.UseSwagger();
//app.UseSwaggerUI();
app.UseSwaggerUI(c =>
{
c.SwaggerEndpoint("/swagger/v1/swagger.json", "TCM_API");
});
//在 ASP.NET Core 中啟用 CORS (跨原始來源要求)
// Shows UseCors with CorsPolicyBuilder.
app.UseCors(builder =>