操作日志记录增加门店相关

This commit is contained in:
苏尹岚
2020-01-17 16:16:56 +08:00
parent 05ebeeb77c
commit 3aec482720
7 changed files with 33 additions and 23 deletions

View File

@@ -1084,9 +1084,11 @@ func updateStoresSkusWithoutSync(ctx *jxcontext.Context, db *dao.DaoDB, storeIDs
// updateFieldMap["Price"] = 1
}
if tmpStatus := getSkuSaleStatus(inSkuBind, skuBindInfo); tmpStatus != model.StoreSkuBindStatusNA {
if tmpStatus != skuBind.Status {
updateFieldMap[model.FieldStatus] = 1
}
skuBind.Status = tmpStatus
setStoreSkuBindStatus(skuBind, model.SyncFlagSaleMask)
updateFieldMap[model.FieldStatus] = 1
}
if skuBindInfo.UnitPrice != 0 && isCanChangePrice { // 这里是否需要加此条件限制
price := jxutils.CaculateSkuPrice(unitPrice, v.SpecQuality, v.SpecUnit, v.SkuNameUnit)
@@ -1107,8 +1109,10 @@ func updateStoresSkusWithoutSync(ctx *jxcontext.Context, db *dao.DaoDB, storeIDs
if err := ValidateStruct(skuBindInfo); err != nil {
globals.SugarLogger.Infof("更改商品:%s, 可售时间不合法!时间范围:[%v] 至 [%v]", allBinds[0].Name, skuBindInfo.StatusSaleBegin, skuBindInfo.StatusSaleEnd)
} else {
updateFieldMap["StatusSaleBegin"] = int(skuBindInfo.StatusSaleBegin)
updateFieldMap["StatusSaleEnd"] = int(skuBindInfo.StatusSaleEnd)
if skuBind.StatusSaleBegin != skuBindInfo.StatusSaleBegin || skuBind.StatusSaleEnd != skuBindInfo.StatusSaleEnd {
updateFieldMap["StatusSaleBegin"] = 1
updateFieldMap["StatusSaleEnd"] = 1
}
skuBind.StatusSaleBegin = skuBindInfo.StatusSaleBegin
skuBind.StatusSaleEnd = skuBindInfo.StatusSaleEnd
}
@@ -1180,7 +1184,7 @@ func AddEventDetail(db *dao.DaoDB, ctx *jxcontext.Context, operateType, thingID,
ThingID: thingID,
ThingType: thingType,
StoreID: storeID,
AccessUUID: ctx.GetTrackInfo(),
AccessUUID: ctx.GetTrackInfo()[0:strings.Index(ctx.GetTrackInfo(), ",")],
BeforeData: beforeData,
AfterData: afterData,
}

View File

@@ -29,7 +29,7 @@ type CheckCookie struct {
Status string `json:"status"`
}
func AddOperateEvent(ctx *jxcontext.Context, accessUUID string) (err error) {
func AddOperateEvent(ctx *jxcontext.Context, accessUUID, jsonData string) (err error) {
var (
apiFunction string
db = dao.GetDB()
@@ -43,12 +43,16 @@ func AddOperateEvent(ctx *jxcontext.Context, accessUUID string) (err error) {
return err
}
}
if accessUUID != "" {
accessUUID = accessUUID[0:strings.Index(accessUUID, ",")]
}
event := &model.OperateEvent{
CreatedAt: time.Now(),
LastOperator: ctx.GetUserName(),
APIFunction: apiFunction,
UserID: ctx.GetUserID(),
AccessUUID: accessUUID,
JsonData: jsonData,
}
dao.Begin(db)
defer func() {
@@ -90,7 +94,7 @@ func DeleteOperateEventAndDetail(ctx *jxcontext.Context, deleteTime time.Time) (
return err
}
func GetOperateEvents(ctx *jxcontext.Context, apiFunction, name string, operateType int, skuIDs, storeIDs []int, fromTime, toTime string, offset, pageSize int) (pageInfo *model.PagedInfo, err error) {
func GetOperateEvents(ctx *jxcontext.Context, name string, apiFunctions []string, operateTypes, skuIDs, storeIDs []int, fromTime, toTime string, offset, pageSize int) (pageInfo *model.PagedInfo, err error) {
var (
fromTimeP time.Time
toTimeP time.Time
@@ -104,7 +108,7 @@ func GetOperateEvents(ctx *jxcontext.Context, apiFunction, name string, operateT
}
pageSize = jxutils.FormalizePageSize(pageSize)
offset = jxutils.FormalizePageOffset(offset)
operateEventExt, totalCount, err := dao.GetOperateEvents(db, apiFunction, name, operateType, skuIDs, storeIDs, fromTimeP, toTimeP, offset, pageSize)
operateEventExt, totalCount, err := dao.GetOperateEvents(db, name, apiFunctions, operateTypes, skuIDs, storeIDs, fromTimeP, toTimeP, offset, pageSize)
if err != nil {
return pageInfo, err
}

View File

@@ -44,7 +44,7 @@ var (
"08:00:00",
"18:00:00",
}
createStorePriceTimeList = []string{
createStorePriceTimeList = []string{
"02:00:00",
}
refreshPageActTimeList = []string{
@@ -156,7 +156,7 @@ func Init() {
cms.AutoFocusStoreSkusForTopSkus(jxcontext.AdminCtx, true, true)
}, createStorePriceTimeList)
ScheduleTimerFunc("GetCheckVendorCookie", func() {
event.GetCheckVendorCookie(jxcontext.AdminCtx, []int{0, 1, 3}, true)
event.GetCheckVendorCookie(jxcontext.AdminCtx, []int{0, 1, 3, 102}, true)
}, checkCookieList)
}
ScheduleTimerFunc("AutoSaleStoreSku", func() {