This commit is contained in:
2025-05-09 17:54:28 +08:00
parent 8003431fdb
commit 00c2f07769
110 changed files with 11003 additions and 576 deletions

View File

@@ -99,6 +99,29 @@ func (l *PaymentLogic) Payment(req *types.PaymentReq) (resp *types.PaymentResp,
return errors.Wrapf(xerr.NewErrCode(xerr.SERVER_COMMON_ERROR), "生成订单, 获取保存订单ID失败: %+v", lastInsertIdErr)
}
orderID = insertedOrderID
promoteKey, ok := l.ctx.Value("promoteKey").(string)
if ok && promoteKey != "" {
// TODO: 在这里添加处理 promoteKey 的逻辑
url := fmt.Sprintf("%s/%s", l.svcCtx.Config.AdminPromotion.URLDomain, promoteKey)
promoteLink, err := l.svcCtx.AdminPromotionLinkModel.FindOneByUrl(l.ctx, url)
if err != nil && !errors.Is(err, model.ErrNotFound) {
return errors.Wrapf(xerr.NewErrCode(xerr.SERVER_COMMON_ERROR), "生成订单, 查找推广链接失败: %+v", err)
}
if promoteLink != nil {
promoteOrder := &model.AdminPromotionOrder{
OrderId: orderID,
LinkId: promoteLink.Id,
UserId: userID,
AdminUserId: promoteLink.AdminUserId,
}
_, insertPromoteOrderErr := l.svcCtx.AdminPromotionOrderModel.Insert(ctx, session, promoteOrder)
if insertPromoteOrderErr != nil {
return errors.Wrapf(xerr.NewErrCode(xerr.SERVER_COMMON_ERROR), "生成订单, 保存推广订单失败: %+v", insertPromoteOrderErr)
}
}
}
return nil
})
if transErr != nil {