This commit is contained in:
邹宗楠
2025-08-12 17:52:30 +08:00
parent 5c14110da0
commit 14b6c34652
9 changed files with 236 additions and 26 deletions

View File

@@ -144,13 +144,24 @@ func (c *MtwmController) DeliveryFeeChange() {
func (c *MtwmController) Invoice() {
body, err := ioutil.ReadAll(c.Ctx.Request.Body)
if err != nil {
c.Data["json"] = mtwmapi.Err2CallbackResponse(err, "")
c.Data["json"] = map[string]interface{}{"result_code": -1}
c.ServeJSON()
return
}
globals.SugarLogger.Debugf("------body:= %s", string(body))
callbackResponse := mtwmapi.Err2CallbackResponse(nil, "")
c.Data["json"] = callbackResponse
data := &mtwmapi.InvoiceCallback{}
if err = json.Unmarshal(body, data); err != nil {
c.Data["json"] = map[string]interface{}{"result_code": -1}
c.ServeJSON()
return
}
// 消息通知
if err = mtwm.InvoiceCallback(data); err != nil {
globals.SugarLogger.Errorf("mtwm Invoice err := %v", err)
}
c.Data["json"] = map[string]interface{}{"result_code": 1}
c.ServeJSON()
}