This commit is contained in:
gazebo
2019-07-24 20:10:54 +08:00
parent 94510ff2af
commit 987d205985
4 changed files with 45 additions and 25 deletions

View File

@@ -146,12 +146,15 @@ func StoreDetail2ShopInfo(storeDetail *dao.StoreDetail2) (shopInfo *dadaapi.Shop
func (c *DeliveryHandler) CreateStore(ctx *jxcontext.Context, storeDetail *dao.StoreDetail2) (vendorStoreID string, status int, err error) {
if globals.EnableStoreWrite {
_, err = api.DadaAPI.ShopAdd(StoreDetail2ShopInfo(storeDetail))
}
if err == nil {
vendorStoreID, err = api.DadaAPI.ShopAdd(StoreDetail2ShopInfo(storeDetail))
if err == nil {
status = model.StoreAuditStatusOnline
}
} else {
vendorStoreID = utils.Int64ToStr(jxutils.GenFakeID())
status = model.StoreAuditStatusOnline
}
return "", status, err
return vendorStoreID, status, err
}
func (c *DeliveryHandler) UpdateStore(ctx *jxcontext.Context, storeDetail *dao.StoreDetail2) (err error) {
@@ -161,6 +164,13 @@ func (c *DeliveryHandler) UpdateStore(ctx *jxcontext.Context, storeDetail *dao.S
return err
}
func dadaStatus2Jx(dadaStatus int) int {
if dadaStatus == dadaapi.ShopStatusOnline {
return model.StoreStatusOpened
}
return model.StoreStatusDisabled
}
func (c *DeliveryHandler) GetStore(ctx *jxcontext.Context, storeID int, vendorStoreID string) (storeDetail *dao.StoreDetail2, err error) {
shopInfo, err := api.DadaAPI.ShopDetail(vendorStoreID)
if err == nil {
@@ -175,6 +185,8 @@ func (c *DeliveryHandler) GetStore(ctx *jxcontext.Context, storeID int, vendorSt
},
VendorID: model.VendorIDDada,
VendorStoreID: shopInfo.OriginShopID,
CourierStatus: dadaStatus2Jx(shopInfo.Status),
AuditStatus: model.StoreAuditStatusOnline,
CityName: shopInfo.CityName,
DistrictName: shopInfo.AreaName,
}