add sms authorization
This commit is contained in:
@@ -135,7 +135,6 @@ func (l *AlipayCallbackLogic) handleQueryOrderPayment(w http.ResponseWriter, not
|
||||
UserId: order.UserId,
|
||||
TargetName: encryptName,
|
||||
TargetIdcard: encryptIdcard,
|
||||
GrantType: model.GrantTypeFace,
|
||||
Status: model.AuthorizationStatusPending,
|
||||
})
|
||||
if err != nil {
|
||||
|
||||
@@ -205,7 +205,6 @@ func (l *PaymentLogic) QueryOrderPayment(req *types.PaymentReq, session sqlx.Ses
|
||||
UserId: order.UserId,
|
||||
TargetName: encryptName,
|
||||
TargetIdcard: encryptIdcard,
|
||||
GrantType: model.GrantTypeFace,
|
||||
Status: model.AuthorizationStatusPending,
|
||||
})
|
||||
if err != nil {
|
||||
|
||||
@@ -132,7 +132,6 @@ func (l *WechatPayCallbackLogic) handleQueryOrderPayment(w http.ResponseWriter,
|
||||
UserId: order.UserId,
|
||||
TargetName: encryptName,
|
||||
TargetIdcard: encryptIdcard,
|
||||
GrantType: model.GrantTypeFace,
|
||||
Status: model.AuthorizationStatusPending,
|
||||
})
|
||||
if err != nil {
|
||||
@@ -233,51 +232,6 @@ func (l *WechatPayCallbackLogic) handleRefund(order *model.AgentMembershipRechar
|
||||
if refundErr != nil {
|
||||
return refundErr
|
||||
}
|
||||
} else {
|
||||
refund, refundErr := l.svcCtx.AlipayService.AliRefund(ctx, order.OrderNo, order.Amount)
|
||||
if refundErr != nil {
|
||||
return refundErr
|
||||
}
|
||||
if refund.IsSuccess() {
|
||||
redisKey := fmt.Sprintf(types.QueryCacheKey, order.UserId, order.OrderNo)
|
||||
cache, cacheErr := l.svcCtx.Redis.Get(redisKey)
|
||||
if cacheErr != nil {
|
||||
return fmt.Errorf("获取缓存内容失败: %+v", cacheErr)
|
||||
}
|
||||
var data types.QueryCacheLoad
|
||||
err := json.Unmarshal([]byte(cache), &data)
|
||||
if err != nil {
|
||||
return fmt.Errorf("解析缓存内容失败: %+v", err)
|
||||
}
|
||||
secretKey := l.svcCtx.Config.Encrypt.SecretKey
|
||||
key, decodeErr := hex.DecodeString(secretKey)
|
||||
if decodeErr != nil {
|
||||
return fmt.Errorf("获取AES密钥失败: %+v", decodeErr)
|
||||
}
|
||||
decryptData, aesdecryptErr := crypto.AesDecrypt(data.Params, key)
|
||||
if aesdecryptErr != nil {
|
||||
return fmt.Errorf("解密参数失败: %+v", aesdecryptErr)
|
||||
}
|
||||
var paramsMap map[string]string
|
||||
if err := json.Unmarshal([]byte(decryptData), ¶msMap); err != nil {
|
||||
return fmt.Errorf("解析参数失败: %+v", err)
|
||||
}
|
||||
_, err = l.svcCtx.AuthorizationModel.Insert(l.ctx, nil, &model.Authorization{
|
||||
OrderId: order.Id,
|
||||
UserId: order.UserId,
|
||||
TargetName: paramsMap["name"],
|
||||
TargetIdcard: paramsMap["id_card"],
|
||||
GrantType: model.GrantTypeFace,
|
||||
Status: model.AuthorizationStatusPending,
|
||||
})
|
||||
if err != nil {
|
||||
logx.Errorf("支付宝支付回调,插入授权信息失败: %+v", err)
|
||||
return fmt.Errorf("插入授权信息失败: %+v", err)
|
||||
}
|
||||
} else {
|
||||
logx.Errorf("支付宝退款失败:%v", refundErr)
|
||||
return refundErr
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user