- avoid dada store name duplicated.
This commit is contained in:
@@ -714,13 +714,13 @@ func RefreshMissingDadaStores(ctx *jxcontext.Context, storeID int, isAsync, isCo
|
||||
_, err = api.DadaAPI.ShopDetail(utils.Int2Str(storeDetail.ID))
|
||||
if err != nil {
|
||||
if codeErr, ok := err.(*utils.ErrorWithCode); ok && codeErr.IntCode() == dadaapi.ResponseCodeShopNotExist {
|
||||
_, err = api.DadaAPI.ShopAdd(utils.Int2Str(storeDetail.ID), storeDetail.Name, dadaapi.BusinessTypeConvStore, storeDetail.CityName,
|
||||
_, err = api.DadaAPI.ShopAdd(utils.Int2Str(storeDetail.ID), composeDadaStoreName(storeDetail), dadaapi.BusinessTypeConvStore, storeDetail.CityName,
|
||||
storeDetail.DistrictName, storeDetail.Address, jxutils.IntCoordinate2Standard(storeDetail.Lng), jxutils.IntCoordinate2Standard(storeDetail.Lat),
|
||||
storeDetail.Tel1, storeDetail.Tel1, nil)
|
||||
}
|
||||
} else {
|
||||
params := map[string]interface{}{
|
||||
"station_name": storeDetail.Name,
|
||||
"station_name": composeDadaStoreName(storeDetail),
|
||||
"business": dadaapi.BusinessTypeConvStore,
|
||||
"city_name": storeDetail.CityName,
|
||||
"area_name": storeDetail.DistrictName,
|
||||
@@ -749,3 +749,7 @@ func RefreshMissingDadaStores(ctx *jxcontext.Context, storeID int, isAsync, isCo
|
||||
}
|
||||
return hint, err
|
||||
}
|
||||
|
||||
func composeDadaStoreName(store *dao.StoreDetail2) (storeName string) {
|
||||
return storeDetail.Name + "-" + utils.Int2Str(store.ID)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user