Compare commits

..

No commits in common. "master" and "v1.0.1" have entirely different histories.

11 changed files with 42 additions and 96 deletions

View File

@ -48,7 +48,6 @@ jobs:
OWNER=${{ gitea.repository_owner }} OWNER=${{ gitea.repository_owner }}
TAG=${{ gitea.ref_name }} TAG=${{ gitea.ref_name }}
ASPNETCORE_ENVIRONMENT=${{ env.ASPNETCORE_ENVIRONMENT }} ASPNETCORE_ENVIRONMENT=${{ env.ASPNETCORE_ENVIRONMENT }}
replicas=1
run: | run: |
echo "$env_file">.env echo "$env_file">.env
@ -60,7 +59,7 @@ jobs:
username: ${{ secrets.PUBLISH_USER_NAME }} username: ${{ secrets.PUBLISH_USER_NAME }}
password: ${{ secrets.PUBLISH_PASSWORD }} password: ${{ secrets.PUBLISH_PASSWORD }}
target: ${{ env.PUBLISH_PATH }} target: ${{ env.PUBLISH_PATH }}
source: docker-swarm.yaml,.env source: docker-compose.yaml,.env
- name: 部署到服务器 - name: 部署到服务器
uses: docker://appleboy/drone-ssh uses: docker://appleboy/drone-ssh
@ -75,7 +74,7 @@ jobs:
[ -f .env ] && export $(sed '/^#/d' .env) [ -f .env ] && export $(sed '/^#/d' .env)
docker stack deploy -c docker-swarm.yaml --with-registry-auth mk docker stack deploy -c docker-compose.yaml --with-registry-auth mk
- name: 发送构建通知 - name: 发送构建通知
if: ${{ always() }} if: ${{ always() }}
@ -94,7 +93,6 @@ jobs:
>**代码分支**: ${{ gitea.ref_name }} >**代码分支**: ${{ gitea.ref_name }}
>**提交标识**: ${{ gitea.sha }} >**提交标识**: ${{ gitea.sha }}
>**提交发起**: ${{ gitea.actor }} >**提交发起**: ${{ gitea.actor }}
>**提交信息**: ${{ gitea.event.head_commit.message }}\n
" "
} }
} }

View File

@ -35,21 +35,16 @@ jobs:
volumes: volumes:
- /opt/.runner/nuget_packages:/root/.nuget/packages - /opt/.runner/nuget_packages:/root/.nuget/packages
env:
run_cmd: |
cd D:/marking.cut.service/publish
start Dolphin.ExamPictureCut.HttpApi.Host.exe --URLS="http://*:30000"
start Dolphin.ExamPictureCut.HttpApi.Host.exe --URLS="http://*:30001"
start Dolphin.ExamPictureCut.HttpApi.Host.exe --URLS="http://*:30002"
start Dolphin.ExamPictureCut.HttpApi.Host.exe --URLS="http://*:30003"
start Dolphin.ExamPictureCut.HttpApi.Host.exe --URLS="http://*:30004"
steps: steps:
- name: 下载源码 - name: 下载源码
uses: actions/checkout@v3 uses: actions/checkout@v3
- name: 使用缓存
uses: actions/cache@master
with:
mount: |
node_modules
- name: 编译后端 - name: 编译后端
uses: actions/aspnet@8.0 uses: actions/aspnet@8.0
with: with:
@ -89,12 +84,7 @@ jobs:
rm -rf marking.cut.service.tar.gz rm -rf marking.cut.service.tar.gz
curl -O https://static.w.23544.com:8843/marking/marking.cut.service.tar.gz curl -O https://static.w.23544.com:8843/marking/marking.cut.service.tar.gz
tar -zxvf marking.cut.service.tar.gz tar -zxvf marking.cut.service.tar.gz
# curl "http://localhost:5244/publish/run?execPath=D:/marking.cut.service/publish/Dolphin.ExamPictureCut.HttpApi.Host.exe&count=2" curl "http://localhost:5244/publish/run?execPath=D:/marking.cut.service/publish/Dolphin.ExamPictureCut.HttpApi.Host.exe&count=2"
echo "${{ env.run_cmd }}"
echo "${{ env.run_cmd }}"> publish/run.cmd
curl "http://localhost:5244/publish/run?execPath=D:/marking.cut.service/publish/run.cmd&count=2"
- name: 启动生产环境106 - name: 启动生产环境106
uses: docker://appleboy/drone-ssh uses: docker://appleboy/drone-ssh
@ -111,12 +101,7 @@ jobs:
rm -rf marking.cut.service.tar.gz rm -rf marking.cut.service.tar.gz
curl -O https://static.w.23544.com:8843/marking/marking.cut.service.tar.gz curl -O https://static.w.23544.com:8843/marking/marking.cut.service.tar.gz
tar -zxvf marking.cut.service.tar.gz tar -zxvf marking.cut.service.tar.gz
# curl "http://localhost:5244/publish/run?execPath=D:/marking.cut.service/publish/Dolphin.ExamPictureCut.HttpApi.Host.exe&count=2" curl "http://localhost:5244/publish/run?execPath=D:/marking.cut.service/publish/Dolphin.ExamPictureCut.HttpApi.Host.exe&count=2"
echo "${{ env.run_cmd }}"
echo "${{ env.run_cmd }}"> publish/run.cmd
curl "http://localhost:5244/publish/run?execPath=D:/marking.cut.service/publish/run.cmd&count=2"
- name: 发送构建通知 - name: 发送构建通知
if: ${{ always() }} if: ${{ always() }}
@ -135,7 +120,6 @@ jobs:
>**代码分支**: ${{ gitea.ref_name }} >**代码分支**: ${{ gitea.ref_name }}
>**提交标识**: ${{ gitea.sha }} >**提交标识**: ${{ gitea.sha }}
>**提交发起**: ${{ gitea.actor }} >**提交发起**: ${{ gitea.actor }}
>**提交信息**: ${{ gitea.event.head_commit.message }}\n
" "
} }
} }

