Commit Graph

2 Commits

Author SHA1 Message Date
cjy
1572be00a2 调整GetPendingAssignBySubNums与GetArtistUploadStatsList的BundleOrder过滤规则
- taskStatsQueryOptions 改写:
  * 普通任务分支改为 Case A OR Case B:
    - Case A: order_type=1 AND contract_tpl_type=1 AND status=2 (套餐-普通,仅已签已支付)
    - Case B: order_type=2 AND contract_tpl_type=2 AND status IN (1,2,4) AND pay_later_status IN (1,2) (套餐先用后付存量)
  * 先用后付任务分支保持不变: order_type=2 AND contract_tpl_type=3 AND pay_later_status IN (1,2) AND status IN (1,2,4)
  * 去掉对 order_mode / IFNULL 的依赖,改用 order_type + contract_tpl_type 区分
  * NOT EXISTS 内层 bor2 谓词与外层完全对齐,保持"每用户取最新单"语义
2026-06-11 13:05:04 +08:00
cjy
590f0dedd6 test: 为 taskDao 与 taskLogic 添加单元测试
新增 internal/testutil/db.go,基于 DATA-DOG/go-sqlmock 提供
SetupTaskBenchDB 帮助函数,把 mock 出来的 *gorm.DB 挂到
app.ModuleClients.TaskBenchDB 上,方便 dao / logic 层单测。
SQL 匹配使用 QueryMatcherRegexp,避免对 gorm 生成的 SQL 字面量
(字段顺序、占位符数量等)过度耦合。

- internal/dao/taskDao_test.go:覆盖 GetPendingTaskLayout 等
  DAO 方法的 SQL 行为与错误分支。
- internal/logic/taskLogic_test.go:覆盖 CreateTaskWorkLog
  的入参范围校验分支。

go.mod / go.sum:
- 新增直接依赖 github.com/DATA-DOG/go-sqlmock v1.5.2、
  github.com/stretchr/testify v1.11.1;
- 调整 google/uuid、robfig/cron/v3、satori/go.uuid 为直接依赖。

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-10 15:21:03 +08:00