fix pay callback inside amount
This commit is contained in:
		| @@ -45,12 +45,21 @@ func (l *AlipayCallbackLogic) AlipayCallback(w http.ResponseWriter, r *http.Requ | ||||
| 		alipay.ACKNotification(w) | ||||
| 		return nil | ||||
| 	} | ||||
| 	amount := lzUtils.ToAlipayAmount(order.Amount) | ||||
| 	// 确保订单金额和状态正确,防止重复更新 | ||||
| 	if amount != notification.TotalAmount { | ||||
| 		logx.Errorf("支付宝支付回调,金额不一致") | ||||
| 	user, err := l.svcCtx.UserModel.FindOne(l.ctx, order.UserId) | ||||
| 	if err != nil { | ||||
| 		logx.Errorf("支付宝支付回调,查找用户失败: %+v", err) | ||||
| 		return nil | ||||
| 	} | ||||
| 	amount := lzUtils.ToAlipayAmount(order.Amount) | ||||
|  | ||||
| 	if user.Inside != 1 { | ||||
| 		// 确保订单金额和状态正确,防止重复更新 | ||||
| 		if amount != notification.TotalAmount { | ||||
| 			logx.Errorf("支付宝支付回调,金额不一致") | ||||
| 			return nil | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| 	if order.Status != "pending" { | ||||
| 		w.WriteHeader(http.StatusOK) | ||||
| 		_, _ = w.Write([]byte("success")) // 确保只写入一次响应 | ||||
|   | ||||
		Reference in New Issue
	
	Block a user