im 管理后台
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
// Package queues
|
||||
// @Link https://github.com/bufanyun/hotgo
|
||||
// @Copyright Copyright (c) 2023 HotGo CLI
|
||||
// @Author Ms <133814250@qq.com>
|
||||
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
|
||||
package queues
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"hotgo/internal/consts"
|
||||
"hotgo/internal/library/queue"
|
||||
"hotgo/internal/model/entity"
|
||||
"hotgo/internal/service"
|
||||
)
|
||||
|
||||
func init() {
|
||||
queue.RegisterConsumer(LoginLog)
|
||||
}
|
||||
|
||||
// LoginLog 登录日志
|
||||
var LoginLog = &qLoginLog{}
|
||||
|
||||
type qLoginLog struct{}
|
||||
|
||||
// GetTopic 主题
|
||||
func (q *qLoginLog) GetTopic() string {
|
||||
return consts.QueueLoginLogTopic
|
||||
}
|
||||
|
||||
// Handle 处理消息
|
||||
func (q *qLoginLog) Handle(ctx context.Context, mqMsg queue.MqMsg) (err error) {
|
||||
var data entity.SysLoginLog
|
||||
if err = json.Unmarshal(mqMsg.Body, &data); err != nil {
|
||||
return err
|
||||
}
|
||||
return service.SysLoginLog().RealWrite(ctx, data)
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
// Package queues
|
||||
// @Link https://github.com/bufanyun/hotgo
|
||||
// @Copyright Copyright (c) 2023 HotGo CLI
|
||||
// @Author Ms <133814250@qq.com>
|
||||
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
|
||||
package queues
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
"hotgo/internal/consts"
|
||||
"hotgo/internal/library/queue"
|
||||
"hotgo/internal/model/entity"
|
||||
"hotgo/internal/service"
|
||||
)
|
||||
|
||||
func init() {
|
||||
queue.RegisterConsumer(ServeLog)
|
||||
}
|
||||
|
||||
// ServeLog 登录日志
|
||||
var ServeLog = &qServeLog{}
|
||||
|
||||
type qServeLog struct{}
|
||||
|
||||
// GetTopic 主题
|
||||
func (q *qServeLog) GetTopic() string {
|
||||
return consts.QueueServeLogTopic
|
||||
}
|
||||
|
||||
// Handle 处理消息
|
||||
func (q *qServeLog) Handle(ctx context.Context, mqMsg queue.MqMsg) error {
|
||||
var data entity.SysServeLog
|
||||
if err := json.Unmarshal(mqMsg.Body, &data); err != nil {
|
||||
g.Dump("ServeLog Handle Unmarshal err:", err)
|
||||
return nil
|
||||
}
|
||||
|
||||
if err := service.SysServeLog().RealWrite(ctx, data); err != nil {
|
||||
g.Dump("ServeLog Handle Write err:", err)
|
||||
return nil
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
// Package queues
|
||||
// @Link https://github.com/bufanyun/hotgo
|
||||
// @Copyright Copyright (c) 2023 HotGo CLI
|
||||
// @Author Ms <133814250@qq.com>
|
||||
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
|
||||
package queues
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"hotgo/internal/consts"
|
||||
"hotgo/internal/library/queue"
|
||||
"hotgo/internal/model/entity"
|
||||
"hotgo/internal/service"
|
||||
)
|
||||
|
||||
func init() {
|
||||
queue.RegisterConsumer(SysLog)
|
||||
}
|
||||
|
||||
// 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) {
|
||||
var data entity.SysLog
|
||||
if err = json.Unmarshal(mqMsg.Body, &data); err != nil {
|
||||
return err
|
||||
}
|
||||
return service.SysLog().RealWrite(ctx, data)
|
||||
}
|
||||
Reference in New Issue
Block a user