This commit is contained in:
Mrx
2026-01-27 15:08:00 +08:00
parent 33dd85fd2f
commit 1a44eab144
33 changed files with 999 additions and 3733 deletions

View File

@@ -99,6 +99,24 @@ func (l *AlipayCallbackLogic) handleQueryOrderPayment(w http.ResponseWriter, not
return nil
}
// 更新 query_user_record 表的 platform_order_id
queryUserRecords, findRecordErr := l.svcCtx.QueryUserRecordModel.FindAll(l.ctx,
l.svcCtx.QueryUserRecordModel.SelectBuilder().
Where("query_no = ?", notification.OutTradeNo).
Where("del_state = ?", 0).
Limit(1), "")
if findRecordErr == nil && len(queryUserRecords) > 0 {
record := queryUserRecords[0]
record.PlatformOrderId = lzUtils.StringToNullString(notification.TradeNo)
record.Version = record.Version + 1
if updateRecordErr := l.svcCtx.QueryUserRecordModel.UpdateWithVersion(l.ctx, nil, record); updateRecordErr != nil {
logx.Errorf("支付宝支付回调,更新查询用户记录失败: %+v", updateRecordErr)
// 更新失败不影响主流程,只记录日志
} else {
logx.Infof("支付宝支付回调更新查询用户记录成功query_no: %s, platform_order_id: %s", notification.OutTradeNo, notification.TradeNo)
}
}
if order.Status == "paid" {
if asyncErr := l.svcCtx.AsynqService.SendQueryTask(order.Id); asyncErr != nil {
logx.Errorf("异步任务调度失败: %v", asyncErr)