到家商城的订单发通知消息

+Store.LinkStoreID
This commit is contained in:
gazebo
2020-02-04 16:20:09 +08:00
parent b76404d31d
commit f118cd8331
14 changed files with 249 additions and 185 deletions

View File

@@ -6,6 +6,7 @@ import (
"git.rosy.net.cn/jx-callback/business/jxstore/cms"
"git.rosy.net.cn/jx-callback/business/jxutils"
"git.rosy.net.cn/jx-callback/business/jxutils/weixinmsg"
"git.rosy.net.cn/jx-callback/business/model"
"github.com/astaxie/beego"
)
@@ -31,7 +32,7 @@ func (c *MsgController) SendStoreMessage() {
if err = jxutils.Strings2Objs(params.StoreIDs, &storeIDs); err != nil {
return retVal, "", err
}
retVal, err = cms.SendStoreMessage(params.Ctx, params.Title, params.Content, storeIDs, params.IsAsync, params.IsContinueWhenError)
retVal, err = weixinmsg.SendStoreMessage(params.Ctx, params.Title, params.Content, storeIDs, params.IsAsync, params.IsContinueWhenError)
return retVal, "", err
})
}

View File

@@ -5,8 +5,10 @@ import (
"git.rosy.net.cn/baseapi/platformapi/jdapi"
"git.rosy.net.cn/baseapi/utils"
"git.rosy.net.cn/jx-callback/business/jxcallback/orderman"
"git.rosy.net.cn/jx-callback/business/partner/purchase/jd"
"git.rosy.net.cn/jx-callback/globals"
"git.rosy.net.cn/jx-callback/globals/api"
"github.com/astaxie/beego"
)
@@ -16,25 +18,21 @@ type Djsw2Controller struct {
}
func (c *Djsw2Controller) handleMsg(handler func(*jdapi.API, interface{}) *jdapi.CallbackResponse) (callbackResponse *jdapi.CallbackResponse) {
// callbackMsg, mapData, callbackResponse := jdapi.GetCallbackMsg(getUsefulRequest(c.Ctx))
// globals.SugarLogger.Debug(utils.Format4Output(callbackMsg, true))
// if callbackResponse == nil {
// if jdAPI := jd.GetAPI(jd.AppKey2OrgCode(callbackMsg.AppKey)); jdAPI != nil {
// if callbackResponse = jdAPI.CheckCallbackValidation(mapData, callbackMsg.Sign); callbackResponse == nil {
// callbackResponse = handler(jdAPI, callbackMsg.Param)
// }
// } else {
// callbackResponse = jdapi.Err2CallbackResponse(fmt.Errorf("没有匹配的appKey,非法请求"), "")
// }
// }
callbackMsg, _, callbackResponse := jdapi.GetCallbackMsg(getUsefulRequest(c.Ctx))
globals.SugarLogger.Debug(utils.Format4Output(callbackMsg, true))
if callbackResponse == nil {
callbackResponse = handler(api.FakeJdAPI, callbackMsg.Param)
}
return callbackResponse
}
func (c *Djsw2Controller) orderStatus() {
if c.Ctx.Input.Method() == http.MethodPost {
callbackResponse := c.handleMsg(func(a *jdapi.API, obj interface{}) (callbackResponse *jdapi.CallbackResponse) {
callbackResponse = jd.OnOrderMsg(obj.(*jdapi.CallbackOrderMsg))
return callbackResponse
if orderMsg, ok := obj.(*jdapi.CallbackOrderMsg); ok {
orderman.FixedOrderManager.OnNewFakeJdOrder(orderMsg.BillID)
}
return nil
})
c.Data["json"] = c.transferResponse("orderStatus", callbackResponse)
c.ServeJSON()
@@ -48,43 +46,43 @@ func (c *Djsw2Controller) NewOrder() {
}
func (c *Djsw2Controller) OrderAdjust() {
c.orderStatus()
c.nullOperation()
}
func (c *Djsw2Controller) OrderWaitOutStore() {
c.orderStatus()
c.nullOperation()
}
func (c *Djsw2Controller) PickFinishOrder() {
c.orderStatus()
c.nullOperation()
}
func (c *Djsw2Controller) DeliveryOrder() {
c.orderStatus()
c.nullOperation()
}
func (c *Djsw2Controller) FinishOrder() {
c.orderStatus()
c.nullOperation()
}
func (c *Djsw2Controller) LockOrder() {
c.orderStatus()
c.nullOperation()
}
func (c *Djsw2Controller) UnlockOrder() {
c.orderStatus()
c.nullOperation()
}
func (c *Djsw2Controller) UserCancelOrder() {
c.orderStatus()
c.nullOperation()
}
func (c *Djsw2Controller) ApplyCancelOrder() {
c.orderStatus()
c.nullOperation()
}
func (c *Djsw2Controller) VenderAuditApplyCancelOrder() {
c.orderStatus()
c.nullOperation()
}
func (c *Djsw2Controller) PushDeliveryStatus() {
@@ -101,7 +99,7 @@ func (c *Djsw2Controller) PushDeliveryStatus() {
}
func (c *Djsw2Controller) OrderCommentPush() {
c.orderStatus()
c.nullOperation()
}
func (c *Djsw2Controller) Token() {
@@ -114,42 +112,15 @@ func (c *Djsw2Controller) Token() {
}
func (c *Djsw2Controller) StockIsHave() {
// globals.SugarLogger.Info(string(c.Ctx.Input.RequestBody))
if c.Ctx.Input.Method() == http.MethodPost {
callbackResponse := c.handleMsg(func(a *jdapi.API, obj interface{}) (callbackResponse *jdapi.CallbackResponse) {
return callbackResponse
})
c.Data["json"] = c.transferResponse("StockIsHave", callbackResponse)
c.ServeJSON()
} else {
c.Abort("404")
}
c.nullOperation()
}
func (c *Djsw2Controller) SinglePromoteCreate() {
if c.Ctx.Input.Method() == http.MethodPost {
callbackResponse := c.handleMsg(func(a *jdapi.API, obj interface{}) (callbackResponse *jdapi.CallbackResponse) {
callbackResponse = jd.OnActMsg(obj.(*jdapi.CallbackOrderMsg))
return callbackResponse
})
c.Data["json"] = c.transferResponse("SinglePromoteCreate", callbackResponse)
c.ServeJSON()
} else {
c.Abort("404")
}
c.nullOperation()
}
func (c *Djsw2Controller) StoreCrud() {
if c.Ctx.Input.Method() == http.MethodPost {
callbackResponse := c.handleMsg(func(a *jdapi.API, obj interface{}) (callbackResponse *jdapi.CallbackResponse) {
callbackResponse = jd.OnStoreMsg(obj.(*jdapi.CallbackOrderMsg))
return callbackResponse
})
c.Data["json"] = c.transferResponse("StoreCrud", callbackResponse)
c.ServeJSON()
} else {
c.Abort("404")
}
c.nullOperation()
}
func (c *Djsw2Controller) transferResponse(funcName string, inCallbackResponse *jdapi.CallbackResponse) (outCallbackResponse *jdapi.CallbackResponse) {
@@ -188,11 +159,11 @@ func (c *Djsw2Controller) NewAfterSaleBill() {
}
func (c *Djsw2Controller) AfterSaleBillStatus() {
c.orderStatus()
c.nullOperation()
}
func (c *Djsw2Controller) OrderAccounting() {
c.orderStatus()
c.nullOperation()
}
func (c *Djsw2Controller) nullOperation() {
@@ -205,5 +176,5 @@ func (c *Djsw2Controller) UpdateSku() {
}
func (c *Djsw2Controller) OrderAddTips() {
c.orderStatus()
c.nullOperation()
}