View File

@ -48,7 +48,6 @@ jobs:
OWNER=${{ gitea.repository_owner }} OWNER=${{ gitea.repository_owner }}
TAG=${{ gitea.ref_name }} TAG=${{ gitea.ref_name }}
ASPNETCORE_ENVIRONMENT=${{ env.ASPNETCORE_ENVIRONMENT }} ASPNETCORE_ENVIRONMENT=${{ env.ASPNETCORE_ENVIRONMENT }}
replicas=8
run: | run: |
echo "$env_file">.env echo "$env_file">.env
@ -60,7 +59,7 @@ jobs:
username: ${{ secrets.PUBLISH_USER_NAME }} username: ${{ secrets.PUBLISH_USER_NAME }}
password: ${{ secrets.PUBLISH_PASSWORD }} password: ${{ secrets.PUBLISH_PASSWORD }}
target: ${{ env.PUBLISH_PATH }} target: ${{ env.PUBLISH_PATH }}
source: docker-swarm.yaml,.env source: docker-compose.yaml,.env
- name: 部署到服务器 - name: 部署到服务器
uses: docker://appleboy/drone-ssh uses: docker://appleboy/drone-ssh
@ -75,7 +74,7 @@ jobs:
[ -f .env ] && export $(sed '/^#/d' .env) [ -f .env ] && export $(sed '/^#/d' .env)
docker stack deploy -c docker-swarm.yaml --with-registry-auth mk docker stack deploy -c docker-compose.yaml --with-registry-auth mk
- name: 发送构建通知 - name: 发送构建通知
if: ${{ always() }} if: ${{ always() }}
@ -94,7 +93,6 @@ jobs:
>**代码分支**: ${{ gitea.ref_name }} >**代码分支**: ${{ gitea.ref_name }}
>**提交标识**: ${{ gitea.sha }} >**提交标识**: ${{ gitea.sha }}
>**提交发起**: ${{ gitea.actor }} >**提交发起**: ${{ gitea.actor }}
>**提交信息**: ${{ gitea.event.head_commit.message }}\n
" "
} }
} }

View File

