5555
This commit is contained in:
parent
323fab28d7
commit
99c0f62d55
@ -112,7 +112,7 @@ func (r *CallBack) WxPaySingle(c *gin.Context) {
|
||||
res, err := questionService.AddQuestionPayCount(tx, orderSingle.QuestionId)
|
||||
if err != nil || res == false {
|
||||
tx.Rollback()
|
||||
responses.FailWithMessage("内部错误", c)
|
||||
c.JSON(http.StatusBadRequest, gin.H{"code": "ERROR", "message": "内部错误"})
|
||||
return
|
||||
}
|
||||
|
||||
@ -121,9 +121,33 @@ func (r *CallBack) WxPaySingle(c *gin.Context) {
|
||||
res, err = userService.AddUserSingleSubmitCount(tx, orderSingle.UserId)
|
||||
if err != nil || res == false {
|
||||
tx.Rollback()
|
||||
responses.FailWithMessage("内部错误", c)
|
||||
c.JSON(http.StatusBadRequest, gin.H{"code": "ERROR", "message": "内部错误"})
|
||||
return
|
||||
}
|
||||
|
||||
// 取消同题目未支付订单
|
||||
maps = make(map[string]interface{})
|
||||
maps["user_id"] = orderSingle.UserId
|
||||
maps["question_id"] = orderSingle.QuestionId
|
||||
orderSingles, err := orderSingleDao.GetOrderSingleList(maps)
|
||||
if err != nil {
|
||||
tx.Rollback()
|
||||
c.JSON(http.StatusBadRequest, gin.H{"code": "ERROR", "message": "内部错误"})
|
||||
return
|
||||
}
|
||||
|
||||
orderSingleService := service.OrderSingleService{}
|
||||
for _, single := range orderSingles {
|
||||
if single.OrderId == orderSingle.OrderId {
|
||||
continue
|
||||
}
|
||||
|
||||
// 取消单项订单
|
||||
res, err = orderSingleService.CancelOrderSingle(tx, orderSingle, 3)
|
||||
if err != nil && res == false {
|
||||
utils.LogJsonErr("微信支付回调-单项", "取消单项订单失败")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
tx.Commit()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user