操作日志门店绑定

This commit is contained in:
苏尹岚
2020-01-17 17:43:36 +08:00
parent 0fa8c013cb
commit fc82933437

View File

@@ -1109,7 +1109,7 @@ func AddStoreVendorMap(ctx *jxcontext.Context, db *dao.DaoDB, vendorID int, vend
}()
if err = dao.CreateEntity(db, storeMap); err == nil {
if globals.IsAddEvent {
err = AddEventDetail(db, ctx, model.OperateAdd, storeID, model.ThingTypeStore, storeID, "", `{"VendorID":`+utils.Int2Str(vendorID)+`}`)
err = AddEventDetail(db, ctx, model.OperateAdd, vendorID, model.ThingTypeStore, storeID, "", `{"VendorID":`+utils.Int2Str(vendorID)+`}`)
}
dao.Commit(db)
outStoreMap = storeMap
@@ -1138,7 +1138,7 @@ func DeleteStoreVendorMap(ctx *jxcontext.Context, db *dao.DaoDB, storeID, vendor
model.FieldStatus: model.StoreStatusDisabled,
}, userName, nil)
if globals.IsAddEvent {
err = AddEventDetail(db, ctx, model.OperateDelete, storeID, model.ThingTypeStore, storeID, "", `{"VendorID":`+utils.Int2Str(vendorID)+`}`)
err = AddEventDetail(db, ctx, model.OperateDelete, vendorID, model.ThingTypeStore, storeID, "", `{"VendorID":`+utils.Int2Str(vendorID)+`}`)
}
}
return num, err
@@ -1179,6 +1179,7 @@ func UpdateStoreVendorMap(ctx *jxcontext.Context, db *dao.DaoDB, storeID, vendor
if err = dao.GetEntity(db, storeMap, model.FieldStoreID, model.FieldVendorID, model.FieldDeletedAt); err != nil {
return 0, err
}
var beforeStoreMap = *storeMap
syncStatus := model.SyncFlagModifiedMask
valid := dao.StrictMakeMapByStructObject(payload, storeMap, userName)
if valid["status"] != nil {
@@ -1246,6 +1247,10 @@ func UpdateStoreVendorMap(ctx *jxcontext.Context, db *dao.DaoDB, storeID, vendor
return 0, err
}
if num > 0 {
if globals.IsAddEvent {
mapBefore := refutil.FindMapAndStructMixed(valid, beforeStoreMap)
err = AddEventDetail(db, ctx, model.OperateUpdate, vendorID, model.ThingTypeStore, storeID, BuildDiffData(mapBefore), BuildDiffData(valid))
}
if vendorID != model.VendorIDJX {
if valid["pricePercentage"] != nil || valid["pricePercentagePack"] != nil {
storeSkuBind := &model.StoreSkuBind{}