- 适应快递API接口变更
This commit is contained in:
@@ -8,6 +8,7 @@ import (
|
||||
"git.rosy.net.cn/baseapi/platformapi/mtpsapi"
|
||||
"git.rosy.net.cn/baseapi/utils"
|
||||
"git.rosy.net.cn/jx-callback/business/jxutils"
|
||||
"git.rosy.net.cn/jx-callback/business/jxutils/jxcontext"
|
||||
"git.rosy.net.cn/jx-callback/business/model"
|
||||
"git.rosy.net.cn/jx-callback/business/model/dao"
|
||||
"git.rosy.net.cn/jx-callback/business/partner"
|
||||
@@ -30,6 +31,12 @@ var (
|
||||
|
||||
var (
|
||||
curDeliveryHandler *DeliveryHandler
|
||||
auditStatusMap = map[int]int{
|
||||
mtpsapi.ShopStatusCreateSuccess: model.StoreAuditStatusCreated,
|
||||
mtpsapi.ShopStatusAuditRejected: model.StoreAuditStatusRejected,
|
||||
mtpsapi.ShopStatusAuditPassed: model.StoreAuditStatusCreated,
|
||||
mtpsapi.ShopStatusOnline: model.StoreAuditStatusOnline,
|
||||
}
|
||||
)
|
||||
|
||||
type DeliveryHandler struct {
|
||||
@@ -114,6 +121,36 @@ func (c *DeliveryHandler) callbackMsg2Waybill(msg *mtpsapi.CallbackOrderMsg) (re
|
||||
return retVal
|
||||
}
|
||||
|
||||
func (c *DeliveryHandler) CreateStore(ctx *jxcontext.Context, storeDetail *dao.StoreDetail2) (vendorStoreID string, status int, err error) {
|
||||
businessHours := []*mtpsapi.BusinessHour{
|
||||
&mtpsapi.BusinessHour{
|
||||
BeginTime: "06:00",
|
||||
EndTime: "22:00",
|
||||
},
|
||||
}
|
||||
shopInfo := &mtpsapi.ShopInfo{
|
||||
ShopID: utils.Int2Str(storeDetail.ID),
|
||||
ShopName: storeDetail.Name,
|
||||
Category: mtpsapi.ShopCategoryFruit,
|
||||
SecondCategory: mtpsapi.ShopCategoryFruitFruit,
|
||||
ContactName: storeDetail.PayeeName,
|
||||
ContactPhone: storeDetail.Tel1,
|
||||
ShopAddress: storeDetail.Address,
|
||||
ShopLng: storeDetail.Lng,
|
||||
ShopLat: storeDetail.Lat,
|
||||
CoordinateType: mtpsapi.CoordinateTypeMars,
|
||||
BusinessHours: string(utils.MustMarshal(businessHours)),
|
||||
}
|
||||
shopStatus := mtpsapi.ShopStatusCreateSuccess
|
||||
if globals.EnableStoreWrite {
|
||||
shopStatus, err = api.MtpsAPI.ShopCreate(shopInfo)
|
||||
}
|
||||
if err == nil {
|
||||
status = auditStatusMap[shopStatus]
|
||||
}
|
||||
return "", status, err
|
||||
}
|
||||
|
||||
func (c *DeliveryHandler) GetWaybillFee(order *model.GoodsOrder) (deliveryFeeInfo *partner.WaybillFeeInfo, err error) {
|
||||
db := dao.GetDB()
|
||||
deliveryFeeInfo = &partner.WaybillFeeInfo{}
|
||||
|
||||
Reference in New Issue
Block a user