更新2.1.2版本,优化部门、角色权限,增加上下级关系;增加登录、系统、短信日志;优化省市区编码

This commit is contained in:
孟帅
2023-01-25 11:49:21 +08:00
parent 11fad0132d
commit 93e0fe7250
190 changed files with 35896 additions and 7208 deletions

View File

@@ -8,40 +8,32 @@ package queues
import (
"context"
"encoding/json"
"hotgo/internal/consts"
"hotgo/internal/library/queue"
"hotgo/internal/model/entity"
"hotgo/internal/service"
)
// SysLog 系统日志
var SysLog = &qSysLog{topic: consts.QueueLogTopic}
func init() {
jobList = append(jobList, SysLog)
}
type qSysLog struct {
topic string
// SysLog 系统日志
var SysLog = &qSysLog{}
type qSysLog struct{}
// getTopic 主题
func (q *qSysLog) getTopic() string {
return consts.QueueLogTopic
}
// handle 处理消息
func (q *qSysLog) handle(ctx context.Context, mqMsg queue.MqMsg) (err error) {
return service.SysLog().QueueJob(ctx, mqMsg)
}
// Listen 监听
func (q *qSysLog) Listen(ctx context.Context) {
consumer, err := queue.InstanceConsumer()
if err != nil {
queue.FatalLog(ctx, "InstanceConsumer "+q.topic+"异常:", err)
return
var data entity.SysLog
if err = json.Unmarshal(mqMsg.Body, &data); err != nil {
return err
}
// 全局日志
if listenErr := consumer.ListenReceiveMsgDo(q.topic, func(mqMsg queue.MqMsg) {
err = q.handle(ctx, mqMsg)
// 记录队列日志
queue.ConsumerLog(ctx, q.topic, mqMsg, err)
}); listenErr != nil {
queue.FatalLog(ctx, "队列:"+q.topic+" 监听失败", listenErr)
}
return service.SysLog().RealWrite(ctx, data)
}