addstoreVendorMap和update支持京西门店

This commit is contained in:
苏尹岚
2019-12-11 13:46:16 +08:00
parent 2b49d2ba74
commit 77880d2318
4 changed files with 17 additions and 18 deletions

View File

@@ -359,7 +359,7 @@ func UpdateConfig(ctx *jxcontext.Context, key, configType, value string) (hint s
if vendorID != model.VendorIDJX { if vendorID != model.VendorIDJX {
dao.SetStoreSkuSyncStatus(db, vendorID, storeIDs, nil, model.SyncFlagPriceMask) dao.SetStoreSkuSyncStatus(db, vendorID, storeIDs, nil, model.SyncFlagPriceMask)
} else { } else {
ReCalculateJxPrice(ctx, storeIDs) ReCalculateJxPrice(db, ctx, storeIDs)
} }
} }
case model.ConfigTypeFreightPack: case model.ConfigTypeFreightPack:

View File

@@ -1058,7 +1058,7 @@ func AddStoreVendorMap(ctx *jxcontext.Context, db *dao.DaoDB, vendorID int, vend
err = ErrCanNotFindVendor err = ErrCanNotFindVendor
} }
} else { } else {
ReCalculateJxPrice(ctx, []int{storeID}) ReCalculateJxPrice(db, ctx, []int{storeID})
} }
if err == nil { if err == nil {
dao.WrapAddIDCULDEntity(storeMap, userName) dao.WrapAddIDCULDEntity(storeMap, userName)
@@ -1201,7 +1201,7 @@ func UpdateStoreVendorMap(ctx *jxcontext.Context, db *dao.DaoDB, storeID, vendor
} }
} else { } else {
if valid["pricePercentage"] != nil || valid["pricePercentagePack"] != nil { if valid["pricePercentage"] != nil || valid["pricePercentagePack"] != nil {
ReCalculateJxPrice(ctx, []int{storeID}) ReCalculateJxPrice(db, ctx, []int{storeID})
} }
} }
} }

View File

@@ -2058,8 +2058,7 @@ func AutoSaleStoreSku(ctx *jxcontext.Context, storeIDs []int, isNeedSync bool) (
return err return err
} }
func ReCalculateJxPrice(ctx *jxcontext.Context, storeIDs []int) (err error) { func ReCalculateJxPrice(db *dao.DaoDB, ctx *jxcontext.Context, storeIDs []int) (err error) {
db := dao.GetDB()
for _, storeID := range storeIDs { for _, storeID := range storeIDs {
if storeDetail, err := dao.GetStoreDetail(db, storeID, model.VendorIDJX); err == nil { if storeDetail, err := dao.GetStoreDetail(db, storeID, model.VendorIDJX); err == nil {
if storeSkuList, err := dao.GetStoresSkusInfo(db, []int{storeID}, nil); err == nil { if storeSkuList, err := dao.GetStoresSkusInfo(db, []int{storeID}, nil); err == nil {

View File

@@ -107,9 +107,9 @@ func getStoreDetail(db *DaoDB, storeID, vendorID int, vendorStoreID string) (sto
utils.DefaultTimeValue, utils.DefaultTimeValue,
utils.DefaultTimeValue, utils.DefaultTimeValue,
} }
if vendorID != model.VendorIDJX { // if vendorID != model.VendorIDJX {
sql += " AND t2.id IS NOT NULL" // sql += " AND t2.id IS NOT NULL"
} // }
if storeID > 0 { if storeID > 0 {
sql += " AND t1.id = ?" sql += " AND t1.id = ?"
sqlParams = append(sqlParams, storeID) 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 { if err = GetRow(db, &storeDetail, sql, sqlParams...); err == nil {
storeDetail.PricePercentagePackObj = PricePercentagePack2Obj(storeDetail.PricePercentagePackStr) storeDetail.PricePercentagePackObj = PricePercentagePack2Obj(storeDetail.PricePercentagePackStr)
storeDetail.FreightDeductionPackObj = FreightDeductionPack2Obj(storeDetail.FreightDeductionPackStr) storeDetail.FreightDeductionPackObj = FreightDeductionPack2Obj(storeDetail.FreightDeductionPackStr)
if storeDetail.VendorStoreID == "" { // if storeDetail.VendorStoreID == "" {
storeDetail.VendorStatus = storeDetail.Status // storeDetail.VendorStatus = storeDetail.Status
storeDetail.PricePercentage = model.DefVendorPricePercentage // storeDetail.PricePercentage = model.DefVendorPricePercentage
storeDetail.AutoPickup = 1 // storeDetail.AutoPickup = 1
storeDetail.DeliveryType = model.StoreDeliveryTypeByStore // storeDetail.DeliveryType = model.StoreDeliveryTypeByStore
storeDetail.DeliveryCompetition = 1 // storeDetail.DeliveryCompetition = 1
if vendorID == model.VendorIDJX { // if vendorID == model.VendorIDJX {
storeDetail.IsSync = 1 // storeDetail.IsSync = 1
} // }
} // }
return storeDetail, nil return storeDetail, nil
} }
return nil, err return nil, err