@ -22,17 +22,6 @@ jobs:
volumes: volumes:
- /opt/.runner/nuget_packages:/root/.nuget/packages - /opt/.runner/nuget_packages:/root/.nuget/packages
env:
run_cmd: |
cd D:/marking.cut.service/publish
start Dolphin.ExamPictureCut.HttpApi.Host.exe --URLS="http://*:30000"
start Dolphin.ExamPictureCut.HttpApi.Host.exe --URLS="http://*:30001"
start Dolphin.ExamPictureCut.HttpApi.Host.exe --URLS="http://*:30002"
start Dolphin.ExamPictureCut.HttpApi.Host.exe --URLS="http://*:30003"
start Dolphin.ExamPictureCut.HttpApi.Host.exe --URLS="http://*:30004"
steps: steps:
- name: 下载源码 - name: 下载源码
uses: actions/checkout@v3 uses: actions/checkout@v3
@ -86,12 +75,7 @@ jobs:
rm -rf marking.cut.service.tar.gz rm -rf marking.cut.service.tar.gz
curl -O https://static.w.23544.com:8843/marking/marking.cut.service.tar.gz curl -O https://static.w.23544.com:8843/marking/marking.cut.service.tar.gz
tar -zxvf marking.cut.service.tar.gz tar -zxvf marking.cut.service.tar.gz
# curl "http://localhost:5244/publish/run?execPath=D:/marking.cut.service/publish/Dolphin.ExamPictureCut.HttpApi.Host.exe&count=2" curl "http://localhost:5244/publish/run?execPath=D:/marking.cut.service/publish/Dolphin.ExamPictureCut.HttpApi.Host.exe&count=2"
echo "${{ env.run_cmd }}"
echo "${{ env.run_cmd }}"> publish/run.cmd
curl "http://localhost:5244/publish/run?execPath=D:/marking.cut.service/publish/run.cmd&count=2"
- name: 启动生产环境106 - name: 启动生产环境106
uses: docker://appleboy/drone-ssh uses: docker://appleboy/drone-ssh
@ -108,12 +92,7 @@ jobs:
rm -rf marking.cut.service.tar.gz rm -rf marking.cut.service.tar.gz
curl -O https://static.w.23544.com:8843/marking/marking.cut.service.tar.gz curl -O https://static.w.23544.com:8843/marking/marking.cut.service.tar.gz
tar -zxvf marking.cut.service.tar.gz tar -zxvf marking.cut.service.tar.gz
# curl "http://localhost:5244/publish/run?execPath=D:/marking.cut.service/publish/Dolphin.ExamPictureCut.HttpApi.Host.exe&count=2" curl "http://localhost:5244/publish/run?execPath=D:/marking.cut.service/publish/Dolphin.ExamPictureCut.HttpApi.Host.exe&count=2"
echo "${{ env.run_cmd }}"
echo "${{ env.run_cmd }}"> publish/run.cmd
curl "http://localhost:5244/publish/run?execPath=D:/marking.cut.service/publish/run.cmd&count=2"
- name: 发送构建通知 - name: 发送构建通知
if: ${{ always() }} if: ${{ always() }}
@ -132,7 +111,6 @@ jobs:
>**代码分支**: ${{ gitea.ref_name }} >**代码分支**: ${{ gitea.ref_name }}
>**提交标识**: ${{ gitea.sha }} >**提交标识**: ${{ gitea.sha }}
>**提交发起**: ${{ gitea.actor }} >**提交发起**: ${{ gitea.actor }}
>**提交信息**: ${{ gitea.event.release.target_commitish }}\n
" "
} }
} }

View File

