111
This commit is contained in:
@@ -43,20 +43,13 @@ type ShortStatus struct {
|
|||||||
BusinessData string `json:"business_data"`
|
BusinessData string `json:"business_data"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// 门店状态回调
|
//#region 订单
|
||||||
type ChainstoreStatusNotify struct {
|
|
||||||
CallbackBusinessType string `json:"callback_business_type"`
|
|
||||||
Param *ChainstoreParam `json:"param"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// 门店状态回调paramter
|
type CallBackOrder struct {
|
||||||
type ChainstoreParam struct {
|
AppId string `json:"app_id"`
|
||||||
MerchantId string `json:"merchant_id"` // 商户id
|
Signature string `json:"signature"`
|
||||||
ChainStoreId string `json:"chain_store_id"` // 蜂鸟门店id
|
Timestamp string `json:"timestamp"`
|
||||||
OutShopCode string `json:"out_shop_code"` // 外部门店编码
|
BusinessData *OrderStatusNottify `json:"business_data"`
|
||||||
Status string `json:"status"` // 门店认证状态
|
|
||||||
ModifyStatus string `json:"modify_status"` // 门店修改状态
|
|
||||||
Remark string `json:"remark"` // 门店认证、修改等驳回时返回原因
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 订单状态
|
// 订单状态
|
||||||
@@ -84,6 +77,23 @@ type OrderCallbackParam struct {
|
|||||||
Transfer int `json:"transfer"` // 转单标识 转单标识 1 是转单 0非转单
|
Transfer int `json:"transfer"` // 转单标识 转单标识 1 是转单 0非转单
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//#endregion
|
||||||
|
// 门店状态回调
|
||||||
|
type ChainstoreStatusNotify struct {
|
||||||
|
CallbackBusinessType string `json:"callback_business_type"`
|
||||||
|
Param *ChainstoreParam `json:"param"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// 门店状态回调paramter
|
||||||
|
type ChainstoreParam struct {
|
||||||
|
MerchantId string `json:"merchant_id"` // 商户id
|
||||||
|
ChainStoreId string `json:"chain_store_id"` // 蜂鸟门店id
|
||||||
|
OutShopCode string `json:"out_shop_code"` // 外部门店编码
|
||||||
|
Status string `json:"status"` // 门店认证状态
|
||||||
|
ModifyStatus string `json:"modify_status"` // 门店修改状态
|
||||||
|
Remark string `json:"remark"` // 门店认证、修改等驳回时返回原因
|
||||||
|
}
|
||||||
|
|
||||||
// 出餐回调
|
// 出餐回调
|
||||||
type CookingFinishNotify struct {
|
type CookingFinishNotify struct {
|
||||||
OrderId int64 `json:"order_id"` // 订单号
|
OrderId int64 `json:"order_id"` // 订单号
|
||||||
@@ -142,34 +152,18 @@ 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)
|
err := request.ParseForm()
|
||||||
if err != nil {
|
var refundData *CallBackOrder
|
||||||
baseapi.SugarLogger.Debugf("FN GetChainOrderStatusNotify failed with No result msg err:%v", err)
|
if err == nil {
|
||||||
callbackResponse = &CallbackResponse{Code: -1}
|
data := utils.URLValues2Map(request.Form)
|
||||||
return nil, callbackResponse
|
if err = utils.Map2StructByJson(data, &refundData, true); err == nil {
|
||||||
|
return nil, SignatureIsNotOk
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
fmt.Println("==============", refundData.BusinessData)
|
||||||
//storeNotify := &OrderStatusNottify{}
|
fmt.Println("==============", refundData.BusinessData.Param)
|
||||||
fmt.Println("string==================", string(data))
|
fmt.Println("==============", refundData.BusinessData.Param.PartnerOrderCode)
|
||||||
//if err := json.Unmarshal(data, &storeNotify); err != nil {
|
return refundData.BusinessData, SuccessResponse
|
||||||
// baseapi.SugarLogger.Debugf("FN GetShopStatusCallbackMsg failed with err:%v", err)
|
|
||||||
// callbackResponse = &CallbackResponse{Code: -1}
|
|
||||||
// return nil, callbackResponse
|
|
||||||
//}
|
|
||||||
|
|
||||||
//fmt.Println("======================", storeNotify)
|
|
||||||
//fnNotify := &OrderCallbackParam{}
|
|
||||||
//if err := json.Unmarshal([]byte(storeNotify.Param), fnNotify); err != nil {
|
|
||||||
// baseapi.SugarLogger.Debugf("FN callback string to ChainstoreStatusNotify failed with err:%v", err)
|
|
||||||
// callbackResponse = &CallbackResponse{Code: -1}
|
|
||||||
// return nil, callbackResponse
|
|
||||||
//}
|
|
||||||
//fmt.Println("======================business_data", storeNotify.Param)
|
|
||||||
//fmt.Println("======================business_data", storeNotify.Param.OrderId)
|
|
||||||
//fmt.Println("======================business_data", storeNotify.Param.PartnerOrderCode)
|
|
||||||
//fmt.Println("======================business_data", storeNotify.CallbackBusinessType)
|
|
||||||
|
|
||||||
return nil, SuccessResponse
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 异常配送
|
// 异常配送
|
||||||
@@ -197,3 +191,11 @@ func (a *API) GetChainAbnormaltatusNotify(request *http.Request) (shopStatusMsg
|
|||||||
|
|
||||||
return fnNotify, SuccessResponse
|
return fnNotify, SuccessResponse
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (a *API) CheckCallbackValidation(request *http.Request) (callbackResponse *CallbackResponse) {
|
||||||
|
err := request.ParseForm()
|
||||||
|
if err != nil {
|
||||||
|
callbackResponse = Err2CallbackResponse(err, "")
|
||||||
|
}
|
||||||
|
return callbackResponse
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user