fix(card_apple_order): 缩短未成功订单回调时间筛选间隔

- 将未成功订单的更新时间筛选从10分钟调整为1分钟,提升回调效率

refactor(card_apple_account): 优化账户查询条件逻辑

- 简化账户查询条件,直接使用创建用户ID过滤
- 删除冗余条件判断,提升代码可读性和执行效率

test(utils): 新增DecryptPasswordAES测试用例

- 添加基础测试函数,验证AES密码解密功能正确性
This commit is contained in:
danial
2025-12-04 20:25:58 +08:00
parent d291b5ac3f
commit 0f2eb8f587
3 changed files with 10 additions and 9 deletions

View File

@@ -55,15 +55,9 @@ func (a *sAppleAccount) GetAccordingAccount(ctx context.Context, amount decimal.
isEnough = false
// 从当前用户开始,循环遍历所有用户
currentUser := users[(currentUserIndex+i)%len(users)]
m := dao.V1CardAppleAccountInfo.Ctx(ctx).DB(config.GetDatabaseV1())
m := dao.V1CardAppleAccountInfo.Ctx(ctx).DB(config.GetDatabaseV1()).
Where(dao.V1CardAppleAccountInfo.Columns().CreatedUserId, currentUser.Id)
if currentUser.Id != "" {
m = m.Where(dao.V1CardAppleAccountInfo.Columns().CreatedUserId, currentUser.Id)
} else {
//查找管理员上传的id
m = m.Where(dao.V1CardAppleAccountInfo.Columns().CreatedUserId, currentUser.Id).
WhereOr(dao.V1CardAppleAccountInfo.Columns().CreatedUserId)
}
if len(excludeAccountIds) > 0 {
m = m.WhereNotIn(dao.V1CardAppleAccountInfo.Columns().Id, excludeAccountIds)
}

View File

@@ -62,7 +62,7 @@ func (h *sAppleOrder) CronFailedScheduleTask(ctx context.Context) error {
var orders []*entity.V1CardAppleRechargeInfo
_ = dao.V1CardAppleRechargeInfo.Ctx(ctx).DB(config.GetDatabaseV1()).
Where(dao.V1CardAppleRechargeInfo.Columns().Status, consts.AppleRechargeOrderProcessing). // 只回调未成功的
WhereLT(dao.V1CardAppleRechargeInfo.Columns().UpdatedAt, gtime.Now().Add(-gtime.M*10)).
WhereLT(dao.V1CardAppleRechargeInfo.Columns().UpdatedAt, gtime.Now().Add(-gtime.M)).
Scan(&orders)
for _, order := range orders {
if err := h.AddHistory(ctx, &model.AppleCardRechargeHistoryInput{

View File

@@ -1 +1,8 @@
package utils
import "testing"
func TestDecryptPasswordAES(t *testing.T) {
result, err := DecryptPasswordAES("uDdGDAizNq7EuF5TH163PA==")
t.Log(result, err)
}