mirror of
https://github.com/bufanyun/hotgo.git
synced 2026-04-26 04:54:29 +08:00
模块化定时任务,方便在插件中注册任务;增加日志分组
This commit is contained in:
@@ -7,9 +7,9 @@ package cmd
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
"github.com/gogf/gf/v2/os/gcmd"
|
||||
"hotgo/internal/crons"
|
||||
"hotgo/internal/global"
|
||||
"hotgo/internal/library/cron"
|
||||
"hotgo/internal/service"
|
||||
)
|
||||
|
||||
@@ -19,6 +19,9 @@ var (
|
||||
Brief: "定时任务,用来部署一些可独立运行的定时任务,通过tcp方式和后台保持长连接通讯,动态调整任务属性。",
|
||||
Description: ``,
|
||||
Func: func(ctx context.Context, parser *gcmd.Parser) (err error) {
|
||||
// 服务日志处理
|
||||
cron.Logger().SetHandlers(global.LoggingServeLogHandler)
|
||||
|
||||
// 启动定时任务
|
||||
service.SysCron().StartCron(ctx)
|
||||
|
||||
@@ -32,8 +35,8 @@ var (
|
||||
|
||||
<-serverCloseSignal
|
||||
service.CronClient().Stop(ctx)
|
||||
crons.StopALL()
|
||||
g.Log().Debug(ctx, "cron successfully closed ..")
|
||||
cron.StopALL()
|
||||
cron.Logger().Debug(ctx, "cron successfully closed ..")
|
||||
serverWg.Done()
|
||||
return
|
||||
},
|
||||
|
||||
@@ -10,8 +10,11 @@ import (
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
"github.com/gogf/gf/v2/net/ghttp"
|
||||
"github.com/gogf/gf/v2/os/gcmd"
|
||||
"hotgo/internal/consts"
|
||||
"hotgo/internal/library/addons"
|
||||
"hotgo/internal/library/casbin"
|
||||
"hotgo/internal/library/hggen"
|
||||
"hotgo/internal/library/payment"
|
||||
"hotgo/internal/router"
|
||||
"hotgo/internal/service"
|
||||
"hotgo/internal/websocket"
|
||||
@@ -23,9 +26,7 @@ var (
|
||||
Usage: "http",
|
||||
Brief: "HTTP服务,也可以称为主服务,包含http、websocket、tcpserver多个可对外服务",
|
||||
Func: func(ctx context.Context, parser *gcmd.Parser) (err error) {
|
||||
// 加载权限
|
||||
casbin.InitEnforcer(ctx)
|
||||
|
||||
// 初始化http服务
|
||||
s := g.Server()
|
||||
|
||||
// 错误状态码接管
|
||||
@@ -47,7 +48,7 @@ var (
|
||||
|
||||
// 注册全局中间件
|
||||
group.Middleware(
|
||||
service.Middleware().Ctx, //必须第一个加载
|
||||
service.Middleware().Ctx, // 必须第一个加载
|
||||
service.Middleware().CORS,
|
||||
service.Middleware().Blacklist,
|
||||
service.Middleware().DemoLimit,
|
||||
@@ -70,11 +71,25 @@ var (
|
||||
addons.RegisterModulesRouter(ctx, group)
|
||||
})
|
||||
|
||||
// 初始化casbin权限
|
||||
casbin.InitEnforcer(ctx)
|
||||
|
||||
// 初始化生成代码配置
|
||||
hggen.InIt(ctx)
|
||||
|
||||
// 启动tcp服务
|
||||
service.TCPServer().Start(ctx)
|
||||
|
||||
// https
|
||||
setSSL(ctx, s)
|
||||
// 启动服务监控
|
||||
service.AdminMonitor().StartMonitor(ctx)
|
||||
|
||||
// 加载ip访问黑名单
|
||||
service.SysBlacklist().Load(ctx)
|
||||
|
||||
// 注册支付成功回调方法
|
||||
payment.RegisterNotifyCallMap(map[string]payment.NotifyCallFunc{
|
||||
consts.OrderGroupAdminOrder: service.AdminOrder().PayNotify, // 后台充值订单
|
||||
})
|
||||
|
||||
serverWg.Add(1)
|
||||
|
||||
@@ -96,13 +111,3 @@ var (
|
||||
},
|
||||
}
|
||||
)
|
||||
|
||||
func setSSL(ctx context.Context, s *ghttp.Server) {
|
||||
config, err := service.SysConfig().GetLoadSSL(ctx)
|
||||
if err != nil {
|
||||
g.Log().Fatal(ctx, "ssl配置获取失败:err:%+v", err)
|
||||
}
|
||||
if config != nil && config.Switch {
|
||||
s.EnableHTTPS(config.CrtPath, config.KeyPath)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,8 +7,8 @@ package cmd
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
"github.com/gogf/gf/v2/os/gcmd"
|
||||
"hotgo/internal/global"
|
||||
"hotgo/internal/library/queue"
|
||||
"hotgo/utility/simple"
|
||||
)
|
||||
@@ -19,10 +19,13 @@ var (
|
||||
Brief: "消息队列",
|
||||
Description: ``,
|
||||
Func: func(ctx context.Context, parser *gcmd.Parser) (err error) {
|
||||
// 服务日志处理
|
||||
queue.Logger().SetHandlers(global.LoggingServeLogHandler)
|
||||
|
||||
simple.SafeGo(ctx, func(ctx context.Context) {
|
||||
g.Log().Debug(ctx, "start queue consumer..")
|
||||
queue.Logger().Debug(ctx, "start queue consumer..")
|
||||
queue.StartConsumersListener(ctx)
|
||||
g.Log().Debug(ctx, "start queue consumer success..")
|
||||
queue.Logger().Debug(ctx, "start queue consumer success..")
|
||||
})
|
||||
|
||||
serverWg.Add(1)
|
||||
@@ -31,7 +34,7 @@ var (
|
||||
signalListen(ctx, signalHandlerForOverall)
|
||||
|
||||
<-serverCloseSignal
|
||||
g.Log().Debug(ctx, "queue successfully closed ..")
|
||||
queue.Logger().Debug(ctx, "queue successfully closed ..")
|
||||
serverWg.Done()
|
||||
return
|
||||
},
|
||||
|
||||
@@ -50,7 +50,6 @@ func (c *cCash) List(ctx context.Context, req *cash.ListReq) (res *cash.ListRes,
|
||||
res.PageCount = form.CalPageCount(totalCount, req.PerPage)
|
||||
res.Page = req.Page
|
||||
res.PerPage = req.PerPage
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -41,7 +41,6 @@ func (c *cMonitor) Offline(ctx context.Context, req *monitor.OfflineReq) (res *m
|
||||
websocket.SendSuccess(client, "kick")
|
||||
websocket.Close(client)
|
||||
})
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
@@ -94,18 +93,17 @@ func (c *cMonitor) OnlineList(ctx context.Context, req *monitor.OnlineListReq) (
|
||||
res.PerPage = req.PerPage
|
||||
|
||||
sort.Sort(monitor.OnlineModels(clients))
|
||||
isDemo := g.Cfg().MustGet(ctx, "hotgo.isDemo", false)
|
||||
isDemo := g.Cfg().MustGet(ctx, "hotgo.isDemo", false).Bool()
|
||||
_, perPage, offset := form.CalPage(ctx, req.Page, req.PerPage)
|
||||
|
||||
for k, v := range clients {
|
||||
if k >= offset && i <= perPage {
|
||||
if isDemo.Bool() {
|
||||
if isDemo {
|
||||
v.Addr = consts.DemoTips
|
||||
}
|
||||
res.List = append(res.List, v)
|
||||
i++
|
||||
}
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
@@ -18,6 +18,8 @@ type cConsole struct{}
|
||||
func (c *cConsole) Stat(_ context.Context, _ *common.ConsoleStatReq) (res *common.ConsoleStatRes, err error) {
|
||||
res = new(common.ConsoleStatRes)
|
||||
|
||||
// 此处均为模拟数据,可以根据实际业务情况替换成真实数据
|
||||
|
||||
res.Visits.DayVisits = 12010
|
||||
res.Visits.Rise = 13501
|
||||
res.Visits.Decline = 10502
|
||||
|
||||
@@ -24,7 +24,6 @@ func (c *cUpload) UploadImage(ctx context.Context, _ *common.UploadImageReq) (re
|
||||
err = gerror.New("没有找到上传的文件")
|
||||
return
|
||||
}
|
||||
|
||||
return service.CommonUpload().UploadImage(ctx, file)
|
||||
}
|
||||
|
||||
@@ -35,6 +34,5 @@ func (c *cUpload) UploadFile(ctx context.Context, _ *common.UploadFileReq) (res
|
||||
err = gerror.New("没有找到上传的文件")
|
||||
return
|
||||
}
|
||||
|
||||
return service.CommonUpload().UploadFile(ctx, file)
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
// @Copyright Copyright (c) 2023 HotGo CLI
|
||||
// @Author Ms <133814250@qq.com>
|
||||
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
|
||||
//
|
||||
package sys
|
||||
|
||||
import (
|
||||
@@ -94,6 +93,5 @@ func (c *cDictData) Selects(ctx context.Context, req *dict.DataSelectsReq) (res
|
||||
}
|
||||
res[v] = option
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
@@ -37,7 +37,6 @@ func (c *cNotify) WxPay(ctx context.Context, _ *pay.NotifyWxPayReq) (res *pay.No
|
||||
}
|
||||
|
||||
res = &pay.NotifyWxPayRes{PayType: consts.PayTypeWxPay, Code: "SUCCESS", Message: "收单成功"}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -23,7 +23,6 @@ import (
|
||||
"hotgo/utility/format"
|
||||
"os"
|
||||
"runtime"
|
||||
"strconv"
|
||||
"time"
|
||||
)
|
||||
|
||||
@@ -77,8 +76,8 @@ func (c *cMonitor) RunInfo(client *websocket.Client, req *websocket.WRequest) {
|
||||
"goSize": file.DirSize(pwd),
|
||||
}
|
||||
|
||||
isDemo := g.Cfg().MustGet(client.Context(), "hotgo.isDemo", false)
|
||||
if isDemo.Bool() {
|
||||
isDemo := g.Cfg().MustGet(client.Context(), "hotgo.isDemo", false).Bool()
|
||||
if isDemo {
|
||||
data["rootPath"] = consts.DemoTips
|
||||
data["pwd"] = consts.DemoTips
|
||||
data["intranet_ip"] = consts.DemoTips
|
||||
@@ -104,7 +103,7 @@ func (c *cMonitor) Trends(client *websocket.Client, req *websocket.WRequest) {
|
||||
mMem, memErr = mem.VirtualMemory()
|
||||
mMemUsed float64
|
||||
mDisk, diskErr = disk.Usage("/")
|
||||
mProcess, ProcessErr = process.Pids()
|
||||
mProcess, processErr = process.Pids()
|
||||
mLoadAvg = new(model.LoadAvgStats)
|
||||
monitorHeads []MonitorHead
|
||||
nets []NetC
|
||||
@@ -112,32 +111,32 @@ func (c *cMonitor) Trends(client *websocket.Client, req *websocket.WRequest) {
|
||||
)
|
||||
|
||||
if cpuErr != nil {
|
||||
g.Log().Infof(client.Context(), "read CPU info fail:%+v", cpuErr)
|
||||
g.Log().Warningf(client.Context(), "read CPU info fail:%+v", cpuErr)
|
||||
mCpu = []cpu.InfoStat{{VendorID: "", ModelName: ""}}
|
||||
}
|
||||
|
||||
if memErr != nil {
|
||||
g.Log().Infof(client.Context(), "read mem info fail:%+v", memErr)
|
||||
g.Log().Warningf(client.Context(), "read mem info fail:%+v", memErr)
|
||||
mMem = new(mem.VirtualMemoryStat)
|
||||
}
|
||||
|
||||
if diskErr != nil {
|
||||
g.Log().Infof(client.Context(), "read disk info fail:%+v", diskErr)
|
||||
g.Log().Warningf(client.Context(), "read disk info fail:%+v", diskErr)
|
||||
mDisk = new(disk.UsageStat)
|
||||
}
|
||||
|
||||
if ProcessErr != nil {
|
||||
g.Log().Infof(client.Context(), "read process.Pids fail:%+v", ProcessErr)
|
||||
if processErr != nil {
|
||||
g.Log().Warningf(client.Context(), "read process.Pids fail:%+v", processErr)
|
||||
}
|
||||
|
||||
// cpu使用率
|
||||
cu, err := cpu.Percent(time.Second, false)
|
||||
if err == nil {
|
||||
mCpuUsed, _ = strconv.ParseFloat(fmt.Sprintf("%.2f", cu[0]), 64)
|
||||
mCpuUsed = gconv.Float64(fmt.Sprintf("%.2f", cu[0]))
|
||||
}
|
||||
|
||||
// 内存使用率
|
||||
mMemUsed, _ = strconv.ParseFloat(fmt.Sprintf("%.2f", mMem.UsedPercent), 64)
|
||||
mMemUsed = gconv.Float64(fmt.Sprintf("%.2f", mMem.UsedPercent))
|
||||
|
||||
// 负载
|
||||
if len(meta.LoadAvg) > 0 {
|
||||
|
||||
@@ -11,11 +11,12 @@ import (
|
||||
"github.com/gogf/gf/v2/os/gtime"
|
||||
"hotgo/internal/consts"
|
||||
"hotgo/internal/dao"
|
||||
"hotgo/internal/library/cron"
|
||||
"hotgo/internal/service"
|
||||
)
|
||||
|
||||
func init() {
|
||||
cronList = append(cronList, CloseOrder)
|
||||
cron.Register(CloseOrder)
|
||||
}
|
||||
|
||||
// CloseOrder 取消过期订单
|
||||
@@ -38,6 +39,6 @@ func (c *cCloseOrder) Execute(ctx context.Context) {
|
||||
dao.AdminOrder.Columns().Status: consts.OrderStatusClose,
|
||||
}).Update()
|
||||
if err != nil {
|
||||
g.Log().Warning(ctx, "cron CloseOrder Execute err:%+v", err)
|
||||
cron.Logger().Warning(ctx, "cron CloseOrder Execute err:%+v", err)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,17 +3,16 @@
|
||||
// @Copyright Copyright (c) 2023 HotGo CLI
|
||||
// @Author Ms <133814250@qq.com>
|
||||
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
|
||||
//
|
||||
package crons
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
"hotgo/internal/library/cron"
|
||||
"time"
|
||||
)
|
||||
|
||||
func init() {
|
||||
cronList = append(cronList, Test)
|
||||
cron.Register(Test)
|
||||
}
|
||||
|
||||
// Test 测试任务(无参数)
|
||||
@@ -29,5 +28,5 @@ func (c *cTest) GetName() string {
|
||||
|
||||
// Execute 执行任务
|
||||
func (c *cTest) Execute(ctx context.Context) {
|
||||
g.Log().Infof(ctx, "cron test Execute:%v", time.Now())
|
||||
cron.Logger().Infof(ctx, "cron test Execute:%v", time.Now())
|
||||
}
|
||||
|
||||
@@ -3,18 +3,17 @@
|
||||
// @Copyright Copyright (c) 2023 HotGo CLI
|
||||
// @Author Ms <133814250@qq.com>
|
||||
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
|
||||
//
|
||||
package crons
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
"hotgo/internal/consts"
|
||||
"hotgo/internal/library/cron"
|
||||
"time"
|
||||
)
|
||||
|
||||
func init() {
|
||||
cronList = append(cronList, Test2)
|
||||
cron.Register(Test2)
|
||||
}
|
||||
|
||||
// Test2 测试2任务(带参数)
|
||||
@@ -32,11 +31,11 @@ func (c *cTest2) GetName() string {
|
||||
func (c *cTest2) Execute(ctx context.Context) {
|
||||
args, ok := ctx.Value(consts.ContextKeyCronArgs).([]string)
|
||||
if !ok {
|
||||
g.Log().Warning(ctx, "参数解析失败!")
|
||||
cron.Logger().Warning(ctx, "参数解析失败!")
|
||||
return
|
||||
}
|
||||
if len(args) != 3 {
|
||||
g.Log().Warning(ctx, "test2 传入参数不正确!")
|
||||
cron.Logger().Warning(ctx, "test2 传入参数不正确!")
|
||||
return
|
||||
}
|
||||
|
||||
@@ -46,5 +45,5 @@ func (c *cTest2) Execute(ctx context.Context) {
|
||||
msg = args[2]
|
||||
)
|
||||
|
||||
g.Log().Infof(ctx, "cron test2 Execute:%v, name:%v, age:%v, msg:%v", time.Now(), name, age, msg)
|
||||
cron.Logger().Infof(ctx, "cron test2 Execute:%v, name:%v, age:%v, msg:%v", time.Now(), name, age, msg)
|
||||
}
|
||||
|
||||
@@ -18,7 +18,6 @@ import (
|
||||
"github.com/gogf/gf/v2/text/gstr"
|
||||
"hotgo/internal/consts"
|
||||
"hotgo/internal/library/cache"
|
||||
"hotgo/internal/library/hggen"
|
||||
"hotgo/internal/library/queue"
|
||||
"hotgo/internal/model/entity"
|
||||
"hotgo/internal/service"
|
||||
@@ -47,22 +46,12 @@ func Init(ctx context.Context) {
|
||||
// 设置缓存适配器
|
||||
cache.SetAdapter(ctx)
|
||||
|
||||
// 启动服务监控
|
||||
service.AdminMonitor().StartMonitor(ctx)
|
||||
|
||||
// 加载ip访问黑名单
|
||||
service.SysBlacklist().Load(ctx)
|
||||
|
||||
// 初始化功能库配置
|
||||
service.SysConfig().InitConfig(ctx)
|
||||
|
||||
// 注册支付成功回调方法
|
||||
payNotifyCall()
|
||||
|
||||
// 初始化生成代码配置
|
||||
hggen.InIt(ctx)
|
||||
}
|
||||
|
||||
// LoggingServeLogHandler 服务日志处理
|
||||
// 需要将异常日志保存到服务日志时可以通过SetHandlers设置此方法
|
||||
func LoggingServeLogHandler(ctx context.Context, in *glog.HandlerInput) {
|
||||
in.Next(ctx)
|
||||
|
||||
@@ -120,6 +109,6 @@ func LoggingServeLogHandler(ctx context.Context, in *glog.HandlerInput) {
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
g.Log("serveLog").Errorf(ctx, "LoggingServeLogHandler err:%+v", err)
|
||||
g.Dump("LoggingServeLogHandler err:%+v", err)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
package global
|
||||
|
||||
import (
|
||||
"hotgo/internal/consts"
|
||||
"hotgo/internal/library/payment"
|
||||
"hotgo/internal/service"
|
||||
)
|
||||
|
||||
// 注册支付成功回调方法
|
||||
func payNotifyCall() {
|
||||
payment.RegisterNotifyCall(consts.OrderGroupAdminOrder, service.AdminOrder().PayNotify) // 后台充值订单
|
||||
// ...
|
||||
}
|
||||
@@ -1,9 +1,9 @@
|
||||
// Package crons
|
||||
// Package cron
|
||||
// @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 crons
|
||||
package cron
|
||||
|
||||
import (
|
||||
"context"
|
||||
@@ -11,6 +11,7 @@ import (
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
"github.com/gogf/gf/v2/os/gcron"
|
||||
"github.com/gogf/gf/v2/os/gctx"
|
||||
"github.com/gogf/gf/v2/os/glog"
|
||||
"github.com/gogf/gf/v2/os/gtime"
|
||||
"hotgo/internal/consts"
|
||||
"hotgo/internal/dao"
|
||||
@@ -20,19 +21,19 @@ import (
|
||||
"sync"
|
||||
)
|
||||
|
||||
var crons = &cronManager{
|
||||
tasks: make(map[string]*TaskItem),
|
||||
}
|
||||
|
||||
// cronStrategy 任务接口
|
||||
type cronStrategy interface {
|
||||
GetName() string
|
||||
Execute(ctx context.Context)
|
||||
}
|
||||
|
||||
var (
|
||||
// 添加新的任务时,只需实现cronStrategy接口,并加入到cronList即可
|
||||
cronList []cronStrategy
|
||||
inst = new(tasks)
|
||||
)
|
||||
|
||||
type tasks struct {
|
||||
list []*TaskItem
|
||||
// consumerManager 任务管理者
|
||||
type cronManager struct {
|
||||
tasks map[string]*TaskItem
|
||||
sync.RWMutex
|
||||
}
|
||||
|
||||
@@ -45,40 +46,40 @@ type TaskItem struct {
|
||||
Count int // 执行次数,仅Policy=4时有效
|
||||
}
|
||||
|
||||
func LoadCronList() {
|
||||
for _, cron := range cronList {
|
||||
inst.Add(&TaskItem{
|
||||
Name: cron.GetName(),
|
||||
Fun: cron.Execute,
|
||||
})
|
||||
}
|
||||
func Logger() *glog.Logger {
|
||||
return g.Log("cron")
|
||||
}
|
||||
|
||||
// Register 注册任务
|
||||
func Register(c cronStrategy) {
|
||||
crons.Lock()
|
||||
defer crons.Unlock()
|
||||
|
||||
name := c.GetName()
|
||||
if _, ok := crons.tasks[name]; ok {
|
||||
Logger().Debugf(gctx.GetInitCtx(), "cron.Register name:%v duplicate registration.", name)
|
||||
return
|
||||
}
|
||||
crons.tasks[name] = &TaskItem{Name: c.GetName(), Fun: c.Execute}
|
||||
}
|
||||
|
||||
// StopALL 停止所有任务
|
||||
func StopALL() {
|
||||
for _, v := range gcron.Entries() {
|
||||
gcron.Remove(v.Name)
|
||||
}
|
||||
}
|
||||
|
||||
// StartALL 启动任务
|
||||
func StartALL(sysCron []*entity.SysCron) error {
|
||||
if len(inst.list) == 0 {
|
||||
LoadCronList()
|
||||
}
|
||||
|
||||
var (
|
||||
err error
|
||||
ct = gctx.New()
|
||||
)
|
||||
|
||||
if len(sysCron) == 0 {
|
||||
g.Log().Debug(ct, "no scheduled task is available.")
|
||||
return nil
|
||||
// StartALL 启动所有任务
|
||||
func StartALL(sysCron []*entity.SysCron) (err error) {
|
||||
if len(crons.tasks) == 0 {
|
||||
g.Log().Debug(gctx.GetInitCtx(), "no scheduled task is available.")
|
||||
return
|
||||
}
|
||||
|
||||
for _, cron := range sysCron {
|
||||
f := inst.Get(cron.Name)
|
||||
if f == nil {
|
||||
f, ok := crons.tasks[cron.Name]
|
||||
if !ok {
|
||||
return gerror.Newf("该任务没有加入任务列表:%v", cron.Name)
|
||||
}
|
||||
|
||||
@@ -120,17 +121,14 @@ func StartALL(sysCron []*entity.SysCron) error {
|
||||
|
||||
// 执行完毕,单次和多次执行的任务更新状态
|
||||
if cron.Policy == consts.CronPolicyOnce || cron.Policy == consts.CronPolicyTimes {
|
||||
_, err = dao.SysCron.Ctx(ct).Where("id", cron.Id).
|
||||
Data(g.Map{"status": consts.StatusDisable, "updated_at": gtime.Now()}).
|
||||
Update()
|
||||
if err != nil {
|
||||
err = gerror.Wrap(err, consts.ErrorORM)
|
||||
if _, err = dao.SysCron.Ctx(gctx.GetInitCtx()).Where("id", cron.Id).Data(g.Map{"status": consts.StatusDisable, "updated_at": gtime.Now()}).Update(); err != nil {
|
||||
err = gerror.Wrap(err, "定时任务执行失败!")
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
g.Log().Debug(ct, "load cron success..")
|
||||
Logger().Debug(gctx.GetInitCtx(), "load cron success..")
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -143,7 +141,6 @@ func RefreshStatus(sysCron *entity.SysCron) (err error) {
|
||||
if sysCron.Status == consts.StatusEnabled {
|
||||
return Start(sysCron)
|
||||
}
|
||||
|
||||
return Stop(sysCron)
|
||||
}
|
||||
|
||||
@@ -159,15 +156,14 @@ func Stop(sysCron *entity.SysCron) (err error) {
|
||||
|
||||
// Once 立即执行一次某个任务
|
||||
func Once(ctx context.Context, sysCron *entity.SysCron) error {
|
||||
for _, v := range cronList {
|
||||
if v.GetName() == sysCron.Name {
|
||||
for _, v := range crons.tasks {
|
||||
if v.Name == sysCron.Name {
|
||||
simple.SafeGo(ctx, func(ctx context.Context) {
|
||||
v.Execute(ctx)
|
||||
v.Fun(ctx)
|
||||
})
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
return gerror.Newf("定时任务不存在:%+v", sysCron.Name)
|
||||
}
|
||||
|
||||
@@ -182,7 +178,6 @@ func Delete(sysCron *entity.SysCron) (err error) {
|
||||
gcron.Remove(v.Name)
|
||||
}
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
@@ -191,53 +186,11 @@ func Start(sysCron *entity.SysCron) (err error) {
|
||||
if sysCron == nil {
|
||||
return
|
||||
}
|
||||
cr := gcron.Search(sysCron.Name)
|
||||
if cr != nil {
|
||||
cr.Start()
|
||||
|
||||
c := gcron.Search(sysCron.Name)
|
||||
if c != nil {
|
||||
c.Start()
|
||||
return
|
||||
}
|
||||
|
||||
return StartALL([]*entity.SysCron{sysCron})
|
||||
}
|
||||
|
||||
// Add 添加任务
|
||||
func (t *tasks) Add(task *TaskItem) *tasks {
|
||||
if task.Name == "" || task.Fun == nil {
|
||||
return t
|
||||
}
|
||||
t.Lock()
|
||||
defer t.Unlock()
|
||||
t.list = append(t.list, task)
|
||||
return t
|
||||
}
|
||||
|
||||
// Get 找到任务
|
||||
func (t *tasks) Get(name string) *TaskItem {
|
||||
if len(t.list) == 0 {
|
||||
return nil
|
||||
}
|
||||
|
||||
for _, item := range t.list {
|
||||
if item.Name == name {
|
||||
return item
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Del 删除任务
|
||||
func (t *tasks) Del(name string) (newList []*TaskItem) {
|
||||
if len(t.list) == 0 {
|
||||
return nil
|
||||
}
|
||||
t.Lock()
|
||||
defer t.Unlock()
|
||||
|
||||
for _, item := range t.list {
|
||||
if item.Name == name {
|
||||
continue
|
||||
}
|
||||
newList = append(newList, item)
|
||||
}
|
||||
return newList
|
||||
}
|
||||
@@ -19,10 +19,10 @@ func Send(config *model.EmailConfig, to string, subject string, body string) err
|
||||
}
|
||||
|
||||
func sendToMail(config *model.EmailConfig, to, subject, body, mailType string) error {
|
||||
|
||||
if config == nil {
|
||||
return gerror.New("邮件配置不能为空")
|
||||
}
|
||||
|
||||
var (
|
||||
contentType string
|
||||
auth = smtp.PlainAuth("", config.User, config.Password, config.Host)
|
||||
|
||||
@@ -99,17 +99,14 @@ func Cz88Find(ctx context.Context, ip string) (*IpLocationData, error) {
|
||||
if detail == nil {
|
||||
return nil, fmt.Errorf("no ip data is queried. procedure:%v", ip)
|
||||
}
|
||||
|
||||
locationData := &IpLocationData{
|
||||
return &IpLocationData{
|
||||
Ip: ip,
|
||||
Country: detail.Country,
|
||||
Region: detail.Region,
|
||||
Province: detail.Province,
|
||||
City: detail.City,
|
||||
Area: detail.County,
|
||||
}
|
||||
|
||||
return locationData, nil
|
||||
}, nil
|
||||
}
|
||||
|
||||
// IsJurisByIpTitle 判断地区名称是否为直辖市
|
||||
|
||||
@@ -8,6 +8,7 @@ package location
|
||||
import (
|
||||
"context"
|
||||
"github.com/gogf/gf/v2/container/gvar"
|
||||
"github.com/gogf/gf/v2/database/gdb"
|
||||
"github.com/gogf/gf/v2/errors/gerror"
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
"hotgo/internal/consts"
|
||||
@@ -15,6 +16,10 @@ import (
|
||||
"hotgo/utility/tree"
|
||||
)
|
||||
|
||||
func GetModel(ctx context.Context) *gdb.Model {
|
||||
return g.Model("sys_provinces").Ctx(ctx)
|
||||
}
|
||||
|
||||
// ParseSimpleRegion 通过地区ID解析地区名称,自动加入上级地区
|
||||
func ParseSimpleRegion(ctx context.Context, id int64, spilt ...string) (string, error) {
|
||||
if id == 0 {
|
||||
@@ -25,7 +30,7 @@ func ParseSimpleRegion(ctx context.Context, id int64, spilt ...string) (string,
|
||||
err error
|
||||
)
|
||||
|
||||
if err = g.Model("sys_provinces").Ctx(ctx).Fields("title,level,tree").Where("id", id).Scan(&models); err != nil {
|
||||
if err = GetModel(ctx).Fields("title,level,tree").Where("id", id).Scan(&models); err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
@@ -71,14 +76,14 @@ func ParseRegion(ctx context.Context, province int64, city int64, county int64,
|
||||
}
|
||||
|
||||
if province > 0 && province < 999999 {
|
||||
provinceName, err = g.Model("sys_provinces").Ctx(ctx).Where("id", province).Fields("title").Value()
|
||||
provinceName, err = GetModel(ctx).Where("id", province).Fields("title").Value()
|
||||
if err != nil {
|
||||
err = gerror.Wrap(err, consts.ErrorORM)
|
||||
return "", err
|
||||
}
|
||||
|
||||
if city > 0 {
|
||||
cityName, err = g.Model("sys_provinces").Ctx(ctx).Where("id", city).Fields("title").Value()
|
||||
cityName, err = GetModel(ctx).Where("id", city).Fields("title").Value()
|
||||
if err != nil {
|
||||
err = gerror.Wrap(err, consts.ErrorORM)
|
||||
return "", err
|
||||
@@ -86,7 +91,7 @@ func ParseRegion(ctx context.Context, province int64, city int64, county int64,
|
||||
}
|
||||
|
||||
if county > 0 {
|
||||
countyName, err = g.Model("sys_provinces").Ctx(ctx).Where("id", county).Fields("title").Value()
|
||||
countyName, err = GetModel(ctx).Where("id", county).Fields("title").Value()
|
||||
if err != nil {
|
||||
err = gerror.Wrap(err, consts.ErrorORM)
|
||||
return "", err
|
||||
|
||||
@@ -7,7 +7,6 @@ package tcp
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"github.com/gogf/gf/v2/errors/gerror"
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
"github.com/gogf/gf/v2/net/gtcp"
|
||||
@@ -87,13 +86,7 @@ func NewClient(config *ClientConfig) (client *Client, err error) {
|
||||
client.auth = config.Auth
|
||||
client.loginEvent = config.LoginEvent
|
||||
client.closeEvent = config.CloseEvent
|
||||
|
||||
logger := glog.New()
|
||||
path := g.Cfg().MustGet(client.Ctx, "logger.path", "logs/logger").String()
|
||||
if err = logger.SetPath(fmt.Sprintf("%s/tcp.client/%s.%s", path, config.Auth.Group, config.Auth.Name)); err != nil {
|
||||
return
|
||||
}
|
||||
client.Logger = logger
|
||||
client.Logger = g.Log("tcpClient")
|
||||
|
||||
if config.ConnectInterval <= 0 {
|
||||
client.connectInterval = 5 * time.Second
|
||||
|
||||
@@ -7,7 +7,6 @@ package tcp
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"github.com/gogf/gf/v2/errors/gerror"
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
"github.com/gogf/gf/v2/net/gtcp"
|
||||
@@ -73,17 +72,10 @@ func NewServer(config *ServerConfig) (server *Server, err error) {
|
||||
server.ln = gtcp.NewServer(server.addr, server.accept, config.Name)
|
||||
server.clients = make(map[string]*ClientConn)
|
||||
server.closeFlag = false
|
||||
|
||||
logger := glog.New()
|
||||
path := g.Cfg().MustGet(server.Ctx, "logger.path", "logs/logger").String()
|
||||
if err = logger.SetPath(fmt.Sprintf("%s/tcp.server/%s", path, config.Name)); err != nil {
|
||||
return
|
||||
}
|
||||
server.Logger = logger
|
||||
server.Logger = g.Log("tcpServer")
|
||||
server.rpc = NewRpc(server.Ctx)
|
||||
|
||||
server.startCron()
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -29,6 +29,13 @@ func RegisterNotifyCall(group string, f NotifyCallFunc) {
|
||||
notifyCall[group] = f
|
||||
}
|
||||
|
||||
// RegisterNotifyCallMap 注册支付成功回调方法
|
||||
func RegisterNotifyCallMap(calls map[string]NotifyCallFunc) {
|
||||
for group, f := range calls {
|
||||
RegisterNotifyCall(group, f)
|
||||
}
|
||||
}
|
||||
|
||||
// NotifyCall 执行订单分组的异步回调
|
||||
func NotifyCall(ctx context.Context, in payin.NotifyCallFuncInp) {
|
||||
f, ok := notifyCall[in.Pay.OrderGroup]
|
||||
|
||||
@@ -2,7 +2,6 @@ package queue
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
"sync"
|
||||
)
|
||||
|
||||
@@ -28,7 +27,7 @@ func RegisterConsumer(cs consumerStrategy) {
|
||||
defer consumers.Unlock()
|
||||
topic := cs.GetTopic()
|
||||
if _, ok := consumers.list[topic]; ok {
|
||||
g.Log().Debugf(ctx, "queue.RegisterConsumer topic:%v duplicate registration.", topic)
|
||||
Logger().Debugf(ctx, "queue.RegisterConsumer topic:%v duplicate registration.", topic)
|
||||
return
|
||||
}
|
||||
consumers.list[topic] = cs
|
||||
@@ -51,7 +50,7 @@ func consumerListen(ctx context.Context, job consumerStrategy) {
|
||||
)
|
||||
|
||||
if err != nil {
|
||||
g.Log().Fatalf(ctx, "InstanceConsumer %s err:%+v", topic, err)
|
||||
Logger().Fatalf(ctx, "InstanceConsumer %s err:%+v", topic, err)
|
||||
return
|
||||
}
|
||||
|
||||
@@ -67,6 +66,6 @@ func consumerListen(ctx context.Context, job consumerStrategy) {
|
||||
ConsumerLog(ctx, topic, mqMsg, err)
|
||||
|
||||
}); listenErr != nil {
|
||||
g.Log().Fatalf(ctx, "消费队列:%s 监听失败, err:%+v", topic, listenErr)
|
||||
Logger().Fatalf(ctx, "消费队列:%s 监听失败, err:%+v", topic, listenErr)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,6 @@ import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"github.com/gogf/gf/v2/errors/gerror"
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
"github.com/gogf/gf/v2/os/gfile"
|
||||
"hotgo/internal/library/queue/disk"
|
||||
"sync"
|
||||
@@ -45,7 +44,7 @@ func (q *DiskConsumerMq) ListenReceiveMsgDo(topic string, receiveDo func(mqMsg M
|
||||
if index, offset, data, err := queue.Read(); err == nil {
|
||||
var mqMsg MqMsg
|
||||
if err = json.Unmarshal(data, &mqMsg); err != nil {
|
||||
g.Log().Warningf(ctx, "disk.ListenReceiveMsgDo Unmarshal err:%+v, topic:%v, data:%+v .", err, topic, string(data))
|
||||
Logger().Warningf(ctx, "disk.ListenReceiveMsgDo Unmarshal err:%+v, topic:%v, data:%+v .", err, topic, string(data))
|
||||
continue
|
||||
}
|
||||
if mqMsg.MsgId != "" {
|
||||
@@ -130,14 +129,14 @@ func NewDiskQueue(topic string, config *disk.Config) *disk.Queue {
|
||||
|
||||
if !gfile.Exists(conf.Path) {
|
||||
if err := gfile.Mkdir(conf.Path); err != nil {
|
||||
g.Log().Errorf(ctx, "NewDiskQueue Failed to create the cache directory. Procedure, err:%+v", err)
|
||||
Logger().Errorf(ctx, "NewDiskQueue Failed to create the cache directory. Procedure, err:%+v", err)
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
queue, err := disk.New(conf)
|
||||
if err != nil {
|
||||
g.Log().Errorf(ctx, "NewDiskQueue err:%v", err)
|
||||
Logger().Errorf(ctx, "NewDiskQueue err:%v", err)
|
||||
return nil
|
||||
}
|
||||
return queue
|
||||
|
||||
@@ -71,7 +71,6 @@ func (r *KafkaMq) SendByteMsg(topic string, body []byte) (mqMsg MqMsg, err error
|
||||
case <-sendCtx.Done():
|
||||
return mqMsg, gerror.New("send mqMst timeout")
|
||||
}
|
||||
|
||||
return mqMsg, nil
|
||||
}
|
||||
|
||||
@@ -95,11 +94,11 @@ func (r *KafkaMq) ListenReceiveMsgDo(topic string, receiveDo func(mqMsg MqMsg))
|
||||
go func(consumerCtx context.Context) {
|
||||
for {
|
||||
if err = r.consumerIns.Consume(consumerCtx, []string{topic}, &consumer); err != nil {
|
||||
g.Log().Fatalf(ctx, "kafka Error from consumer, err%+v", err)
|
||||
Logger().Fatalf(ctx, "kafka Error from consumer, err%+v", err)
|
||||
}
|
||||
|
||||
if consumerCtx.Err() != nil {
|
||||
g.Log().Debugf(ctx, fmt.Sprintf("kafka consoumer stop : %v", consumerCtx.Err()))
|
||||
Logger().Debugf(ctx, fmt.Sprintf("kafka consoumer stop : %v", consumerCtx.Err()))
|
||||
return
|
||||
}
|
||||
consumer.ready = make(chan bool)
|
||||
@@ -108,13 +107,13 @@ func (r *KafkaMq) ListenReceiveMsgDo(topic string, receiveDo func(mqMsg MqMsg))
|
||||
|
||||
// await till the consumer has been set up
|
||||
<-consumer.ready
|
||||
g.Log().Debug(ctx, "kafka consumer up and running!...")
|
||||
Logger().Debug(ctx, "kafka consumer up and running!...")
|
||||
|
||||
gproc.AddSigHandlerShutdown(func(sig os.Signal) {
|
||||
g.Log().Debug(ctx, "kafka consumer close...")
|
||||
Logger().Debug(ctx, "kafka consumer close...")
|
||||
cancel()
|
||||
if err = r.consumerIns.Close(); err != nil {
|
||||
g.Log().Fatalf(ctx, "kafka Error closing client, err:%+v", err)
|
||||
Logger().Fatalf(ctx, "kafka Error closing client, err:%+v", err)
|
||||
}
|
||||
})
|
||||
return
|
||||
@@ -256,6 +255,5 @@ func (consumer *Consumer) ConsumeClaim(session sarama.ConsumerGroupSession, clai
|
||||
})
|
||||
session.MarkMessage(message, "")
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ package queue
|
||||
import (
|
||||
"context"
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
"github.com/gogf/gf/v2/os/glog"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -15,16 +16,20 @@ const (
|
||||
ProducerLogErrFormat = "生产 [%s] 失败, body:%+v, err:%+v"
|
||||
)
|
||||
|
||||
func Logger() *glog.Logger {
|
||||
return g.Log("queue")
|
||||
}
|
||||
|
||||
// ConsumerLog 消费日志
|
||||
func ConsumerLog(ctx context.Context, topic string, mqMsg MqMsg, err error) {
|
||||
if err != nil {
|
||||
g.Log().Errorf(ctx, ConsumerLogErrFormat, topic, string(mqMsg.Body), err)
|
||||
Logger().Errorf(ctx, ConsumerLogErrFormat, topic, string(mqMsg.Body), err)
|
||||
}
|
||||
}
|
||||
|
||||
// ProducerLog 生产日志
|
||||
func ProducerLog(ctx context.Context, topic string, mqMsg MqMsg, err error) {
|
||||
if err != nil {
|
||||
g.Log().Errorf(ctx, ProducerLogErrFormat, topic, string(mqMsg.Body), err)
|
||||
Logger().Errorf(ctx, ProducerLogErrFormat, topic, string(mqMsg.Body), err)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -79,7 +79,7 @@ func init() {
|
||||
mqProducerInstanceMap = make(map[string]MqProducer)
|
||||
mqConsumerInstanceMap = make(map[string]MqConsumer)
|
||||
if err := g.Cfg().MustGet(ctx, "queue").Scan(&config); err != nil {
|
||||
g.Log().Warningf(ctx, "queue init err:%+v", err)
|
||||
Logger().Warningf(ctx, "queue init err:%+v", err)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -207,7 +207,6 @@ func NewConsumer(groupName string) (mqClient MqConsumer, err error) {
|
||||
mutex.Lock()
|
||||
defer mutex.Unlock()
|
||||
mqConsumerInstanceMap[groupName] = mqClient
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -148,7 +148,7 @@ func (r *RedisMq) ListenReceiveMsgDo(topic string, receiveDo func(mqMsg MqMsg))
|
||||
}
|
||||
for err = range errCh {
|
||||
if err != nil && err != context.Canceled && err != context.DeadlineExceeded {
|
||||
g.Log().Infof(ctx, "ListenReceiveMsgDo Delay topic:%v, err:%+v", topic, err)
|
||||
Logger().Infof(ctx, "ListenReceiveMsgDo Delay topic:%v, err:%+v", topic, err)
|
||||
}
|
||||
}
|
||||
}()
|
||||
@@ -166,7 +166,7 @@ func (r *RedisMq) loopReadQueue(key string) (mqMsgList []MqMsg) {
|
||||
for {
|
||||
data, err := conn.Do(ctx, "RPOP", key)
|
||||
if err != nil {
|
||||
g.Log().Warningf(ctx, "loopReadQueue redis RPOP err:%+v", err)
|
||||
Logger().Warningf(ctx, "loopReadQueue redis RPOP err:%+v", err)
|
||||
break
|
||||
}
|
||||
|
||||
@@ -176,7 +176,7 @@ func (r *RedisMq) loopReadQueue(key string) (mqMsgList []MqMsg) {
|
||||
|
||||
var mqMsg MqMsg
|
||||
if err = data.Scan(&mqMsg); err != nil {
|
||||
g.Log().Warningf(ctx, "loopReadQueue Scan err:%+v", err)
|
||||
Logger().Warningf(ctx, "loopReadQueue Scan err:%+v", err)
|
||||
break
|
||||
}
|
||||
|
||||
|
||||
@@ -3,13 +3,8 @@
|
||||
// @Copyright Copyright (c) 2023 HotGo CLI
|
||||
// @Author Ms <133814250@qq.com>
|
||||
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
|
||||
//
|
||||
package queue
|
||||
|
||||
import (
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
)
|
||||
|
||||
type RocketMqLogger struct {
|
||||
Flag string
|
||||
LevelLog string
|
||||
@@ -22,18 +17,17 @@ func (l *RocketMqLogger) Debug(msg string, fields map[string]interface{}) {
|
||||
if msg == "" && len(fields) == 0 {
|
||||
return
|
||||
}
|
||||
|
||||
if l.LevelLog == "debug" || l.LevelLog == "all" {
|
||||
g.Log().Debug(ctx, msg)
|
||||
Logger().Debug(ctx, msg)
|
||||
}
|
||||
}
|
||||
|
||||
func (l *RocketMqLogger) Level(level string) {
|
||||
g.Log().Info(ctx, level)
|
||||
Logger().Info(ctx, level)
|
||||
}
|
||||
|
||||
func (l *RocketMqLogger) OutputPath(path string) (err error) {
|
||||
g.Log().Info(ctx, path)
|
||||
Logger().Info(ctx, path)
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -46,7 +40,7 @@ func (l *RocketMqLogger) Info(msg string, fields map[string]interface{}) {
|
||||
}
|
||||
|
||||
if l.LevelLog == "info" || l.LevelLog == "all" {
|
||||
g.Log().Info(ctx, msg)
|
||||
Logger().Info(ctx, msg)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,7 +53,7 @@ func (l *RocketMqLogger) Warning(msg string, fields map[string]interface{}) {
|
||||
}
|
||||
|
||||
if l.LevelLog == "warn" || l.LevelLog == "all" {
|
||||
g.Log().Warning(ctx, msg)
|
||||
Logger().Warning(ctx, msg)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -71,7 +65,7 @@ func (l *RocketMqLogger) Error(msg string, fields map[string]interface{}) {
|
||||
return
|
||||
}
|
||||
if l.LevelLog == "error" || l.LevelLog == "all" {
|
||||
g.Log().Error(ctx, msg)
|
||||
Logger().Error(ctx, msg)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -84,6 +78,6 @@ func (l *RocketMqLogger) Fatal(msg string, fields map[string]interface{}) {
|
||||
}
|
||||
|
||||
if l.LevelLog == "fatal" || l.LevelLog == "all" {
|
||||
g.Log().Fatal(ctx, msg)
|
||||
Logger().Fatal(ctx, msg)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,11 +21,6 @@ func JsonExit(r *ghttp.Request, code int, message string, data ...interface{}) {
|
||||
}
|
||||
|
||||
// RJson 标准返回结果数据结构封装
|
||||
// @Description: 返回固定数据结构的JSON
|
||||
// @param r
|
||||
// @param code 状态码(200:成功,302跳转,和http请求状态码一至)
|
||||
// @param message 请求结果信息
|
||||
// @param data 请求结果,根据不同接口返回结果的数据结构不同
|
||||
func RJson(r *ghttp.Request, code int, message string, data ...interface{}) {
|
||||
responseData := interface{}(nil)
|
||||
if len(data) > 0 {
|
||||
|
||||
@@ -33,6 +33,5 @@ func New(name ...string) Drive {
|
||||
default:
|
||||
panic(fmt.Sprintf("暂不支持短信驱动:%v", instanceName))
|
||||
}
|
||||
|
||||
return drive
|
||||
}
|
||||
|
||||
@@ -125,6 +125,5 @@ func (d *tencent) SendCode(ctx context.Context, in sysin.SendCodeInp, config *mo
|
||||
* [UnsupportedOperation.ContainDomesticAndInternationalPhoneNumber](https://cloud.tencent.com/document/product/382/9558#.E7.9F.AD.E4.BF.A1.E5.8F.91.E9.80.81.E6.8F.90.E7.A4.BA.EF.BC.9Aunsupportedoperation.containdomesticandinternationalphonenumber-.E5.A6.82.E4.BD.95.E5.A4.84.E7.90.86.EF.BC.9F)
|
||||
* 更多错误,可咨询[腾讯云助手](https://tccc.qcloud.com/web/im/index.html#/chat?webAppId=8fa15978f85cb41f7e2ea36920cb3ae1&title=Sms)
|
||||
*/
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
@@ -81,7 +81,6 @@ func Login(ctx context.Context, user *model.Identity) (string, int64, error) {
|
||||
if err = cache.Instance().Set(ctx, bindKey, tokenKey, duration); err != nil {
|
||||
return "", 0, err
|
||||
}
|
||||
|
||||
return header, config.Expires, nil
|
||||
}
|
||||
|
||||
@@ -270,7 +269,6 @@ func parseToken(ctx context.Context, header string) (*Claims, error) {
|
||||
if !ok {
|
||||
return nil, errorLogin
|
||||
}
|
||||
|
||||
return claims, nil
|
||||
}
|
||||
|
||||
@@ -283,7 +281,6 @@ func GetAuthorization(r *ghttp.Request) string {
|
||||
if authorization == "" {
|
||||
return r.Get("authorization").String()
|
||||
}
|
||||
|
||||
return gstr.Replace(authorization, "Bearer ", "")
|
||||
}
|
||||
|
||||
|
||||
@@ -68,7 +68,6 @@ func GetOpenUserAccessToken(ctx context.Context, code string) (accessToken offic
|
||||
err = gerror.Newf("GetOpenUserAccessToken err:%+v", accessToken.ErrMsg)
|
||||
return
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
@@ -98,7 +97,6 @@ func GetUserAccessToken(ctx context.Context, code string) (accessToken officialO
|
||||
err = gerror.Newf("GetUserAccessToken err:%+v", accessToken.ErrMsg)
|
||||
return
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -55,7 +55,6 @@ func allow(memberId int64) bool {
|
||||
v.lastSeen = gtime.Now()
|
||||
return true
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
|
||||
@@ -172,12 +172,6 @@ func (s *sSysConfig) GetLoadToken(ctx context.Context) (conf *model.TokenConfig,
|
||||
return
|
||||
}
|
||||
|
||||
// GetLoadSSL 获取本地日志配置
|
||||
func (s *sSysConfig) GetLoadSSL(ctx context.Context) (conf *model.SSLConfig, err error) {
|
||||
err = g.Cfg().MustGet(ctx, "hotgo.ssl").Scan(&conf)
|
||||
return
|
||||
}
|
||||
|
||||
// GetLoadLog 获取本地日志配置
|
||||
func (s *sSysConfig) GetLoadLog(ctx context.Context) (conf *model.LogConfig, err error) {
|
||||
err = g.Cfg().MustGet(ctx, "hotgo.log").Scan(&conf)
|
||||
|
||||
@@ -12,8 +12,8 @@ import (
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
"github.com/gogf/gf/v2/os/gctx"
|
||||
"hotgo/internal/consts"
|
||||
"hotgo/internal/crons"
|
||||
"hotgo/internal/dao"
|
||||
"hotgo/internal/library/cron"
|
||||
"hotgo/internal/model/entity"
|
||||
"hotgo/internal/model/input/form"
|
||||
"hotgo/internal/model/input/sysin"
|
||||
@@ -39,12 +39,12 @@ func (s *sSysCron) StartCron(ctx context.Context) {
|
||||
Where("status", consts.StatusEnabled).
|
||||
Order("sort asc,id desc").
|
||||
Scan(&list); err != nil {
|
||||
g.Log().Fatalf(ctx, "定时任务获取失败, err . %v", err)
|
||||
cron.Logger().Fatalf(ctx, "定时任务获取失败, err . %v", err)
|
||||
return
|
||||
}
|
||||
|
||||
if err := crons.StartALL(list); err != nil {
|
||||
g.Log().Fatalf(ctx, "定时任务启动失败, err . %v", err)
|
||||
if err := cron.StartALL(list); err != nil {
|
||||
cron.Logger().Fatalf(ctx, "定时任务启动失败, err . %v", err)
|
||||
return
|
||||
}
|
||||
}
|
||||
@@ -66,7 +66,7 @@ func (s *sSysCron) Delete(ctx context.Context, in sysin.CronDeleteInp) (err erro
|
||||
if _, err = dao.SysCron.Ctx(ctx).Where("id", in.Id).Delete(); err != nil {
|
||||
return
|
||||
}
|
||||
return crons.Delete(models)
|
||||
return cron.Delete(models)
|
||||
})
|
||||
return
|
||||
}
|
||||
@@ -84,7 +84,7 @@ func (s *sSysCron) Edit(ctx context.Context, in sysin.CronEditInp) (err error) {
|
||||
return
|
||||
}
|
||||
simple.SafeGo(ctx, func(ctx context.Context) {
|
||||
_ = crons.RefreshStatus(&in.SysCron)
|
||||
_ = cron.RefreshStatus(&in.SysCron)
|
||||
})
|
||||
return
|
||||
}
|
||||
@@ -128,7 +128,7 @@ func (s *sSysCron) Status(ctx context.Context, in sysin.CronStatusInp) (err erro
|
||||
|
||||
models.Status = in.Status
|
||||
simple.SafeGo(ctx, func(ctx context.Context) {
|
||||
_ = crons.RefreshStatus(models)
|
||||
_ = cron.RefreshStatus(models)
|
||||
})
|
||||
return
|
||||
}
|
||||
@@ -201,5 +201,5 @@ func (s *sSysCron) OnlineExec(ctx context.Context, in sysin.OnlineExecInp) (err
|
||||
}
|
||||
|
||||
newCtx := context.WithValue(gctx.New(), consts.ContextKeyCronArgs, strings.Split(data.Params, consts.CronSplitStr))
|
||||
return crons.Once(newCtx, data)
|
||||
return cron.Once(newCtx, data)
|
||||
}
|
||||
|
||||
@@ -31,7 +31,6 @@ func (s *sSysDictData) Delete(ctx context.Context, in sysin.DictDataDeleteInp) e
|
||||
err = gerror.Wrap(err, consts.ErrorORM)
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -110,7 +109,6 @@ func (s *sSysDictData) List(ctx context.Context, in sysin.DictDataListInp) (list
|
||||
for _, v := range list {
|
||||
v.TypeID, _ = dao.SysDictType.GetId(ctx, v.Type)
|
||||
}
|
||||
|
||||
return list, totalCount, err
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package model
|
||||
|
||||
// 后台配置.
|
||||
|
||||
// BasicConfig 基础配置
|
||||
type BasicConfig struct {
|
||||
CaptchaSwitch int `json:"basicCaptchaSwitch"`
|
||||
@@ -170,123 +172,3 @@ type LoginConfig struct {
|
||||
AutoOpenId int `json:"loginAutoOpenId"`
|
||||
ForceInvite int `json:"loginForceInvite"`
|
||||
}
|
||||
|
||||
///////////// 以下是本地配置
|
||||
|
||||
// SSLConfig https配置
|
||||
type SSLConfig struct {
|
||||
Switch bool `json:"switch"`
|
||||
CrtPath string `json:"crtPath"`
|
||||
KeyPath string `json:"keyPath"`
|
||||
}
|
||||
|
||||
// LogConfig 日志配置
|
||||
type LogConfig struct {
|
||||
Switch bool `json:"switch"`
|
||||
Queue bool `json:"queue"`
|
||||
Module []string `json:"module"`
|
||||
SkipCode []string `json:"skipCode"`
|
||||
}
|
||||
|
||||
// ServeLogConfig 服务日志配置
|
||||
type ServeLogConfig struct {
|
||||
Switch bool `json:"switch"`
|
||||
Queue bool `json:"queue"`
|
||||
LevelFormat []string `json:"levelFormat"`
|
||||
}
|
||||
|
||||
// GenerateAppCrudTemplate curd模板
|
||||
type GenerateAppCrudTemplate struct {
|
||||
Group string `json:"group"`
|
||||
IsAddon bool `json:"isAddon"`
|
||||
MasterPackage string `json:"masterPackage"`
|
||||
TemplatePath string `json:"templatePath"`
|
||||
ApiPath string `json:"apiPath"`
|
||||
InputPath string `json:"inputPath"`
|
||||
ControllerPath string `json:"controllerPath"`
|
||||
LogicPath string `json:"logicPath"`
|
||||
RouterPath string `json:"routerPath"`
|
||||
SqlPath string `json:"sqlPath"`
|
||||
WebApiPath string `json:"webApiPath"`
|
||||
WebViewsPath string `json:"webViewsPath"`
|
||||
}
|
||||
|
||||
// GenerateAppQueueTemplate 消息队列模板
|
||||
type GenerateAppQueueTemplate struct {
|
||||
Group string `json:"group"`
|
||||
TemplatePath string `json:"templatePath"`
|
||||
}
|
||||
|
||||
// GenerateAppTreeTemplate 关系树列表模板
|
||||
type GenerateAppTreeTemplate struct {
|
||||
Group string `json:"group"`
|
||||
TemplatePath string `json:"templatePath"`
|
||||
}
|
||||
|
||||
// GenerateConfig 生成代码配置
|
||||
type GenerateConfig struct {
|
||||
AllowedIPs []string `json:"allowedIPs"`
|
||||
Application struct {
|
||||
Crud struct {
|
||||
Templates []*GenerateAppCrudTemplate `json:"templates"`
|
||||
} `json:"crud"`
|
||||
Queue struct {
|
||||
Templates []*GenerateAppQueueTemplate `json:"templates"`
|
||||
} `json:"queue"`
|
||||
Tree struct {
|
||||
Templates []*GenerateAppTreeTemplate `json:"templates"`
|
||||
} `json:"tree"`
|
||||
} `json:"application"`
|
||||
Delimiters []string `json:"delimiters"`
|
||||
DevPath string `json:"devPath"`
|
||||
DisableTables []string `json:"disableTables"`
|
||||
SelectDbs []string `json:"selectDbs"`
|
||||
Addon *BuildAddonConfig `json:"addon"`
|
||||
}
|
||||
|
||||
// BuildAddonConfig 构建插件模块配置
|
||||
type BuildAddonConfig struct {
|
||||
SrcPath string `json:"srcPath"`
|
||||
TemplatePath string `json:"templatePath"`
|
||||
WebApiPath string `json:"webApiPath"`
|
||||
WebViewsPath string `json:"webViewsPath"`
|
||||
}
|
||||
|
||||
// CacheConfig 缓存配置
|
||||
type CacheConfig struct {
|
||||
Adapter string `json:"adapter"`
|
||||
FileDir string `json:"fileDir"`
|
||||
}
|
||||
|
||||
type TCPServerConfig struct {
|
||||
Address string `json:"address"`
|
||||
}
|
||||
|
||||
type TCPClientConfig struct {
|
||||
Cron *TCPClientConnConfig `json:"cron"`
|
||||
Auth *TCPClientConnConfig `json:"auth"`
|
||||
}
|
||||
|
||||
type TCPClientConnConfig struct {
|
||||
Group string `json:"group"`
|
||||
Name string `json:"name"`
|
||||
Address string `json:"address"`
|
||||
AppId string `json:"appId"`
|
||||
SecretKey string `json:"secretKey"`
|
||||
}
|
||||
|
||||
// TCPConfig tcp服务器配置
|
||||
type TCPConfig struct {
|
||||
Server *TCPServerConfig `json:"server"`
|
||||
Client *TCPClientConfig `json:"client"`
|
||||
}
|
||||
|
||||
// TokenConfig 登录令牌配置
|
||||
type TokenConfig struct {
|
||||
SecretKey string `json:"secretKey"`
|
||||
Expires int64 `json:"expires"`
|
||||
AutoRefresh bool `json:"autoRefresh"`
|
||||
RefreshInterval int64 `json:"refreshInterval"`
|
||||
MaxRefreshTimes int64 `json:"maxRefreshTimes"`
|
||||
MultiLogin bool `json:"multiLogin"`
|
||||
}
|
||||
|
||||
117
server/internal/model/config_load.go
Normal file
117
server/internal/model/config_load.go
Normal file
@@ -0,0 +1,117 @@
|
||||
package model
|
||||
|
||||
// 本地配置.
|
||||
|
||||
// LogConfig 日志配置
|
||||
type LogConfig struct {
|
||||
Switch bool `json:"switch"`
|
||||
Queue bool `json:"queue"`
|
||||
Module []string `json:"module"`
|
||||
SkipCode []string `json:"skipCode"`
|
||||
}
|
||||
|
||||
// ServeLogConfig 服务日志配置
|
||||
type ServeLogConfig struct {
|
||||
Switch bool `json:"switch"`
|
||||
Queue bool `json:"queue"`
|
||||
LevelFormat []string `json:"levelFormat"`
|
||||
}
|
||||
|
||||
// GenerateAppCrudTemplate curd模板
|
||||
type GenerateAppCrudTemplate struct {
|
||||
Group string `json:"group"`
|
||||
IsAddon bool `json:"isAddon"`
|
||||
MasterPackage string `json:"masterPackage"`
|
||||
TemplatePath string `json:"templatePath"`
|
||||
ApiPath string `json:"apiPath"`
|
||||
InputPath string `json:"inputPath"`
|
||||
ControllerPath string `json:"controllerPath"`
|
||||
LogicPath string `json:"logicPath"`
|
||||
RouterPath string `json:"routerPath"`
|
||||
SqlPath string `json:"sqlPath"`
|
||||
WebApiPath string `json:"webApiPath"`
|
||||
WebViewsPath string `json:"webViewsPath"`
|
||||
}
|
||||
|
||||
// GenerateAppQueueTemplate 消息队列模板
|
||||
type GenerateAppQueueTemplate struct {
|
||||
Group string `json:"group"`
|
||||
TemplatePath string `json:"templatePath"`
|
||||
}
|
||||
|
||||
// GenerateAppTreeTemplate 关系树列表模板
|
||||
type GenerateAppTreeTemplate struct {
|
||||
Group string `json:"group"`
|
||||
TemplatePath string `json:"templatePath"`
|
||||
}
|
||||
|
||||
// GenerateConfig 生成代码配置
|
||||
type GenerateConfig struct {
|
||||
AllowedIPs []string `json:"allowedIPs"`
|
||||
Application struct {
|
||||
Crud struct {
|
||||
Templates []*GenerateAppCrudTemplate `json:"templates"`
|
||||
} `json:"crud"`
|
||||
Queue struct {
|
||||
Templates []*GenerateAppQueueTemplate `json:"templates"`
|
||||
} `json:"queue"`
|
||||
Tree struct {
|
||||
Templates []*GenerateAppTreeTemplate `json:"templates"`
|
||||
} `json:"tree"`
|
||||
} `json:"application"`
|
||||
Delimiters []string `json:"delimiters"`
|
||||
DevPath string `json:"devPath"`
|
||||
DisableTables []string `json:"disableTables"`
|
||||
SelectDbs []string `json:"selectDbs"`
|
||||
Addon *BuildAddonConfig `json:"addon"`
|
||||
}
|
||||
|
||||
// BuildAddonConfig 构建插件模块配置
|
||||
type BuildAddonConfig struct {
|
||||
SrcPath string `json:"srcPath"`
|
||||
TemplatePath string `json:"templatePath"`
|
||||
WebApiPath string `json:"webApiPath"`
|
||||
WebViewsPath string `json:"webViewsPath"`
|
||||
}
|
||||
|
||||
// CacheConfig 缓存配置
|
||||
type CacheConfig struct {
|
||||
Adapter string `json:"adapter"`
|
||||
FileDir string `json:"fileDir"`
|
||||
}
|
||||
|
||||
// TCPServerConfig tcp服务器配置
|
||||
type TCPServerConfig struct {
|
||||
Address string `json:"address"`
|
||||
}
|
||||
|
||||
// TCPClientConfig tcp客户端配置
|
||||
type TCPClientConfig struct {
|
||||
Cron *TCPClientConnConfig `json:"cron"`
|
||||
Auth *TCPClientConnConfig `json:"auth"`
|
||||
}
|
||||
|
||||
// TCPClientConnConfig tcp客户端认证
|
||||
type TCPClientConnConfig struct {
|
||||
Group string `json:"group"`
|
||||
Name string `json:"name"`
|
||||
Address string `json:"address"`
|
||||
AppId string `json:"appId"`
|
||||
SecretKey string `json:"secretKey"`
|
||||
}
|
||||
|
||||
// TCPConfig tcp服务器配置
|
||||
type TCPConfig struct {
|
||||
Server *TCPServerConfig `json:"server"`
|
||||
Client *TCPClientConfig `json:"client"`
|
||||
}
|
||||
|
||||
// TokenConfig 登录令牌配置
|
||||
type TokenConfig struct {
|
||||
SecretKey string `json:"secretKey"`
|
||||
Expires int64 `json:"expires"`
|
||||
AutoRefresh bool `json:"autoRefresh"`
|
||||
RefreshInterval int64 `json:"refreshInterval"`
|
||||
MaxRefreshTimes int64 `json:"maxRefreshTimes"`
|
||||
MultiLogin bool `json:"multiLogin"`
|
||||
}
|
||||
@@ -19,32 +19,6 @@ import (
|
||||
)
|
||||
|
||||
type (
|
||||
IAdminMember interface {
|
||||
AddBalance(ctx context.Context, in adminin.MemberAddBalanceInp) (err error)
|
||||
AddIntegral(ctx context.Context, in adminin.MemberAddIntegralInp) (err error)
|
||||
UpdateCash(ctx context.Context, in adminin.MemberUpdateCashInp) (err error)
|
||||
UpdateEmail(ctx context.Context, in adminin.MemberUpdateEmailInp) (err error)
|
||||
UpdateMobile(ctx context.Context, in adminin.MemberUpdateMobileInp) (err error)
|
||||
UpdateProfile(ctx context.Context, in adminin.MemberUpdateProfileInp) (err error)
|
||||
UpdatePwd(ctx context.Context, in adminin.MemberUpdatePwdInp) (err error)
|
||||
ResetPwd(ctx context.Context, in adminin.MemberResetPwdInp) (err error)
|
||||
VerifyUnique(ctx context.Context, in adminin.VerifyUniqueInp) (err error)
|
||||
Delete(ctx context.Context, in adminin.MemberDeleteInp) (err error)
|
||||
Edit(ctx context.Context, in adminin.MemberEditInp) (err error)
|
||||
View(ctx context.Context, in adminin.MemberViewInp) (res *adminin.MemberViewModel, err error)
|
||||
List(ctx context.Context, in adminin.MemberListInp) (list []*adminin.MemberListModel, totalCount int, err error)
|
||||
Status(ctx context.Context, in adminin.MemberStatusInp) (err error)
|
||||
GenTree(ctx context.Context, pid int64) (level int, newTree string, err error)
|
||||
LoginMemberInfo(ctx context.Context) (res *adminin.LoginMemberInfoModel, err error)
|
||||
MemberLoginStat(ctx context.Context, in adminin.MemberLoginStatInp) (res *adminin.MemberLoginStatModel, err error)
|
||||
GetIdByCode(ctx context.Context, in adminin.GetIdByCodeInp) (res *adminin.GetIdByCodeModel, err error)
|
||||
Select(ctx context.Context, in adminin.MemberSelectInp) (res []*adminin.MemberSelectModel, err error)
|
||||
VerifySuperId(ctx context.Context, verifyId int64) bool
|
||||
FilterAuthModel(ctx context.Context, memberId int64) *gdb.Model
|
||||
}
|
||||
IAdminMemberPost interface {
|
||||
UpdatePostIds(ctx context.Context, memberId int64, postIds []int64) (err error)
|
||||
}
|
||||
IAdminMenu interface {
|
||||
MaxSort(ctx context.Context, req *menu.MaxSortReq) (res *menu.MaxSortRes, err error)
|
||||
NameUnique(ctx context.Context, req *menu.NameUniqueReq) (res *menu.NameUniqueRes, err error)
|
||||
@@ -56,48 +30,6 @@ type (
|
||||
GetMenuList(ctx context.Context, memberId int64) (res *role.DynamicRes, err error)
|
||||
LoginPermissions(ctx context.Context, memberId int64) (lists adminin.MemberLoginPermissions, err error)
|
||||
}
|
||||
IAdminNotice interface {
|
||||
Model(ctx context.Context, option ...*handler.Option) *gdb.Model
|
||||
Delete(ctx context.Context, in adminin.NoticeDeleteInp) (err error)
|
||||
Edit(ctx context.Context, in adminin.NoticeEditInp) (err error)
|
||||
Status(ctx context.Context, in adminin.NoticeStatusInp) (err error)
|
||||
MaxSort(ctx context.Context, in adminin.NoticeMaxSortInp) (res *adminin.NoticeMaxSortModel, err error)
|
||||
View(ctx context.Context, in adminin.NoticeViewInp) (res *adminin.NoticeViewModel, err error)
|
||||
List(ctx context.Context, in adminin.NoticeListInp) (list []*adminin.NoticeListModel, totalCount int, err error)
|
||||
PullMessages(ctx context.Context, in adminin.PullMessagesInp) (res *adminin.PullMessagesModel, err error)
|
||||
UnreadCount(ctx context.Context, in adminin.NoticeUnreadCountInp) (res *adminin.NoticeUnreadCountModel, err error)
|
||||
UpRead(ctx context.Context, in adminin.NoticeUpReadInp) (err error)
|
||||
ReadAll(ctx context.Context, in adminin.NoticeReadAllInp) (err error)
|
||||
MessageList(ctx context.Context, in adminin.NoticeMessageListInp) (list []*adminin.NoticeMessageListModel, totalCount int, err error)
|
||||
}
|
||||
IAdminSite interface {
|
||||
Register(ctx context.Context, in adminin.RegisterInp) (err error)
|
||||
AccountLogin(ctx context.Context, in adminin.AccountLoginInp) (res *adminin.LoginModel, err error)
|
||||
MobileLogin(ctx context.Context, in adminin.MobileLoginInp) (res *adminin.LoginModel, err error)
|
||||
}
|
||||
IAdminCash interface {
|
||||
View(ctx context.Context, in adminin.CashViewInp) (res *adminin.CashViewModel, err error)
|
||||
List(ctx context.Context, in adminin.CashListInp) (list []*adminin.CashListModel, totalCount int, err error)
|
||||
Apply(ctx context.Context, in adminin.CashApplyInp) (err error)
|
||||
Payment(ctx context.Context, in adminin.CashPaymentInp) (err error)
|
||||
}
|
||||
IAdminCreditsLog interface {
|
||||
Model(ctx context.Context, option ...*handler.Option) *gdb.Model
|
||||
SaveBalance(ctx context.Context, in adminin.CreditsLogSaveBalanceInp) (res *adminin.CreditsLogSaveBalanceModel, err error)
|
||||
SaveIntegral(ctx context.Context, in adminin.CreditsLogSaveIntegralInp) (res *adminin.CreditsLogSaveIntegralModel, err error)
|
||||
List(ctx context.Context, in adminin.CreditsLogListInp) (list []*adminin.CreditsLogListModel, totalCount int, err error)
|
||||
Export(ctx context.Context, in adminin.CreditsLogListInp) (err error)
|
||||
}
|
||||
IAdminDept interface {
|
||||
Delete(ctx context.Context, in adminin.DeptDeleteInp) (err error)
|
||||
Edit(ctx context.Context, in adminin.DeptEditInp) (err error)
|
||||
Status(ctx context.Context, in adminin.DeptStatusInp) (err error)
|
||||
MaxSort(ctx context.Context, in adminin.DeptMaxSortInp) (res *adminin.DeptMaxSortModel, err error)
|
||||
View(ctx context.Context, in adminin.DeptViewInp) (res *adminin.DeptViewModel, err error)
|
||||
Option(ctx context.Context, in adminin.DeptOptionInp) (res *adminin.DeptOptionModel, totalCount int, err error)
|
||||
List(ctx context.Context, in adminin.DeptListInp) (res *adminin.DeptListModel, err error)
|
||||
GetName(ctx context.Context, id int64) (name string, err error)
|
||||
}
|
||||
IAdminMonitor interface {
|
||||
StartMonitor(ctx context.Context)
|
||||
GetMeta(ctx context.Context) *model.MonitorData
|
||||
@@ -138,56 +70,91 @@ type (
|
||||
DataScopeSelect() (res form.Selects)
|
||||
DataScopeEdit(ctx context.Context, in *adminin.DataScopeEditInp) (err error)
|
||||
}
|
||||
IAdminCash interface {
|
||||
View(ctx context.Context, in adminin.CashViewInp) (res *adminin.CashViewModel, err error)
|
||||
List(ctx context.Context, in adminin.CashListInp) (list []*adminin.CashListModel, totalCount int, err error)
|
||||
Apply(ctx context.Context, in adminin.CashApplyInp) (err error)
|
||||
Payment(ctx context.Context, in adminin.CashPaymentInp) (err error)
|
||||
}
|
||||
IAdminDept interface {
|
||||
Delete(ctx context.Context, in adminin.DeptDeleteInp) (err error)
|
||||
Edit(ctx context.Context, in adminin.DeptEditInp) (err error)
|
||||
Status(ctx context.Context, in adminin.DeptStatusInp) (err error)
|
||||
MaxSort(ctx context.Context, in adminin.DeptMaxSortInp) (res *adminin.DeptMaxSortModel, err error)
|
||||
View(ctx context.Context, in adminin.DeptViewInp) (res *adminin.DeptViewModel, err error)
|
||||
Option(ctx context.Context, in adminin.DeptOptionInp) (res *adminin.DeptOptionModel, totalCount int, err error)
|
||||
List(ctx context.Context, in adminin.DeptListInp) (res *adminin.DeptListModel, err error)
|
||||
GetName(ctx context.Context, id int64) (name string, err error)
|
||||
}
|
||||
IAdminMemberPost interface {
|
||||
UpdatePostIds(ctx context.Context, memberId int64, postIds []int64) (err error)
|
||||
}
|
||||
IAdminSite interface {
|
||||
Register(ctx context.Context, in adminin.RegisterInp) (err error)
|
||||
AccountLogin(ctx context.Context, in adminin.AccountLoginInp) (res *adminin.LoginModel, err error)
|
||||
MobileLogin(ctx context.Context, in adminin.MobileLoginInp) (res *adminin.LoginModel, err error)
|
||||
}
|
||||
IAdminCreditsLog interface {
|
||||
Model(ctx context.Context, option ...*handler.Option) *gdb.Model
|
||||
SaveBalance(ctx context.Context, in adminin.CreditsLogSaveBalanceInp) (res *adminin.CreditsLogSaveBalanceModel, err error)
|
||||
SaveIntegral(ctx context.Context, in adminin.CreditsLogSaveIntegralInp) (res *adminin.CreditsLogSaveIntegralModel, err error)
|
||||
List(ctx context.Context, in adminin.CreditsLogListInp) (list []*adminin.CreditsLogListModel, totalCount int, err error)
|
||||
Export(ctx context.Context, in adminin.CreditsLogListInp) (err error)
|
||||
}
|
||||
IAdminMember interface {
|
||||
AddBalance(ctx context.Context, in adminin.MemberAddBalanceInp) (err error)
|
||||
AddIntegral(ctx context.Context, in adminin.MemberAddIntegralInp) (err error)
|
||||
UpdateCash(ctx context.Context, in adminin.MemberUpdateCashInp) (err error)
|
||||
UpdateEmail(ctx context.Context, in adminin.MemberUpdateEmailInp) (err error)
|
||||
UpdateMobile(ctx context.Context, in adminin.MemberUpdateMobileInp) (err error)
|
||||
UpdateProfile(ctx context.Context, in adminin.MemberUpdateProfileInp) (err error)
|
||||
UpdatePwd(ctx context.Context, in adminin.MemberUpdatePwdInp) (err error)
|
||||
ResetPwd(ctx context.Context, in adminin.MemberResetPwdInp) (err error)
|
||||
VerifyUnique(ctx context.Context, in adminin.VerifyUniqueInp) (err error)
|
||||
Delete(ctx context.Context, in adminin.MemberDeleteInp) (err error)
|
||||
Edit(ctx context.Context, in adminin.MemberEditInp) (err error)
|
||||
View(ctx context.Context, in adminin.MemberViewInp) (res *adminin.MemberViewModel, err error)
|
||||
List(ctx context.Context, in adminin.MemberListInp) (list []*adminin.MemberListModel, totalCount int, err error)
|
||||
Status(ctx context.Context, in adminin.MemberStatusInp) (err error)
|
||||
GenTree(ctx context.Context, pid int64) (level int, newTree string, err error)
|
||||
LoginMemberInfo(ctx context.Context) (res *adminin.LoginMemberInfoModel, err error)
|
||||
MemberLoginStat(ctx context.Context, in adminin.MemberLoginStatInp) (res *adminin.MemberLoginStatModel, err error)
|
||||
GetIdByCode(ctx context.Context, in adminin.GetIdByCodeInp) (res *adminin.GetIdByCodeModel, err error)
|
||||
Select(ctx context.Context, in adminin.MemberSelectInp) (res []*adminin.MemberSelectModel, err error)
|
||||
VerifySuperId(ctx context.Context, verifyId int64) bool
|
||||
FilterAuthModel(ctx context.Context, memberId int64) *gdb.Model
|
||||
}
|
||||
IAdminNotice interface {
|
||||
Model(ctx context.Context, option ...*handler.Option) *gdb.Model
|
||||
Delete(ctx context.Context, in adminin.NoticeDeleteInp) (err error)
|
||||
Edit(ctx context.Context, in adminin.NoticeEditInp) (err error)
|
||||
Status(ctx context.Context, in adminin.NoticeStatusInp) (err error)
|
||||
MaxSort(ctx context.Context, in adminin.NoticeMaxSortInp) (res *adminin.NoticeMaxSortModel, err error)
|
||||
View(ctx context.Context, in adminin.NoticeViewInp) (res *adminin.NoticeViewModel, err error)
|
||||
List(ctx context.Context, in adminin.NoticeListInp) (list []*adminin.NoticeListModel, totalCount int, err error)
|
||||
PullMessages(ctx context.Context, in adminin.PullMessagesInp) (res *adminin.PullMessagesModel, err error)
|
||||
UnreadCount(ctx context.Context, in adminin.NoticeUnreadCountInp) (res *adminin.NoticeUnreadCountModel, err error)
|
||||
UpRead(ctx context.Context, in adminin.NoticeUpReadInp) (err error)
|
||||
ReadAll(ctx context.Context, in adminin.NoticeReadAllInp) (err error)
|
||||
MessageList(ctx context.Context, in adminin.NoticeMessageListInp) (list []*adminin.NoticeMessageListModel, totalCount int, err error)
|
||||
}
|
||||
)
|
||||
|
||||
var (
|
||||
localAdminSite IAdminSite
|
||||
localAdminCash IAdminCash
|
||||
localAdminCreditsLog IAdminCreditsLog
|
||||
localAdminDept IAdminDept
|
||||
localAdminMemberPost IAdminMemberPost
|
||||
localAdminMenu IAdminMenu
|
||||
localAdminMonitor IAdminMonitor
|
||||
localAdminOrder IAdminOrder
|
||||
localAdminPost IAdminPost
|
||||
localAdminRole IAdminRole
|
||||
localAdminCash IAdminCash
|
||||
localAdminSite IAdminSite
|
||||
localAdminMember IAdminMember
|
||||
localAdminMemberPost IAdminMemberPost
|
||||
localAdminMenu IAdminMenu
|
||||
localAdminNotice IAdminNotice
|
||||
localAdminCreditsLog IAdminCreditsLog
|
||||
)
|
||||
|
||||
func AdminSite() IAdminSite {
|
||||
if localAdminSite == nil {
|
||||
panic("implement not found for interface IAdminSite, forgot register?")
|
||||
}
|
||||
return localAdminSite
|
||||
}
|
||||
|
||||
func RegisterAdminSite(i IAdminSite) {
|
||||
localAdminSite = i
|
||||
}
|
||||
|
||||
func AdminCash() IAdminCash {
|
||||
if localAdminCash == nil {
|
||||
panic("implement not found for interface IAdminCash, forgot register?")
|
||||
}
|
||||
return localAdminCash
|
||||
}
|
||||
|
||||
func RegisterAdminCash(i IAdminCash) {
|
||||
localAdminCash = i
|
||||
}
|
||||
|
||||
func AdminCreditsLog() IAdminCreditsLog {
|
||||
if localAdminCreditsLog == nil {
|
||||
panic("implement not found for interface IAdminCreditsLog, forgot register?")
|
||||
}
|
||||
return localAdminCreditsLog
|
||||
}
|
||||
|
||||
func RegisterAdminCreditsLog(i IAdminCreditsLog) {
|
||||
localAdminCreditsLog = i
|
||||
}
|
||||
|
||||
func AdminDept() IAdminDept {
|
||||
if localAdminDept == nil {
|
||||
panic("implement not found for interface IAdminDept, forgot register?")
|
||||
@@ -199,6 +166,28 @@ func RegisterAdminDept(i IAdminDept) {
|
||||
localAdminDept = i
|
||||
}
|
||||
|
||||
func AdminMemberPost() IAdminMemberPost {
|
||||
if localAdminMemberPost == nil {
|
||||
panic("implement not found for interface IAdminMemberPost, forgot register?")
|
||||
}
|
||||
return localAdminMemberPost
|
||||
}
|
||||
|
||||
func RegisterAdminMemberPost(i IAdminMemberPost) {
|
||||
localAdminMemberPost = i
|
||||
}
|
||||
|
||||
func AdminMenu() IAdminMenu {
|
||||
if localAdminMenu == nil {
|
||||
panic("implement not found for interface IAdminMenu, forgot register?")
|
||||
}
|
||||
return localAdminMenu
|
||||
}
|
||||
|
||||
func RegisterAdminMenu(i IAdminMenu) {
|
||||
localAdminMenu = i
|
||||
}
|
||||
|
||||
func AdminMonitor() IAdminMonitor {
|
||||
if localAdminMonitor == nil {
|
||||
panic("implement not found for interface IAdminMonitor, forgot register?")
|
||||
@@ -243,6 +232,28 @@ func RegisterAdminRole(i IAdminRole) {
|
||||
localAdminRole = i
|
||||
}
|
||||
|
||||
func AdminCash() IAdminCash {
|
||||
if localAdminCash == nil {
|
||||
panic("implement not found for interface IAdminCash, forgot register?")
|
||||
}
|
||||
return localAdminCash
|
||||
}
|
||||
|
||||
func RegisterAdminCash(i IAdminCash) {
|
||||
localAdminCash = i
|
||||
}
|
||||
|
||||
func AdminSite() IAdminSite {
|
||||
if localAdminSite == nil {
|
||||
panic("implement not found for interface IAdminSite, forgot register?")
|
||||
}
|
||||
return localAdminSite
|
||||
}
|
||||
|
||||
func RegisterAdminSite(i IAdminSite) {
|
||||
localAdminSite = i
|
||||
}
|
||||
|
||||
func AdminMember() IAdminMember {
|
||||
if localAdminMember == nil {
|
||||
panic("implement not found for interface IAdminMember, forgot register?")
|
||||
@@ -254,28 +265,6 @@ func RegisterAdminMember(i IAdminMember) {
|
||||
localAdminMember = i
|
||||
}
|
||||
|
||||
func AdminMemberPost() IAdminMemberPost {
|
||||
if localAdminMemberPost == nil {
|
||||
panic("implement not found for interface IAdminMemberPost, forgot register?")
|
||||
}
|
||||
return localAdminMemberPost
|
||||
}
|
||||
|
||||
func RegisterAdminMemberPost(i IAdminMemberPost) {
|
||||
localAdminMemberPost = i
|
||||
}
|
||||
|
||||
func AdminMenu() IAdminMenu {
|
||||
if localAdminMenu == nil {
|
||||
panic("implement not found for interface IAdminMenu, forgot register?")
|
||||
}
|
||||
return localAdminMenu
|
||||
}
|
||||
|
||||
func RegisterAdminMenu(i IAdminMenu) {
|
||||
localAdminMenu = i
|
||||
}
|
||||
|
||||
func AdminNotice() IAdminNotice {
|
||||
if localAdminNotice == nil {
|
||||
panic("implement not found for interface IAdminNotice, forgot register?")
|
||||
@@ -286,3 +275,14 @@ func AdminNotice() IAdminNotice {
|
||||
func RegisterAdminNotice(i IAdminNotice) {
|
||||
localAdminNotice = i
|
||||
}
|
||||
|
||||
func AdminCreditsLog() IAdminCreditsLog {
|
||||
if localAdminCreditsLog == nil {
|
||||
panic("implement not found for interface IAdminCreditsLog, forgot register?")
|
||||
}
|
||||
return localAdminCreditsLog
|
||||
}
|
||||
|
||||
func RegisterAdminCreditsLog(i IAdminCreditsLog) {
|
||||
localAdminCreditsLog = i
|
||||
}
|
||||
|
||||
@@ -17,71 +17,29 @@ import (
|
||||
)
|
||||
|
||||
type (
|
||||
ISysSmsLog interface {
|
||||
Delete(ctx context.Context, in sysin.SmsLogDeleteInp) (err error)
|
||||
Edit(ctx context.Context, in sysin.SmsLogEditInp) (err error)
|
||||
Status(ctx context.Context, in sysin.SmsLogStatusInp) (err error)
|
||||
MaxSort(ctx context.Context, in sysin.SmsLogMaxSortInp) (res *sysin.SmsLogMaxSortModel, err error)
|
||||
View(ctx context.Context, in sysin.SmsLogViewInp) (res *sysin.SmsLogViewModel, err error)
|
||||
List(ctx context.Context, in sysin.SmsLogListInp) (list []*sysin.SmsLogListModel, totalCount int, err error)
|
||||
SendCode(ctx context.Context, in sysin.SendCodeInp) (err error)
|
||||
GetTemplate(ctx context.Context, template string, config *model.SmsConfig) (val string, err error)
|
||||
AllowSend(ctx context.Context, models *entity.SysSmsLog, config *model.SmsConfig) (err error)
|
||||
VerifyCode(ctx context.Context, in sysin.VerifyCodeInp) (err error)
|
||||
ISysCronGroup interface {
|
||||
Delete(ctx context.Context, in sysin.CronGroupDeleteInp) (err error)
|
||||
Edit(ctx context.Context, in sysin.CronGroupEditInp) (err error)
|
||||
Status(ctx context.Context, in sysin.CronGroupStatusInp) (err error)
|
||||
MaxSort(ctx context.Context, in sysin.CronGroupMaxSortInp) (res *sysin.CronGroupMaxSortModel, err error)
|
||||
View(ctx context.Context, in sysin.CronGroupViewInp) (res *sysin.CronGroupViewModel, err error)
|
||||
List(ctx context.Context, in sysin.CronGroupListInp) (list []*sysin.CronGroupListModel, totalCount int, err error)
|
||||
Select(ctx context.Context, in sysin.CronGroupSelectInp) (res *sysin.CronGroupSelectModel, err error)
|
||||
}
|
||||
ISysServeLog interface {
|
||||
Model(ctx context.Context) *gdb.Model
|
||||
List(ctx context.Context, in sysin.ServeLogListInp) (list []*sysin.ServeLogListModel, totalCount int, err error)
|
||||
Export(ctx context.Context, in sysin.ServeLogListInp) (err error)
|
||||
Delete(ctx context.Context, in sysin.ServeLogDeleteInp) (err error)
|
||||
View(ctx context.Context, in sysin.ServeLogViewInp) (res *sysin.ServeLogViewModel, err error)
|
||||
RealWrite(ctx context.Context, models entity.SysServeLog) (err error)
|
||||
ISysLog interface {
|
||||
Export(ctx context.Context, in sysin.LogListInp) (err error)
|
||||
RealWrite(ctx context.Context, log entity.SysLog) (err error)
|
||||
AutoLog(ctx context.Context) error
|
||||
AnalysisLog(ctx context.Context) entity.SysLog
|
||||
View(ctx context.Context, in sysin.LogViewInp) (res *sysin.LogViewModel, err error)
|
||||
Delete(ctx context.Context, in sysin.LogDeleteInp) (err error)
|
||||
List(ctx context.Context, in sysin.LogListInp) (list []*sysin.LogListModel, totalCount int, err error)
|
||||
}
|
||||
ISysAddons interface {
|
||||
List(ctx context.Context, in sysin.AddonsListInp) (list []*sysin.AddonsListModel, totalCount int, err error)
|
||||
Selects(ctx context.Context, in sysin.AddonsSelectsInp) (res *sysin.AddonsSelectsModel, err error)
|
||||
Build(ctx context.Context, in sysin.AddonsBuildInp) (err error)
|
||||
Install(ctx context.Context, in sysin.AddonsInstallInp) (err error)
|
||||
Upgrade(ctx context.Context, in sysin.AddonsUpgradeInp) (err error)
|
||||
UnInstall(ctx context.Context, in sysin.AddonsUnInstallInp) (err error)
|
||||
}
|
||||
ISysCron interface {
|
||||
StartCron(ctx context.Context)
|
||||
Delete(ctx context.Context, in sysin.CronDeleteInp) (err error)
|
||||
Edit(ctx context.Context, in sysin.CronEditInp) (err error)
|
||||
Status(ctx context.Context, in sysin.CronStatusInp) (err error)
|
||||
MaxSort(ctx context.Context, in sysin.CronMaxSortInp) (res *sysin.CronMaxSortModel, err error)
|
||||
View(ctx context.Context, in sysin.CronViewInp) (res *sysin.CronViewModel, err error)
|
||||
List(ctx context.Context, in sysin.CronListInp) (list []*sysin.CronListModel, totalCount int, err error)
|
||||
OnlineExec(ctx context.Context, in sysin.OnlineExecInp) (err error)
|
||||
}
|
||||
ISysCurdDemo interface {
|
||||
Model(ctx context.Context, option ...*handler.Option) *gdb.Model
|
||||
List(ctx context.Context, in sysin.CurdDemoListInp) (list []*sysin.CurdDemoListModel, totalCount int, err error)
|
||||
Export(ctx context.Context, in sysin.CurdDemoListInp) (err error)
|
||||
Edit(ctx context.Context, in sysin.CurdDemoEditInp) (err error)
|
||||
Delete(ctx context.Context, in sysin.CurdDemoDeleteInp) (err error)
|
||||
MaxSort(ctx context.Context, in sysin.CurdDemoMaxSortInp) (res *sysin.CurdDemoMaxSortModel, err error)
|
||||
View(ctx context.Context, in sysin.CurdDemoViewInp) (res *sysin.CurdDemoViewModel, err error)
|
||||
Status(ctx context.Context, in sysin.CurdDemoStatusInp) (err error)
|
||||
Switch(ctx context.Context, in sysin.CurdDemoSwitchInp) (err error)
|
||||
}
|
||||
ISysDictType interface {
|
||||
Tree(ctx context.Context) (list []*sysin.DictTypeTree, err error)
|
||||
Delete(ctx context.Context, in sysin.DictTypeDeleteInp) (err error)
|
||||
Edit(ctx context.Context, in sysin.DictTypeEditInp) (err error)
|
||||
TreeSelect(ctx context.Context, in sysin.DictTreeSelectInp) (list []*sysin.DictTypeTree, err error)
|
||||
}
|
||||
ISysEmsLog interface {
|
||||
Delete(ctx context.Context, in sysin.EmsLogDeleteInp) (err error)
|
||||
Edit(ctx context.Context, in sysin.EmsLogEditInp) (err error)
|
||||
Status(ctx context.Context, in sysin.EmsLogStatusInp) (err error)
|
||||
View(ctx context.Context, in sysin.EmsLogViewInp) (res *sysin.EmsLogViewModel, err error)
|
||||
List(ctx context.Context, in sysin.EmsLogListInp) (list []*sysin.EmsLogListModel, totalCount int, err error)
|
||||
Send(ctx context.Context, in sysin.SendEmsInp) (err error)
|
||||
GetTemplate(ctx context.Context, template string, config *model.EmailConfig) (val string, err error)
|
||||
AllowSend(ctx context.Context, models *entity.SysEmsLog, config *model.EmailConfig) (err error)
|
||||
VerifyCode(ctx context.Context, in sysin.VerifyEmsCodeInp) (err error)
|
||||
ISysDictData interface {
|
||||
Delete(ctx context.Context, in sysin.DictDataDeleteInp) error
|
||||
Edit(ctx context.Context, in sysin.DictDataEditInp) (err error)
|
||||
List(ctx context.Context, in sysin.DictDataListInp) (list []*sysin.DictDataListModel, totalCount int, err error)
|
||||
Select(ctx context.Context, in sysin.DataSelectInp) (list sysin.DataSelectModel, err error)
|
||||
}
|
||||
ISysGenCodes interface {
|
||||
Delete(ctx context.Context, in sysin.GenCodesDeleteInp) (err error)
|
||||
@@ -97,12 +55,70 @@ type (
|
||||
Preview(ctx context.Context, in sysin.GenCodesPreviewInp) (res *sysin.GenCodesPreviewModel, err error)
|
||||
Build(ctx context.Context, in sysin.GenCodesBuildInp) (err error)
|
||||
}
|
||||
ISysLoginLog interface {
|
||||
Model(ctx context.Context) *gdb.Model
|
||||
List(ctx context.Context, in sysin.LoginLogListInp) (list []*sysin.LoginLogListModel, totalCount int, err error)
|
||||
Export(ctx context.Context, in sysin.LoginLogListInp) (err error)
|
||||
Delete(ctx context.Context, in sysin.LoginLogDeleteInp) (err error)
|
||||
View(ctx context.Context, in sysin.LoginLogViewInp) (res *sysin.LoginLogViewModel, err error)
|
||||
Push(ctx context.Context, in sysin.LoginLogPushInp)
|
||||
RealWrite(ctx context.Context, models entity.SysLoginLog) (err error)
|
||||
}
|
||||
ISysServeLog interface {
|
||||
Model(ctx context.Context) *gdb.Model
|
||||
List(ctx context.Context, in sysin.ServeLogListInp) (list []*sysin.ServeLogListModel, totalCount int, err error)
|
||||
Export(ctx context.Context, in sysin.ServeLogListInp) (err error)
|
||||
Delete(ctx context.Context, in sysin.ServeLogDeleteInp) (err error)
|
||||
View(ctx context.Context, in sysin.ServeLogViewInp) (res *sysin.ServeLogViewModel, err error)
|
||||
RealWrite(ctx context.Context, models entity.SysServeLog) (err error)
|
||||
}
|
||||
ISysAddonsConfig interface {
|
||||
GetConfigByGroup(ctx context.Context, in sysin.GetAddonsConfigInp) (res *sysin.GetAddonsConfigModel, err error)
|
||||
ConversionType(ctx context.Context, models *entity.SysAddonsConfig) (value interface{}, err error)
|
||||
UpdateConfigByGroup(ctx context.Context, in sysin.UpdateAddonsConfigInp) (err error)
|
||||
}
|
||||
ISysAttachment interface {
|
||||
Model(ctx context.Context, option ...*handler.Option) *gdb.Model
|
||||
Delete(ctx context.Context, in sysin.AttachmentDeleteInp) (err error)
|
||||
View(ctx context.Context, in sysin.AttachmentViewInp) (res *sysin.AttachmentViewModel, err error)
|
||||
List(ctx context.Context, in sysin.AttachmentListInp) (list []*sysin.AttachmentListModel, totalCount int, err error)
|
||||
}
|
||||
ISysCron interface {
|
||||
StartCron(ctx context.Context)
|
||||
Delete(ctx context.Context, in sysin.CronDeleteInp) (err error)
|
||||
Edit(ctx context.Context, in sysin.CronEditInp) (err error)
|
||||
Status(ctx context.Context, in sysin.CronStatusInp) (err error)
|
||||
MaxSort(ctx context.Context, in sysin.CronMaxSortInp) (res *sysin.CronMaxSortModel, err error)
|
||||
View(ctx context.Context, in sysin.CronViewInp) (res *sysin.CronViewModel, err error)
|
||||
List(ctx context.Context, in sysin.CronListInp) (list []*sysin.CronListModel, totalCount int, err error)
|
||||
OnlineExec(ctx context.Context, in sysin.OnlineExecInp) (err error)
|
||||
}
|
||||
ISysDictType interface {
|
||||
Tree(ctx context.Context) (list []*sysin.DictTypeTree, err error)
|
||||
Delete(ctx context.Context, in sysin.DictTypeDeleteInp) (err error)
|
||||
Edit(ctx context.Context, in sysin.DictTypeEditInp) (err error)
|
||||
TreeSelect(ctx context.Context, in sysin.DictTreeSelectInp) (list []*sysin.DictTypeTree, err error)
|
||||
}
|
||||
ISysSmsLog interface {
|
||||
Delete(ctx context.Context, in sysin.SmsLogDeleteInp) (err error)
|
||||
Edit(ctx context.Context, in sysin.SmsLogEditInp) (err error)
|
||||
Status(ctx context.Context, in sysin.SmsLogStatusInp) (err error)
|
||||
MaxSort(ctx context.Context, in sysin.SmsLogMaxSortInp) (res *sysin.SmsLogMaxSortModel, err error)
|
||||
View(ctx context.Context, in sysin.SmsLogViewInp) (res *sysin.SmsLogViewModel, err error)
|
||||
List(ctx context.Context, in sysin.SmsLogListInp) (list []*sysin.SmsLogListModel, totalCount int, err error)
|
||||
SendCode(ctx context.Context, in sysin.SendCodeInp) (err error)
|
||||
GetTemplate(ctx context.Context, template string, config *model.SmsConfig) (val string, err error)
|
||||
AllowSend(ctx context.Context, models *entity.SysSmsLog, config *model.SmsConfig) (err error)
|
||||
VerifyCode(ctx context.Context, in sysin.VerifyCodeInp) (err error)
|
||||
}
|
||||
ISysAddons interface {
|
||||
List(ctx context.Context, in sysin.AddonsListInp) (list []*sysin.AddonsListModel, totalCount int, err error)
|
||||
Selects(ctx context.Context, in sysin.AddonsSelectsInp) (res *sysin.AddonsSelectsModel, err error)
|
||||
Build(ctx context.Context, in sysin.AddonsBuildInp) (err error)
|
||||
Install(ctx context.Context, in sysin.AddonsInstallInp) (err error)
|
||||
Upgrade(ctx context.Context, in sysin.AddonsUpgradeInp) (err error)
|
||||
UnInstall(ctx context.Context, in sysin.AddonsUnInstallInp) (err error)
|
||||
}
|
||||
ISysBlacklist interface {
|
||||
Delete(ctx context.Context, in sysin.BlacklistDeleteInp) (err error)
|
||||
Edit(ctx context.Context, in sysin.BlacklistEditInp) (err error)
|
||||
@@ -127,30 +143,33 @@ type (
|
||||
GetLoadCache(ctx context.Context) (conf *model.CacheConfig, err error)
|
||||
GetLoadGenerate(ctx context.Context) (conf *model.GenerateConfig, err error)
|
||||
GetLoadToken(ctx context.Context) (conf *model.TokenConfig, err error)
|
||||
GetLoadSSL(ctx context.Context) (conf *model.SSLConfig, err error)
|
||||
GetLoadLog(ctx context.Context) (conf *model.LogConfig, err error)
|
||||
GetLoadServeLog(ctx context.Context) (conf *model.ServeLogConfig, err error)
|
||||
GetConfigByGroup(ctx context.Context, in sysin.GetConfigInp) (res *sysin.GetConfigModel, err error)
|
||||
ConversionType(ctx context.Context, models *entity.SysConfig) (value interface{}, err error)
|
||||
UpdateConfigByGroup(ctx context.Context, in sysin.UpdateConfigInp) (err error)
|
||||
}
|
||||
ISysLog interface {
|
||||
Export(ctx context.Context, in sysin.LogListInp) (err error)
|
||||
RealWrite(ctx context.Context, log entity.SysLog) (err error)
|
||||
AutoLog(ctx context.Context) error
|
||||
AnalysisLog(ctx context.Context) entity.SysLog
|
||||
View(ctx context.Context, in sysin.LogViewInp) (res *sysin.LogViewModel, err error)
|
||||
Delete(ctx context.Context, in sysin.LogDeleteInp) (err error)
|
||||
List(ctx context.Context, in sysin.LogListInp) (list []*sysin.LogListModel, totalCount int, err error)
|
||||
ISysCurdDemo interface {
|
||||
Model(ctx context.Context, option ...*handler.Option) *gdb.Model
|
||||
List(ctx context.Context, in sysin.CurdDemoListInp) (list []*sysin.CurdDemoListModel, totalCount int, err error)
|
||||
Export(ctx context.Context, in sysin.CurdDemoListInp) (err error)
|
||||
Edit(ctx context.Context, in sysin.CurdDemoEditInp) (err error)
|
||||
Delete(ctx context.Context, in sysin.CurdDemoDeleteInp) (err error)
|
||||
MaxSort(ctx context.Context, in sysin.CurdDemoMaxSortInp) (res *sysin.CurdDemoMaxSortModel, err error)
|
||||
View(ctx context.Context, in sysin.CurdDemoViewInp) (res *sysin.CurdDemoViewModel, err error)
|
||||
Status(ctx context.Context, in sysin.CurdDemoStatusInp) (err error)
|
||||
Switch(ctx context.Context, in sysin.CurdDemoSwitchInp) (err error)
|
||||
}
|
||||
ISysLoginLog interface {
|
||||
Model(ctx context.Context) *gdb.Model
|
||||
List(ctx context.Context, in sysin.LoginLogListInp) (list []*sysin.LoginLogListModel, totalCount int, err error)
|
||||
Export(ctx context.Context, in sysin.LoginLogListInp) (err error)
|
||||
Delete(ctx context.Context, in sysin.LoginLogDeleteInp) (err error)
|
||||
View(ctx context.Context, in sysin.LoginLogViewInp) (res *sysin.LoginLogViewModel, err error)
|
||||
Push(ctx context.Context, in sysin.LoginLogPushInp)
|
||||
RealWrite(ctx context.Context, models entity.SysLoginLog) (err error)
|
||||
ISysEmsLog interface {
|
||||
Delete(ctx context.Context, in sysin.EmsLogDeleteInp) (err error)
|
||||
Edit(ctx context.Context, in sysin.EmsLogEditInp) (err error)
|
||||
Status(ctx context.Context, in sysin.EmsLogStatusInp) (err error)
|
||||
View(ctx context.Context, in sysin.EmsLogViewInp) (res *sysin.EmsLogViewModel, err error)
|
||||
List(ctx context.Context, in sysin.EmsLogListInp) (list []*sysin.EmsLogListModel, totalCount int, err error)
|
||||
Send(ctx context.Context, in sysin.SendEmsInp) (err error)
|
||||
GetTemplate(ctx context.Context, template string, config *model.EmailConfig) (val string, err error)
|
||||
AllowSend(ctx context.Context, models *entity.SysEmsLog, config *model.EmailConfig) (err error)
|
||||
VerifyCode(ctx context.Context, in sysin.VerifyEmsCodeInp) (err error)
|
||||
}
|
||||
ISysProvinces interface {
|
||||
Tree(ctx context.Context) (list []g.Map, err error)
|
||||
@@ -164,90 +183,37 @@ type (
|
||||
UniqueId(ctx context.Context, in sysin.ProvincesUniqueIdInp) (res *sysin.ProvincesUniqueIdModel, err error)
|
||||
Select(ctx context.Context, in sysin.ProvincesSelectInp) (res *sysin.ProvincesSelectModel, err error)
|
||||
}
|
||||
ISysAddonsConfig interface {
|
||||
GetConfigByGroup(ctx context.Context, in sysin.GetAddonsConfigInp) (res *sysin.GetAddonsConfigModel, err error)
|
||||
ConversionType(ctx context.Context, models *entity.SysAddonsConfig) (value interface{}, err error)
|
||||
UpdateConfigByGroup(ctx context.Context, in sysin.UpdateAddonsConfigInp) (err error)
|
||||
}
|
||||
ISysCronGroup interface {
|
||||
Delete(ctx context.Context, in sysin.CronGroupDeleteInp) (err error)
|
||||
Edit(ctx context.Context, in sysin.CronGroupEditInp) (err error)
|
||||
Status(ctx context.Context, in sysin.CronGroupStatusInp) (err error)
|
||||
MaxSort(ctx context.Context, in sysin.CronGroupMaxSortInp) (res *sysin.CronGroupMaxSortModel, err error)
|
||||
View(ctx context.Context, in sysin.CronGroupViewInp) (res *sysin.CronGroupViewModel, err error)
|
||||
List(ctx context.Context, in sysin.CronGroupListInp) (list []*sysin.CronGroupListModel, totalCount int, err error)
|
||||
Select(ctx context.Context, in sysin.CronGroupSelectInp) (res *sysin.CronGroupSelectModel, err error)
|
||||
}
|
||||
ISysDictData interface {
|
||||
Delete(ctx context.Context, in sysin.DictDataDeleteInp) error
|
||||
Edit(ctx context.Context, in sysin.DictDataEditInp) (err error)
|
||||
List(ctx context.Context, in sysin.DictDataListInp) (list []*sysin.DictDataListModel, totalCount int, err error)
|
||||
Select(ctx context.Context, in sysin.DataSelectInp) (list sysin.DataSelectModel, err error)
|
||||
}
|
||||
)
|
||||
|
||||
var (
|
||||
localSysCron ISysCron
|
||||
localSysConfig ISysConfig
|
||||
localSysCurdDemo ISysCurdDemo
|
||||
localSysServeLog ISysServeLog
|
||||
localSysEmsLog ISysEmsLog
|
||||
localSysProvinces ISysProvinces
|
||||
localSysAddons ISysAddons
|
||||
localSysBlacklist ISysBlacklist
|
||||
localSysConfig ISysConfig
|
||||
localSysDictType ISysDictType
|
||||
localSysEmsLog ISysEmsLog
|
||||
localSysGenCodes ISysGenCodes
|
||||
localSysAttachment ISysAttachment
|
||||
localSysCronGroup ISysCronGroup
|
||||
localSysDictData ISysDictData
|
||||
localSysLog ISysLog
|
||||
localSysLoginLog ISysLoginLog
|
||||
localSysProvinces ISysProvinces
|
||||
localSysAddonsConfig ISysAddonsConfig
|
||||
localSysServeLog ISysServeLog
|
||||
localSysDictData ISysDictData
|
||||
localSysGenCodes ISysGenCodes
|
||||
localSysCron ISysCron
|
||||
localSysDictType ISysDictType
|
||||
localSysSmsLog ISysSmsLog
|
||||
localSysAddonsConfig ISysAddonsConfig
|
||||
localSysAttachment ISysAttachment
|
||||
)
|
||||
|
||||
func SysConfig() ISysConfig {
|
||||
if localSysConfig == nil {
|
||||
panic("implement not found for interface ISysConfig, forgot register?")
|
||||
func SysAddonsConfig() ISysAddonsConfig {
|
||||
if localSysAddonsConfig == nil {
|
||||
panic("implement not found for interface ISysAddonsConfig, forgot register?")
|
||||
}
|
||||
return localSysConfig
|
||||
return localSysAddonsConfig
|
||||
}
|
||||
|
||||
func RegisterSysConfig(i ISysConfig) {
|
||||
localSysConfig = i
|
||||
}
|
||||
|
||||
func SysDictType() ISysDictType {
|
||||
if localSysDictType == nil {
|
||||
panic("implement not found for interface ISysDictType, forgot register?")
|
||||
}
|
||||
return localSysDictType
|
||||
}
|
||||
|
||||
func RegisterSysDictType(i ISysDictType) {
|
||||
localSysDictType = i
|
||||
}
|
||||
|
||||
func SysEmsLog() ISysEmsLog {
|
||||
if localSysEmsLog == nil {
|
||||
panic("implement not found for interface ISysEmsLog, forgot register?")
|
||||
}
|
||||
return localSysEmsLog
|
||||
}
|
||||
|
||||
func RegisterSysEmsLog(i ISysEmsLog) {
|
||||
localSysEmsLog = i
|
||||
}
|
||||
|
||||
func SysGenCodes() ISysGenCodes {
|
||||
if localSysGenCodes == nil {
|
||||
panic("implement not found for interface ISysGenCodes, forgot register?")
|
||||
}
|
||||
return localSysGenCodes
|
||||
}
|
||||
|
||||
func RegisterSysGenCodes(i ISysGenCodes) {
|
||||
localSysGenCodes = i
|
||||
func RegisterSysAddonsConfig(i ISysAddonsConfig) {
|
||||
localSysAddonsConfig = i
|
||||
}
|
||||
|
||||
func SysAttachment() ISysAttachment {
|
||||
@@ -261,81 +227,26 @@ func RegisterSysAttachment(i ISysAttachment) {
|
||||
localSysAttachment = i
|
||||
}
|
||||
|
||||
func SysBlacklist() ISysBlacklist {
|
||||
if localSysBlacklist == nil {
|
||||
panic("implement not found for interface ISysBlacklist, forgot register?")
|
||||
func SysCron() ISysCron {
|
||||
if localSysCron == nil {
|
||||
panic("implement not found for interface ISysCron, forgot register?")
|
||||
}
|
||||
return localSysBlacklist
|
||||
return localSysCron
|
||||
}
|
||||
|
||||
func RegisterSysBlacklist(i ISysBlacklist) {
|
||||
localSysBlacklist = i
|
||||
func RegisterSysCron(i ISysCron) {
|
||||
localSysCron = i
|
||||
}
|
||||
|
||||
func SysDictData() ISysDictData {
|
||||
if localSysDictData == nil {
|
||||
panic("implement not found for interface ISysDictData, forgot register?")
|
||||
func SysDictType() ISysDictType {
|
||||
if localSysDictType == nil {
|
||||
panic("implement not found for interface ISysDictType, forgot register?")
|
||||
}
|
||||
return localSysDictData
|
||||
return localSysDictType
|
||||
}
|
||||
|
||||
func RegisterSysDictData(i ISysDictData) {
|
||||
localSysDictData = i
|
||||
}
|
||||
|
||||
func SysLog() ISysLog {
|
||||
if localSysLog == nil {
|
||||
panic("implement not found for interface ISysLog, forgot register?")
|
||||
}
|
||||
return localSysLog
|
||||
}
|
||||
|
||||
func RegisterSysLog(i ISysLog) {
|
||||
localSysLog = i
|
||||
}
|
||||
|
||||
func SysLoginLog() ISysLoginLog {
|
||||
if localSysLoginLog == nil {
|
||||
panic("implement not found for interface ISysLoginLog, forgot register?")
|
||||
}
|
||||
return localSysLoginLog
|
||||
}
|
||||
|
||||
func RegisterSysLoginLog(i ISysLoginLog) {
|
||||
localSysLoginLog = i
|
||||
}
|
||||
|
||||
func SysProvinces() ISysProvinces {
|
||||
if localSysProvinces == nil {
|
||||
panic("implement not found for interface ISysProvinces, forgot register?")
|
||||
}
|
||||
return localSysProvinces
|
||||
}
|
||||
|
||||
func RegisterSysProvinces(i ISysProvinces) {
|
||||
localSysProvinces = i
|
||||
}
|
||||
|
||||
func SysAddonsConfig() ISysAddonsConfig {
|
||||
if localSysAddonsConfig == nil {
|
||||
panic("implement not found for interface ISysAddonsConfig, forgot register?")
|
||||
}
|
||||
return localSysAddonsConfig
|
||||
}
|
||||
|
||||
func RegisterSysAddonsConfig(i ISysAddonsConfig) {
|
||||
localSysAddonsConfig = i
|
||||
}
|
||||
|
||||
func SysCronGroup() ISysCronGroup {
|
||||
if localSysCronGroup == nil {
|
||||
panic("implement not found for interface ISysCronGroup, forgot register?")
|
||||
}
|
||||
return localSysCronGroup
|
||||
}
|
||||
|
||||
func RegisterSysCronGroup(i ISysCronGroup) {
|
||||
localSysCronGroup = i
|
||||
func RegisterSysDictType(i ISysDictType) {
|
||||
localSysDictType = i
|
||||
}
|
||||
|
||||
func SysSmsLog() ISysSmsLog {
|
||||
@@ -349,6 +260,39 @@ func RegisterSysSmsLog(i ISysSmsLog) {
|
||||
localSysSmsLog = i
|
||||
}
|
||||
|
||||
func SysAddons() ISysAddons {
|
||||
if localSysAddons == nil {
|
||||
panic("implement not found for interface ISysAddons, forgot register?")
|
||||
}
|
||||
return localSysAddons
|
||||
}
|
||||
|
||||
func RegisterSysAddons(i ISysAddons) {
|
||||
localSysAddons = i
|
||||
}
|
||||
|
||||
func SysBlacklist() ISysBlacklist {
|
||||
if localSysBlacklist == nil {
|
||||
panic("implement not found for interface ISysBlacklist, forgot register?")
|
||||
}
|
||||
return localSysBlacklist
|
||||
}
|
||||
|
||||
func RegisterSysBlacklist(i ISysBlacklist) {
|
||||
localSysBlacklist = i
|
||||
}
|
||||
|
||||
func SysConfig() ISysConfig {
|
||||
if localSysConfig == nil {
|
||||
panic("implement not found for interface ISysConfig, forgot register?")
|
||||
}
|
||||
return localSysConfig
|
||||
}
|
||||
|
||||
func RegisterSysConfig(i ISysConfig) {
|
||||
localSysConfig = i
|
||||
}
|
||||
|
||||
func SysCurdDemo() ISysCurdDemo {
|
||||
if localSysCurdDemo == nil {
|
||||
panic("implement not found for interface ISysCurdDemo, forgot register?")
|
||||
@@ -360,6 +304,83 @@ func RegisterSysCurdDemo(i ISysCurdDemo) {
|
||||
localSysCurdDemo = i
|
||||
}
|
||||
|
||||
func SysEmsLog() ISysEmsLog {
|
||||
if localSysEmsLog == nil {
|
||||
panic("implement not found for interface ISysEmsLog, forgot register?")
|
||||
}
|
||||
return localSysEmsLog
|
||||
}
|
||||
|
||||
func RegisterSysEmsLog(i ISysEmsLog) {
|
||||
localSysEmsLog = i
|
||||
}
|
||||
|
||||
func SysProvinces() ISysProvinces {
|
||||
if localSysProvinces == nil {
|
||||
panic("implement not found for interface ISysProvinces, forgot register?")
|
||||
}
|
||||
return localSysProvinces
|
||||
}
|
||||
|
||||
func RegisterSysProvinces(i ISysProvinces) {
|
||||
localSysProvinces = i
|
||||
}
|
||||
|
||||
func SysCronGroup() ISysCronGroup {
|
||||
if localSysCronGroup == nil {
|
||||
panic("implement not found for interface ISysCronGroup, forgot register?")
|
||||
}
|
||||
return localSysCronGroup
|
||||
}
|
||||
|
||||
func RegisterSysCronGroup(i ISysCronGroup) {
|
||||
localSysCronGroup = i
|
||||
}
|
||||
|
||||
func SysLog() ISysLog {
|
||||
if localSysLog == nil {
|
||||
panic("implement not found for interface ISysLog, forgot register?")
|
||||
}
|
||||
return localSysLog
|
||||
}
|
||||
|
||||
func RegisterSysLog(i ISysLog) {
|
||||
localSysLog = i
|
||||
}
|
||||
|
||||
func SysDictData() ISysDictData {
|
||||
if localSysDictData == nil {
|
||||
panic("implement not found for interface ISysDictData, forgot register?")
|
||||
}
|
||||
return localSysDictData
|
||||
}
|
||||
|
||||
func RegisterSysDictData(i ISysDictData) {
|
||||
localSysDictData = i
|
||||
}
|
||||
|
||||
func SysGenCodes() ISysGenCodes {
|
||||
if localSysGenCodes == nil {
|
||||
panic("implement not found for interface ISysGenCodes, forgot register?")
|
||||
}
|
||||
return localSysGenCodes
|
||||
}
|
||||
|
||||
func RegisterSysGenCodes(i ISysGenCodes) {
|
||||
localSysGenCodes = i
|
||||
}
|
||||
|
||||
func SysLoginLog() ISysLoginLog {
|
||||
if localSysLoginLog == nil {
|
||||
panic("implement not found for interface ISysLoginLog, forgot register?")
|
||||
}
|
||||
return localSysLoginLog
|
||||
}
|
||||
|
||||
func RegisterSysLoginLog(i ISysLoginLog) {
|
||||
localSysLoginLog = i
|
||||
}
|
||||
|
||||
func SysServeLog() ISysServeLog {
|
||||
if localSysServeLog == nil {
|
||||
panic("implement not found for interface ISysServeLog, forgot register?")
|
||||
@@ -370,25 +391,3 @@ func SysServeLog() ISysServeLog {
|
||||
func RegisterSysServeLog(i ISysServeLog) {
|
||||
localSysServeLog = i
|
||||
}
|
||||
|
||||
func SysAddons() ISysAddons {
|
||||
if localSysAddons == nil {
|
||||
panic("implement not found for interface ISysAddons, forgot register?")
|
||||
}
|
||||
return localSysAddons
|
||||
}
|
||||
|
||||
func RegisterSysAddons(i ISysAddons) {
|
||||
localSysAddons = i
|
||||
}
|
||||
|
||||
func SysCron() ISysCron {
|
||||
if localSysCron == nil {
|
||||
panic("implement not found for interface ISysCron, forgot register?")
|
||||
}
|
||||
return localSysCron
|
||||
}
|
||||
|
||||
func RegisterSysCron(i ISysCron) {
|
||||
localSysCron = i
|
||||
}
|
||||
|
||||
@@ -28,8 +28,8 @@ type (
|
||||
)
|
||||
|
||||
var (
|
||||
localCronClient ICronClient
|
||||
localAuthClient IAuthClient
|
||||
localCronClient ICronClient
|
||||
)
|
||||
|
||||
func AuthClient() IAuthClient {
|
||||
|
||||
Reference in New Issue
Block a user