- RefreshMissingDadaStores检查城市码和区码

This commit is contained in:
gazebo
2019-05-09 14:59:44 +08:00
parent 2b7f6f9cff
commit 709fd6231a
2 changed files with 11 additions and 2 deletions

View File

@@ -873,6 +873,9 @@ func RefreshMissingDadaStores(ctx *jxcontext.Context, storeID int, isAsync, isCo
storeDetail := batchItemList[0].(*dao.StoreDetail2)
var resultList []interface{}
if storeDetail.DadaStoreID == "" {
if storeDetail.DistrictName == "" || storeDetail.CityName == "" {
return nil, fmt.Errorf("门店:%s的城市码或区码有错误", storeDetail.Name)
}
db := dao.GetDB()
if _, err = AddStoreCourierMap(ctx, db, storeDetail.ID, model.VendorIDDada, &model.StoreCourierMap{
VendorStoreID: utils.Int2Str(storeDetail.ID),
@@ -896,6 +899,12 @@ func RefreshMissingDadaStores(ctx *jxcontext.Context, storeID int, isAsync, isCo
}
func updateOrCreateDadaStore(storeDetail *dao.StoreDetail2) (err error) {
if storeDetail.DistrictName == "" {
return fmt.Errorf("门店的区码有问题,请检查")
}
if storeDetail.CityName == "" {
return fmt.Errorf("门店的城市码有问题,请检查")
}
if globals.EnableStoreWrite {
_, err = api.DadaAPI.ShopDetail(storeDetail.DadaStoreID)
if err != nil {

View File

@@ -136,8 +136,8 @@ func GetMissingDadaStores(db *DaoDB, storeID int, isMustHaveJdStore bool) (store
t3.vendor_store_id dada_store_id
FROM store t1
LEFT JOIN store_map t2 ON t1.id = t2.store_id AND t2.vendor_id = ? AND t2.deleted_at = ?
JOIN place city ON city.code = t1.city_code
JOIN place district ON district.code = t1.district_code
LEFT JOIN place city ON city.code = t1.city_code
LEFT JOIN place district ON district.code = t1.district_code
LEFT JOIN store_courier_map t3 ON t3.store_id = t1.id AND t3.vendor_id = ? AND t3.deleted_at = ?
WHERE t1.deleted_at = ?
`