refactor(task): 重构任务奖励系统,优化任务奖励处理逻辑

移除废弃的任务相关代码文件,包括task/list.go和task/list_daily.go,
以及相关的模型定义config_task表和PetReward服务。

修改任务奖励获取方式,从原有的TaskResultMap改为通过数据库配置获取,
新增TaskService.Get方法用于获取任务配置信息。

---
feat(boss): 优化
This commit is contained in:
2025-12-31 21:00:29 +08:00
parent c082eb3e91
commit 3efbba3883
12 changed files with 117 additions and 433 deletions

View File

@@ -48,7 +48,10 @@ func (s *ShinyService) RandShiny(id uint32) *data.GlowFilter {
var ret []model.ColorfulSkin
// 执行 Raw SQL 并扫描返回值
cool.DBM(s.Model).Wheref(`bind_elf_ids @> ?::jsonb`, id).Wheref(`jsonb_typeof(bind_elf_ids) = ?`, "array").Cache(gdb.CacheOption{
cool.DBM(s.Model).
Wheref(`bind_elf_ids @> ?::jsonb`, id).
Wheref(`jsonb_typeof(bind_elf_ids) = ?`, "array").
Where("is_enabled", 1).Cache(gdb.CacheOption{
// Duration: time.Hour,
Force: false,
@@ -78,11 +81,15 @@ func (s *ShinyService) FixShiny(id uint32) *data.GlowFilter {
var ret []model.ColorfulSkin
// 执行 Raw SQL 并扫描返回值
cool.DBM(s.Model).Wheref(`bind_elf_ids @> ?::jsonb`, id).Wheref(`jsonb_typeof(bind_elf_ids) = ?`, "array").Cache(gdb.CacheOption{
// Duration: time.Hour,
cool.DBM(s.Model).
Wheref(`bind_elf_ids @> ?::jsonb`, id).
Wheref(`jsonb_typeof(bind_elf_ids) = ?`, "array").
Where("is_enabled", 1).
Cache(gdb.CacheOption{
// Duration: time.Hour,
Force: false,
}).Scan(&ret)
Force: false,
}).Scan(&ret)
rets := utils.ToMap(ret, func(t model.ColorfulSkin) uint32 {
return uint32(t.ID)
@@ -98,7 +105,7 @@ func (s *ShinyService) FixShiny(id uint32) *data.GlowFilter {
r := json.Unmarshal([]byte(v.Color), &t)
if r == nil {
m := cool.DBM(s.Model).Where("id", id)
m.Increment("refresh_count", 1)
m.Increment("usage_count", 1)
return &t
}