123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- package v1
- import (
- "context"
- "go.uber.org/zap"
- "property-company-gateway/pb"
- "property-company-gateway/pb/v1"
- "time"
- "git.getensh.com/common/gopkgs/logger"
- )
- const (
- ModuleGarden = "小区管理"
- ModuleSystemUser = "物业小区管理员"
- ModuleCompany = "公司信息"
- )
- //
- const (
- ActionGardenAdd = "新增小区"
- ActionGardenUpdate = "修改小区"
- ActionGardenDel = "删除小区"
- )
- //
- const (
- ActionSystemUserAdd = "新增小区管理员"
- ActionSystemUserDel = "删除小区管理员"
- ActionSystemUserUpdate = "修改小区管理员"
- )
- const (
- ActionCompanyUpdate = "修改公司信息"
- )
- type OperationLogRequest struct {
- Module string
- Action string
- UserName string
- Uid int64
- Origin interface{}
- Target interface{}
- Cid int64
- }
- func OperationLogAdd(req *OperationLogRequest) {
- mreq := v1.CompanyLogAddRequest{
- Module:req.Module,
- Action:req.Action,
- Username:req.UserName,
- Uid:req.Uid,
- Timestamp:time.Now().Unix(),
- Cid:req.Cid,
- }
- 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.CompanyLogAdd(context.Background(), &mreq)
- if err != nil {
- s, _ := json.Marshal(mreq)
- logger.Error("func",
- zap.String("call", "pb.PropertyLog.CompanyLogAdd"),
- zap.String("params", string(s)),
- zap.String("error", err.Error()))
- }
- }
|