From 77880d23180caeb0cb1963e77e34b0240424d6c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Wed, 11 Dec 2019 13:46:16 +0800 Subject: [PATCH] =?UTF-8?q?addstoreVendorMap=E5=92=8Cupdate=E6=94=AF?= =?UTF-8?q?=E6=8C=81=E4=BA=AC=E8=A5=BF=E9=97=A8=E5=BA=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/cms/cms.go | 2 +- business/jxstore/cms/store.go | 4 ++-- business/jxstore/cms/store_sku.go | 3 +-- business/model/dao/store.go | 26 +++++++++++++------------- 4 files changed, 17 insertions(+), 18 deletions(-) diff --git a/business/jxstore/cms/cms.go b/business/jxstore/cms/cms.go index 5cb3071bc..87f88d2c6 100644 --- a/business/jxstore/cms/cms.go +++ b/business/jxstore/cms/cms.go @@ -359,7 +359,7 @@ func UpdateConfig(ctx *jxcontext.Context, key, configType, value string) (hint s if vendorID != model.VendorIDJX { dao.SetStoreSkuSyncStatus(db, vendorID, storeIDs, nil, model.SyncFlagPriceMask) } else { - ReCalculateJxPrice(ctx, storeIDs) + ReCalculateJxPrice(db, ctx, storeIDs) } } case model.ConfigTypeFreightPack: diff --git a/business/jxstore/cms/store.go b/business/jxstore/cms/store.go index bf40ee07f..8f99c24aa 100644 --- a/business/jxstore/cms/store.go +++ b/business/jxstore/cms/store.go @@ -1058,7 +1058,7 @@ func AddStoreVendorMap(ctx *jxcontext.Context, db *dao.DaoDB, vendorID int, vend err = ErrCanNotFindVendor } } else { - ReCalculateJxPrice(ctx, []int{storeID}) + ReCalculateJxPrice(db, ctx, []int{storeID}) } if err == nil { dao.WrapAddIDCULDEntity(storeMap, userName) @@ -1201,7 +1201,7 @@ func UpdateStoreVendorMap(ctx *jxcontext.Context, db *dao.DaoDB, storeID, vendor } } else { if valid["pricePercentage"] != nil || valid["pricePercentagePack"] != nil { - ReCalculateJxPrice(ctx, []int{storeID}) + ReCalculateJxPrice(db, ctx, []int{storeID}) } } } diff --git a/business/jxstore/cms/store_sku.go b/business/jxstore/cms/store_sku.go index cc40e61a9..84298599f 100644 --- a/business/jxstore/cms/store_sku.go +++ b/business/jxstore/cms/store_sku.go @@ -2058,8 +2058,7 @@ func AutoSaleStoreSku(ctx *jxcontext.Context, storeIDs []int, isNeedSync bool) ( return err } -func ReCalculateJxPrice(ctx *jxcontext.Context, storeIDs []int) (err error) { - db := dao.GetDB() +func ReCalculateJxPrice(db *dao.DaoDB, ctx *jxcontext.Context, storeIDs []int) (err error) { for _, storeID := range storeIDs { if storeDetail, err := dao.GetStoreDetail(db, storeID, model.VendorIDJX); err == nil { if storeSkuList, err := dao.GetStoresSkusInfo(db, []int{storeID}, nil); err == nil { diff --git a/business/model/dao/store.go b/business/model/dao/store.go index 0cfdc4520..7892798f0 100644 --- a/business/model/dao/store.go +++ b/business/model/dao/store.go @@ -107,9 +107,9 @@ func getStoreDetail(db *DaoDB, storeID, vendorID int, vendorStoreID string) (sto utils.DefaultTimeValue, utils.DefaultTimeValue, } - if vendorID != model.VendorIDJX { - sql += " AND t2.id IS NOT NULL" - } + // if vendorID != model.VendorIDJX { + // sql += " AND t2.id IS NOT NULL" + // } if storeID > 0 { sql += " AND t1.id = ?" sqlParams = append(sqlParams, storeID) @@ -121,16 +121,16 @@ func getStoreDetail(db *DaoDB, storeID, vendorID int, vendorStoreID string) (sto if err = GetRow(db, &storeDetail, sql, sqlParams...); err == nil { storeDetail.PricePercentagePackObj = PricePercentagePack2Obj(storeDetail.PricePercentagePackStr) storeDetail.FreightDeductionPackObj = FreightDeductionPack2Obj(storeDetail.FreightDeductionPackStr) - if storeDetail.VendorStoreID == "" { - storeDetail.VendorStatus = storeDetail.Status - storeDetail.PricePercentage = model.DefVendorPricePercentage - storeDetail.AutoPickup = 1 - storeDetail.DeliveryType = model.StoreDeliveryTypeByStore - storeDetail.DeliveryCompetition = 1 - if vendorID == model.VendorIDJX { - storeDetail.IsSync = 1 - } - } + // if storeDetail.VendorStoreID == "" { + // storeDetail.VendorStatus = storeDetail.Status + // storeDetail.PricePercentage = model.DefVendorPricePercentage + // storeDetail.AutoPickup = 1 + // storeDetail.DeliveryType = model.StoreDeliveryTypeByStore + // storeDetail.DeliveryCompetition = 1 + // if vendorID == model.VendorIDJX { + // storeDetail.IsSync = 1 + // } + // } return storeDetail, nil } return nil, err