package controllers import ( "net/http" "git.rosy.net.cn/baseapi/platformapi/jdapi" "git.rosy.net.cn/jx-callback/business/partner/purchase/jd" "git.rosy.net.cn/jx-callback/globals/api" "github.com/astaxie/beego" ) // Operations about JDOrder type DjswController struct { beego.Controller } func (c *DjswController) orderStatus(isCancelOrder bool) { if c.Ctx.Input.Method() == http.MethodPost { var obj *jdapi.CallbackOrderMsg var callbackResponse *jdapi.CallbackResponse if isCancelOrder { obj, callbackResponse = api.JdAPI.GetOrderApplyCancelCallbackMsg(c.Ctx.Input.RequestBody) } else { obj, callbackResponse = api.JdAPI.GetOrderCallbackMsg(c.Ctx.Input.RequestBody) } if callbackResponse == nil { callbackResponse = jd.OnOrderMsg(obj) } c.Data["json"] = callbackResponse c.ServeJSON() } else { c.Abort("404") } } func (c *DjswController) NewOrder() { c.orderStatus(false) } func (c *DjswController) OrderAdjust() { c.orderStatus(false) } func (c *DjswController) OrderWaitOutStore() { c.orderStatus(false) } func (c *DjswController) PickFinishOrder() { c.orderStatus(false) } func (c *DjswController) DeliveryOrder() { c.orderStatus(false) } func (c *DjswController) FinishOrder() { c.orderStatus(false) } func (c *DjswController) LockOrder() { c.orderStatus(false) } func (c *DjswController) UserCancelOrder() { c.orderStatus(false) } func (c *DjswController) ApplyCancelOrder() { c.orderStatus(true) } func (c *DjswController) PushDeliveryStatus() { if c.Ctx.Input.Method() == http.MethodPost { obj, callbackResponse := api.JdAPI.GetOrderDeliveryCallbackMsg(c.Ctx.Input.RequestBody) if callbackResponse == nil { callbackResponse = jd.OnWaybillMsg(obj) } c.Data["json"] = callbackResponse c.ServeJSON() } else { c.Abort("404") } } func (c *DjswController) OrderCommentPush() { c.orderStatus(false) }