From 3a79ec7ed5414f596fb293e4ad1343e32f9aa844 Mon Sep 17 00:00:00 2001 From: danial Date: Thu, 15 May 2025 01:23:44 +0800 Subject: [PATCH] =?UTF-8?q?feat(internal):=20=E4=BC=98=E5=8C=96=E8=B4=A6?= =?UTF-8?q?=E5=8F=B7=E8=A7=A3=E5=B0=81=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 解封今日封禁的账号 - 解封临时封禁的账号 - 添加日志记录解封失败的情况 - 更新 Go 和 Python 版本 --- .lingma/rules/project_rule.md | 2 ++ .tool-versions | 1 + .../card_redeem_cookie/account_schedule.go | 22 ++++++++++++++----- 3 files changed, 19 insertions(+), 6 deletions(-) create mode 100644 .lingma/rules/project_rule.md 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 }