- avoid manually build map in CreateOrderByShop.
This commit is contained in:
@@ -21,6 +21,7 @@ type JDOrderMsg struct {
|
||||
BillId string `json:"billId"`
|
||||
StatusId string `json:"statusId"`
|
||||
Timestamp string `json:"timestamp"`
|
||||
Remark string `json:"remark"`
|
||||
}
|
||||
|
||||
type JDDeliveryStatusMsg struct {
|
||||
@@ -77,13 +78,18 @@ func (j *JDAPI) CheckRequestValidation(request *http.Request) (callbackResponse
|
||||
return nil
|
||||
}
|
||||
|
||||
func (j *JDAPI) GetOrderMsg(request *http.Request) (msg *JDOrderMsg, callbackResponse *JDCallbackResponse) {
|
||||
func (j *JDAPI) getCommonOrderMsg(request *http.Request, needDecode bool) (msg *JDOrderMsg, callbackResponse *JDCallbackResponse) {
|
||||
if callbackResponse = j.CheckRequestValidation(request); callbackResponse != nil {
|
||||
return nil, callbackResponse
|
||||
}
|
||||
|
||||
msg = new(JDOrderMsg)
|
||||
jdParamJSON := request.FormValue(JD_PARAM_JSON)
|
||||
if needDecode {
|
||||
if jdParamJSON2, err := url.QueryUnescape(jdParamJSON); err == nil {
|
||||
jdParamJSON = jdParamJSON2
|
||||
}
|
||||
}
|
||||
callbackResponse = j.unmarshalData(jdParamJSON, msg)
|
||||
if callbackResponse != nil {
|
||||
return nil, callbackResponse
|
||||
@@ -91,6 +97,14 @@ func (j *JDAPI) GetOrderMsg(request *http.Request) (msg *JDOrderMsg, callbackRes
|
||||
return msg, nil
|
||||
}
|
||||
|
||||
func (j *JDAPI) GetOrderMsg(request *http.Request) (msg *JDOrderMsg, callbackResponse *JDCallbackResponse) {
|
||||
return j.getCommonOrderMsg(request, false)
|
||||
}
|
||||
|
||||
func (j *JDAPI) GetOrderApplyCancelMsg(request *http.Request) (msg *JDOrderMsg, callbackResponse *JDCallbackResponse) {
|
||||
return j.getCommonOrderMsg(request, true)
|
||||
}
|
||||
|
||||
func (j *JDAPI) GetOrderDeliveryMsg(request *http.Request) (msg *JDDeliveryStatusMsg, callbackResponse *JDCallbackResponse) {
|
||||
if callbackResponse = j.CheckRequestValidation(request); callbackResponse != nil {
|
||||
return nil, callbackResponse
|
||||
|
||||
Reference in New Issue
Block a user