123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172 |
- package v1
- import (
- "context"
- "git.getensh.com/common/gopkgs/logger"
- "go.uber.org/zap"
- "property-system-gateway/pb"
- "property-system-gateway/pb/v1"
- "time"
- )
- const (
- ModuleGarden = "楼盘管理"
- ModuleHousehold = "业主管理"
- ModulePermission = "权限管理"
- ModuleSelf = "个人账户管理"
- ModuleUser = "用户管理"
- ModulePark = "停车场管理"
- ModuleDepartment = "部门"
- ModuleCharge = "费用管理"
- ModuleRepair = "报事报修"
- ModuleSuggestion = "投诉与建议"
- ModuleAnnouncement = "公告"
- ModuleVehicle = "车辆"
- )
- const (
- ActionAnnouncementAdd = "新增公告"
- ActionAnnouncementDel = "删除公告"
- ActionAnnouncementUpdate = "更新公告"
- )
- const (
- ActionVehicleAdd = "添加车辆"
- ActionVehicleUpdate = "修改车辆"
- ActionVehicleDel = "删除车辆"
- )
- const (
- ActionRepairClassAdd = "添加分类"
- ActionRepairClassUpdate = "修改分类"
- ActionRepairClassDel = "删除分类"
- ActionRepairOrderAdd = "添加工单"
- ActionRepairOrderUpdate = "修改工单"
- ActionRepairOrderDel = "删除工单"
- ActionRepairOrderSend = "派单"
- ActionRepairOrderFinish = "结单"
- ActionRepairOrderBack = "退单"
- ActionRepairOrderReturnVisit = "回访"
- )
- const (
- ActionSuggestionOrderAdd = "添加工单"
- ActionSuggestionOrderUpdate = "修改工单"
- ActionSuggestionOrderDel = "删除工单"
- ActionSuggestionOrderSend = "派单"
- ActionSuggestionOrderFinish = "结单"
- ActionSuggestionOrderBack = "退单"
- ActionSuggestionOrderReturnVisit = "回访"
- )
- // 费用
- const (
- ActionChargeConfAdd = "新增费用配置"
- ActionChargeConfUpdate = "修改费用配置"
- ActionChargeConfDel = "删除费用配置"
- ActionChargeBind = "绑定对象"
- ActionChargeUnbind = "解绑对象"
- ActionChargeSetTime = "修改费用时间"
- ActionChargePowerRecordAdd = "新增抄表记录"
- ActionChargePowerRecordDel = "删除抄表记录"
- ActionChargePowerRecordUpdate = "修改抄表记录"
- ActionChargePay = "欠费缴费"
- ActionChargePrePay = "预存费用"
- ActionChargePropertyPackageAdd = "新增物业费套餐"
- ActionChargePropertyPackageUpdate = "修改物业费套餐"
- ActionChargePropertyPackageDel = "删除物业费套餐"
- )
- // 楼栋
- const (
- ActionGardenAddBuilding = "新增楼栋"
- ActionGardenAddUnit = "新增单元"
- ActionGardenAddHouse = "新增房屋"
- ActionGardenUpdateBuilding = "修改楼栋"
- ActionGardenUpdateUnit = "修改单元"
- ActionGardenUpdateHouse = "修改房屋"
- ActionGardenDelBuilding = "删除楼栋"
- ActionGardenDelUnit = "删除单元"
- ActionGardenDelHouse = "删除房屋"
- )
- // 权限
- const (
- ActionGroupAdd = "新增权限组"
- ActionGroupDel = "删除权限组"
- ActionGroupUpdate = "修改权限组"
- )
- // 用户
- const (
- ActionUserAdd = "新增用户"
- ActionUserDel = "删除用户"
- ActionUserUpdate = "修改用户"
- )
- // 个人账户
- const (
- ActionSelfResetPassword = "忘记密码重置密码"
- ActionSelfChangePassword = "修改密码"
- )
- // 业主
- const (
- ActionHouseholdApprove = "业主房屋绑定审核"
- )
- const (
- ActionParkAdd = "添加停车场"
- ActionParkDel = "删除停车场"
- ActionParkUpdate = "修改停车场"
- ActionParkSpaceAdd = "添加车位"
- ActionParkSpaceDel = "删除车位"
- ActionParkSpaceUpdate = "修改车位"
- )
- const (
- ActionDepartmentAdd = "添加部门"
- ActionDepartmentDel = "删除部门"
- ActionDepartmentUpdate = "修改部门"
- )
- type OperationLogRequest struct {
- Module string
- Action string
- UserName string
- Uid int64
- Origin interface{}
- Target interface{}
- Cid int64
- GardenId int64
- }
- func OperationLogAdd(req *OperationLogRequest) {
- return
- mreq := v1.SystemLogAddRequest{
- Module: req.Module,
- Action: req.Action,
- Username: req.UserName,
- Uid: req.Uid,
- Timestamp: time.Now().Unix(),
- Cid: req.Cid,
- GardenId: req.GardenId,
- }
- if req.Origin != nil {
- origin, _ := json.Marshal(req.Origin)
- mreq.Origin = string(origin)
- }
- if req.Target != nil {
- target, _ := json.Marshal(req.Target)
- mreq.Target = string(target)
- }
- _, err := pb.PropertyLog.SystemLogAdd(context.Background(), &mreq)
- if err != nil {
- s, _ := json.Marshal(mreq)
- logger.Error("func",
- zap.String("call", "pb.PropertyLog.SystemLogAdd"),
- zap.String("params", string(s)),
- zap.String("error", err.Error()))
- }
- }
|