This commit is contained in:
2026-06-20 15:13:58 +08:00
parent 6c4029e645
commit 8ccd20f69e
24 changed files with 526 additions and 888 deletions

View File

@@ -172,6 +172,15 @@ func (l *AlipayCallbackLogic) handleWhitelistOrderPayment(w http.ResponseWriter,
return nil
}
if whitelistOrder.Status == 2 {
syncPaidWhitelistOrderToTianyuan(
l.ctx,
l.svcCtx,
whitelistOrder,
buildAgentPaidWhitelistSyncRemark(orderNo),
)
}
// 6. 更新订单和白名单订单 + 创建白名单记录并删除报告数据
err = l.svcCtx.WhitelistOrderModel.Trans(l.ctx, func(ctx context.Context, session sqlx.Session) error {
// 6.1 更新订单状态

View File

@@ -217,6 +217,13 @@ func (l *PaymentLogic) Payment(req *types.PaymentReq) (resp *types.PaymentResp,
}
// 更新白名单订单状态为已支付并处理白名单记录
syncPaidWhitelistOrderToTianyuan(
context.Background(),
l.svcCtx,
whitelistOrder,
buildAgentPaidWhitelistSyncRemark(paymentTypeResp.outTradeNo),
)
err := l.svcCtx.WhitelistOrderModel.Trans(context.Background(), func(transCtx context.Context, session sqlx.Session) error {
// 更新白名单订单状态为已支付
whitelistOrder.Status = 2 // 已支付

View File

@@ -166,6 +166,15 @@ func (l *WechatPayCallbackLogic) handleWhitelistOrderPayment(w http.ResponseWrit
return nil
}
if whitelistOrder.Status == 2 {
syncPaidWhitelistOrderToTianyuan(
l.ctx,
l.svcCtx,
whitelistOrder,
buildAgentPaidWhitelistSyncRemark(orderNo),
)
}
// 6. 更新订单和白名单订单 + 创建白名单记录并删除报告数据
err := l.svcCtx.WhitelistOrderModel.Trans(l.ctx, func(ctx context.Context, session sqlx.Session) error {
// 6.1 更新订单状态

View File

@@ -0,0 +1,28 @@
package pay
import (
"context"
"fmt"
"ycc-server/app/main/api/internal/svc"
"ycc-server/app/main/model"
)
func syncPaidWhitelistOrderToTianyuan(
ctx context.Context,
svcCtx *svc.ServiceContext,
whitelistOrder *model.WhitelistOrder,
remark string,
) {
itemBuilder := svcCtx.WhitelistOrderItemModel.SelectBuilder().
Where("order_id = ?", whitelistOrder.Id)
items, err := svcCtx.WhitelistOrderItemModel.FindAll(ctx, itemBuilder, "")
if err != nil || len(items) == 0 {
return
}
svcCtx.QueryWhitelistSyncService.TrySyncWhitelistOrder(ctx, whitelistOrder, items, remark)
}
func buildAgentPaidWhitelistSyncRemark(orderNo string) string {
return fmt.Sprintf("代理付费下架自动同步 order_no=%s", orderNo)
}