fix(pay): 统一错误响应JSON的返回处理
- 将校验错误的错误信息改为固定提示“校验错误” - 在解析金额失败时添加ServeJSON调用,保证响应返回 - 在金额有误时添加ServeJSON调用,保证响应返回 - 统一错误处理流程,避免遗漏响应返回导致前端异常
This commit is contained in:
@@ -414,7 +414,7 @@ func (c *PayController) PayV2() {
|
||||
if err != nil || m == nil {
|
||||
c.Data["json"] = response.CommonResponse{
|
||||
Code: -1,
|
||||
Msg: err.Error(),
|
||||
Msg: "校验错误",
|
||||
}
|
||||
_ = c.ServeJSON()
|
||||
return
|
||||
@@ -427,6 +427,7 @@ func (c *PayController) PayV2() {
|
||||
Code: -1,
|
||||
Msg: "解析金额失败",
|
||||
}
|
||||
_ = c.ServeJSON()
|
||||
}
|
||||
|
||||
if m.ShowMMValue != factValue {
|
||||
@@ -434,6 +435,7 @@ func (c *PayController) PayV2() {
|
||||
Code: -1,
|
||||
Msg: "金额有误",
|
||||
}
|
||||
_ = c.ServeJSON()
|
||||
return
|
||||
}
|
||||
if m.OrderNo != req.OrderId {
|
||||
|
||||
Reference in New Issue
Block a user