- 调整到家“新增或修改门店消息”

This commit is contained in:
gazebo
2019-03-11 09:40:24 +08:00
parent aeda2df6bd
commit 899e0d8362
2 changed files with 31 additions and 5 deletions

View File

@@ -7,6 +7,7 @@ import (
"git.rosy.net.cn/baseapi/utils"
"git.rosy.net.cn/jx-callback/business/model"
"git.rosy.net.cn/jx-callback/business/partner"
"git.rosy.net.cn/jx-callback/globals"
)
var (
@@ -70,3 +71,8 @@ func JxStoreStatus2JdStatus(status int) (yn, closeStatus int) {
return 0, 0
}
}
func OnStoreMsg(msg *jdapi.CallbackOrderMsg) (retVal *jdapi.CallbackResponse) {
globals.SugarLogger.Debugf("OnStoreMsg, msg:%s", utils.Format4Output(msg, false))
return jdapi.Err2CallbackResponse(nil, "")
}

View File

@@ -30,7 +30,7 @@ func (c *DjswController) orderStatus(isCancelOrder bool) {
if callbackResponse == nil {
callbackResponse = jd.OnOrderMsg(obj)
}
c.Data["json"] = callbackResponse
c.Data["json"] = c.transferResponse(callbackResponse)
c.ServeJSON()
} else {
c.Abort("404")
@@ -83,7 +83,7 @@ func (c *DjswController) PushDeliveryStatus() {
if callbackResponse == nil {
callbackResponse = jd.OnWaybillMsg(obj)
}
c.Data["json"] = callbackResponse
c.Data["json"] = c.transferResponse(callbackResponse)
c.ServeJSON()
} else {
c.Abort("404")
@@ -99,7 +99,7 @@ func (c *DjswController) Token() {
if err == nil {
globals.SugarLogger.Info(utils.Format4Output(utils.URLValues2Map(urlValues), false))
}
c.Data["json"] = jdapi.Err2CallbackResponse(err, "")
c.Data["json"] = c.transferResponse(nil)
c.ServeJSON()
}
@@ -111,7 +111,7 @@ func (c *DjswController) StockIsHave() {
// globals.SugarLogger.Debugf("StockIsHave, obj:%s", utils.Format4Output(obj, false))
callbackResponse = promotion.OnStoreStockMsg(obj)
}
c.Data["json"] = callbackResponse
c.Data["json"] = c.transferResponse(callbackResponse)
c.ServeJSON()
} else {
c.Abort("404")
@@ -124,9 +124,29 @@ func (c *DjswController) SinglePromoteCreate() {
if callbackResponse == nil {
callbackResponse = promotion.OnNewPromotionMsg(obj)
}
c.Data["json"] = callbackResponse
c.Data["json"] = c.transferResponse(callbackResponse)
c.ServeJSON()
} else {
c.Abort("404")
}
}
func (c *DjswController) StoreCrud() {
if c.Ctx.Input.Method() == http.MethodPost {
obj, callbackResponse := api.JdAPI.GetOrderCallbackMsg(c.Ctx.Input.RequestBody)
if callbackResponse == nil {
callbackResponse = jd.OnStoreMsg(obj)
}
c.Data["json"] = c.transferResponse(callbackResponse)
c.ServeJSON()
} else {
c.Abort("404")
}
}
func (c *DjswController) transferResponse(inCallbackResponse *jdapi.CallbackResponse) (outCallbackResponse *jdapi.CallbackResponse) {
if inCallbackResponse == nil {
return jdapi.Err2CallbackResponse(nil, "")
}
return inCallbackResponse
}