chore: 并入 iotlcm-admin-svr 历史到 admin-svr/(原提交 49818c6)

This commit is contained in:
MiFaZhan
2026-11-02 13:27:59 +08:00
1250 changed files with 154111 additions and 0 deletions
@@ -0,0 +1,51 @@
// package httpqueues
// @Link https://github.com/xiujiecn/xiu-admin
// @Copyright Copyright (c) 2025 LiXiujie
// @Author Lxj <xxx@example.com>
// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE
package httpqueues
import (
"context"
"encoding/json"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/cmd/inithttp"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/consts"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/utility/queue"
"github.com/gogf/gf/v2/frame/g"
"github.com/gogf/gf/v2/os/gctx"
)
func init() {
inithttp.RegisterHttpInitFunc("init "+consts.BroadcastDbChg, func(ctx context.Context) error {
queue.NewConsumer(gctx.New(), BroadcastDbChgQueue, &queue.Config{
Workers: 10,
})
queue.NewProducer(gctx.New(), queue.QueueTypeMemory, consts.BroadcastDbChg, &queue.Config{})
return nil
})
}
type qBroadcastDbChg struct{}
var BroadcastDbChgQueue = &qBroadcastDbChg{}
func (q *qBroadcastDbChg) GetTopic() string {
return consts.BroadcastDbChg
}
func (q *qBroadcastDbChg) GetType() queue.QueueType {
return queue.QueueTypeMemory
}
func (q *qBroadcastDbChg) Handle(ctx context.Context, p queue.Payload) error {
var data model.BroadcastDbChgCache
if err := json.Unmarshal(p.Data, &data); err != nil {
g.Log().Error(ctx, "qBroadcastDbChg.Handle json.Unmarshal err.", err)
return err
}
return service.MemoryDB().EventHandler(ctx, &data)
}
@@ -0,0 +1,52 @@
// package queues
// @Link https://github.com/xiujiecn/xiu-admin
// @Copyright Copyright (c) 2025 LiXiujie
// @Author Lxj <xxx@example.com>
// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE
package httpqueues
import (
"context"
"encoding/json"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/cmd/inithttp"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/consts"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model/entity"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/utility/queue"
"github.com/gogf/gf/v2/frame/g"
"github.com/gogf/gf/v2/os/gctx"
)
func init() {
// memqueue.Register(gctx.New(), SysOptLogQueue)
inithttp.RegisterHttpInitFunc("init "+consts.QueueSysOptLog, func(ctx context.Context) error {
queue.NewConsumer(gctx.New(), SysOptLogQueue, &queue.Config{
Workers: 100,
})
queue.NewProducer(gctx.New(), queue.QueueTypeMemory, consts.QueueSysOptLog, &queue.Config{})
return nil
})
}
type qSysOperLog struct{}
var SysOptLogQueue = &qSysOperLog{}
func (q *qSysOperLog) GetTopic() string {
return consts.QueueSysOptLog
}
func (q *qSysOperLog) GetType() queue.QueueType {
return queue.QueueTypeMemory
}
func (q *qSysOperLog) Handle(ctx context.Context, p queue.Payload) error {
var data entity.SysOperLog
if err := json.Unmarshal(p.Data, &data); err != nil {
g.Log().Error(ctx, "qSysOperLog.Handle json.Unmarshal err.", err)
return err
}
return service.SysOperLog().RealWrite(ctx, data)
}