add action,login log
This commit is contained in:
@@ -56,6 +56,8 @@ func (l *RoleEditLogic) RoleEdit(in *admin.RoleEditRequest) (*admin.Response, er
|
||||
modelObj := model.RoleModel{}.Init()
|
||||
id := in.Id
|
||||
var editErr error
|
||||
var row int64
|
||||
var action utils.ActionAdd
|
||||
if id > utils.NumberZero {
|
||||
if check.Id > utils.NumberZero && check.Id != id {
|
||||
return l.fail(utils.ErrorExist)
|
||||
@@ -71,18 +73,21 @@ func (l *RoleEditLogic) RoleEdit(in *admin.RoleEditRequest) (*admin.Response, er
|
||||
if info.Id < utils.NumberOne {
|
||||
return l.fail(utils.ErrorNotFund)
|
||||
}
|
||||
|
||||
action.OldContent = info
|
||||
edit.Id = info.Id
|
||||
edit.Status = info.Status
|
||||
|
||||
w = modelbase.Params{Eq: map[string]string{"id": strconv.FormatInt(info.Id, utils.NumberTen)}}
|
||||
_, editErr = modelObj.Edit(w, edit)
|
||||
row, editErr = modelObj.Edit(w, edit)
|
||||
action.Type = utils.LogActionTypeEdit
|
||||
} else {
|
||||
if check.Id > utils.NumberZero {
|
||||
return l.fail(utils.ErrorExist)
|
||||
}
|
||||
editErr = modelObj.Create(&edit)
|
||||
id = edit.Id
|
||||
row = id
|
||||
action.Type = utils.LogActionTypeAdd
|
||||
}
|
||||
|
||||
if editErr != nil {
|
||||
@@ -90,6 +95,11 @@ func (l *RoleEditLogic) RoleEdit(in *admin.RoleEditRequest) (*admin.Response, er
|
||||
return l.fail(utils.Fail)
|
||||
}
|
||||
|
||||
if row > utils.NumberZero {
|
||||
action.NewContent = edit
|
||||
action.ModuleName = utils.LogActionModuleRole
|
||||
utils.SetActionLog(adminInfo, action)
|
||||
}
|
||||
return l.ok(id)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user