promote
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user