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

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

@@ -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
}