- RefreshMissingDadaStores检查城市码和区码
This commit is contained in:
@@ -873,6 +873,9 @@ func RefreshMissingDadaStores(ctx *jxcontext.Context, storeID int, isAsync, isCo
|
|||||||
storeDetail := batchItemList[0].(*dao.StoreDetail2)
|
storeDetail := batchItemList[0].(*dao.StoreDetail2)
|
||||||
var resultList []interface{}
|
var resultList []interface{}
|
||||||
if storeDetail.DadaStoreID == "" {
|
if storeDetail.DadaStoreID == "" {
|
||||||
|
if storeDetail.DistrictName == "" || storeDetail.CityName == "" {
|
||||||
|
return nil, fmt.Errorf("门店:%s的城市码或区码有错误", storeDetail.Name)
|
||||||
|
}
|
||||||
db := dao.GetDB()
|
db := dao.GetDB()
|
||||||
if _, err = AddStoreCourierMap(ctx, db, storeDetail.ID, model.VendorIDDada, &model.StoreCourierMap{
|
if _, err = AddStoreCourierMap(ctx, db, storeDetail.ID, model.VendorIDDada, &model.StoreCourierMap{
|
||||||
VendorStoreID: utils.Int2Str(storeDetail.ID),
|
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) {
|
func updateOrCreateDadaStore(storeDetail *dao.StoreDetail2) (err error) {
|
||||||
|
if storeDetail.DistrictName == "" {
|
||||||
|
return fmt.Errorf("门店的区码有问题,请检查")
|
||||||
|
}
|
||||||
|
if storeDetail.CityName == "" {
|
||||||
|
return fmt.Errorf("门店的城市码有问题,请检查")
|
||||||
|
}
|
||||||
if globals.EnableStoreWrite {
|
if globals.EnableStoreWrite {
|
||||||
_, err = api.DadaAPI.ShopDetail(storeDetail.DadaStoreID)
|
_, err = api.DadaAPI.ShopDetail(storeDetail.DadaStoreID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -136,8 +136,8 @@ func GetMissingDadaStores(db *DaoDB, storeID int, isMustHaveJdStore bool) (store
|
|||||||
t3.vendor_store_id dada_store_id
|
t3.vendor_store_id dada_store_id
|
||||||
FROM store t1
|
FROM store t1
|
||||||
LEFT JOIN store_map t2 ON t1.id = t2.store_id AND t2.vendor_id = ? AND t2.deleted_at = ?
|
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
|
LEFT JOIN place city ON city.code = t1.city_code
|
||||||
JOIN place district ON district.code = t1.district_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 = ?
|
LEFT JOIN store_courier_map t3 ON t3.store_id = t1.id AND t3.vendor_id = ? AND t3.deleted_at = ?
|
||||||
WHERE t1.deleted_at = ?
|
WHERE t1.deleted_at = ?
|
||||||
`
|
`
|
||||||
|
|||||||
Reference in New Issue
Block a user