- ebai调整一些常量类型
This commit is contained in:
@@ -37,6 +37,38 @@ type CallbackMsg struct {
|
||||
Cmd string `json:"cmd"`
|
||||
Timestamp int64 `json:"timestamp"`
|
||||
Body map[string]interface{} `json:"body"`
|
||||
Data interface{} `json:"data"`
|
||||
}
|
||||
|
||||
type CBPartRefundInfo struct {
|
||||
OrderID int64 `json:"order_id"`
|
||||
RefundID string `json:"refund_id"`
|
||||
Type int `json:"type"`
|
||||
Status int `json:"status"`
|
||||
AdditionReason string `json:"addition_reason"`
|
||||
Photos []string `json:"photos"`
|
||||
ReasonType string `json:"reason_type"`
|
||||
Reason string `json:"reason"`
|
||||
RefundProducts []*struct {
|
||||
SkuID string `json:"sku_id"`
|
||||
Upc string `json:"upc"`
|
||||
CustomSkuID string `json:"custom_sku_id"`
|
||||
Name string `json:"name"`
|
||||
Number int `json:"number"`
|
||||
TotalRefund int64 `json:"total_refund"`
|
||||
ShopEleRefund int64 `json:"shop_ele_refund"`
|
||||
} `json:"refund_products"`
|
||||
RefundPrice int64 `json:"refund_price"`
|
||||
}
|
||||
|
||||
type CBUserCancelInfo struct {
|
||||
OrderID int64 `json:"order_id"`
|
||||
CancelReason string `json:"cancel_reason"`
|
||||
AdditionReason string `json:"addition_reason"`
|
||||
RefuseReason string `json:"refuse_reason"`
|
||||
Pictures []string `json:"pictures"`
|
||||
Type int `json:"type"`
|
||||
CancelType int `json:"cancel_type"`
|
||||
}
|
||||
|
||||
func (a *API) Err2CallbackResponse(cmd string, err error, data interface{}) *CallbackResponse {
|
||||
@@ -107,6 +139,20 @@ func (a *API) GetCallbackMsg(request *http.Request) (msg *CallbackMsg, callbackR
|
||||
}
|
||||
msg.Cmd = GetCmd(request)
|
||||
msg.Timestamp = utils.Str2Int64(utils.Interface2String(request.FormValue("timestamp")))
|
||||
var tmpObj interface{}
|
||||
switch msg.Cmd {
|
||||
case CmdOrderPartRefund:
|
||||
var partRefundData CBPartRefundInfo
|
||||
tmpObj = &partRefundData
|
||||
case CmdOrderUserCancel:
|
||||
var userCancelData CBUserCancelInfo
|
||||
tmpObj = &userCancelData
|
||||
}
|
||||
if tmpObj != nil {
|
||||
if utils.Map2StructByJson(msg.Body, tmpObj, true) == nil {
|
||||
msg.Data = tmpObj
|
||||
}
|
||||
}
|
||||
return msg, nil
|
||||
}
|
||||
return nil, a.Err2CallbackResponse("", err, nil)
|
||||
|
||||
Reference in New Issue
Block a user