diff --git a/business/partner/delivery/mtps/store.go b/business/partner/delivery/mtps/store.go index e38939f23..9664c736e 100644 --- a/business/partner/delivery/mtps/store.go +++ b/business/partner/delivery/mtps/store.go @@ -44,36 +44,38 @@ func (c *DeliveryHandler) OnStoreStatus(msg *mtpsapi.CallbackShopStatusMsg) (ret } 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: storeDetail.VendorStoreID, - ShopName: storeDetail.Name, - Category: mtpsapi.ShopCategoryFruit, - SecondCategory: mtpsapi.ShopCategoryFruitFruit, - ContactName: storeDetail.PayeeName, - ContactPhone: storeDetail.Tel1, - ContactEmail: fakeContactEmail, - ShopAddress: storeDetail.Address, - ShopLng: storeDetail.Lng, - ShopLat: storeDetail.Lat, - CoordinateType: mtpsapi.CoordinateTypeMars, - BusinessHours: string(utils.MustMarshal(businessHours)), - } - shopStatus := mtpsapi.ShopStatusAuditCreated if globals.EnableStoreWrite { - shopStatus, err = api.MtpsAPI.ShopCreate(shopInfo) - if err == nil { - vendorStoreID = shopInfo.ShopID - status = getAuditStatus(shopStatus) + businessHours := []*mtpsapi.BusinessHour{ + &mtpsapi.BusinessHour{ + BeginTime: "06:00", + EndTime: "22:00", + }, + } + shopInfo := &mtpsapi.ShopInfo{ + ShopID: storeDetail.VendorStoreID, + ShopName: storeDetail.Name, + Category: mtpsapi.ShopCategoryFruit, + SecondCategory: mtpsapi.ShopCategoryFruitFruit, + ContactName: storeDetail.PayeeName, + ContactPhone: storeDetail.Tel1, + ContactEmail: fakeContactEmail, + ShopAddress: storeDetail.Address, + ShopLng: storeDetail.Lng, + ShopLat: storeDetail.Lat, + CoordinateType: mtpsapi.CoordinateTypeMars, + BusinessHours: string(utils.MustMarshal(businessHours)), + } + shopStatus := mtpsapi.ShopStatusAuditCreated + if globals.EnableStoreWrite { + shopStatus, err = api.MtpsAPI.ShopCreate(shopInfo) + if err == nil { + vendorStoreID = shopInfo.ShopID + status = getAuditStatus(shopStatus) + } + } else { + vendorStoreID = utils.Int64ToStr(jxutils.GenFakeID()) + status = model.StoreAuditStatusOnline } - } else { - vendorStoreID = utils.Int64ToStr(jxutils.GenFakeID()) - status = model.StoreAuditStatusOnline } return vendorStoreID, status, err }