1
This commit is contained in:
@@ -142,20 +142,14 @@ func (a *API) GetChainstoreStatusNotify(request *http.Request) (shopStatusMsg *C
|
|||||||
|
|
||||||
// 获取订单状态回调消息
|
// 获取订单状态回调消息
|
||||||
func (a *API) GetChainOrderStatusNotify(request *http.Request) (shopStatusMsg *OrderStatusNottify, callbackResponse *CallbackResponse) {
|
func (a *API) GetChainOrderStatusNotify(request *http.Request) (shopStatusMsg *OrderStatusNottify, callbackResponse *CallbackResponse) {
|
||||||
//data, err := ioutil.ReadAll(request.Body)
|
data, err := ioutil.ReadAll(request.Body)
|
||||||
//if err != nil {
|
if err != nil {
|
||||||
// baseapi.SugarLogger.Debugf("FN GetChainOrderStatusNotify failed with No result msg err:%v", err)
|
baseapi.SugarLogger.Debugf("FN GetChainOrderStatusNotify failed with No result msg err:%v", err)
|
||||||
// callbackResponse = &CallbackResponse{Code: -1}
|
callbackResponse = &CallbackResponse{Code: -1}
|
||||||
// return nil, callbackResponse
|
return nil, callbackResponse
|
||||||
//}
|
|
||||||
resultData := &ShortStatus{
|
|
||||||
AppId: request.FormValue("app_id"),
|
|
||||||
Signature: request.FormValue("signature"),
|
|
||||||
Timestamp: request.FormValue("timestamp"),
|
|
||||||
BusinessData: request.FormValue("business_data"),
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fmt.Println("string==================", resultData.BusinessData)
|
fmt.Println("string==================", string(data))
|
||||||
//if err := json.Unmarshal([]byte(resultData.BusinessData), &storeNotify); err != nil {
|
//if err := json.Unmarshal([]byte(resultData.BusinessData), &storeNotify); err != nil {
|
||||||
// baseapi.SugarLogger.Debugf("FN GetShopStatusCallbackMsg failed with err:%v", err)
|
// baseapi.SugarLogger.Debugf("FN GetShopStatusCallbackMsg failed with err:%v", err)
|
||||||
// callbackResponse = &CallbackResponse{Code: -1}
|
// callbackResponse = &CallbackResponse{Code: -1}
|
||||||
@@ -163,19 +157,19 @@ func (a *API) GetChainOrderStatusNotify(request *http.Request) (shopStatusMsg *O
|
|||||||
//}
|
//}
|
||||||
//
|
//
|
||||||
//fmt.Println("======================", storeNotify)
|
//fmt.Println("======================", storeNotify)
|
||||||
fnNotify := &OrderStatusNottify{}
|
//fnNotify := &OrderStatusNottify{}
|
||||||
if err := json.Unmarshal([]byte(resultData.BusinessData), fnNotify); err != nil {
|
//if err := json.Unmarshal([]byte(resultData.BusinessData), fnNotify); err != nil {
|
||||||
baseapi.SugarLogger.Debugf("FN callback string to ChainstoreStatusNotify failed with err:%v", err)
|
// baseapi.SugarLogger.Debugf("FN callback string to ChainstoreStatusNotify failed with err:%v", err)
|
||||||
callbackResponse = &CallbackResponse{Code: -1}
|
// callbackResponse = &CallbackResponse{Code: -1}
|
||||||
return nil, callbackResponse
|
// return nil, callbackResponse
|
||||||
}
|
//}
|
||||||
fmt.Println("======================business_data", fnNotify.Param)
|
//fmt.Println("======================business_data", fnNotify.Param)
|
||||||
fmt.Println("======================business_data", fnNotify.Param["orderId"])
|
//fmt.Println("======================business_data", fnNotify.Param["orderId"])
|
||||||
fmt.Println("======================business_data", fnNotify.Param["partnerOrderCode"])
|
//fmt.Println("======================business_data", fnNotify.Param["partnerOrderCode"])
|
||||||
fmt.Println("======================business_data", fnNotify.Param)
|
//fmt.Println("======================business_data", fnNotify.Param)
|
||||||
fmt.Println("======================business_data", fnNotify.CallbackBusinessType)
|
//fmt.Println("======================business_data", fnNotify.CallbackBusinessType)
|
||||||
|
|
||||||
return fnNotify, SuccessResponse
|
return nil, SuccessResponse
|
||||||
}
|
}
|
||||||
|
|
||||||
// 异常配送
|
// 异常配送
|
||||||
@@ -203,45 +197,3 @@ func (a *API) GetChainAbnormaltatusNotify(request *http.Request) (shopStatusMsg
|
|||||||
|
|
||||||
return fnNotify, SuccessResponse
|
return fnNotify, SuccessResponse
|
||||||
}
|
}
|
||||||
|
|
||||||
// 蜂鸟返回值解析
|
|
||||||
//func FnCallbackAnalysis(notify *ChainstoreStatusNotify) (result map[string]interface{}, err error) {
|
|
||||||
// switch notify.CallbackBusinessType {
|
|
||||||
// case OrderStatus: // 订单回调
|
|
||||||
// orderRes := &OrderCallbackParam{}
|
|
||||||
// if err := json.Unmarshal([]byte(notify.Param), orderRes); err != nil {
|
|
||||||
// return nil, err
|
|
||||||
// }
|
|
||||||
// notifyObj := utils.Struct2FlatMap(orderRes)
|
|
||||||
// notifyObj["orderStatusNotify"] = ChainstoreStatus
|
|
||||||
// return notifyObj, nil
|
|
||||||
// case AbnormalStatus: // 异常报备回调
|
|
||||||
// return nil, nil
|
|
||||||
// case CookingFinishStatus: // 商户出餐回调
|
|
||||||
// //cokking := &CookingFinishNotify{}
|
|
||||||
// //if err := json.Unmarshal([]byte(notify.Param), cokking); err != nil {
|
|
||||||
// // return nil, err
|
|
||||||
// //}
|
|
||||||
// //notifyObj := utils.Struct2FlatMap(cokking)
|
|
||||||
// //notifyObj["cookingFinishNotify"] = ChainstoreStatus
|
|
||||||
// //return notifyObj, nil
|
|
||||||
// return nil, nil
|
|
||||||
// case ChainstoreStatus: // 门店状态变更回调
|
|
||||||
// storeRes := &ChainstoreParam{}
|
|
||||||
// if err := json.Unmarshal([]byte(notify.Param), storeRes); err != nil {
|
|
||||||
// return nil, err
|
|
||||||
// }
|
|
||||||
// notifyObj := utils.Struct2FlatMap(storeRes)
|
|
||||||
// notifyObj["notifyUel"] = ChainstoreStatus
|
|
||||||
// return notifyObj, nil
|
|
||||||
// case ChainstoreServiceStatus: // 门店采购服务变更回调
|
|
||||||
// return nil, nil
|
|
||||||
// case NoServiceStatus: // 城市屏蔽区域调整回调通知
|
|
||||||
// return nil, nil
|
|
||||||
// default:
|
|
||||||
// return nil, errors.New("回调函数,回调路径错误")
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// globals.SugarLogger.Warnf("Fn callback url func err:=[%s],dont's exits", "notify.CallbackBusinessType")
|
|
||||||
// return nil, errors.New("回调函数,回调路径错误")
|
|
||||||
//}
|
|
||||||
|
|||||||
Reference in New Issue
Block a user