aa
This commit is contained in:
@@ -40,6 +40,14 @@ func GetAPI(appOrgCode string) (apiObj *jdapi.API) {
|
|||||||
return getAPI(appOrgCode)
|
return getAPI(appOrgCode)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func GetAPIbyKey(appKey string) (apiObj *jdapi.API) {
|
||||||
|
if code, err := dao.GetVendorOrgCodeByKey(dao.GetDB(), model.VendorIDJD, appKey); err == nil && code != nil {
|
||||||
|
return jdapi.New(code.Token, code.AppKey, code.AppSecret)
|
||||||
|
}
|
||||||
|
globals.SugarLogger.Warnf("GetAPIbyKey appKey:%s get empty vendorOrgCode", appKey)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
func AppKey2OrgCode(appKey string) (vendorOrgCode string) {
|
func AppKey2OrgCode(appKey string) (vendorOrgCode string) {
|
||||||
// apiList := partner.CurAPIManager.GetAppOrgCodeList(model.VendorIDJD)
|
// apiList := partner.CurAPIManager.GetAppOrgCodeList(model.VendorIDJD)
|
||||||
// for _, v := range apiList {
|
// for _, v := range apiList {
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ func (c *DjswController) handleMsg(handler func(*jdapi.API, interface{}) *jdapi.
|
|||||||
callbackMsg, mapData, callbackResponse := jdapi.GetCallbackMsg(getUsefulRequest(c.Ctx))
|
callbackMsg, mapData, callbackResponse := jdapi.GetCallbackMsg(getUsefulRequest(c.Ctx))
|
||||||
globals.SugarLogger.Debug(utils.Format4Output(callbackMsg, true))
|
globals.SugarLogger.Debug(utils.Format4Output(callbackMsg, true))
|
||||||
if callbackResponse == nil {
|
if callbackResponse == nil {
|
||||||
if jdAPI := jd.GetAPI(jd.AppKey2OrgCode(callbackMsg.AppKey)); jdAPI != nil {
|
if jdAPI := jd.GetAPIbyKey(callbackMsg.AppKey); jdAPI != nil {
|
||||||
if callbackResponse = jdAPI.CheckCallbackValidation(mapData, callbackMsg.Sign); callbackResponse == nil {
|
if callbackResponse = jdAPI.CheckCallbackValidation(mapData, callbackMsg.Sign); callbackResponse == nil {
|
||||||
callbackResponse = handler(jdAPI, callbackMsg.Param)
|
callbackResponse = handler(jdAPI, callbackMsg.Param)
|
||||||
}
|
}
|
||||||
@@ -38,7 +38,6 @@ func (c *DjswController) orderStatus() {
|
|||||||
if c.Ctx.Input.Method() == http.MethodPost {
|
if c.Ctx.Input.Method() == http.MethodPost {
|
||||||
callbackResponse := c.handleMsg(func(a *jdapi.API, obj interface{}) (callbackResponse *jdapi.CallbackResponse) {
|
callbackResponse := c.handleMsg(func(a *jdapi.API, obj interface{}) (callbackResponse *jdapi.CallbackResponse) {
|
||||||
callbackResponse = jd.OnOrderMsg(obj.(*jdapi.CallbackOrderMsg))
|
callbackResponse = jd.OnOrderMsg(obj.(*jdapi.CallbackOrderMsg))
|
||||||
globals.SugarLogger.Debugf("22222", utils.Format4Output(callbackResponse, true))
|
|
||||||
return callbackResponse
|
return callbackResponse
|
||||||
})
|
})
|
||||||
c.Data["json"] = c.transferResponse("orderStatus", callbackResponse)
|
c.Data["json"] = c.transferResponse("orderStatus", callbackResponse)
|
||||||
|
|||||||
Reference in New Issue
Block a user