审核门店

This commit is contained in:
苏尹岚
2020-09-24 10:30:52 +08:00
parent 4184561e5f
commit 610f44e5b5

View File

@@ -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
}