diff --git a/business/jxstore/cms/store.go b/business/jxstore/cms/store.go index d03a98d8b..9474c6e5d 100644 --- a/business/jxstore/cms/store.go +++ b/business/jxstore/cms/store.go @@ -461,24 +461,7 @@ func AddStoreVendorMap(ctx *jxcontext.Context, db *dao.DaoDB, storeID, vendorID err = ErrCanNotFindVendor } if err == nil && vendorID == model.VendorIDJD { - db := dao.GetDB() - storeDetailList, err2 := dao.GetMissingDadaStores(db, storeID) - if err = err2; err == nil && len(storeDetailList) > 0 { - storeDetail := storeDetailList[0] - if _, err = api.DadaAPI.ShopAdd(utils.Int2Str(storeID), storeDetail.Name, dadaapi.BusinessTypeConvStore, storeDetail.CityName, - storeDetail.DistrictName, storeDetail.Address, jxutils.IntCoordinate2Standard(storeDetail.Lng), jxutils.IntCoordinate2Standard(storeDetail.Lat), - storeDetail.Tel1, storeDetail.Tel1, nil); err != nil { - if codeErr, ok := err.(*utils.ErrorWithCode); ok && codeErr.IntCode() == dadaapi.ResponseCodeShopAlreadyExist { - err = nil - } - } - if err == nil { - _, err = AddStoreCourierMap(ctx, db, storeDetail.ID, model.VendorIDDada, &model.StoreCourierMap{ - VendorStoreID: utils.Int2Str(storeDetail.ID), - Status: model.StoreStatusOpened, - }) - } - } + _, err = RefreshMissingDadaStores(ctx, storeID, false, false) } return outStoreMap, err } @@ -720,9 +703,9 @@ func UpdateStoreCourierMap(ctx *jxcontext.Context, db *dao.DaoDB, storeID, vendo return num, err } -func RefreshMissingDadaStores(ctx *jxcontext.Context, isAsync, isContinueWhenError bool) (hint string, err error) { +func RefreshMissingDadaStores(ctx *jxcontext.Context, storeID int, isAsync, isContinueWhenError bool) (hint string, err error) { db := dao.GetDB() - storeList, err := dao.GetMissingDadaStores(db, 0) + storeList, err := dao.GetMissingDadaStores(db, storeID) if err != nil { return "", err } diff --git a/business/model/dao/store.go b/business/model/dao/store.go index c7064b0bc..f245ed914 100644 --- a/business/model/dao/store.go +++ b/business/model/dao/store.go @@ -116,7 +116,7 @@ func GetMissingDadaStores(db *DaoDB, storeID int) (storeList []*StoreDetail2, er JOIN place city ON city.code = t1.city_code 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 = ? AND t1.status <> ? AND t3.id IS NULL + WHERE t1.deleted_at = ? AND t3.id IS NULL ` sqlParams := []interface{}{ model.VendorIDJD, @@ -124,7 +124,6 @@ func GetMissingDadaStores(db *DaoDB, storeID int) (storeList []*StoreDetail2, er model.VendorIDDada, utils.DefaultTimeValue, utils.DefaultTimeValue, - model.StoreStatusDisabled, } if storeID != 0 { sql += " AND t1.id = ?" diff --git a/controllers/cms_store.go b/controllers/cms_store.go index 93da60884..96a3b3c70 100644 --- a/controllers/cms_store.go +++ b/controllers/cms_store.go @@ -298,7 +298,7 @@ func (c *StoreController) DeleteStoreCourierMap() { // @router /RefreshMissingDadaStores [put] func (c *StoreController) RefreshMissingDadaStores() { c.callRefreshMissingDadaStores(func(params *tStoreRefreshMissingDadaStoresParams) (retVal interface{}, errCode string, err error) { - retVal, err = cms.RefreshMissingDadaStores(params.Ctx, params.IsAsync, params.IsContinueWhenError) + retVal, err = cms.RefreshMissingDadaStores(params.Ctx, 0, params.IsAsync, params.IsContinueWhenError) return retVal, "", err }) }