- 平台门店调价价格包实现初始版本

This commit is contained in:
gazebo
2019-07-16 11:36:28 +08:00
parent bdee4269d5
commit f133ccb290
13 changed files with 292 additions and 22 deletions

View File

@@ -791,6 +791,12 @@ func UpdateStoreVendorMap(ctx *jxcontext.Context, db *dao.DaoDB, storeID, vendor
return 0, err
}
valid := dao.StrictMakeMapByStructObject(payload, storeMap, userName)
if valid["pricePercentagePack"] != nil {
_, err2 := dao.QueryConfigs(db, model.ConfigTypePricePack, utils.Interface2String(valid["pricePercentagePack"]), "")
if err = err2; err != nil {
return 0, err
}
}
if vendorStoreID := utils.Interface2String(valid["vendorStoreID"]); vendorStoreID != "" {
vendorStoreInfo, err2 := storeHandler.ReadStore(vendorStoreID)
if err = err2; err == nil {
@@ -817,7 +823,7 @@ func UpdateStoreVendorMap(ctx *jxcontext.Context, db *dao.DaoDB, storeID, vendor
})
}
if err == nil && num > 0 {
if valid["pricePercentage"] != nil {
if valid["pricePercentage"] != nil || valid["pricePercentagePack"] != nil {
storeSkuBind := &model.StoreSkuBind{}
if num, err = dao.UpdateEntityLogicallyAndUpdateSyncStatus(db, storeSkuBind, nil, userName, map[string]interface{}{
model.FieldStoreID: storeID,
@@ -1127,7 +1133,7 @@ func composeDadaStoreName(storeDetail *dao.StoreDetail2) (storeName string) {
func ExportShopsHealthInfo(ctx *jxcontext.Context, vendorIDs, storeIDs []int, isAsync, isContinueWhenError bool) (hint string, err error) {
db := dao.GetDB()
vendorID := model.VendorIDEBAI
storeMapList, err := dao.GetStoresMapList(db, []int{vendorID}, storeIDs, model.StoreStatusAll, model.StoreIsSyncYes)
storeMapList, err := dao.GetStoresMapList(db, []int{vendorID}, storeIDs, model.StoreStatusAll, model.StoreIsSyncYes, "")
if err != nil {
return "", err
}
@@ -1214,7 +1220,7 @@ func GetCorporationInfo(ctx *jxcontext.Context, licenceCode string) (corporation
func GetStoresVendorSnapshot(ctx *jxcontext.Context, parentTask tasksch.ITask, vendorIDs, storeIDs []int) (vendorStoreSnapshotList []*model.VendorStoreSnapshot, err error) {
db := dao.GetDB()
storeMapList, err := dao.GetStoresMapList(db, vendorIDs, storeIDs, model.StoreStatusAll, model.StoreIsSyncYes)
storeMapList, err := dao.GetStoresMapList(db, vendorIDs, storeIDs, model.StoreStatusAll, model.StoreIsSyncYes, "")
if err != nil {
return nil, err
}
@@ -1256,7 +1262,7 @@ func getCurrentSnapshotAt(now time.Time) (snapshotAt time.Time) {
}
func updateVendorStoreStatusBySnapshot(db *dao.DaoDB, curSnapshotList []*model.VendorStoreSnapshot) (err error) {
storeMapList, err := dao.GetStoresMapList(db, nil, nil, model.StoreStatusAll, model.StoreIsSyncAll)
storeMapList, err := dao.GetStoresMapList(db, nil, nil, model.StoreStatusAll, model.StoreIsSyncAll, "")
if err != nil {
return err
}