add action,login log
This commit is contained in:
@@ -47,6 +47,9 @@ func (l *ServiceEditLogic) ServiceEdit(in *admin.ServiceEditRequest) (*admin.Res
|
||||
|
||||
modelObj := model.ServicesModel{}.Init()
|
||||
var err error
|
||||
var row int64
|
||||
var action utils.ActionAdd
|
||||
|
||||
if in.Id > utils.NumberZero {
|
||||
w := modelbase.Params{Eq: map[string]string{"id": strconv.Itoa(int(in.Id))}}
|
||||
info := dao.Services{}
|
||||
@@ -58,10 +61,14 @@ func (l *ServiceEditLogic) ServiceEdit(in *admin.ServiceEditRequest) (*admin.Res
|
||||
if info.Id < utils.NumberOne {
|
||||
return l.fail(utils.ErrorNotFund)
|
||||
}
|
||||
action.OldContent = info
|
||||
edit.Id = info.Id
|
||||
_, err = modelObj.Edit(w, &edit)
|
||||
row, err = modelObj.Edit(w, &edit)
|
||||
action.Type = utils.LogActionTypeEdit
|
||||
} else {
|
||||
err = modelObj.Create(&edit)
|
||||
row = edit.Id
|
||||
action.Type = utils.LogActionTypeAdd
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
@@ -69,5 +76,10 @@ func (l *ServiceEditLogic) ServiceEdit(in *admin.ServiceEditRequest) (*admin.Res
|
||||
return l.fail(utils.Fail)
|
||||
}
|
||||
|
||||
if row > utils.NumberZero {
|
||||
action.NewContent = edit
|
||||
action.ModuleName = utils.LogActionModuleService
|
||||
utils.SetActionLog(adminInfo, action)
|
||||
}
|
||||
return l.ok(edit.Id)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user