@ -105,7 +105,7 @@ public class ExamManager : DomainService, IExamManager
}).ToListAsync(); }).ToListAsync();
var gotoCount = 0; var gotoCount = 0;
dotPenOriginalImg: dotPenOriginalImg:
var zgtSettingDtls = await DbBiz.Queryable<MarkingSettingSubjective>().Where(w => w.ExamSubjectId == eto.ExamSubjectId).ToListAsync(); var zgtSettingDtls = await DbBiz.Queryable<MarkingSettingSubjective>().Where(w => w.ExamSubjectId == eto.ExamSubjectId).ToListAsync();
// 割原题 // 割原题
@ -391,6 +391,8 @@ public class ExamManager : DomainService, IExamManager
var skPointMode = SKPointMode.Polygon; var skPointMode = SKPointMode.Polygon;
if (points.Length == 1) if (points.Length == 1)
skPointMode = SKPointMode.Points; skPointMode = SKPointMode.Points;
else if (points.Length == 2)
skPointMode = SKPointMode.Lines;
canvas.DrawPoints(skPointMode, points, skPaint); canvas.DrawPoints(skPointMode, points, skPaint);
} }
@ -411,19 +413,11 @@ public class ExamManager : DomainService, IExamManager
await DbBiz.BeginTranAsync(); await DbBiz.BeginTranAsync();
// 删除 // 删除
var delObjectiveIds = await DbBiz.Queryable<MkExamResult>() await DbBiz.Deleteable<MkExamResult>().Where(w => w.ExamSubjectId == eto.ExamSubjectId && w.StudentNo == penSerial).ExecuteCommandAsync();
.Where(w => w.ExamSubjectId == eto.ExamSubjectId && w.StudentNo == penSerial)
.Select(s => s.Id).ToListAsync();
await DbBiz.Deleteable<MkExamResult>().Where(w => delObjectiveIds.Contains(w.Id)).ExecuteCommandAsync();
var delSubjectiveIds = await DbBiz.Queryable<SubjectiveMarkingResult>()
.Where(w => w.ExamSubjectId == eto.ExamSubjectId && w.StudentExamNum == penSerial && w.IsDeleted == false)
.Select(s => s.Id).ToListAsync();
await DbBiz.Updateable<SubjectiveMarkingResult>() await DbBiz.Updateable<SubjectiveMarkingResult>()
.SetColumns(s => new SubjectiveMarkingResult { IsDeleted = true, UpdateDate = Clock.Now }) .SetColumns(s => new SubjectiveMarkingResult { IsDeleted = true, UpdateDate = Clock.Now })
.Where(w => delSubjectiveIds.Contains(w.Id)) .Where(w => w.ExamSubjectId == eto.ExamSubjectId && w.StudentExamNum == penSerial && w.IsDeleted == false)
.ExecuteCommandAsync(); .ExecuteCommandAsync();
// 新增 // 新增
await DbBiz.Insertable(kgtDtls).ExecuteCommandAsync(); await DbBiz.Insertable(kgtDtls).ExecuteCommandAsync();
await DbBiz.Insertable(zgtDtls).ExecuteCommandAsync(); await DbBiz.Insertable(zgtDtls).ExecuteCommandAsync();
@ -443,7 +437,6 @@ public class ExamManager : DomainService, IExamManager
catch (Exception ex) catch (Exception ex)
{ {
Logger.LogError("{ExamSubjectId} {penSerial} 收集失败! {error}", eto.ExamSubjectId, penSerial, ex); Logger.LogError("{ExamSubjectId} {penSerial} 收集失败! {error}", eto.ExamSubjectId, penSerial, ex);
await NotifyExt.DingTalk($"{eto.ExamSubjectId} {penSerial} 收集失败! 异常:{ex.Message}");
} }
finally finally
{ {

View File

@ -1,5 +1,4 @@
using Dolphin.ExamPictureCut.Exams; using Dolphin.ExamPictureCut.Exams;
using Dolphin.ExamPictureCut.Extensions;
namespace Dolphin.ExamPictureCut.Services; namespace Dolphin.ExamPictureCut.Services;
@ -15,9 +14,4 @@ public class ExamAppService : DolphinAppService
{ {
await _examManager.ExamStudentGather(new() { SchoolId = 3, StudentExamNum = "BP2-3G3-07K-C1", BookId = 529493484986437, ExamSubjectSchoolId = 530151338438726, ExamSubjectId = 530151329325125, LastCollectTime = DateTime.Now }); await _examManager.ExamStudentGather(new() { SchoolId = 3, StudentExamNum = "BP2-3G3-07K-C1", BookId = 529493484986437, ExamSubjectSchoolId = 530151338438726, ExamSubjectId = 530151329325125, LastCollectTime = DateTime.Now });
} }
public async Task NotifyTest()
{
await NotifyExt.DingTalk($"{530151329325125} {"BP2-3G3-07K-C1"} 收集失败! 异常: {""}");
}
} }

View File

@ -1,19 +0,0 @@
using Flurl.Http;
namespace Dolphin.ExamPictureCut.Extensions;
public class NotifyExt
{
public static async Task DingTalk(string text)
{
await "https://oapi.dingtalk.com/robot/send?access_token=6ddafcada8f44f4bad4a7314c4d9bd19a895ded0a1ba1afdaff5dd01a5af6781".PostJsonAsync(new
{
msgtype = "markdown",
markdown = new
{
title = "异常通知",
text = $"dotpan,{Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT")}异常\n > 来源:Dplphin.ExamPictureCut\n > 详情:" + text,
}
}).ReceiveString();
}
}

View File

@ -1,4 +1,4 @@
FROM dotnet/aspnet:8.0 FROM mcr.microsoft.com/dotnet/aspnet:8.0
ENV TZ=Asia/Shanghai \ ENV TZ=Asia/Shanghai \
DEBIAN_FRONTEND=noninteractive DEBIAN_FRONTEND=noninteractive

View File

@ -63,7 +63,7 @@ public class DolphinExamPictureCutHttpApiHostModule : AbpModule
}, },
db => db =>
{ {
//db.QueryFilter.AddTableFilter<ISoftDelete>(s => s.IsDeleted == false); db.QueryFilter.AddTableFilter<ISoftDelete>(s => s.IsDeleted == false);
var config = new SqlSugarConfig(); var config = new SqlSugarConfig();
db.Aop.DataExecuting = config.DataExecuting(context.Services); db.Aop.DataExecuting = config.DataExecuting(context.Services);

View File

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<location path="." inheritInChildApplications="false">
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath="dotnet" arguments=".\Dolphin.ExamPictureCut.HttpApi.Host.dll" stdoutLogEnabled="false" stdoutLogFile=".\Logs\stdout" hostingModel="inprocess" />
</system.webServer>
</location>
<system.webServer>
<httpProtocol>
<customHeaders>
<remove name="x-powered-by" />
</customHeaders>
</httpProtocol>
</system.webServer>
</configuration>

View File

@ -12,4 +12,4 @@ services:
# - 9925:80 # - 9925:80
deploy: deploy:
mode: replicated mode: replicated
replicas: ${replicas:-1} replicas: 1