change layout
This commit is contained in:
@@ -0,0 +1,96 @@
|
||||
package utils
|
||||
|
||||
import (
|
||||
lonelog "lone-services/rpc/lonelog/pb"
|
||||
|
||||
jsoniter "github.com/json-iterator/go"
|
||||
)
|
||||
|
||||
const (
|
||||
LogActionTypeAdd = 1 //增加
|
||||
LogActionTypeEdit = 2 //编辑
|
||||
LogActionTypeDel = 3 //删除
|
||||
LogActionTypeOut = 4 //强退
|
||||
LogActionTypeDown = 5 //下载
|
||||
LogActionTypeStatus = 6 //状态
|
||||
LogActionTypePassword = 7 //修改密码
|
||||
|
||||
//增加、删除、修改时需要改 services.log中的返回值
|
||||
|
||||
LogActionModuleAdmin = "管理员管理"
|
||||
LogActionModuleRole = "角色管理"
|
||||
LogActionModuleService = "服务管理"
|
||||
LogActionModuleAuthority = "权限管理"
|
||||
LogActionModuleProduct = "产品管理"
|
||||
LogActionModuleUser = "用户管理"
|
||||
LogActionModuleOrder = "订单管理"
|
||||
LogActionModuleSale = "销售管理"
|
||||
LogActionModuleTask = "提成与任务管理"
|
||||
LogActionModuleAccount = "结算管理"
|
||||
LogActionModulePay = "支付管理"
|
||||
LogActionModuleStore = "服务商管理"
|
||||
LogActionModuleExpress = "快递管理"
|
||||
LogActionModuleEquipment = "设备管理"
|
||||
LogActionModuleAd = "广告管理"
|
||||
LogActionModuleCustomService = "客服管理"
|
||||
LogActionModuleWorkWeChat = "企业微信管理"
|
||||
LogActionModuleOther = "其他管理"
|
||||
LogActionModulePrison = "监狱管理"
|
||||
LogActionModuleThirdParty = "第三方管理"
|
||||
LogActionModuleBill = "票据管理"
|
||||
LogActionModuleWarehouse = "仓库管理"
|
||||
LogActionModuleBuy = "采购管理"
|
||||
LogActionModuleLog = "日志管理"
|
||||
LogActionModuleFactory = "工厂管理"
|
||||
)
|
||||
|
||||
type ActionAdd struct {
|
||||
NewContent interface{} `json:"new_content"`
|
||||
OldContent interface{} `json:"old_content"`
|
||||
Reason string `json:"reason"`
|
||||
Type int32 `json:"type"`
|
||||
ModuleName string `json:"module_name"`
|
||||
}
|
||||
|
||||
const LoginReasonOK = "OK"
|
||||
|
||||
func GetActionStruct(adminInfo UserInfo, info ActionAdd) *lonelog.ActionLog {
|
||||
content := map[string]interface{}{
|
||||
"old_content": info.OldContent,
|
||||
"new_content": info.NewContent,
|
||||
}
|
||||
jsonData, _ := jsoniter.Marshal(content)
|
||||
return &lonelog.ActionLog{
|
||||
Content: string(jsonData),
|
||||
AdminId: adminInfo.ID,
|
||||
AdminName: adminInfo.Name,
|
||||
Type: info.Type,
|
||||
ModuleName: info.ModuleName,
|
||||
Ip: adminInfo.ClientIP,
|
||||
BrowserInfo: adminInfo.UserAgent,
|
||||
BrowserName: adminInfo.BrowserName,
|
||||
BrowserVersion: adminInfo.BrowserVer,
|
||||
Reason: info.Reason,
|
||||
CreateTime: Now().GoString(),
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func GetLogStruct(adminInfo UserInfo, status bool, reason string) *lonelog.LoginLog {
|
||||
st := 2
|
||||
if status {
|
||||
st = 1
|
||||
}
|
||||
|
||||
return &lonelog.LoginLog{
|
||||
AdminId: adminInfo.ID,
|
||||
Ip: adminInfo.ClientIP,
|
||||
Name: adminInfo.Name,
|
||||
BrowserInfo: adminInfo.UserAgent,
|
||||
BrowserName: adminInfo.BrowserName,
|
||||
BrowserVersion: adminInfo.BrowserVer,
|
||||
Status: int32(st),
|
||||
CreateTime: Now().GoString(),
|
||||
Reason: reason,
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user