diff --git a/.lingma/rules/project_rule.md b/.lingma/rules/project_rule.md new file mode 100644 index 00000000..aea8af41 --- /dev/null +++ b/.lingma/rules/project_rule.md @@ -0,0 +1,2 @@ +**添加规则文件可帮助模型精准理解你的编码偏好,如框架、代码风格等** +**规则文件只对当前工程生效,单文件限制10000字符。如果无需将该文件提交到远程 Git 仓库,请将其添加到 .gitignore** \ No newline at end of file diff --git a/.tool-versions b/.tool-versions index 6d51b8f6..cc63c521 100644 --- a/.tool-versions +++ b/.tool-versions @@ -1 +1,2 @@ golang 1.24.3 +python 3.13.3 diff --git a/internal/logic/card_redeem_cookie/account_schedule.go b/internal/logic/card_redeem_cookie/account_schedule.go index 49c7c853..44c32c9f 100644 --- a/internal/logic/card_redeem_cookie/account_schedule.go +++ b/internal/logic/card_redeem_cookie/account_schedule.go @@ -2,11 +2,14 @@ package cardredeemcookie import ( "context" + "github.com/gogf/gf/v2/os/glog" "github.com/gogf/gf/v2/os/gtime" "kami/internal/consts" "kami/internal/dao" + "kami/internal/model/do" "kami/internal/model/entity" "kami/utility/config" + "time" "github.com/duke-git/lancet/v2/pointer" "github.com/gogf/gf/errors/gerror" @@ -27,14 +30,21 @@ func (s *sCardReddemCookie) ScheduleAccount(ctx context.Context, tx gdb.TX) (out // UnlockAccount 解封临时封禁的账号 func (s *sCardReddemCookie) UnlockAccount(ctx context.Context, tx gdb.TX) { - m := dao.V1CardRedeemCookieInfo.Ctx(ctx).DB(config.GetDatabaseV1()). - Where(dao.V1CardRedeemCookieInfo.Columns().Status, consts.CardRedeemCookieStatusDailyDisable). - WhereLT(dao.V1CardRedeemCookieInfo.Columns().UpdatedAt, gtime.Now().StartOfDay()) + m := dao.V1CardRedeemCookieInfo.Ctx(ctx).DB(config.GetDatabaseV1()) if tx != nil { m = m.TX(tx) } - _, _ = m.Update(gdb.Map{ - dao.V1CardRedeemCookieInfo.Columns().Status: consts.CardRedeemCookieStatusNormal, - }) + if _, err := m.Where(dao.V1CardRedeemCookieInfo.Columns().Status, consts.CardRedeemCookieStatusDailyDisable). + WhereLT(dao.V1CardRedeemCookieInfo.Columns().UpdatedAt, gtime.Now().StartOfDay()).Update(do.V1CardRedeemCookieInfo{ + Status: consts.CardRedeemCookieStatusNormal, + }); err != nil { + glog.Error(ctx, "解封今日封禁的账号失败", err) + } + if _, err := m.Where(dao.V1CardRedeemCookieInfo.Columns().Status, consts.CardRedeemCookieStatusTmpDisable). + WhereLT(dao.V1CardRedeemCookieInfo.Columns().UpdatedAt, gtime.Now().Add(-time.Minute*10)).Update(do.V1CardRedeemCookieInfo{ + Status: consts.CardRedeemCookieStatusNormal, + }); err != nil { + glog.Error(ctx, "解封临时封禁的账号失败", err) + } return }