globals.IsStoreSkuAct控制是否添加门店商品的平台活动信息

This commit is contained in:
gazebo
2020-01-13 14:17:50 +08:00
parent 21accbf8fe
commit d29b7b3686
10 changed files with 221 additions and 93 deletions

View File

@@ -61,7 +61,21 @@ func Act2ActMap(act *model.Act2) (actMap *model.ActMap) {
}
func ActStoreSku2ActStoreSkuMap(actStoreSku *model.ActStoreSku2) (actStoreSkuMap *model.ActStoreSkuMap) {
actStoreSkuMap = &model.ActStoreSkuMap{}
actStoreSkuMap = &model.ActStoreSkuMap{
ModelIDCULD: actStoreSku.ModelIDCULD,
BindID: actStoreSku.MapID,
ActID: actStoreSku.ActID,
StoreID: actStoreSku.StoreID,
SkuID: actStoreSku.SkuID,
VendorID: actStoreSku.VendorID,
VendorActID: actStoreSku.VendorActID,
SyncStatus: actStoreSku.SyncStatus,
VendorPrice: actStoreSku.VendorPrice,
ActualActPrice: actStoreSku.ActualActPrice,
EarningPrice: actStoreSku.EarningPrice,
}
actStoreSkuMap.ID = actStoreSku.MapID
return actStoreSkuMap
}
@@ -86,13 +100,17 @@ func Act2Update(ctx *jxcontext.Context, act *model.Act2, syncStatus int) (item *
func ActStoreSku2Update(ctx *jxcontext.Context, actStoreSkuList []*model.ActStoreSku2, syncStatus int) (items []*dao.KVUpdateItem) {
for _, v := range actStoreSkuList {
v.SyncStatus = 0
v.UpdatedAt = time.Now()
v.LastOperator = ctx.GetUserName()
kvs := map[string]interface{}{
model.FieldSyncStatus: 0,
model.FieldUpdatedAt: time.Now(),
model.FieldLastOperator: ctx.GetUserName(),
model.FieldSyncStatus: v.SyncStatus,
model.FieldUpdatedAt: v.UpdatedAt,
model.FieldLastOperator: v.LastOperator,
}
if syncStatus == model.SyncFlagDeletedMask {
kvs[model.FieldDeletedAt] = time.Now()
v.DeletedAt = time.Now()
kvs[model.FieldDeletedAt] = v.DeletedAt
} else if syncStatus == model.SyncFlagNewMask {
kvs[model.FieldVendorActID] = v.VendorActID
}

View File

@@ -332,7 +332,7 @@ func (c *PurchaseHandler) SyncAct(ctx *jxcontext.Context, parentTask tasksch.ITa
return err
}()
db := dao.GetDB()
_, err2 := dao.BatchUpdateEntityByKV(db, updateItems)
_, err2 := dao.BatchUpdateActEntity(db, model.IsSyncStatusDelete(act.SyncStatus), updateItems)
if err == nil {
err = err2
}

View File

@@ -341,7 +341,7 @@ func (c *PurchaseHandler) SyncAct(ctx *jxcontext.Context, parentTask tasksch.ITa
return err
}()
// globals.SugarLogger.Debug(utils.Format4Output(updateItems, false))
_, err2 := dao.BatchUpdateEntityByKV(db, updateItems)
_, err2 := dao.BatchUpdateActEntity(db, model.IsSyncStatusDelete(act.SyncStatus), updateItems)
if err == nil {
err = err2
}

View File

@@ -207,7 +207,7 @@ func (c *PurchaseHandler) SyncAct(ctx *jxcontext.Context, parentTask tasksch.ITa
return err
}()
db := dao.GetDB()
_, err2 := dao.BatchUpdateEntityByKV(db, updateItems)
_, err2 := dao.BatchUpdateActEntity(db, model.IsSyncStatusDelete(act.SyncStatus), updateItems)
if err == nil {
err = err2
}