feat: add Go backend
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
// Package cmd
|
||||
// @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 cmd
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
"github.com/gogf/gf/v2/os/gcmd"
|
||||
"hotgo/internal/service"
|
||||
)
|
||||
|
||||
var (
|
||||
Auth = &gcmd.Command{
|
||||
Name: "auth",
|
||||
Brief: "系统授权,当为第三方客户开发应用项目不想将源码和可执行文件让其随意使用时,可以通过授权的方式约束使用方。",
|
||||
Description: `目前已实现,一对一、一对多、有效期授权,具体使用可以参考现有逻辑结合实际场景进行改造`,
|
||||
Func: func(ctx context.Context, parser *gcmd.Parser) (err error) {
|
||||
service.AuthClient().Start(ctx)
|
||||
|
||||
serverWg.Add(1)
|
||||
|
||||
// 信号监听
|
||||
signalListen(ctx, signalHandlerForOverall)
|
||||
|
||||
<-serverCloseSignal
|
||||
service.AuthClient().Stop(ctx)
|
||||
g.Log().Debug(ctx, "auth successfully closed ..")
|
||||
serverWg.Done()
|
||||
return
|
||||
},
|
||||
}
|
||||
)
|
||||
@@ -0,0 +1,86 @@
|
||||
// Package cmd
|
||||
// @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 cmd
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
"github.com/gogf/gf/v2/os/gcmd"
|
||||
"hotgo/utility/simple"
|
||||
)
|
||||
|
||||
var (
|
||||
Main = &gcmd.Command{
|
||||
Description: `默认启动所有服务`,
|
||||
Func: func(ctx context.Context, parser *gcmd.Parser) (err error) {
|
||||
return All.Func(ctx, parser)
|
||||
},
|
||||
}
|
||||
|
||||
Help = &gcmd.Command{
|
||||
Name: "help",
|
||||
Brief: "查看帮助",
|
||||
Description: `
|
||||
命令提示符
|
||||
---------------------------------------------------------------------------------
|
||||
启动服务
|
||||
>> 所有服务 [go run main.go] 热编译 [gf run main.go]
|
||||
>> HTTP服务 [go run main.go http]
|
||||
>> 消息队列 [go run main.go queue]
|
||||
>> 定时任务 [go run main.go cron]
|
||||
>> 查看帮助 [go run main.go help]
|
||||
|
||||
---------------------------------------------------------------------------------
|
||||
工具
|
||||
>> 释放casbin权限,用于清理无效的权限设置 [go run main.go tools -m=casbin -a1=refresh]
|
||||
>> 打印所有打包的资源文件列表 [go run main.go tools -m=gres -a1=dump]
|
||||
>> 打印指定打包的资源文件内容 [go run main.go tools -m=gres -a1=content -a2=resource/template/home/index.html]
|
||||
---------------------------------------------------------------------------------
|
||||
升级更新
|
||||
>> 修复菜单关系树 [go run main.go up -m=fix -a1=menuTree]
|
||||
---------------------------------------------------------------------------------
|
||||
更多
|
||||
github地址:https://github.com/bufanyun/hotgo
|
||||
文档地址:https://github.com/bufanyun/hotgo/tree/v2.0/docs/guide-zh-CN
|
||||
HotGo框架交流1群:190966648
|
||||
`,
|
||||
}
|
||||
|
||||
All = &gcmd.Command{
|
||||
Name: "all",
|
||||
Brief: "start all server",
|
||||
Description: "this is the command entry for starting all server",
|
||||
Func: func(ctx context.Context, parser *gcmd.Parser) (err error) {
|
||||
g.Log().Debug(ctx, "starting all server")
|
||||
|
||||
// 需要启动的服务
|
||||
var allServers = []*gcmd.Command{Http, Queue, Cron}
|
||||
|
||||
for _, server := range allServers {
|
||||
var cmd = server
|
||||
simple.SafeGo(ctx, func(ctx context.Context) {
|
||||
if err := cmd.Func(ctx, parser); err != nil {
|
||||
g.Log().Fatalf(ctx, "%v start fail:%v", cmd.Name, err)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// 信号监听
|
||||
signalListen(ctx, signalHandlerForOverall)
|
||||
|
||||
<-serverCloseSignal
|
||||
serverWg.Wait()
|
||||
g.Log().Debug(ctx, "all service successfully closed ..")
|
||||
return
|
||||
},
|
||||
}
|
||||
)
|
||||
|
||||
func init() {
|
||||
if err := Main.AddCommand(All, Http, Queue, Cron, Auth, Tools, Up, Help); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
// Package cmd
|
||||
// @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 cmd
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/gogf/gf/v2/os/gcmd"
|
||||
_ "hotgo/internal/crons"
|
||||
"hotgo/internal/global"
|
||||
"hotgo/internal/library/cron"
|
||||
"hotgo/internal/service"
|
||||
)
|
||||
|
||||
var (
|
||||
Cron = &gcmd.Command{
|
||||
Name: "cron",
|
||||
Brief: "定时任务,用来部署一些可独立运行的定时任务,通过tcp方式和后台保持长连接通讯,动态调整任务属性。",
|
||||
Description: ``,
|
||||
Func: func(ctx context.Context, parser *gcmd.Parser) (err error) {
|
||||
// 服务日志处理
|
||||
cron.Logger().SetHandlers(global.LoggingServeLogHandler)
|
||||
|
||||
// 启动定时任务
|
||||
service.SysCron().StartCron(ctx)
|
||||
|
||||
// tcp客户端
|
||||
service.CronClient().Start(ctx)
|
||||
|
||||
serverWg.Add(1)
|
||||
|
||||
// 信号监听
|
||||
signalListen(ctx, signalHandlerForOverall)
|
||||
|
||||
<-serverCloseSignal
|
||||
service.CronClient().Stop(ctx)
|
||||
cron.StopALL()
|
||||
cron.Logger().Debug(ctx, "cron successfully closed ..")
|
||||
serverWg.Done()
|
||||
return
|
||||
},
|
||||
}
|
||||
)
|
||||
@@ -0,0 +1,44 @@
|
||||
// Package cmd
|
||||
// @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 cmd
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/gogf/gf/v2/os/gctx"
|
||||
"github.com/gogf/gf/v2/os/gproc"
|
||||
"hotgo/internal/consts"
|
||||
"hotgo/utility/simple"
|
||||
"os"
|
||||
"sync"
|
||||
)
|
||||
|
||||
var (
|
||||
serverCloseSignal = make(chan struct{}, 1)
|
||||
serverWg = sync.WaitGroup{}
|
||||
once sync.Once
|
||||
)
|
||||
|
||||
// signalHandlerForOverall 关闭信号处理
|
||||
func signalHandlerForOverall(sig os.Signal) {
|
||||
serverCloseEvent(gctx.GetInitCtx())
|
||||
serverCloseSignal <- struct{}{}
|
||||
}
|
||||
|
||||
// signalListen 信号监听
|
||||
func signalListen(ctx context.Context, handler ...gproc.SigHandler) {
|
||||
simple.SafeGo(ctx, func(ctx context.Context) {
|
||||
gproc.AddSigHandlerShutdown(handler...)
|
||||
gproc.Listen()
|
||||
})
|
||||
}
|
||||
|
||||
// serverCloseEvent 关闭事件
|
||||
// 区别于服务收到退出信号后的处理,只会执行一次
|
||||
func serverCloseEvent(ctx context.Context) {
|
||||
once.Do(func() {
|
||||
simple.Event().Call(consts.EventServerClose, ctx)
|
||||
})
|
||||
}
|
||||
@@ -0,0 +1,106 @@
|
||||
// Package cmd
|
||||
// @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 cmd
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
"github.com/gogf/gf/v2/net/ghttp"
|
||||
"github.com/gogf/gf/v2/os/gcmd"
|
||||
"github.com/gogf/gf/v2/util/gmode"
|
||||
"hotgo/internal/library/addons"
|
||||
"hotgo/internal/library/casbin"
|
||||
"hotgo/internal/library/hggen"
|
||||
"hotgo/internal/router"
|
||||
"hotgo/internal/service"
|
||||
"hotgo/internal/websocket"
|
||||
)
|
||||
|
||||
var (
|
||||
Http = &gcmd.Command{
|
||||
Name: "http",
|
||||
Usage: "http",
|
||||
Brief: "HTTP服务,也可以称为主服务,包含http、websocket、tcpserver多个可对外服务",
|
||||
Func: func(ctx context.Context, parser *gcmd.Parser) (err error) {
|
||||
// 初始化http服务
|
||||
s := g.Server()
|
||||
|
||||
// 初始化请求前回调
|
||||
s.BindHookHandler("/*any", ghttp.HookBeforeServe, service.Hook().BeforeServe)
|
||||
|
||||
// 请求响应结束后回调
|
||||
s.BindHookHandler("/*any", ghttp.HookAfterOutput, service.Hook().AfterOutput)
|
||||
|
||||
// 注册全局中间件
|
||||
s.BindMiddleware("/*any", []ghttp.HandlerFunc{
|
||||
service.Middleware().Ctx, // 初始化请求上下文,一般需要第一个进行加载,后续中间件存在依赖关系
|
||||
service.Middleware().CORS, // 跨域中间件,自动处理跨域问题
|
||||
service.Middleware().Blacklist, // IP黑名单中间件,如果请求IP被后台拉黑,所有请求将被拒绝
|
||||
service.Middleware().DemoLimit, // 演示系統操作限制,当开启演示模式时,所有POST请求将被拒绝
|
||||
service.Middleware().PreFilter, // 请求输入预处理,api使用gf规范路由并且XxxReq结构体实现了validate.Filter接口即可隐式预处理
|
||||
service.Middleware().ResponseHandler, // HTTP响应预处理,在业务处理完成后,对响应结果进行格式化和错误过滤,将处理后的数据发送给请求方
|
||||
}...)
|
||||
|
||||
s.Group("/", func(group *ghttp.RouterGroup) {
|
||||
// 注册后台路由
|
||||
router.Admin(ctx, group)
|
||||
|
||||
// 注册Api路由
|
||||
router.Api(ctx, group)
|
||||
|
||||
// 注册websocket路由
|
||||
router.WebSocket(ctx, group)
|
||||
|
||||
// 注册前台页面路由
|
||||
router.Home(ctx, group)
|
||||
})
|
||||
|
||||
// 启动插件
|
||||
if err = addons.StartModules(ctx, &addons.Option{Server: s}); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// 初始化casbin权限
|
||||
casbin.InitEnforcer(ctx)
|
||||
|
||||
// 初始化生成代码配置
|
||||
if !gmode.IsProduct() {
|
||||
hggen.InIt(ctx)
|
||||
}
|
||||
|
||||
// 启动tcp服务
|
||||
service.TCPServer().Start(ctx)
|
||||
|
||||
// 启动服务监控
|
||||
service.AdminMonitor().StartMonitor(ctx)
|
||||
|
||||
// 加载ip访问黑名单
|
||||
service.SysBlacklist().Load(ctx)
|
||||
|
||||
// 注册支付成功回调方法
|
||||
service.Pay().RegisterNotifyCall()
|
||||
|
||||
serverWg.Add(1)
|
||||
|
||||
// 信号监听
|
||||
signalListen(ctx, signalHandlerForOverall)
|
||||
|
||||
go func() {
|
||||
<-serverCloseSignal
|
||||
websocket.Stop() // 关闭websocket
|
||||
service.TCPServer().Stop(ctx) // 关闭tcp服务器
|
||||
addons.StopModules(ctx) // 停止插件
|
||||
_ = s.Shutdown() // 关闭http服务,主服务建议放在最后一个关闭
|
||||
g.Log().Debug(ctx, "http successfully closed ..")
|
||||
serverWg.Done()
|
||||
}()
|
||||
|
||||
// Just run the server.
|
||||
s.Run()
|
||||
return
|
||||
},
|
||||
}
|
||||
)
|
||||
@@ -0,0 +1,43 @@
|
||||
// Package cmd
|
||||
// @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 cmd
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/gogf/gf/v2/os/gcmd"
|
||||
"hotgo/internal/global"
|
||||
"hotgo/internal/library/queue"
|
||||
_ "hotgo/internal/queues"
|
||||
"hotgo/utility/simple"
|
||||
)
|
||||
|
||||
var (
|
||||
Queue = &gcmd.Command{
|
||||
Name: "queue",
|
||||
Brief: "消息队列",
|
||||
Description: ``,
|
||||
Func: func(ctx context.Context, parser *gcmd.Parser) (err error) {
|
||||
// 服务日志处理
|
||||
queue.Logger().SetHandlers(global.LoggingServeLogHandler)
|
||||
|
||||
simple.SafeGo(ctx, func(ctx context.Context) {
|
||||
queue.Logger().Debug(ctx, "start queue consumer..")
|
||||
queue.StartConsumersListener(ctx)
|
||||
queue.Logger().Debug(ctx, "start queue consumer success..")
|
||||
})
|
||||
|
||||
serverWg.Add(1)
|
||||
|
||||
// 信号监听
|
||||
signalListen(ctx, signalHandlerForOverall)
|
||||
|
||||
<-serverCloseSignal
|
||||
queue.Logger().Debug(ctx, "queue successfully closed ..")
|
||||
serverWg.Done()
|
||||
return
|
||||
},
|
||||
}
|
||||
)
|
||||
@@ -0,0 +1,107 @@
|
||||
// Package cmd
|
||||
// @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 cmd
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"github.com/gogf/gf/v2/errors/gerror"
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
"github.com/gogf/gf/v2/os/gcmd"
|
||||
"github.com/gogf/gf/v2/os/gres"
|
||||
"hotgo/internal/library/casbin"
|
||||
)
|
||||
|
||||
var (
|
||||
Tools = &gcmd.Command{
|
||||
Name: "tools",
|
||||
Brief: "常用工具",
|
||||
Description: ``,
|
||||
Func: func(ctx context.Context, parser *gcmd.Parser) (err error) {
|
||||
args := parser.GetOptAll()
|
||||
g.Log().Debugf(ctx, "tools args:%v", args)
|
||||
if len(args) == 0 {
|
||||
err = gerror.New("tools args cannot be empty.")
|
||||
return
|
||||
}
|
||||
|
||||
method, ok := args["m"]
|
||||
if !ok {
|
||||
err = gerror.New("tools method cannot be empty.")
|
||||
return
|
||||
}
|
||||
|
||||
switch method {
|
||||
case "casbin":
|
||||
err = handleCasbin(ctx, args)
|
||||
case "gres":
|
||||
err = handleGRes(ctx, args)
|
||||
default:
|
||||
err = gerror.Newf("tools method[%v] does not exist", method)
|
||||
}
|
||||
|
||||
if err == nil {
|
||||
g.Log().Info(ctx, "tools exec successful!")
|
||||
}
|
||||
return
|
||||
},
|
||||
}
|
||||
)
|
||||
|
||||
// handleCasbin casbin.
|
||||
func handleCasbin(ctx context.Context, args map[string]string) (err error) {
|
||||
a1, ok := args["a1"]
|
||||
if !ok {
|
||||
err = gerror.New("casbin args cannot be empty.")
|
||||
return
|
||||
}
|
||||
|
||||
casbin.InitEnforcer(ctx)
|
||||
switch a1 {
|
||||
case "clear":
|
||||
err = casbin.Clear(ctx)
|
||||
case "refresh":
|
||||
err = casbin.Refresh(ctx)
|
||||
default:
|
||||
err = gerror.Newf("casbin a1 is invalid, a1:%v", a1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func handleGRes(ctx context.Context, args map[string]string) (err error) {
|
||||
a1, ok := args["a1"]
|
||||
if !ok {
|
||||
err = gerror.New("gres args cannot be empty.")
|
||||
return
|
||||
}
|
||||
|
||||
switch a1 {
|
||||
case "dump":
|
||||
gres.Dump()
|
||||
case "content":
|
||||
path, ok := args["a2"]
|
||||
if !ok {
|
||||
err = gerror.New("缺少查看文件路径参数:`a2`")
|
||||
return
|
||||
}
|
||||
|
||||
if !gres.Contains(path) {
|
||||
err = gerror.Newf("没有找到资源文件:%v", path)
|
||||
return
|
||||
}
|
||||
content := string(gres.GetContent(path))
|
||||
|
||||
if len(content) == 0 {
|
||||
err = gerror.Newf("没有找到资源文件内容,请确认传入`a2`参数是一个文件,a2:%v", path)
|
||||
return
|
||||
}
|
||||
fmt.Println("以下是资源文件内容:")
|
||||
fmt.Println(content)
|
||||
default:
|
||||
err = gerror.Newf("handleGRes a1 is invalid, a1:%v", a1)
|
||||
}
|
||||
return
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
// Package cmd
|
||||
// @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 cmd
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/gogf/gf/v2/errors/gerror"
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
"github.com/gogf/gf/v2/os/gcmd"
|
||||
"hotgo/internal/cmd/upgrade/fix"
|
||||
)
|
||||
|
||||
var (
|
||||
Up = &gcmd.Command{
|
||||
Name: "up",
|
||||
Brief: "处理hotgo版本升级更新带来的兼容问题",
|
||||
Description: ``,
|
||||
Func: func(ctx context.Context, parser *gcmd.Parser) (err error) {
|
||||
args := parser.GetOptAll()
|
||||
g.Log().Debugf(ctx, "up args:%v", args)
|
||||
if len(args) == 0 {
|
||||
err = gerror.New("up args cannot be empty.")
|
||||
return
|
||||
}
|
||||
|
||||
method, ok := args["m"]
|
||||
if !ok {
|
||||
err = gerror.New("up method cannot be empty.")
|
||||
return
|
||||
}
|
||||
|
||||
switch method {
|
||||
case "fix":
|
||||
err = handleUpgradeFix(ctx, args)
|
||||
default:
|
||||
err = gerror.Newf("up method[%v] does not exist", method)
|
||||
}
|
||||
|
||||
if err == nil {
|
||||
g.Log().Info(ctx, "up exec successful!")
|
||||
}
|
||||
return
|
||||
},
|
||||
}
|
||||
)
|
||||
|
||||
// handleUpgradeFix 处理修复脚本
|
||||
func handleUpgradeFix(ctx context.Context, args map[string]string) (err error) {
|
||||
a1, ok := args["a1"]
|
||||
if !ok {
|
||||
err = gerror.New("fix args cannot be empty.")
|
||||
return
|
||||
}
|
||||
|
||||
switch a1 {
|
||||
case "menuTree":
|
||||
fix.UpdateAdminMenuTree(ctx)
|
||||
default:
|
||||
err = gerror.Newf("fix a1 is invalid, a1:%v", a1)
|
||||
}
|
||||
return
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
// Package fix
|
||||
// @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 fix
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
"github.com/gogf/gf/v2/os/gtime"
|
||||
"hotgo/internal/dao"
|
||||
"hotgo/internal/library/hgorm"
|
||||
"hotgo/internal/model/entity"
|
||||
)
|
||||
|
||||
// UpdateAdminMenuTree 更新菜单关系树
|
||||
// 根据树等级从上到下依次检查,将无效的关系树进行修复更新
|
||||
func UpdateAdminMenuTree(ctx context.Context) {
|
||||
var list []*entity.AdminMenu
|
||||
err := dao.AdminMenu.Ctx(ctx).OrderAsc("level").Scan(&list)
|
||||
if err != nil {
|
||||
g.Log().Fatal(ctx, err)
|
||||
}
|
||||
|
||||
genUpdateData := func(v *entity.AdminMenu) g.Map {
|
||||
update := g.Map{"updated_at": gtime.Now()}
|
||||
if v.Pid <= 0 {
|
||||
update["level"] = 1
|
||||
update["tree"] = ""
|
||||
return update
|
||||
}
|
||||
|
||||
// 生成下级关系树
|
||||
update["pid"], update["level"], update["tree"], err = hgorm.GenSubTree(ctx, &dao.AdminMenu, v.Pid)
|
||||
return update
|
||||
}
|
||||
|
||||
for _, v := range list {
|
||||
update := genUpdateData(v)
|
||||
if v.Level == update["level"] && v.Tree == update["tree"] {
|
||||
continue
|
||||
}
|
||||
if _, err = dao.AdminMenu.Ctx(ctx).WherePri(v.Id).Data(genUpdateData(v)).Update(); err != nil {
|
||||
g.Log().Fatal(ctx, err)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
// Package consts
|
||||
// @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 consts
|
||||
|
||||
import (
|
||||
"hotgo/internal/library/dict"
|
||||
"hotgo/internal/model"
|
||||
)
|
||||
|
||||
func init() {
|
||||
dict.RegisterEnums("addonsGroupOptions", "插件分组", AddonsGroupOptions)
|
||||
dict.RegisterEnums("addonsInstallStatus", "插件安装状态", AddonsInstallStatusOptions)
|
||||
dict.RegisterEnums("addonsExtend", "插件扩展", AddonsExtendOptions)
|
||||
}
|
||||
|
||||
const (
|
||||
AddonsTag = "addons_" // 插件标签前缀
|
||||
AddonsDir = "addons" // 插件路径
|
||||
)
|
||||
|
||||
const (
|
||||
AddonsGroupPlug = 1 // 功能扩展
|
||||
AddonsGroupBusiness = 2 // 主要业务
|
||||
AddonsGroupThirdParty = 3 // 第三方插件
|
||||
AddonsGroupMiniApp = 4 // 小程序
|
||||
AddonsGroupCustomer = 5 // 客户关系
|
||||
AddonsGroupActivity = 6 // 营销及活动
|
||||
AddonsGroupServices = 7 // 常用服务及工具
|
||||
AddonsGroupBiz = 8 // 行业解决方案
|
||||
)
|
||||
|
||||
// AddonsGroupOptions 插件分组选项
|
||||
var AddonsGroupOptions = []*model.Option{
|
||||
dict.GenInfoOption(AddonsGroupPlug, "功能扩展"),
|
||||
dict.GenInfoOption(AddonsGroupBusiness, "主要业务"),
|
||||
dict.GenInfoOption(AddonsGroupThirdParty, "第三方插件"),
|
||||
dict.GenInfoOption(AddonsGroupMiniApp, "小程序"),
|
||||
dict.GenInfoOption(AddonsGroupCustomer, "客户关系"),
|
||||
dict.GenInfoOption(AddonsGroupActivity, "营销及活动"),
|
||||
dict.GenInfoOption(AddonsGroupServices, "常用服务及工具"),
|
||||
dict.GenInfoOption(AddonsGroupBiz, "行业解决方案"),
|
||||
}
|
||||
|
||||
var AddonsGroupIconMap = map[int]string{
|
||||
AddonsGroupPlug: "AppstoreAddOutlined",
|
||||
AddonsGroupBusiness: "FireOutlined",
|
||||
AddonsGroupThirdParty: "ApiOutlined",
|
||||
AddonsGroupMiniApp: "RocketOutlined",
|
||||
AddonsGroupCustomer: "UserSwitchOutlined",
|
||||
AddonsGroupActivity: "TagOutlined",
|
||||
AddonsGroupServices: "ToolOutlined",
|
||||
AddonsGroupBiz: "CheckCircleOutlined",
|
||||
}
|
||||
|
||||
const (
|
||||
AddonsInstallStatusOk = 1 // 已安装
|
||||
AddonsInstallStatusNo = 2 // 未安装
|
||||
AddonsInstallStatusUn = 3 // 已卸载
|
||||
)
|
||||
|
||||
// AddonsInstallStatusOptions 插件安装状态
|
||||
var AddonsInstallStatusOptions = []*model.Option{
|
||||
dict.GenInfoOption(AddonsInstallStatusOk, "已安装"),
|
||||
dict.GenInfoOption(AddonsInstallStatusNo, "未安装"),
|
||||
dict.GenInfoOption(AddonsInstallStatusUn, "已卸载"),
|
||||
}
|
||||
|
||||
const (
|
||||
AddonsExtendResourcePublic = "resourcePublic"
|
||||
AddonsExtendResourceTemplate = "resourceTemplate"
|
||||
)
|
||||
|
||||
// AddonsExtendOptions 插件扩展选项
|
||||
var AddonsExtendOptions = []*model.Option{
|
||||
dict.GenInfoOption(AddonsExtendResourcePublic, "创建静态目录"),
|
||||
dict.GenInfoOption(AddonsExtendResourceTemplate, "创建模板目录"),
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
// Package consts
|
||||
// @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 consts
|
||||
|
||||
// 应用类型
|
||||
const (
|
||||
AppAdmin = "admin"
|
||||
AppApi = "api"
|
||||
AppHome = "home"
|
||||
AppWebSocket = "websocket"
|
||||
AppDefault = "default"
|
||||
)
|
||||
@@ -0,0 +1,105 @@
|
||||
package consts
|
||||
|
||||
import (
|
||||
"hotgo/internal/library/dict"
|
||||
"hotgo/internal/model"
|
||||
)
|
||||
|
||||
const (
|
||||
AppMemberStatusNormal = 1
|
||||
AppMemberStatusDisabled = 2
|
||||
AppMemberStatusCancelled = 3
|
||||
AppMemberRiskNormal = 1
|
||||
AppMemberRiskWatch = 2
|
||||
AppMemberRiskBlocked = 3
|
||||
AppMemberDispatchAuto = 1
|
||||
AppMemberDispatchManual = 2
|
||||
AppMemberCategoryReal = 1
|
||||
AppMemberCategoryFake = 2
|
||||
PaymentAccountBank = 1
|
||||
PaymentAccountDigital = 2
|
||||
PaymentAccountUnionPay = 3
|
||||
PaymentAccountAlipay = 4
|
||||
PaymentAccountWechat = 5
|
||||
WalletDirectionIncome = 1
|
||||
WalletDirectionExpense = 2
|
||||
WalletAdjustReward = 1
|
||||
WalletAdjustSupplement = 2
|
||||
WalletAdjustDeduct = 3
|
||||
WalletAdjustReversal = 4
|
||||
WalletAdjustOther = 5
|
||||
WalletRequestPending = 1
|
||||
WalletRequestApproved = 2
|
||||
WalletRequestRejected = 3
|
||||
WalletRequestExecuted = 4
|
||||
MemberNoticeReal = 1
|
||||
MemberNoticeSimulation = 2
|
||||
MemberNoticeActive = 1
|
||||
MemberNoticeRevoked = 2
|
||||
)
|
||||
|
||||
var (
|
||||
AppMemberStatusOptions = []*model.Option{
|
||||
dict.GenSuccessOption(AppMemberStatusNormal, "正常"),
|
||||
dict.GenWarningOption(AppMemberStatusDisabled, "禁用"),
|
||||
dict.GenErrorOption(AppMemberStatusCancelled, "已注销"),
|
||||
}
|
||||
AppMemberRiskStatusOptions = []*model.Option{
|
||||
dict.GenSuccessOption(AppMemberRiskNormal, "正常"),
|
||||
dict.GenWarningOption(AppMemberRiskWatch, "观察"),
|
||||
dict.GenErrorOption(AppMemberRiskBlocked, "拦截"),
|
||||
}
|
||||
AppMemberDispatchModeOptions = []*model.Option{
|
||||
dict.GenSuccessOption(AppMemberDispatchAuto, "自动"),
|
||||
dict.GenDefaultOption(AppMemberDispatchManual, "手动"),
|
||||
}
|
||||
AppMemberCategoryOptions = []*model.Option{
|
||||
dict.GenSuccessOption(AppMemberCategoryReal, "真人"),
|
||||
dict.GenWarningOption(AppMemberCategoryFake, "假人"),
|
||||
}
|
||||
PaymentAccountTypeOptions = []*model.Option{
|
||||
dict.GenPrimaryOption(PaymentAccountBank, "银行卡"),
|
||||
dict.GenInfoOption(PaymentAccountDigital, "数字钱包"),
|
||||
dict.GenSuccessOption(PaymentAccountUnionPay, "云闪付"),
|
||||
dict.GenPrimaryOption(PaymentAccountAlipay, "支付宝"),
|
||||
dict.GenSuccessOption(PaymentAccountWechat, "微信"),
|
||||
}
|
||||
WalletAdjustTypeOptions = []*model.Option{
|
||||
dict.GenSuccessOption(WalletAdjustReward, "奖励金"),
|
||||
dict.GenPrimaryOption(WalletAdjustSupplement, "人工补账"),
|
||||
dict.GenErrorOption(WalletAdjustDeduct, "差错扣回"),
|
||||
dict.GenWarningOption(WalletAdjustReversal, "冲正"),
|
||||
dict.GenDefaultOption(WalletAdjustOther, "其他"),
|
||||
}
|
||||
WalletDirectionOptions = []*model.Option{
|
||||
dict.GenSuccessOption(WalletDirectionIncome, "收入"),
|
||||
dict.GenErrorOption(WalletDirectionExpense, "支出"),
|
||||
}
|
||||
WalletRequestStatusOptions = []*model.Option{
|
||||
dict.GenWarningOption(WalletRequestPending, "待审批"),
|
||||
dict.GenPrimaryOption(WalletRequestApproved, "已通过"),
|
||||
dict.GenErrorOption(WalletRequestRejected, "已拒绝"),
|
||||
dict.GenSuccessOption(WalletRequestExecuted, "已执行"),
|
||||
}
|
||||
MemberNoticeSourceOptions = []*model.Option{
|
||||
dict.GenSuccessOption(MemberNoticeReal, "真实通知"),
|
||||
dict.GenWarningOption(MemberNoticeSimulation, "运营模拟"),
|
||||
}
|
||||
MemberNoticeStatusOptions = []*model.Option{
|
||||
dict.GenSuccessOption(MemberNoticeActive, "有效"),
|
||||
dict.GenErrorOption(MemberNoticeRevoked, "已撤回"),
|
||||
}
|
||||
)
|
||||
|
||||
func init() {
|
||||
dict.RegisterEnums("appMemberStatus", "会员状态", AppMemberStatusOptions)
|
||||
dict.RegisterEnums("appMemberRiskStatus", "会员风控状态", AppMemberRiskStatusOptions)
|
||||
dict.RegisterEnums("appMemberDispatchMode", "会员派单模式", AppMemberDispatchModeOptions)
|
||||
dict.RegisterEnums("appMemberCategory", "会员类别", AppMemberCategoryOptions)
|
||||
dict.RegisterEnums("paymentAccountType", "收款账户类型", PaymentAccountTypeOptions)
|
||||
dict.RegisterEnums("walletAdjustType", "钱包调整类型", WalletAdjustTypeOptions)
|
||||
dict.RegisterEnums("walletDirection", "钱包变更方向", WalletDirectionOptions)
|
||||
dict.RegisterEnums("walletRequestStatus", "钱包调整状态", WalletRequestStatusOptions)
|
||||
dict.RegisterEnums("memberNoticeSource", "会员通知来源", MemberNoticeSourceOptions)
|
||||
dict.RegisterEnums("memberNoticeStatus", "会员通知状态", MemberNoticeStatusOptions)
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
package consts
|
||||
|
||||
import (
|
||||
"hotgo/internal/library/dict"
|
||||
"hotgo/internal/model"
|
||||
)
|
||||
|
||||
const (
|
||||
ApprovalStatusDraft = 1
|
||||
ApprovalStatusPending = 2
|
||||
ApprovalStatusReviewing = 3
|
||||
ApprovalStatusApproved = 4
|
||||
ApprovalStatusRejected = 5
|
||||
ApprovalStatusCancelled = 6
|
||||
ApprovalStatusExecuted = 7
|
||||
ApprovalStatusExecuteFailed = 8
|
||||
)
|
||||
|
||||
const (
|
||||
ApprovalActionSubmit = 1
|
||||
ApprovalActionApprove = 2
|
||||
ApprovalActionReject = 3
|
||||
ApprovalActionReturn = 4
|
||||
ApprovalActionCancel = 5
|
||||
ApprovalActionExecute = 6
|
||||
)
|
||||
|
||||
const (
|
||||
ApprovalRiskLow = 1
|
||||
ApprovalRiskMedium = 2
|
||||
ApprovalRiskHigh = 3
|
||||
ApprovalRiskCritical = 4
|
||||
)
|
||||
|
||||
var ApprovalStatusOptions = []*model.Option{
|
||||
dict.GenDefaultOption(ApprovalStatusDraft, "草稿"),
|
||||
dict.GenWarningOption(ApprovalStatusPending, "待审批"),
|
||||
dict.GenPrimaryOption(ApprovalStatusReviewing, "审批中"),
|
||||
dict.GenSuccessOption(ApprovalStatusApproved, "已通过"),
|
||||
dict.GenErrorOption(ApprovalStatusRejected, "已驳回"),
|
||||
dict.GenInfoOption(ApprovalStatusCancelled, "已取消"),
|
||||
dict.GenSuccessOption(ApprovalStatusExecuted, "已执行"),
|
||||
dict.GenErrorOption(ApprovalStatusExecuteFailed, "执行失败"),
|
||||
}
|
||||
|
||||
var ApprovalActionOptions = []*model.Option{
|
||||
dict.GenPrimaryOption(ApprovalActionSubmit, "提交"),
|
||||
dict.GenSuccessOption(ApprovalActionApprove, "通过"),
|
||||
dict.GenErrorOption(ApprovalActionReject, "驳回"),
|
||||
dict.GenWarningOption(ApprovalActionReturn, "退回"),
|
||||
dict.GenInfoOption(ApprovalActionCancel, "取消"),
|
||||
dict.GenPrimaryOption(ApprovalActionExecute, "执行"),
|
||||
}
|
||||
|
||||
var ApprovalRiskLevelOptions = []*model.Option{
|
||||
dict.GenSuccessOption(ApprovalRiskLow, "低"),
|
||||
dict.GenInfoOption(ApprovalRiskMedium, "中"),
|
||||
dict.GenWarningOption(ApprovalRiskHigh, "高"),
|
||||
dict.GenErrorOption(ApprovalRiskCritical, "极高"),
|
||||
}
|
||||
|
||||
func init() {
|
||||
dict.RegisterEnums("approvalStatus", "审批状态", ApprovalStatusOptions)
|
||||
dict.RegisterEnums("approvalAction", "审批动作", ApprovalActionOptions)
|
||||
dict.RegisterEnums("approvalRiskLevel", "审批风险等级", ApprovalRiskLevelOptions)
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
// Package consts
|
||||
// @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 consts
|
||||
|
||||
// cache
|
||||
const (
|
||||
CacheToken = "token" // 登录token
|
||||
CacheTokenBind = "token_bind" // 登录用户身份绑定
|
||||
CacheMultipartUpload = "multipart_upload" // 分片上传
|
||||
)
|
||||
@@ -0,0 +1,6 @@
|
||||
package consts
|
||||
|
||||
const (
|
||||
CaptchaTypeString = iota + 1 // 字符串
|
||||
CaptchaTypeMath // 数字计算
|
||||
)
|
||||
@@ -0,0 +1,13 @@
|
||||
// Package consts
|
||||
// @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 consts
|
||||
|
||||
// 提现状态
|
||||
const (
|
||||
CashStatusWait = 1 // 处理中
|
||||
CashStatusOk = 2 // 提现成功
|
||||
CashStatusFail = 3 // 提现异常
|
||||
)
|
||||
@@ -0,0 +1,117 @@
|
||||
// Package consts
|
||||
// @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 consts
|
||||
|
||||
import (
|
||||
"github.com/gogf/gf/v2/util/gconv"
|
||||
)
|
||||
|
||||
// RequestEncryptKey
|
||||
// 请求加密密钥用于敏感数据加密,16位字符,前后端需保持一致
|
||||
// 安全起见,生产环境运行时请注意修改
|
||||
var RequestEncryptKey = []byte("f080a463654b2279")
|
||||
|
||||
// 配置数据类型
|
||||
const (
|
||||
ConfigTypeString = "string"
|
||||
ConfigTypeInt = "int"
|
||||
ConfigTypeInt8 = "int8"
|
||||
ConfigTypeInt16 = "int16"
|
||||
ConfigTypeInt32 = "int32"
|
||||
ConfigTypeInt64 = "int64"
|
||||
ConfigTypeUint = "uint"
|
||||
ConfigTypeUint8 = "uint8"
|
||||
ConfigTypeUint16 = "uint16"
|
||||
ConfigTypeUint32 = "uint32"
|
||||
ConfigTypeUint64 = "uint64"
|
||||
ConfigTypeFloat32 = "float32"
|
||||
ConfigTypeFloat64 = "float64"
|
||||
ConfigTypeBool = "bool"
|
||||
ConfigTypeDate = "date"
|
||||
ConfigTypeDateTime = "datetime"
|
||||
ConfigTypeSliceString = "[]string"
|
||||
ConfigTypeSliceInt = "[]int"
|
||||
ConfigTypeSliceInt64 = "[]int64"
|
||||
)
|
||||
|
||||
var ConfigTypes = []string{ConfigTypeString,
|
||||
ConfigTypeInt, ConfigTypeInt8, ConfigTypeInt16, ConfigTypeInt32, ConfigTypeInt64,
|
||||
ConfigTypeUint, ConfigTypeUint8, ConfigTypeUint16, ConfigTypeUint32, ConfigTypeUint64,
|
||||
ConfigTypeFloat32, ConfigTypeFloat64,
|
||||
ConfigTypeBool,
|
||||
ConfigTypeDate, ConfigTypeDateTime,
|
||||
ConfigTypeSliceString, ConfigTypeSliceInt, ConfigTypeSliceInt64,
|
||||
}
|
||||
|
||||
// ConfigMaskDemoField 演示环境下需要隐藏的配置
|
||||
var ConfigMaskDemoField = map[string]struct{}{
|
||||
// 邮箱
|
||||
"smtpUser": {}, "smtpPass": {},
|
||||
|
||||
// 云存储
|
||||
"uploadUCloudPublicKey": {}, "uploadUCloudPrivateKey": {}, "uploadCosSecretId": {}, "uploadCosSecretKey": {},
|
||||
"uploadOssSecretId": {}, "uploadOssSecretKey": {}, "uploadQiNiuAccessKey": {}, "uploadQiNiuSecretKey": {},
|
||||
|
||||
// 地图
|
||||
"geoAmapWebKey": {},
|
||||
|
||||
// 短信
|
||||
"smsAliYunAccessKeyID": {}, "smsAliYunAccessKeySecret": {}, "smsTencentSecretId": {}, "smsTencentSecretKey": {},
|
||||
|
||||
// 支付
|
||||
"payWxPayMchId": {}, "payWxPaySerialNo": {}, "payWxPayAPIv3Key": {}, "payWxPayPrivateKey": {}, "payQQPayMchId": {}, "payQQPayApiKey": {},
|
||||
|
||||
// 微信
|
||||
"officialAccountAppSecret": {}, "officialAccountToken": {}, "officialAccountEncodingAESKey": {}, "openPlatformAppSecret": {},
|
||||
"openPlatformToken": {}, "openPlatformEncodingAESKey": {},
|
||||
}
|
||||
|
||||
// ConvType 类型转换
|
||||
func ConvType(val interface{}, t string) interface{} {
|
||||
switch t {
|
||||
case ConfigTypeString:
|
||||
val = gconv.String(val)
|
||||
case ConfigTypeInt:
|
||||
val = gconv.Int(val)
|
||||
case ConfigTypeInt8:
|
||||
val = gconv.Int8(val)
|
||||
case ConfigTypeInt16:
|
||||
val = gconv.Int16(val)
|
||||
case ConfigTypeInt32:
|
||||
val = gconv.Int32(val)
|
||||
case ConfigTypeInt64:
|
||||
val = gconv.Int64(val)
|
||||
case ConfigTypeUint:
|
||||
val = gconv.Uint(val)
|
||||
case ConfigTypeUint8:
|
||||
val = gconv.Uint8(val)
|
||||
case ConfigTypeUint16:
|
||||
val = gconv.Uint16(val)
|
||||
case ConfigTypeUint32:
|
||||
val = gconv.Uint32(val)
|
||||
case ConfigTypeUint64:
|
||||
val = gconv.Uint64(val)
|
||||
case ConfigTypeFloat32:
|
||||
val = gconv.Float32(val)
|
||||
case ConfigTypeFloat64:
|
||||
val = gconv.Float64(val)
|
||||
case ConfigTypeBool:
|
||||
val = gconv.Bool(val)
|
||||
case ConfigTypeDate:
|
||||
val = gconv.Time(val, "Y-m-d")
|
||||
case ConfigTypeDateTime:
|
||||
val = gconv.Time(val, "Y-m-d H:i:s")
|
||||
case ConfigTypeSliceInt:
|
||||
val = gconv.SliceInt(val)
|
||||
case ConfigTypeSliceInt64:
|
||||
val = gconv.SliceInt64(val)
|
||||
case ConfigTypeSliceString:
|
||||
val = gconv.SliceStr(val)
|
||||
default:
|
||||
val = gconv.String(val)
|
||||
}
|
||||
return val
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
// Package consts
|
||||
// @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 consts
|
||||
|
||||
type CtxKey string
|
||||
|
||||
// ContextKey 上下文
|
||||
const (
|
||||
ContextHTTPKey CtxKey = "httpContext" // http上下文变量名称
|
||||
ContextKeyCronArgs CtxKey = "cronArgs" // 定时任务参数
|
||||
ContextKeyCronSn CtxKey = "cronSn" // 定时任务序列号
|
||||
)
|
||||
@@ -0,0 +1,48 @@
|
||||
// Package consts
|
||||
// @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 consts
|
||||
|
||||
import (
|
||||
"hotgo/internal/library/dict"
|
||||
"hotgo/internal/model"
|
||||
)
|
||||
|
||||
func init() {
|
||||
dict.RegisterEnums("creditType", "资金变动类型", CreditTypeOptions)
|
||||
dict.RegisterEnums("creditGroup", "资金变动分组", CreditGroupOptions)
|
||||
}
|
||||
|
||||
const (
|
||||
CreditTypeBalance = "balance" // 余额
|
||||
CreditTypeIntegral = "integral" // 积分
|
||||
)
|
||||
|
||||
const (
|
||||
CreditGroupDecr = "decr" // 扣款
|
||||
CreditGroupIncr = "incr" // 加款
|
||||
CreditGroupOpDecr = "op_decr" // 操作扣款
|
||||
CreditGroupOpIncr = "op_incr" // 操作加款
|
||||
CreditGroupBalanceRecharge = "balance_recharge" // 余额充值
|
||||
CreditGroupBalanceRefund = "balance_refund" // 余额退款
|
||||
CreditGroupApplyCash = "apply_cash" // 申请提现
|
||||
)
|
||||
|
||||
// CreditTypeOptions 变动类型
|
||||
var CreditTypeOptions = []*model.Option{
|
||||
dict.GenSuccessOption(CreditTypeBalance, "余额"),
|
||||
dict.GenInfoOption(CreditTypeIntegral, "积分"),
|
||||
}
|
||||
|
||||
// CreditGroupOptions 变动分组
|
||||
var CreditGroupOptions = []*model.Option{
|
||||
dict.GenWarningOption(CreditGroupDecr, "扣款"),
|
||||
dict.GenSuccessOption(CreditGroupIncr, "加款"),
|
||||
dict.GenWarningOption(CreditGroupOpDecr, "操作扣款"),
|
||||
dict.GenSuccessOption(CreditGroupOpIncr, "操作加款"),
|
||||
dict.GenWarningOption(CreditGroupBalanceRefund, "余额退款"),
|
||||
dict.GenSuccessOption(CreditGroupBalanceRecharge, "余额充值"),
|
||||
dict.GenInfoOption(CreditGroupApplyCash, "申请提现"),
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
// Package consts
|
||||
// @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 consts
|
||||
|
||||
// 定时任务
|
||||
|
||||
const (
|
||||
CronSplitStr = "," // 变量分割符
|
||||
CronPolicySame = 1 // 并行策略
|
||||
CronPolicySingle = 2 // 单例策略
|
||||
CronPolicyOnce = 3 // 单次策略
|
||||
CronPolicyTimes = 4 // 多次策略
|
||||
)
|
||||
@@ -0,0 +1,37 @@
|
||||
// Package consts
|
||||
// @Link https://github.com/bufanyun/hotgo
|
||||
// @Copyright Copyright (c) 2025 HotGo CLI
|
||||
// @Author Ms <133814250@qq.com>
|
||||
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
|
||||
package consts
|
||||
|
||||
// 碎片
|
||||
|
||||
const (
|
||||
DemoTips = "演示系统已隐藏" // 演示系统敏感数据打码
|
||||
NilJsonToString = "{}" // 空json初始化值
|
||||
RegionSpilt = " / " // 地区分隔符
|
||||
Unknown = "Unknown" // Unknown
|
||||
SuperRoleKey = "super" // 超管角色唯一标识符,通过角色验证超管
|
||||
MaxServeLogContentLen = 2048 // 最大保留服务日志内容大小
|
||||
SysDefaultLanguage = "zh_CN" // 系统默认语言,当配置文件没有国际化配置时生效
|
||||
)
|
||||
|
||||
// curd.
|
||||
const (
|
||||
DefaultPage = 10 // 默认列表分页加载数量
|
||||
DefaultPageSize = 1 // 默认列表分页加载页码
|
||||
MaxSortIncr = 10 // 最大排序值增量
|
||||
)
|
||||
|
||||
// TenantField 租户字段
|
||||
const (
|
||||
TenantId = "tenant_id" // 租户ID
|
||||
MerchantId = "merchant_id" // 商户ID
|
||||
UserId = "user_id" // 用户ID
|
||||
)
|
||||
|
||||
const (
|
||||
DBMysql = "mysql"
|
||||
DBPgsql = "pgsql"
|
||||
)
|
||||
@@ -0,0 +1,30 @@
|
||||
// Package consts
|
||||
// @Link https://github.com/bufanyun/hotgo
|
||||
// @Copyright Copyright (c) 2024 HotGo CLI
|
||||
// @Author Ms <133814250@qq.com>
|
||||
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
|
||||
package consts
|
||||
|
||||
import (
|
||||
"hotgo/internal/library/dict"
|
||||
"hotgo/internal/model"
|
||||
)
|
||||
|
||||
func init() {
|
||||
dict.RegisterEnums("deptType", "部门类型选项", DeptTypeOptions)
|
||||
}
|
||||
|
||||
const (
|
||||
DeptTypeCompany = "company" // 公司
|
||||
DeptTypeTenant = "tenant" // 租户
|
||||
DeptTypeMerchant = "merchant" // 商户
|
||||
DeptTypeUser = "user" // 用户
|
||||
)
|
||||
|
||||
// DeptTypeOptions 部门类型选项
|
||||
var DeptTypeOptions = []*model.Option{
|
||||
dict.GenSuccessOption(DeptTypeCompany, "公司"),
|
||||
dict.GenErrorOption(DeptTypeTenant, "租户"),
|
||||
dict.GenInfoOption(DeptTypeMerchant, "商户"),
|
||||
dict.GenWarningOption(DeptTypeUser, "用户"),
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
// Package consts
|
||||
// @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 consts
|
||||
|
||||
import "github.com/gogf/gf/v2/frame/g"
|
||||
|
||||
// 邮件内置模板
|
||||
const (
|
||||
EmsTemplateText = "text" // 通用文本
|
||||
EmsTemplateCode = "code" // 通用验证码
|
||||
EmsTemplateLogin = "login" // 登录
|
||||
EmsTemplateRegister = "register" // 注册
|
||||
EmsTemplateResetPwd = "resetPwd" // 重置密码
|
||||
EmsTemplateBind = "bind" // 绑定邮箱
|
||||
EmsTemplateCash = "cash" // 申请提现
|
||||
)
|
||||
|
||||
var EmsSubjectMap = g.MapStrStr{
|
||||
EmsTemplateText: "这是一封来自HotGo的邮件",
|
||||
EmsTemplateCode: "验证码",
|
||||
EmsTemplateLogin: "登录验证码",
|
||||
EmsTemplateRegister: "注册验证码",
|
||||
EmsTemplateResetPwd: "重置密码",
|
||||
EmsTemplateBind: "绑定邮箱验证码",
|
||||
EmsTemplateCash: "申请提现验证码",
|
||||
}
|
||||
|
||||
// IsCodeEmsTemplate 是否是验证码类型的模板
|
||||
func IsCodeEmsTemplate(template string) bool {
|
||||
return template == EmsTemplateCode ||
|
||||
template == EmsTemplateLogin ||
|
||||
template == EmsTemplateRegister ||
|
||||
template == EmsTemplateBind ||
|
||||
template == EmsTemplateCash
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
// Package consts
|
||||
// @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 consts
|
||||
|
||||
import (
|
||||
"github.com/gogf/gf/v2/text/gstr"
|
||||
)
|
||||
|
||||
// 错误解释
|
||||
const (
|
||||
ErrorORM = "sql执行异常"
|
||||
ErrorNotData = "数据不存在"
|
||||
ErrorRotaPointer = "指针转换异常"
|
||||
)
|
||||
|
||||
// 需要隐藏真实错误的Wrap,开启访问日志后仍然会将真实错误记录
|
||||
var concealErrorSlice = []string{ErrorORM, ErrorRotaPointer}
|
||||
|
||||
// ErrorMessage 错误显示信息,非debug模式有效
|
||||
func ErrorMessage(err error) (message string) {
|
||||
if err == nil {
|
||||
return "操作失败!~"
|
||||
}
|
||||
|
||||
message = err.Error()
|
||||
for _, e := range concealErrorSlice {
|
||||
if gstr.Contains(message, e) {
|
||||
return "操作失败,请稍后重试!~"
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
// Package consts
|
||||
// @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 consts
|
||||
|
||||
const (
|
||||
EventServerClose = "server.close" // 服务关闭事件
|
||||
)
|
||||
@@ -0,0 +1,96 @@
|
||||
// Package consts
|
||||
// @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 consts
|
||||
|
||||
import (
|
||||
"hotgo/internal/library/dict"
|
||||
"hotgo/internal/model"
|
||||
)
|
||||
|
||||
// 生成代码类型
|
||||
const (
|
||||
GenCodesTypeCurd = 10 // 增删改查列表
|
||||
GenCodesTypeTree = 11 // 树列表
|
||||
GenCodesTypeQueue = 20 // 队列消费者
|
||||
GenCodesTypeCron = 30 // 定时任务
|
||||
)
|
||||
|
||||
var GenCodesTypeNameMap = map[int]string{
|
||||
GenCodesTypeCurd: "增删改查列表",
|
||||
GenCodesTypeTree: "关系树列表",
|
||||
GenCodesTypeQueue: "队列消费者(未实现)",
|
||||
GenCodesTypeCron: "定时任务(未实现)",
|
||||
}
|
||||
|
||||
var GenCodesTypeConfMap = map[int]string{
|
||||
GenCodesTypeCurd: "crud",
|
||||
GenCodesTypeTree: "tree",
|
||||
GenCodesTypeQueue: "queue",
|
||||
GenCodesTypeCron: "cron",
|
||||
}
|
||||
|
||||
// 生成代码状态
|
||||
const (
|
||||
GenCodesStatusOk = 1 // 生成成功
|
||||
GenCodesStatusWait = 2 // 未生成
|
||||
GenCodesStatusFail = 3 // 生成失败
|
||||
)
|
||||
|
||||
var GenCodesStatusNameMap = map[int]string{
|
||||
GenCodesStatusOk: "生成成功",
|
||||
GenCodesStatusWait: "未生成",
|
||||
GenCodesStatusFail: "生成失败",
|
||||
}
|
||||
|
||||
// 生成代码关联表方式
|
||||
const (
|
||||
GenCodesJoinLeft = 1 // 左关联
|
||||
GenCodesJoinRight = 2 // 右关联
|
||||
GenCodesJoinInner = 3 // 内关联
|
||||
)
|
||||
|
||||
var GenCodesJoinNameMap = map[int]string{
|
||||
GenCodesJoinLeft: "左关联",
|
||||
GenCodesJoinRight: "右关联",
|
||||
GenCodesJoinInner: "内关联",
|
||||
}
|
||||
|
||||
var GenCodesJoinLinkMap = map[int]string{
|
||||
GenCodesJoinLeft: "LeftJoin",
|
||||
GenCodesJoinRight: "RightJoin",
|
||||
GenCodesJoinInner: "InnerJoin",
|
||||
}
|
||||
|
||||
// 生成代码的生成方式
|
||||
const (
|
||||
GenCodesBuildMethCreate = 1 // 创建
|
||||
GenCodesBuildMethCover = 2 // 覆盖
|
||||
GenCodesBuildMethSkip = 3 // 跳过
|
||||
GenCodesBuildIgnore = 4 // 不生成
|
||||
)
|
||||
|
||||
var GenCodesBuildMethNameMap = map[int]string{
|
||||
GenCodesBuildMethCreate: "创建文件",
|
||||
GenCodesBuildMethCover: "强制覆盖",
|
||||
GenCodesBuildMethSkip: "已存在跳过",
|
||||
GenCodesBuildIgnore: "不生成",
|
||||
}
|
||||
|
||||
const (
|
||||
GenCodesIndexPK = "PRI" // 主键索引
|
||||
GenCodesIndexUNI = "UNI" // 唯一索引
|
||||
)
|
||||
|
||||
const (
|
||||
GenCodesTreeStyleTypeNormal = 1 // 普通树表格
|
||||
GenCodesTreeStyleTypeOption = 2 // 选项式树表
|
||||
)
|
||||
|
||||
// GenCodesTreeStyleTypeOptions 树表样式选项
|
||||
var GenCodesTreeStyleTypeOptions = []*model.Option{
|
||||
dict.GenSuccessOption(GenCodesTreeStyleTypeNormal, "普通树表格"),
|
||||
dict.GenInfoOption(GenCodesTreeStyleTypeOption, "选项式树表"),
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
// Package consts
|
||||
// @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 consts
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"hotgo/internal/library/dict"
|
||||
"hotgo/internal/model"
|
||||
"net/http"
|
||||
|
||||
"github.com/gogf/gf/v2/errors/gcode"
|
||||
)
|
||||
|
||||
func init() {
|
||||
dict.RegisterEnums("HTTPMethod", "HTTP请求方式选项", HTTPMethodOptions)
|
||||
dict.RegisterEnums("HTTPHandlerTime", "HTTP处理耗时选项", HTTPHandlerTimeOptions)
|
||||
dict.RegisterEnums("HTTPApiCode", "HTTP接口状态码选项", HTTPApiCodeOptions)
|
||||
}
|
||||
|
||||
const (
|
||||
HTTPContentTypeXml = "text/xml"
|
||||
HTTPContentTypeHtml = "text/html"
|
||||
HTTPContentTypeStream = "text/event-stream"
|
||||
HTTPContentTypeJson = "application/json"
|
||||
HTTPContentTypeOctetStream = "application/octet-stream"
|
||||
)
|
||||
|
||||
// HTTPMethodOptions HTTP请求方式选项
|
||||
var HTTPMethodOptions = []*model.Option{
|
||||
dict.GenSuccessOption(http.MethodGet, "GET"),
|
||||
dict.GenInfoOption(http.MethodPost, "POST"),
|
||||
dict.GenSuccessOption(http.MethodPut, "PUT"),
|
||||
dict.GenInfoOption(http.MethodDelete, "DELETE"),
|
||||
}
|
||||
|
||||
const (
|
||||
HTTPHandlerTime50 = "< 50"
|
||||
HTTPHandlerTime200 = "< 200"
|
||||
HTTPHandlerTime200To500 = "BETWEEN 200 AND 500"
|
||||
HTTPHandlerTime500To1000 = "BETWEEN 500 AND 1000"
|
||||
HTTPHandlerTime1000To10000 = "BETWEEN 1000 AND 10000"
|
||||
HTTPHandlerTime10000UP = "> 10000"
|
||||
)
|
||||
|
||||
// HTTPHandlerTimeOptions HTTP处理耗时选项
|
||||
var HTTPHandlerTimeOptions = []*model.Option{
|
||||
dict.GenSuccessOption(HTTPHandlerTime50, "50ms以内"),
|
||||
dict.GenInfoOption(HTTPHandlerTime200, "200ms以内"),
|
||||
dict.GenSuccessOption(HTTPHandlerTime200To500, "200~500ms"),
|
||||
dict.GenSuccessOption(HTTPHandlerTime500To1000, "500~1000ms"),
|
||||
dict.GenInfoOption(HTTPHandlerTime1000To10000, "1000~10000ms"),
|
||||
dict.GenInfoOption(HTTPHandlerTime10000UP, "10000ms以上"),
|
||||
}
|
||||
|
||||
// HTTPApiCodeOptions HTTP接口状态码选项
|
||||
var HTTPApiCodeOptions = []*model.Option{
|
||||
dict.GenSuccessOption(gcode.CodeOK.Code(), fmt.Sprintf("%v %v", gcode.CodeOK.Code(), "成功")),
|
||||
dict.GenWarningOption(gcode.CodeNil.Code(), fmt.Sprintf("%v %v", gcode.CodeNil.Code(), "失败")),
|
||||
dict.GenWarningOption(gcode.CodeSecurityReason.Code(), fmt.Sprintf("%v %v", gcode.CodeSecurityReason.Code(), "无访问权限")),
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
// Package consts
|
||||
// @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 consts
|
||||
|
||||
// 公告类型
|
||||
const (
|
||||
NoticeTypeNotify = 1 // 通知
|
||||
NoticeTypeNotice = 2 // 公告
|
||||
NoticeTypeLetter = 3 // 私信
|
||||
)
|
||||
@@ -0,0 +1,66 @@
|
||||
// Package consts
|
||||
// @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 consts
|
||||
|
||||
import (
|
||||
"hotgo/internal/library/dict"
|
||||
"hotgo/internal/model"
|
||||
)
|
||||
|
||||
func init() {
|
||||
dict.RegisterEnums("orderStatus", "订单状态", OrderStatusOptions)
|
||||
dict.RegisterEnums("acceptRefundStatus", "订单退款受理状态", OrderAcceptRefundOptions)
|
||||
}
|
||||
|
||||
// 订单分组
|
||||
// 为不同的业务订单设置不同的分组,分组可以设置不同的业务回调方法
|
||||
|
||||
const (
|
||||
OrderGroupDefault = "order" // 普通订单
|
||||
OrderGroupAdminOrder = "admin_order" // 后台充值订单
|
||||
// 还可以设置其他,方便后期扩展..
|
||||
)
|
||||
|
||||
// 订单类型
|
||||
|
||||
const (
|
||||
OrderTypeBalance = "balance" // 余额充值
|
||||
OrderTypeProduct = "product" // 购买产品
|
||||
)
|
||||
|
||||
const (
|
||||
OrderStatusALL = -1 // 全部状态
|
||||
OrderStatusNotPay = 1 // 待付款
|
||||
OrderStatusPay = 2 // 已付款
|
||||
OrderStatusShipments = 3 // 已发货
|
||||
OrderStatusDone = 4 // 已完成
|
||||
OrderStatusClose = 5 // 已关闭
|
||||
OrderStatusReturnRequest = 6 // 申请退款
|
||||
OrderStatusReturning = 7 // 退款中
|
||||
OrderStatusReturned = 8 // 已退款
|
||||
OrderStatusReturnReject = 9 // 拒绝退款
|
||||
)
|
||||
|
||||
// OrderStatusOptions 订单状态选项
|
||||
var OrderStatusOptions = []*model.Option{
|
||||
dict.GenInfoOption(OrderStatusALL, "全部"),
|
||||
dict.GenInfoOption(OrderStatusNotPay, "待付款"),
|
||||
dict.GenInfoOption(OrderStatusPay, "已付款"),
|
||||
dict.GenInfoOption(OrderStatusShipments, "已发货"),
|
||||
dict.GenSuccessOption(OrderStatusDone, "已完成"),
|
||||
dict.GenDefaultOption(OrderStatusClose, "已关闭"),
|
||||
dict.GenWarningOption(OrderStatusReturnRequest, "申请退款"),
|
||||
dict.GenDefaultOption(OrderStatusReturning, "退款中"),
|
||||
dict.GenErrorOption(OrderStatusReturned, "已退款"),
|
||||
dict.GenWarningOption(OrderStatusReturnReject, "拒绝退款"),
|
||||
}
|
||||
|
||||
// OrderAcceptRefundOptions 订单退款受理状态
|
||||
var OrderAcceptRefundOptions = []*model.Option{
|
||||
dict.GenWarningOption(OrderStatusReturnRequest, "申请退款"),
|
||||
dict.GenSuccessOption(OrderStatusReturned, "已退款"),
|
||||
dict.GenErrorOption(OrderStatusReturnReject, "拒绝退款"),
|
||||
}
|
||||
@@ -0,0 +1,105 @@
|
||||
// Package consts
|
||||
// @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 consts
|
||||
|
||||
import (
|
||||
"hotgo/internal/library/dict"
|
||||
"hotgo/internal/model"
|
||||
)
|
||||
|
||||
// 支付方式
|
||||
|
||||
func init() {
|
||||
dict.RegisterEnums("payType", "支付方式", PayTypeOptions)
|
||||
dict.RegisterEnums("payStatus", "支付状态", PayStatusOptions)
|
||||
}
|
||||
|
||||
const (
|
||||
PayTypeALL = "" // 全部
|
||||
PayTypeWxPay = "wxpay" // 微信支付
|
||||
PayTypeAliPay = "alipay" // 支付宝
|
||||
PayTypeQQPay = "qqpay" // QQ支付
|
||||
PayTypeBalance = "balance" // 余额支付
|
||||
PayTypeBankTransfer = "bank_transfer" // 银行转账
|
||||
PayTypeManual = "manual" // 人工支付
|
||||
)
|
||||
|
||||
var (
|
||||
PayTypeSlice = []string{
|
||||
PayTypeWxPay, PayTypeAliPay, PayTypeQQPay, PayTypeBalance, PayTypeBankTransfer, PayTypeManual,
|
||||
}
|
||||
|
||||
PayTypeNameMap = map[string]string{
|
||||
PayTypeALL: "全部",
|
||||
PayTypeWxPay: "微信支付",
|
||||
PayTypeAliPay: "支付宝",
|
||||
PayTypeQQPay: "QQ支付",
|
||||
PayTypeBalance: "余额支付",
|
||||
PayTypeBankTransfer: "银行转账",
|
||||
PayTypeManual: "人工支付",
|
||||
}
|
||||
)
|
||||
|
||||
// 交易方式
|
||||
|
||||
const (
|
||||
// 微信
|
||||
TradeTypeWxMP = "mp" // 公众号
|
||||
TradeTypeWxMini = "mini" // 小程序
|
||||
TradeTypeWxApp = "app" // APP
|
||||
TradeTypeWxScan = "scan" // 二维码扫码
|
||||
TradeTypeWxPos = "pos" // 二维码收款
|
||||
TradeTypeWxH5 = "h5" // H5
|
||||
|
||||
// 支付宝
|
||||
TradeTypeAliWeb = "web" // 电脑网页
|
||||
TradeTypeAliApp = "app" // APP
|
||||
TradeTypeAliScan = "scan" // 二维码扫码
|
||||
TradeTypeAliWap = "wap" // 手机网页
|
||||
TradeTypeAliPos = "pos" // 二维码收款
|
||||
|
||||
// QQ
|
||||
TradeTypeQQWeb = "qqweb" // PC网页
|
||||
TradeTypeQQWap = "qqwap" // 移动端
|
||||
)
|
||||
|
||||
var (
|
||||
TradeTypeWxSlice = []string{TradeTypeWxMP, TradeTypeWxMini, TradeTypeWxApp, TradeTypeWxScan, TradeTypeWxPos, TradeTypeWxH5}
|
||||
TradeTypeAliSlice = []string{TradeTypeAliWeb, TradeTypeAliApp, TradeTypeAliScan, TradeTypeAliWap, TradeTypeAliPos}
|
||||
TradeTypeQQSlice = []string{TradeTypeQQWeb, TradeTypeQQWap}
|
||||
)
|
||||
|
||||
// 支付状态
|
||||
|
||||
const (
|
||||
PayStatusWait = 1 // 待支付
|
||||
PayStatusOk = 2 // 已支付
|
||||
)
|
||||
|
||||
// PayStatusOptions 支付状态选项
|
||||
var PayStatusOptions = []*model.Option{
|
||||
dict.GenDefaultOption(PayStatusWait, "待支付"),
|
||||
dict.GenSuccessOption(PayStatusOk, "已支付"),
|
||||
}
|
||||
|
||||
// 退款状态
|
||||
|
||||
const (
|
||||
RefundStatusNo = 1 // 未退款
|
||||
RefundStatusApply = 2 // 申请退款
|
||||
RefundStatusReject = 3 // 拒绝退款
|
||||
RefundStatusAgree = 4 // 同意退款,已退款
|
||||
)
|
||||
|
||||
// PayTypeOptions 支付方式选项
|
||||
var PayTypeOptions = []*model.Option{
|
||||
dict.GenSuccessOption(PayTypeWxPay, "微信支付"),
|
||||
dict.GenInfoOption(PayTypeAliPay, "支付宝"),
|
||||
dict.GenDefaultOption(PayTypeQQPay, "QQ支付"),
|
||||
dict.GenPrimaryOption(PayTypeBalance, "余额支付"),
|
||||
dict.GenInfoOption(PayTypeBankTransfer, "银行转账"),
|
||||
dict.GenWarningOption(PayTypeManual, "人工支付"),
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
package consts
|
||||
|
||||
import (
|
||||
"hotgo/internal/library/dict"
|
||||
"hotgo/internal/model"
|
||||
)
|
||||
|
||||
const (
|
||||
BizPublishDraft = 1
|
||||
BizPublishPending = 2
|
||||
BizPublishPublished = 3
|
||||
BizPublishOffline = 4
|
||||
BizPublishArchived = 5
|
||||
|
||||
BannerTargetNone = 1
|
||||
BannerTargetInternal = 2
|
||||
BannerTargetExternal = 3
|
||||
|
||||
ProductTypeStandard = 1
|
||||
ProductTypeManual = 2
|
||||
|
||||
SiteFeatureEnabled = 1
|
||||
SiteFeatureDisabled = 2
|
||||
|
||||
SiteProductModeProduct = 1
|
||||
SiteProductModeCreditCard = 2
|
||||
)
|
||||
|
||||
var BizPublishStatusOptions = []*model.Option{
|
||||
dict.GenInfoOption(BizPublishDraft, "草稿"),
|
||||
dict.GenWarningOption(BizPublishPending, "待审"),
|
||||
dict.GenSuccessOption(BizPublishPublished, "已发布"),
|
||||
dict.GenDefaultOption(BizPublishOffline, "已下线"),
|
||||
dict.GenDefaultOption(BizPublishArchived, "已归档"),
|
||||
}
|
||||
|
||||
var BannerTargetTypeOptions = []*model.Option{
|
||||
dict.GenDefaultOption(BannerTargetNone, "无跳转"),
|
||||
dict.GenPrimaryOption(BannerTargetInternal, "内部路由"),
|
||||
dict.GenInfoOption(BannerTargetExternal, "外部链接"),
|
||||
}
|
||||
|
||||
var BannerPositionOptions = []*model.Option{
|
||||
dict.GenPrimaryOption("home_top", "首页顶部"),
|
||||
dict.GenInfoOption("home_popup", "首页弹窗"),
|
||||
}
|
||||
|
||||
var ProductTypeOptions = []*model.Option{
|
||||
dict.GenPrimaryOption(ProductTypeStandard, "标准商品"),
|
||||
dict.GenInfoOption(ProductTypeManual, "手工商城商品"),
|
||||
}
|
||||
|
||||
var SiteFeatureSwitchOptions = []*model.Option{
|
||||
dict.GenSuccessOption(SiteFeatureEnabled, "开启"),
|
||||
dict.GenDefaultOption(SiteFeatureDisabled, "关闭"),
|
||||
}
|
||||
|
||||
var SiteProductModeOptions = []*model.Option{
|
||||
dict.GenPrimaryOption(SiteProductModeProduct, "商品"),
|
||||
dict.GenInfoOption(SiteProductModeCreditCard, "信用卡"),
|
||||
}
|
||||
|
||||
func init() {
|
||||
dict.RegisterEnums("bizPublishStatus", "业务发布状态", BizPublishStatusOptions)
|
||||
dict.RegisterEnums("bannerTargetType", "Banner跳转类型", BannerTargetTypeOptions)
|
||||
dict.RegisterEnums("bannerPosition", "Banner投放位置", BannerPositionOptions)
|
||||
dict.RegisterEnums("productType", "商品类型", ProductTypeOptions)
|
||||
dict.RegisterEnums("siteFeatureSwitch", "站点功能开关", SiteFeatureSwitchOptions)
|
||||
dict.RegisterEnums("siteProductMode", "站点商城模式", SiteProductModeOptions)
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package consts
|
||||
|
||||
import (
|
||||
"hotgo/internal/library/dict"
|
||||
"hotgo/internal/model"
|
||||
)
|
||||
|
||||
const (
|
||||
TaskSubmissionPending = 1
|
||||
TaskSubmissionApproved = 2
|
||||
TaskSubmissionRejected = 3
|
||||
TaskSubmissionSettled = 4
|
||||
TaskSubmissionReversed = 5
|
||||
)
|
||||
|
||||
var TaskSubmissionStatusOptions = []*model.Option{
|
||||
dict.GenWarningOption(TaskSubmissionPending, "待审核"),
|
||||
dict.GenPrimaryOption(TaskSubmissionApproved, "已通过"),
|
||||
dict.GenErrorOption(TaskSubmissionRejected, "已驳回"),
|
||||
dict.GenSuccessOption(TaskSubmissionSettled, "已结算"),
|
||||
dict.GenDefaultOption(TaskSubmissionReversed, "已冲正"),
|
||||
}
|
||||
|
||||
func init() {
|
||||
dict.RegisterEnums("taskSubmissionStatus", "会员任务审核状态", TaskSubmissionStatusOptions)
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
// Package consts
|
||||
// @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 consts
|
||||
|
||||
const (
|
||||
ClusterSyncSysconfig = "cluster.sync.sysConfig" // 系统配置
|
||||
ClusterSyncSysBlacklist = "cluster.sync.sysBlacklist" // 系统黑名单
|
||||
ClusterSyncSysSuperAdmin = "cluster.sync.superAdmin" // 超管
|
||||
)
|
||||
@@ -0,0 +1,14 @@
|
||||
// Package consts
|
||||
// @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 consts
|
||||
|
||||
// 消息队列
|
||||
const (
|
||||
QueueLogTopic = `request_log` // 访问日志
|
||||
QueueLoginLogTopic = `login_log` // 登录日志
|
||||
QueueServeLogTopic = `serve_log` // 服务日志
|
||||
)
|
||||
@@ -0,0 +1,90 @@
|
||||
// Package consts
|
||||
// @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 consts
|
||||
|
||||
// 数据范围
|
||||
const (
|
||||
RoleDataAll = 1 // 全部权限
|
||||
|
||||
// 通过部门划分
|
||||
RoleDataNowDept = 2 // 当前部门
|
||||
RoleDataDeptAndSub = 3 // 当前部门及以下部门
|
||||
RoleDataDeptCustom = 4 // 自定义部门
|
||||
|
||||
// 通过上下级关系划分
|
||||
RoleDataSelf = 5 // 仅自己
|
||||
RoleDataSelfAndSub = 6 // 自己和直属下级
|
||||
RoleDataSelfAndAllSub = 7 // 自己和全部下级
|
||||
)
|
||||
|
||||
var RoleDataNameMap = map[int]string{
|
||||
RoleDataAll: "全部权限",
|
||||
RoleDataNowDept: "当前部门",
|
||||
RoleDataDeptAndSub: "当前及以下部门",
|
||||
RoleDataDeptCustom: "自定义部门",
|
||||
RoleDataSelf: "仅自己",
|
||||
RoleDataSelfAndSub: "自己和直属下级",
|
||||
RoleDataSelfAndAllSub: "自己和全部下级",
|
||||
}
|
||||
|
||||
type GroupScopeSelect struct {
|
||||
Type string `json:"type,omitempty"`
|
||||
Label string `json:"label"`
|
||||
Key int `json:"key"`
|
||||
Value int `json:"value,omitempty"`
|
||||
Children []ScopeSelect `json:"children,omitempty"`
|
||||
}
|
||||
|
||||
type ScopeSelect struct {
|
||||
Label string `json:"label"`
|
||||
Value int `json:"value"`
|
||||
}
|
||||
|
||||
var DataScopeSelect = []GroupScopeSelect{
|
||||
{
|
||||
Label: RoleDataNameMap[RoleDataAll],
|
||||
Key: RoleDataAll,
|
||||
Value: RoleDataAll,
|
||||
},
|
||||
{
|
||||
Type: "group",
|
||||
Label: "按部门划分",
|
||||
Key: -1,
|
||||
Children: []ScopeSelect{
|
||||
{
|
||||
Label: RoleDataNameMap[RoleDataNowDept],
|
||||
Value: RoleDataNowDept,
|
||||
},
|
||||
{
|
||||
Label: RoleDataNameMap[RoleDataDeptAndSub],
|
||||
Value: RoleDataDeptAndSub,
|
||||
},
|
||||
{
|
||||
Label: RoleDataNameMap[RoleDataDeptCustom],
|
||||
Value: RoleDataDeptCustom,
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
Type: "group",
|
||||
Label: "按上下级关系划分",
|
||||
Key: -2,
|
||||
Children: []ScopeSelect{
|
||||
{
|
||||
Label: RoleDataNameMap[RoleDataSelf],
|
||||
Value: RoleDataSelf,
|
||||
},
|
||||
{
|
||||
Label: RoleDataNameMap[RoleDataSelfAndSub],
|
||||
Value: RoleDataSelfAndSub,
|
||||
},
|
||||
{
|
||||
Label: RoleDataNameMap[RoleDataSelfAndAllSub],
|
||||
Value: RoleDataSelfAndAllSub,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
// Package consts
|
||||
// @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 consts
|
||||
|
||||
import (
|
||||
"hotgo/internal/library/dict"
|
||||
"hotgo/internal/model"
|
||||
)
|
||||
|
||||
func init() {
|
||||
dict.RegisterEnums("ServerLicenseGroupOptions", "服务授权分组选项", ServerLicenseGroupOptions)
|
||||
}
|
||||
|
||||
// 授权分组
|
||||
const (
|
||||
LicenseGroupDefault = "default" // 默认组
|
||||
LicenseGroupCron = "cron" // 定时任务
|
||||
LicenseGroupAuth = "auth" // 服务授权
|
||||
)
|
||||
|
||||
// ServerLicenseGroupOptions 服务授权分组选项
|
||||
var ServerLicenseGroupOptions = []*model.Option{
|
||||
dict.GenWarningOption(LicenseGroupDefault, "默认组"),
|
||||
dict.GenSuccessOption(LicenseGroupCron, "定时任务"),
|
||||
dict.GenSuccessOption(LicenseGroupAuth, "服务授权"),
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
// Package consts
|
||||
// @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 consts
|
||||
|
||||
// 短信驱动
|
||||
const (
|
||||
SmsDriveAliYun = "aliyun" // 阿里云
|
||||
SmsDriveTencent = "tencent" // 腾讯云
|
||||
)
|
||||
|
||||
// 短信内置模板
|
||||
const (
|
||||
SmsTemplateCode = "code" // 通用验证码
|
||||
SmsTemplateLogin = "login" // 登录
|
||||
SmsTemplateRegister = "register" // 注册
|
||||
SmsTemplateResetPwd = "resetPwd" // 重置密码
|
||||
SmsTemplateBind = "bind" // 绑定手机号
|
||||
SmsTemplateCash = "cash" // 申请提现
|
||||
)
|
||||
|
||||
var (
|
||||
SmsTemplateEventMap = map[string]string{
|
||||
SmsTemplateCode: "通用验证码",
|
||||
SmsTemplateLogin: "登录",
|
||||
SmsTemplateRegister: "注册",
|
||||
SmsTemplateResetPwd: "重置密码",
|
||||
SmsTemplateBind: "绑定手机号",
|
||||
SmsTemplateCash: "申请提现",
|
||||
}
|
||||
)
|
||||
@@ -0,0 +1,49 @@
|
||||
// Package consts
|
||||
// @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 consts
|
||||
|
||||
import (
|
||||
"hotgo/internal/library/dict"
|
||||
"hotgo/internal/model"
|
||||
)
|
||||
|
||||
func init() {
|
||||
dict.RegisterEnums("CodeStatusOptions", "验证码状态选项", CodeStatusOptions)
|
||||
dict.RegisterEnums("BlacklistStatusOptions", "黑名单拉黑状态选项", BlacklistStatusOptions)
|
||||
}
|
||||
|
||||
// 状态码
|
||||
const (
|
||||
StatusALL int = -1 // 全部状态
|
||||
StatusEnabled int = 1 // 启用
|
||||
StatusDisable int = 2 // 禁用
|
||||
StatusDelete int = 3 // 已删除
|
||||
)
|
||||
|
||||
var StatusSlice = []int{StatusALL, StatusEnabled, StatusDisable, StatusDelete}
|
||||
|
||||
// 验证码状态
|
||||
const (
|
||||
CodeStatusNotUsed = 1 // 未使用
|
||||
CodeStatusUsed = 2 // 已使用
|
||||
)
|
||||
|
||||
// CodeStatusOptions 验证码状态选项
|
||||
var CodeStatusOptions = []*model.Option{
|
||||
dict.GenWarningOption(CodeStatusNotUsed, "未使用"),
|
||||
dict.GenSuccessOption(CodeStatusUsed, "已使用"),
|
||||
}
|
||||
|
||||
const (
|
||||
BlacklistStatusDisable = 1 // 封禁中
|
||||
BlacklistStatusEnabled = 2 // 已解封
|
||||
)
|
||||
|
||||
// BlacklistStatusOptions 黑名单拉黑状态选项
|
||||
var BlacklistStatusOptions = []*model.Option{
|
||||
dict.GenWarningOption(BlacklistStatusDisable, "封禁中"),
|
||||
dict.GenSuccessOption(BlacklistStatusEnabled, "已解封"),
|
||||
}
|
||||
@@ -0,0 +1,122 @@
|
||||
package consts
|
||||
|
||||
import (
|
||||
"hotgo/internal/library/dict"
|
||||
"hotgo/internal/model"
|
||||
)
|
||||
|
||||
const (
|
||||
TradeOrderTypeProduct = 1
|
||||
TradeOrderTypeTask = 2
|
||||
TradeOrderTypeManual = 3
|
||||
|
||||
TradeOrderMatching = 1
|
||||
TradeOrderPending = 2
|
||||
TradeOrderProcessing = 3
|
||||
TradeOrderCompleted = 4
|
||||
TradeOrderTimeout = 5
|
||||
TradeOrderFrozen = 6
|
||||
TradeOrderCancelled = 7
|
||||
TradeOrderFailed = 8
|
||||
|
||||
TradeFreezeNormal = 1
|
||||
TradeFreezeFrozen = 2
|
||||
TradeFreezePending = 3
|
||||
|
||||
TradeActionCancelMatch = "cancel_match"
|
||||
TradeActionRematch = "rematch"
|
||||
TradeActionUnfreeze = "unfreeze"
|
||||
|
||||
RechargeTypeOnline = 1
|
||||
RechargeTypeManual = 2
|
||||
|
||||
RechargeUnpaid = 1
|
||||
RechargeReview = 2
|
||||
RechargeSuccess = 3
|
||||
RechargeRejected = 4
|
||||
RechargeExpired = 5
|
||||
RechargeCancelled = 6
|
||||
|
||||
WithdrawalPending = 1
|
||||
WithdrawalReviewing = 2
|
||||
WithdrawalProcessing = 3
|
||||
WithdrawalSuccess = 4
|
||||
WithdrawalFailed = 5
|
||||
WithdrawalRejected = 6
|
||||
WithdrawalCancelled = 7
|
||||
|
||||
FinanceDecisionApprove = 1
|
||||
FinanceDecisionReject = 2
|
||||
|
||||
CustomerServiceOnline = 1
|
||||
CustomerServiceOffline = 2
|
||||
|
||||
TradeAutoDispatchEnabled = 1
|
||||
TradeAutoDispatchDisabled = 2
|
||||
)
|
||||
|
||||
var TradeOrderTypeOptions = []*model.Option{
|
||||
dict.GenPrimaryOption(TradeOrderTypeProduct, "商品订单"),
|
||||
dict.GenInfoOption(TradeOrderTypeTask, "任务订单"),
|
||||
dict.GenDefaultOption(TradeOrderTypeManual, "手工商城"),
|
||||
}
|
||||
var TradeOrderStatusOptions = []*model.Option{
|
||||
dict.GenInfoOption(TradeOrderMatching, "匹配中"),
|
||||
dict.GenWarningOption(TradeOrderPending, "待处理"),
|
||||
dict.GenPrimaryOption(TradeOrderProcessing, "处理中"),
|
||||
dict.GenSuccessOption(TradeOrderCompleted, "已完成"),
|
||||
dict.GenWarningOption(TradeOrderTimeout, "已超时"),
|
||||
dict.GenErrorOption(TradeOrderFrozen, "已冻结"),
|
||||
dict.GenDefaultOption(TradeOrderCancelled, "已取消"),
|
||||
dict.GenErrorOption(TradeOrderFailed, "失败"),
|
||||
}
|
||||
var TradeFreezeStatusOptions = []*model.Option{
|
||||
dict.GenSuccessOption(TradeFreezeNormal, "正常"),
|
||||
dict.GenErrorOption(TradeFreezeFrozen, "已冻结"),
|
||||
dict.GenWarningOption(TradeFreezePending, "解冻复核中"),
|
||||
}
|
||||
var RechargeTypeOptions = []*model.Option{
|
||||
dict.GenPrimaryOption(RechargeTypeOnline, "线上支付"),
|
||||
dict.GenInfoOption(RechargeTypeManual, "人工充值"),
|
||||
}
|
||||
var RechargeStatusOptions = []*model.Option{
|
||||
dict.GenDefaultOption(RechargeUnpaid, "用户未支付"),
|
||||
dict.GenWarningOption(RechargeReview, "手动审核"),
|
||||
dict.GenSuccessOption(RechargeSuccess, "已入账"),
|
||||
dict.GenErrorOption(RechargeRejected, "手动驳回"),
|
||||
dict.GenDefaultOption(RechargeExpired, "已过期"),
|
||||
dict.GenDefaultOption(RechargeCancelled, "已取消"),
|
||||
}
|
||||
var WithdrawalStatusOptions = []*model.Option{
|
||||
dict.GenWarningOption(WithdrawalPending, "待初审"),
|
||||
dict.GenWarningOption(WithdrawalReviewing, "复核中"),
|
||||
dict.GenPrimaryOption(WithdrawalProcessing, "付款中"),
|
||||
dict.GenSuccessOption(WithdrawalSuccess, "已到账"),
|
||||
dict.GenErrorOption(WithdrawalFailed, "付款失败"),
|
||||
dict.GenErrorOption(WithdrawalRejected, "已驳回"),
|
||||
dict.GenDefaultOption(WithdrawalCancelled, "已取消"),
|
||||
}
|
||||
var FinanceDecisionOptions = []*model.Option{
|
||||
dict.GenSuccessOption(FinanceDecisionApprove, "通过"),
|
||||
dict.GenErrorOption(FinanceDecisionReject, "驳回"),
|
||||
}
|
||||
var CustomerServiceOnlineOptions = []*model.Option{
|
||||
dict.GenSuccessOption(CustomerServiceOnline, "在线"),
|
||||
dict.GenDefaultOption(CustomerServiceOffline, "离线"),
|
||||
}
|
||||
var TradeAutoDispatchOptions = []*model.Option{
|
||||
dict.GenSuccessOption(TradeAutoDispatchEnabled, "自动派单"),
|
||||
dict.GenDefaultOption(TradeAutoDispatchDisabled, "手动领取"),
|
||||
}
|
||||
|
||||
func init() {
|
||||
dict.RegisterEnums("tradeOrderType", "交易订单类型", TradeOrderTypeOptions)
|
||||
dict.RegisterEnums("tradeOrderStatus", "交易订单状态", TradeOrderStatusOptions)
|
||||
dict.RegisterEnums("tradeFreezeStatus", "交易冻结状态", TradeFreezeStatusOptions)
|
||||
dict.RegisterEnums("rechargeType", "充值类型", RechargeTypeOptions)
|
||||
dict.RegisterEnums("rechargeStatus", "充值状态", RechargeStatusOptions)
|
||||
dict.RegisterEnums("withdrawalStatus", "提现状态", WithdrawalStatusOptions)
|
||||
dict.RegisterEnums("financeDecision", "财务审核结论", FinanceDecisionOptions)
|
||||
dict.RegisterEnums("customerServiceOnline", "客服在线状态", CustomerServiceOnlineOptions)
|
||||
dict.RegisterEnums("tradeAutoDispatch", "交易派单方式", TradeAutoDispatchOptions)
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
// Package consts
|
||||
// @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 consts
|
||||
|
||||
// 上传存储驱动
|
||||
const (
|
||||
UploadDriveLocal = "local" // 本地驱动
|
||||
UploadDriveUCloud = "ucloud" // ucloud对象存储
|
||||
UploadDriveCos = "cos" // 腾讯云cos
|
||||
UploadDriveOss = "oss" // 阿里云oss
|
||||
UploadDriveQiNiu = "qiniu" // 七牛云对象存储
|
||||
UploadDriveMinio = "minio" // minio对象存储
|
||||
)
|
||||
@@ -0,0 +1,11 @@
|
||||
// Package consts
|
||||
// @Link https://github.com/bufanyun/hotgo
|
||||
// @Copyright Copyright (c) 2025 HotGo CLI
|
||||
// @Author Ms <133814250@qq.com>
|
||||
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
|
||||
package consts
|
||||
|
||||
// VersionApp HotGo版本
|
||||
const (
|
||||
VersionApp = "2.18.9"
|
||||
)
|
||||
@@ -0,0 +1,18 @@
|
||||
// Package consts
|
||||
// @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 consts
|
||||
|
||||
// 授权类型
|
||||
const (
|
||||
WechatAuthorizeOpenId = "openId" // 设置openid
|
||||
WechatAuthorizeBindLogin = "bindLogin" // 绑定微信登录
|
||||
)
|
||||
|
||||
// 应用授权作用域
|
||||
const (
|
||||
WechatScopeBase = "snsapi_base" // 只获取openid,无需用户授权
|
||||
WechatScopeUserinfo = "snsapi_userinfo" // 获取用户信息,需要授权
|
||||
)
|
||||
@@ -0,0 +1,60 @@
|
||||
// Package admin
|
||||
// @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 admin
|
||||
|
||||
import (
|
||||
"context"
|
||||
"hotgo/api/admin/cash"
|
||||
"hotgo/internal/library/contexts"
|
||||
"hotgo/internal/model/input/adminin"
|
||||
"hotgo/internal/service"
|
||||
)
|
||||
|
||||
var (
|
||||
Cash = cCash{}
|
||||
)
|
||||
|
||||
type cCash struct{}
|
||||
|
||||
// View 获取指定信息
|
||||
func (c *cCash) View(ctx context.Context, req *cash.ViewReq) (res *cash.ViewRes, err error) {
|
||||
data, err := service.AdminCash().View(ctx, &req.CashViewInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(cash.ViewRes)
|
||||
res.CashViewModel = data
|
||||
return
|
||||
}
|
||||
|
||||
// List 查看列表
|
||||
func (c *cCash) List(ctx context.Context, req *cash.ListReq) (res *cash.ListRes, err error) {
|
||||
list, totalCount, err := service.AdminCash().List(ctx, &req.CashListInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(cash.ListRes)
|
||||
res.List = list
|
||||
res.PageRes.Pack(req, totalCount)
|
||||
return
|
||||
}
|
||||
|
||||
// Apply 申请提现
|
||||
func (c *cCash) Apply(ctx context.Context, req *cash.ApplyReq) (res *cash.ApplyRes, err error) {
|
||||
err = service.AdminCash().Apply(ctx, &adminin.CashApplyInp{
|
||||
Money: req.Money,
|
||||
MemberId: contexts.GetUserId(ctx),
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
// Payment 提现打款处理
|
||||
func (c *cCash) Payment(ctx context.Context, req *cash.PaymentReq) (res *cash.PaymentRes, err error) {
|
||||
err = service.AdminCash().Payment(ctx, &req.CashPaymentInp)
|
||||
return
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
// Package admin
|
||||
// @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
|
||||
// @AutoGenerate Version 2.5.3
|
||||
// @AutoGenerate Date 2023-04-15 15:59:58
|
||||
package admin
|
||||
|
||||
import (
|
||||
"context"
|
||||
"hotgo/api/admin/creditslog"
|
||||
"hotgo/internal/service"
|
||||
)
|
||||
|
||||
var (
|
||||
CreditsLog = cCreditsLog{}
|
||||
)
|
||||
|
||||
type cCreditsLog struct{}
|
||||
|
||||
// List 查看资产变动列表
|
||||
func (c *cCreditsLog) List(ctx context.Context, req *creditslog.ListReq) (res *creditslog.ListRes, err error) {
|
||||
list, totalCount, err := service.AdminCreditsLog().List(ctx, &req.CreditsLogListInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(creditslog.ListRes)
|
||||
res.List = list
|
||||
res.PageRes.Pack(req, totalCount)
|
||||
return
|
||||
}
|
||||
|
||||
// Export 导出资产变动列表
|
||||
func (c *cCreditsLog) Export(ctx context.Context, req *creditslog.ExportReq) (res *creditslog.ExportRes, err error) {
|
||||
err = service.AdminCreditsLog().Export(ctx, &req.CreditsLogListInp)
|
||||
return
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
// Package admin
|
||||
// @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 admin
|
||||
|
||||
import (
|
||||
"context"
|
||||
"hotgo/api/admin/dept"
|
||||
"hotgo/internal/service"
|
||||
)
|
||||
|
||||
var (
|
||||
Dept = cDept{}
|
||||
)
|
||||
|
||||
type cDept struct{}
|
||||
|
||||
// Delete 删除
|
||||
func (c *cDept) Delete(ctx context.Context, req *dept.DeleteReq) (res *dept.DeleteRes, err error) {
|
||||
err = service.AdminDept().Delete(ctx, &req.DeptDeleteInp)
|
||||
return
|
||||
}
|
||||
|
||||
// Edit 更新
|
||||
func (c *cDept) Edit(ctx context.Context, req *dept.EditReq) (res *dept.EditRes, err error) {
|
||||
err = service.AdminDept().Edit(ctx, &req.DeptEditInp)
|
||||
return
|
||||
}
|
||||
|
||||
// MaxSort 最大排序
|
||||
func (c *cDept) MaxSort(ctx context.Context, req *dept.MaxSortReq) (res *dept.MaxSortRes, err error) {
|
||||
res = new(dept.MaxSortRes)
|
||||
res.DeptMaxSortModel, err = service.AdminDept().MaxSort(ctx, &req.DeptMaxSortInp)
|
||||
return
|
||||
}
|
||||
|
||||
// View 获取指定信息
|
||||
func (c *cDept) View(ctx context.Context, req *dept.ViewReq) (res *dept.ViewRes, err error) {
|
||||
res = new(dept.ViewRes)
|
||||
res.DeptViewModel, err = service.AdminDept().View(ctx, &req.DeptViewInp)
|
||||
return
|
||||
}
|
||||
|
||||
// List 查看列表
|
||||
func (c *cDept) List(ctx context.Context, req *dept.ListReq) (res *dept.ListRes, err error) {
|
||||
data, err := service.AdminDept().List(ctx, &req.DeptListInp)
|
||||
if err != nil || data == nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = (*dept.ListRes)(&data)
|
||||
return
|
||||
}
|
||||
|
||||
// Option 获取部门选项树
|
||||
func (c *cDept) Option(ctx context.Context, req *dept.OptionReq) (res *dept.OptionRes, err error) {
|
||||
list, totalCount, err := service.AdminDept().Option(ctx, &req.DeptOptionInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(dept.OptionRes)
|
||||
res.DeptOptionModel = list
|
||||
res.PageRes.Pack(req, totalCount)
|
||||
return
|
||||
}
|
||||
|
||||
// TreeOption 获取部门管理关系树选项
|
||||
func (c *cDept) TreeOption(ctx context.Context, req *dept.TreeOptionReq) (res *dept.TreeOptionRes, err error) {
|
||||
data, err := service.AdminDept().TreeOption(ctx)
|
||||
res = (*dept.TreeOptionRes)(&data)
|
||||
return
|
||||
}
|
||||
@@ -0,0 +1,145 @@
|
||||
// Package admin
|
||||
// @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 admin
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/gogf/gf/v2/errors/gerror"
|
||||
"hotgo/api/admin/member"
|
||||
"hotgo/internal/library/contexts"
|
||||
"hotgo/internal/model/input/adminin"
|
||||
"hotgo/internal/service"
|
||||
)
|
||||
|
||||
var (
|
||||
Member = cMember{}
|
||||
)
|
||||
|
||||
type cMember struct{}
|
||||
|
||||
// UpdateCash 修改代理商提现信息
|
||||
func (c *cMember) UpdateCash(ctx context.Context, req *member.UpdateCashReq) (res *member.UpdateCashRes, err error) {
|
||||
err = service.AdminMember().UpdateCash(ctx, &req.MemberUpdateCashInp)
|
||||
return
|
||||
}
|
||||
|
||||
// UpdateEmail 换绑邮箱
|
||||
func (c *cMember) UpdateEmail(ctx context.Context, req *member.UpdateEmailReq) (res *member.UpdateEmailRes, err error) {
|
||||
err = service.AdminMember().UpdateEmail(ctx, &req.MemberUpdateEmailInp)
|
||||
return
|
||||
}
|
||||
|
||||
// UpdateMobile 换绑手机号
|
||||
func (c *cMember) UpdateMobile(ctx context.Context, req *member.UpdateMobileReq) (res *member.UpdateMobileRes, err error) {
|
||||
err = service.AdminMember().UpdateMobile(ctx, &req.MemberUpdateMobileInp)
|
||||
return
|
||||
}
|
||||
|
||||
// UpdateProfile 更新用户资料
|
||||
func (c *cMember) UpdateProfile(ctx context.Context, req *member.UpdateProfileReq) (res *member.UpdateProfileRes, err error) {
|
||||
err = service.AdminMember().UpdateProfile(ctx, &req.MemberUpdateProfileInp)
|
||||
return
|
||||
}
|
||||
|
||||
// UpdatePwd 修改登录密码
|
||||
func (c *cMember) UpdatePwd(ctx context.Context, req *member.UpdatePwdReq) (res *member.UpdatePwdRes, err error) {
|
||||
var memberId = contexts.Get(ctx).User.Id
|
||||
if memberId <= 0 {
|
||||
err = gerror.New("获取用户信息失败!")
|
||||
return
|
||||
}
|
||||
|
||||
err = service.AdminMember().UpdatePwd(ctx, &adminin.MemberUpdatePwdInp{
|
||||
Id: memberId,
|
||||
OldPassword: req.OldPassword,
|
||||
NewPassword: req.NewPassword,
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
// ResetPwd 重置密码
|
||||
func (c *cMember) ResetPwd(ctx context.Context, req *member.ResetPwdReq) (res *member.ResetPwdRes, err error) {
|
||||
err = service.AdminMember().ResetPwd(ctx, &req.MemberResetPwdInp)
|
||||
return
|
||||
}
|
||||
|
||||
// MemberInfo 登录用户信息
|
||||
func (c *cMember) MemberInfo(ctx context.Context, _ *member.InfoReq) (res *member.InfoRes, err error) {
|
||||
data, err := service.AdminMember().LoginMemberInfo(ctx)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(member.InfoRes)
|
||||
res.LoginMemberInfoModel = data
|
||||
return
|
||||
}
|
||||
|
||||
// Delete 删除用户
|
||||
func (c *cMember) Delete(ctx context.Context, req *member.DeleteReq) (res *member.DeleteRes, err error) {
|
||||
err = service.AdminMember().Delete(ctx, &req.MemberDeleteInp)
|
||||
return
|
||||
}
|
||||
|
||||
// Edit 修改/新增用户
|
||||
func (c *cMember) Edit(ctx context.Context, req *member.EditReq) (res *member.EditRes, err error) {
|
||||
err = service.AdminMember().Edit(ctx, &req.MemberEditInp)
|
||||
return
|
||||
}
|
||||
|
||||
// View 获取指定用户信息
|
||||
func (c *cMember) View(ctx context.Context, req *member.ViewReq) (res *member.ViewRes, err error) {
|
||||
data, err := service.AdminMember().View(ctx, &req.MemberViewInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(member.ViewRes)
|
||||
res.MemberViewModel = data
|
||||
return
|
||||
}
|
||||
|
||||
// List 查看用户列表
|
||||
func (c *cMember) List(ctx context.Context, req *member.ListReq) (res *member.ListRes, err error) {
|
||||
list, totalCount, err := service.AdminMember().List(ctx, &req.MemberListInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(member.ListRes)
|
||||
res.List = list
|
||||
res.PageRes.Pack(req, totalCount)
|
||||
return
|
||||
}
|
||||
|
||||
// Status 更新用户状态
|
||||
func (c *cMember) Status(ctx context.Context, req *member.StatusReq) (res *member.StatusRes, err error) {
|
||||
err = service.AdminMember().Status(ctx, &req.MemberStatusInp)
|
||||
return
|
||||
}
|
||||
|
||||
// Select 获取可选的后台用户选项
|
||||
func (c *cMember) Select(ctx context.Context, req *member.SelectReq) (res *member.SelectRes, err error) {
|
||||
data, err := service.AdminMember().Select(ctx, &req.MemberSelectInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = (*member.SelectRes)(&data)
|
||||
return
|
||||
}
|
||||
|
||||
// AddBalance 增加用户余额
|
||||
func (c *cMember) AddBalance(ctx context.Context, req *member.AddBalanceReq) (res *member.AddBalanceRes, err error) {
|
||||
err = service.AdminMember().AddBalance(ctx, &req.MemberAddBalanceInp)
|
||||
return
|
||||
}
|
||||
|
||||
// AddIntegral 增加用户积分
|
||||
func (c *cMember) AddIntegral(ctx context.Context, req *member.AddIntegralReq) (res *member.AddIntegralRes, err error) {
|
||||
err = service.AdminMember().AddIntegral(ctx, &req.MemberAddIntegralInp)
|
||||
return
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
// Package admin
|
||||
// @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 admin
|
||||
|
||||
import (
|
||||
"context"
|
||||
"hotgo/api/admin/menu"
|
||||
"hotgo/internal/service"
|
||||
)
|
||||
|
||||
// Menu 菜单
|
||||
var (
|
||||
Menu = cMenu{}
|
||||
)
|
||||
|
||||
type cMenu struct{}
|
||||
|
||||
// Delete 删除
|
||||
func (c *cMenu) Delete(ctx context.Context, req *menu.DeleteReq) (res *menu.DeleteRes, err error) {
|
||||
err = service.AdminMenu().Delete(ctx, &req.MenuDeleteInp)
|
||||
return
|
||||
}
|
||||
|
||||
// Edit 更新
|
||||
func (c *cMenu) Edit(ctx context.Context, req *menu.EditReq) (res *menu.EditRes, err error) {
|
||||
err = service.AdminMenu().Edit(ctx, &req.MenuEditInp)
|
||||
return
|
||||
}
|
||||
|
||||
// List 获取列表
|
||||
func (c *cMenu) List(ctx context.Context, req *menu.ListReq) (res menu.ListRes, err error) {
|
||||
res.MenuListModel, err = service.AdminMenu().List(ctx, &req.MenuListInp)
|
||||
return
|
||||
}
|
||||
@@ -0,0 +1,243 @@
|
||||
// Package admin
|
||||
// @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 admin
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/gogf/gf/v2/errors/gerror"
|
||||
"github.com/gogf/gf/v2/os/gtime"
|
||||
"github.com/gogf/gf/v2/text/gstr"
|
||||
"hotgo/api/admin/monitor"
|
||||
"hotgo/internal/consts"
|
||||
"hotgo/internal/dao"
|
||||
"hotgo/internal/model/entity"
|
||||
"hotgo/internal/model/input/form"
|
||||
"hotgo/internal/service"
|
||||
"hotgo/internal/websocket"
|
||||
"hotgo/utility/simple"
|
||||
"hotgo/utility/useragent"
|
||||
"sort"
|
||||
)
|
||||
|
||||
// Monitor 监控
|
||||
var Monitor = cMonitor{
|
||||
wsManager: websocket.Manager(),
|
||||
}
|
||||
|
||||
type cMonitor struct {
|
||||
wsManager *websocket.ClientManager
|
||||
}
|
||||
|
||||
// UserOffline 下线用户
|
||||
func (c *cMonitor) UserOffline(ctx context.Context, req *monitor.UserOfflineReq) (res *monitor.UserOfflineRes, err error) {
|
||||
client := c.wsManager.GetClient(req.Id)
|
||||
if client == nil {
|
||||
err = gerror.New("客户端已离线")
|
||||
return
|
||||
}
|
||||
|
||||
simple.SafeGo(ctx, func(ctx context.Context) {
|
||||
websocket.SendSuccess(client, "kick")
|
||||
websocket.Close(client)
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
// UserOnlineList 获取用户在线列表
|
||||
func (c *cMonitor) UserOnlineList(ctx context.Context, req *monitor.UserOnlineListReq) (res *monitor.UserOnlineListRes, err error) {
|
||||
var (
|
||||
clients []*monitor.UserOnlineModel
|
||||
i int
|
||||
)
|
||||
|
||||
if c.wsManager.GetClientsLen() == 0 {
|
||||
return
|
||||
}
|
||||
|
||||
for conn := range c.wsManager.GetClients() {
|
||||
if conn.SendClose || conn.User == nil {
|
||||
continue
|
||||
}
|
||||
|
||||
if req.UserId > 0 && req.UserId != conn.User.Id {
|
||||
continue
|
||||
}
|
||||
|
||||
if req.Username != "" && req.Username != conn.User.Username {
|
||||
continue
|
||||
}
|
||||
|
||||
if req.IP != "" && !gstr.Contains(conn.IP, req.IP) {
|
||||
continue
|
||||
}
|
||||
|
||||
if len(req.FirstTime) == 2 && (conn.User.LoginAt.Before(req.FirstTime[0]) || conn.User.LoginAt.After(req.FirstTime[1])) {
|
||||
continue
|
||||
}
|
||||
|
||||
clients = append(clients, &monitor.UserOnlineModel{
|
||||
ID: conn.ID,
|
||||
IP: conn.IP,
|
||||
Os: useragent.GetOs(conn.UserAgent),
|
||||
Browser: useragent.GetBrowser(conn.UserAgent),
|
||||
FirstTime: conn.User.LoginAt.Unix(),
|
||||
HeartbeatTime: conn.HeartbeatTime,
|
||||
App: conn.User.App,
|
||||
UserId: conn.User.Id,
|
||||
Username: conn.User.Username,
|
||||
Avatar: conn.User.Avatar,
|
||||
})
|
||||
}
|
||||
|
||||
res = new(monitor.UserOnlineListRes)
|
||||
res.PageRes.Pack(req, len(clients))
|
||||
|
||||
sort.Slice(clients, func(i, j int) bool {
|
||||
if clients[i].FirstTime == clients[j].FirstTime {
|
||||
return clients[i].ID < clients[j].ID
|
||||
}
|
||||
return clients[i].FirstTime < clients[j].FirstTime
|
||||
})
|
||||
|
||||
_, perPage, offset := form.CalPage(req.Page, req.PerPage)
|
||||
for k, v := range clients {
|
||||
if k >= offset && i <= perPage {
|
||||
if simple.IsDemo(ctx) {
|
||||
v.IP = consts.DemoTips
|
||||
}
|
||||
res.List = append(res.List, v)
|
||||
i++
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// NetOnlineList 获取服务在线列表
|
||||
func (c *cMonitor) NetOnlineList(ctx context.Context, req *monitor.NetOnlineListReq) (res *monitor.NetOnlineListRes, err error) {
|
||||
var (
|
||||
clients []*monitor.NetOnlineModel
|
||||
i int
|
||||
cols = dao.SysServeLicense.Columns()
|
||||
serv = service.TCPServer().Instance()
|
||||
models *entity.SysServeLicense
|
||||
)
|
||||
|
||||
conns := serv.GetClients()
|
||||
if len(conns) == 0 {
|
||||
res = new(monitor.NetOnlineListRes)
|
||||
res.PageRes.Pack(req, 0)
|
||||
return
|
||||
}
|
||||
|
||||
for _, conn := range conns {
|
||||
v := &monitor.NetOnlineModel{
|
||||
AuthMeta: conn.Auth,
|
||||
Id: conn.CID,
|
||||
IsAuth: conn.Auth != nil,
|
||||
Addr: conn.RemoteAddr().String(),
|
||||
Port: gstr.SubStrFromEx(conn.LocalAddr().String(), `:`),
|
||||
FirstTime: conn.FirstTime,
|
||||
HeartbeatTime: conn.Heartbeat,
|
||||
Proto: "TCP",
|
||||
}
|
||||
|
||||
if v.IsAuth {
|
||||
if err = dao.SysServeLicense.Ctx(ctx).Where(cols.Appid, conn.Auth.AppId).Where(cols.Group, conn.Auth.Group).Scan(&models); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if models == nil {
|
||||
continue
|
||||
}
|
||||
|
||||
v.LicenseId = models.Id
|
||||
v.LicenseName = models.Name
|
||||
v.LoginTimes = models.LoginTimes
|
||||
v.Online = serv.GetAppIdOnline(models.Appid)
|
||||
v.OnlineLimit = models.OnlineLimit
|
||||
}
|
||||
|
||||
if req.Addr != "" && !gstr.Contains(v.Addr, req.Addr) {
|
||||
continue
|
||||
}
|
||||
|
||||
if req.Name != "" && !gstr.Contains(v.Name, req.Name) {
|
||||
continue
|
||||
}
|
||||
|
||||
if req.Group != "" && (!v.IsAuth || v.Group != req.Group) {
|
||||
continue
|
||||
}
|
||||
|
||||
if req.AppId != "" && (!v.IsAuth || v.AppId != req.AppId) {
|
||||
continue
|
||||
}
|
||||
|
||||
ft := gtime.New(conn.FirstTime)
|
||||
if len(req.FirstTime) == 2 && (ft.Before(req.FirstTime[0]) || ft.After(req.FirstTime[1])) {
|
||||
continue
|
||||
}
|
||||
clients = append(clients, v)
|
||||
}
|
||||
|
||||
res = new(monitor.NetOnlineListRes)
|
||||
res.PageRes.Pack(req, len(clients))
|
||||
|
||||
sort.Slice(clients, func(i, j int) bool {
|
||||
return clients[i].Id > clients[j].Id
|
||||
})
|
||||
|
||||
_, perPage, offset := form.CalPage(req.Page, req.PerPage)
|
||||
for k, v := range clients {
|
||||
if k >= offset && i <= perPage {
|
||||
res.List = append(res.List, v)
|
||||
i++
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// NetOption 获取服务选项
|
||||
func (c *cMonitor) NetOption(ctx context.Context, req *monitor.NetOptionReq) (res *monitor.NetOptionRes, err error) {
|
||||
res = new(monitor.NetOptionRes)
|
||||
|
||||
for _, v := range service.TCPServer().Instance().GetRoutes() {
|
||||
// 无需勾选的路由
|
||||
disabled := false
|
||||
if v.Id == "ServerLoginReq" || v.Id == "ServerHeartbeatReq" {
|
||||
disabled = true
|
||||
}
|
||||
|
||||
res.Routes = append(res.Routes, &monitor.RouteSelect{
|
||||
Value: v.Id,
|
||||
Label: v.Id,
|
||||
Disabled: disabled,
|
||||
IsRPC: v.IsRPC,
|
||||
})
|
||||
}
|
||||
|
||||
sort.Slice(res.Routes, func(i, j int) bool {
|
||||
if res.Routes[i].IsRPC && !res.Routes[j].IsRPC {
|
||||
return true
|
||||
} else if !res.Routes[i].IsRPC && res.Routes[j].IsRPC {
|
||||
return false
|
||||
}
|
||||
return res.Routes[i].Label < res.Routes[j].Label
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
// NetOffline 下线服务
|
||||
func (c *cMonitor) NetOffline(ctx context.Context, req *monitor.NetOfflineReq) (res *monitor.NetOfflineRes, err error) {
|
||||
conn := service.TCPServer().Instance().GetClientById(req.Id)
|
||||
if conn == nil {
|
||||
err = gerror.New("客户端不在线")
|
||||
return
|
||||
}
|
||||
// 关闭连接
|
||||
conn.Close()
|
||||
return
|
||||
}
|
||||
@@ -0,0 +1,127 @@
|
||||
// Package admin
|
||||
// @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 admin
|
||||
|
||||
import (
|
||||
"context"
|
||||
"hotgo/api/admin/notice"
|
||||
"hotgo/internal/consts"
|
||||
"hotgo/internal/service"
|
||||
)
|
||||
|
||||
var (
|
||||
Notice = cNotice{}
|
||||
)
|
||||
|
||||
type cNotice struct{}
|
||||
|
||||
// Delete 删除
|
||||
func (c *cNotice) Delete(ctx context.Context, req *notice.DeleteReq) (res *notice.DeleteRes, err error) {
|
||||
err = service.AdminNotice().Delete(ctx, &req.NoticeDeleteInp)
|
||||
return
|
||||
}
|
||||
|
||||
// Edit 更新
|
||||
func (c *cNotice) Edit(ctx context.Context, req *notice.EditReq) (res *notice.EditRes, err error) {
|
||||
err = service.AdminNotice().Edit(ctx, &req.NoticeEditInp)
|
||||
return
|
||||
}
|
||||
|
||||
// MaxSort 最大排序
|
||||
func (c *cNotice) MaxSort(ctx context.Context, req *notice.MaxSortReq) (res *notice.MaxSortRes, err error) {
|
||||
res = new(notice.MaxSortRes)
|
||||
res.NoticeMaxSortModel, err = service.AdminNotice().MaxSort(ctx, &req.NoticeMaxSortInp)
|
||||
return
|
||||
}
|
||||
|
||||
// View 获取指定信息
|
||||
func (c *cNotice) View(ctx context.Context, req *notice.ViewReq) (res *notice.ViewRes, err error) {
|
||||
data, err := service.AdminNotice().View(ctx, &req.NoticeViewInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(notice.ViewRes)
|
||||
res.NoticeViewModel = data
|
||||
return
|
||||
}
|
||||
|
||||
// List 查看列表
|
||||
func (c *cNotice) List(ctx context.Context, req *notice.ListReq) (res *notice.ListRes, err error) {
|
||||
list, totalCount, err := service.AdminNotice().List(ctx, &req.NoticeListInp)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
res = new(notice.ListRes)
|
||||
res.List = list
|
||||
res.PageRes.Pack(req, totalCount)
|
||||
return
|
||||
}
|
||||
|
||||
// Status 更新状态
|
||||
func (c *cNotice) Status(ctx context.Context, req *notice.StatusReq) (res *notice.StatusRes, err error) {
|
||||
err = service.AdminNotice().Status(ctx, &req.NoticeStatusInp)
|
||||
return
|
||||
}
|
||||
|
||||
// Notify 更新通知
|
||||
func (c *cNotice) Notify(ctx context.Context, req *notice.EditNotifyReq) (res *notice.EditNotifyRes, err error) {
|
||||
req.Type = consts.NoticeTypeNotify
|
||||
err = service.AdminNotice().Edit(ctx, &req.NoticeEditInp)
|
||||
return
|
||||
}
|
||||
|
||||
// Notice 更新公告
|
||||
func (c *cNotice) Notice(ctx context.Context, req *notice.EditNoticeReq) (res *notice.EditNoticeRes, err error) {
|
||||
req.Type = consts.NoticeTypeNotice
|
||||
err = service.AdminNotice().Edit(ctx, &req.NoticeEditInp)
|
||||
return
|
||||
}
|
||||
|
||||
// Letter 更新私信
|
||||
func (c *cNotice) Letter(ctx context.Context, req *notice.EditLetterReq) (res *notice.EditLetterRes, err error) {
|
||||
req.Type = consts.NoticeTypeLetter
|
||||
err = service.AdminNotice().Edit(ctx, &req.NoticeEditInp)
|
||||
return
|
||||
}
|
||||
|
||||
// UpRead 更新已读
|
||||
func (c *cNotice) UpRead(ctx context.Context, req *notice.UpReadReq) (res *notice.UpReadRes, err error) {
|
||||
err = service.AdminNotice().UpRead(ctx, &req.NoticeUpReadInp)
|
||||
return
|
||||
}
|
||||
|
||||
// PullMessages 拉取未读消息列表
|
||||
func (c *cNotice) PullMessages(ctx context.Context, req *notice.PullMessagesReq) (res *notice.PullMessagesRes, err error) {
|
||||
data, err := service.AdminNotice().PullMessages(ctx, &req.PullMessagesInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(notice.PullMessagesRes)
|
||||
res.PullMessagesModel = data
|
||||
return
|
||||
}
|
||||
|
||||
// ReadAll 全部已读
|
||||
func (c *cNotice) ReadAll(ctx context.Context, req *notice.ReadAllReq) (res *notice.ReadAllRes, err error) {
|
||||
err = service.AdminNotice().ReadAll(ctx, &req.NoticeReadAllInp)
|
||||
return
|
||||
}
|
||||
|
||||
// MessageList 我的消息列表
|
||||
func (c *cNotice) MessageList(ctx context.Context, req *notice.MessageListReq) (res *notice.MessageListRes, err error) {
|
||||
list, totalCount, err := service.AdminNotice().MessageList(ctx, &req.NoticeMessageListInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(notice.MessageListRes)
|
||||
res.List = list
|
||||
res.PageRes.Pack(req, totalCount)
|
||||
return
|
||||
}
|
||||
@@ -0,0 +1,91 @@
|
||||
// Package admin
|
||||
// @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 admin
|
||||
|
||||
import (
|
||||
"context"
|
||||
"hotgo/api/admin/order"
|
||||
"hotgo/internal/service"
|
||||
)
|
||||
|
||||
var (
|
||||
Order = cOrder{}
|
||||
)
|
||||
|
||||
type cOrder struct{}
|
||||
|
||||
// AcceptRefund 受理申请退款
|
||||
func (c *cOrder) AcceptRefund(ctx context.Context, req *order.AcceptRefundReq) (res *order.AcceptRefundRes, err error) {
|
||||
err = service.AdminOrder().AcceptRefund(ctx, &req.OrderAcceptRefundInp)
|
||||
return
|
||||
}
|
||||
|
||||
// ApplyRefund 申请退款
|
||||
func (c *cOrder) ApplyRefund(ctx context.Context, req *order.ApplyRefundReq) (res *order.ApplyRefundRes, err error) {
|
||||
err = service.AdminOrder().ApplyRefund(ctx, &req.OrderApplyRefundInp)
|
||||
return
|
||||
}
|
||||
|
||||
// Create 创建充值订单
|
||||
func (c *cOrder) Create(ctx context.Context, req *order.CreateReq) (res *order.CreateRes, err error) {
|
||||
data, err := service.AdminOrder().Create(ctx, &req.OrderCreateInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(order.CreateRes)
|
||||
res.OrderCreateModel = data
|
||||
return
|
||||
}
|
||||
|
||||
// List 查看充值订单列表
|
||||
func (c *cOrder) List(ctx context.Context, req *order.ListReq) (res *order.ListRes, err error) {
|
||||
list, totalCount, err := service.AdminOrder().List(ctx, &req.OrderListInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(order.ListRes)
|
||||
res.List = list
|
||||
res.PageRes.Pack(req, totalCount)
|
||||
return
|
||||
}
|
||||
|
||||
// Export 导出充值订单列表
|
||||
func (c *cOrder) Export(ctx context.Context, req *order.ExportReq) (res *order.ExportRes, err error) {
|
||||
err = service.AdminOrder().Export(ctx, &req.OrderListInp)
|
||||
return
|
||||
}
|
||||
|
||||
// Edit 更新充值订单
|
||||
func (c *cOrder) Edit(ctx context.Context, req *order.EditReq) (res *order.EditRes, err error) {
|
||||
err = service.AdminOrder().Edit(ctx, &req.OrderEditInp)
|
||||
return
|
||||
}
|
||||
|
||||
// View 获取指定充值订单信息
|
||||
func (c *cOrder) View(ctx context.Context, req *order.ViewReq) (res *order.ViewRes, err error) {
|
||||
data, err := service.AdminOrder().View(ctx, &req.OrderViewInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(order.ViewRes)
|
||||
res.OrderViewModel = data
|
||||
return
|
||||
}
|
||||
|
||||
// Delete 删除充值订单
|
||||
func (c *cOrder) Delete(ctx context.Context, req *order.DeleteReq) (res *order.DeleteRes, err error) {
|
||||
err = service.AdminOrder().Delete(ctx, &req.OrderDeleteInp)
|
||||
return
|
||||
}
|
||||
|
||||
// Status 更新充值订单状态
|
||||
func (c *cOrder) Status(ctx context.Context, req *order.StatusReq) (res *order.StatusRes, err error) {
|
||||
err = service.AdminOrder().Status(ctx, &req.OrderStatusInp)
|
||||
return
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
// Package admin
|
||||
// @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 admin
|
||||
|
||||
import (
|
||||
"context"
|
||||
"hotgo/api/admin/post"
|
||||
"hotgo/internal/service"
|
||||
)
|
||||
|
||||
// Post 岗位
|
||||
var Post = cPost{}
|
||||
|
||||
type cPost struct{}
|
||||
|
||||
// Delete 删除
|
||||
func (c *cPost) Delete(ctx context.Context, req *post.DeleteReq) (res *post.DeleteRes, err error) {
|
||||
err = service.AdminPost().Delete(ctx, &req.PostDeleteInp)
|
||||
return
|
||||
}
|
||||
|
||||
// Edit 修改/新增
|
||||
func (c *cPost) Edit(ctx context.Context, req *post.EditReq) (res *post.EditRes, err error) {
|
||||
err = service.AdminPost().Edit(ctx, &req.PostEditInp)
|
||||
return
|
||||
}
|
||||
|
||||
// MaxSort 最大排序
|
||||
func (c *cPost) MaxSort(ctx context.Context, req *post.MaxSortReq) (res *post.MaxSortRes, err error) {
|
||||
res = new(post.MaxSortRes)
|
||||
res.PostMaxSortModel, err = service.AdminPost().MaxSort(ctx, &req.PostMaxSortInp)
|
||||
return
|
||||
}
|
||||
|
||||
// View 获取指定信息
|
||||
func (c *cPost) View(ctx context.Context, req *post.ViewReq) (res *post.ViewRes, err error) {
|
||||
data, err := service.AdminPost().View(ctx, &req.PostViewInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(post.ViewRes)
|
||||
res.PostViewModel = data
|
||||
return
|
||||
}
|
||||
|
||||
// List 获取列表
|
||||
func (c *cPost) List(ctx context.Context, req *post.ListReq) (res *post.ListRes, err error) {
|
||||
list, totalCount, err := service.AdminPost().List(ctx, &req.PostListInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(post.ListRes)
|
||||
res.List = list
|
||||
res.PageRes.Pack(req, totalCount)
|
||||
return
|
||||
}
|
||||
|
||||
// Status 更新状态
|
||||
func (c *cPost) Status(ctx context.Context, req *post.StatusReq) (res *post.StatusRes, err error) {
|
||||
err = service.AdminPost().Status(ctx, &req.PostStatusInp)
|
||||
return
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
// Package admin
|
||||
// @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 admin
|
||||
|
||||
import (
|
||||
"context"
|
||||
"hotgo/api/admin/role"
|
||||
"hotgo/internal/consts"
|
||||
"hotgo/internal/library/contexts"
|
||||
"hotgo/internal/service"
|
||||
)
|
||||
|
||||
var (
|
||||
Role = cRole{}
|
||||
)
|
||||
|
||||
type cRole struct{}
|
||||
|
||||
// List 获取列表
|
||||
func (c *cRole) List(ctx context.Context, req *role.ListReq) (res *role.ListRes, err error) {
|
||||
list, totalCount, err := service.AdminRole().List(ctx, &req.RoleListInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(role.ListRes)
|
||||
res.RoleListModel = list
|
||||
res.PageRes.Pack(req, totalCount)
|
||||
return
|
||||
}
|
||||
|
||||
// Edit 修改角色
|
||||
func (c *cRole) Edit(ctx context.Context, req *role.EditReq) (res *role.EditRes, err error) {
|
||||
err = service.AdminRole().Edit(ctx, &req.RoleEditInp)
|
||||
return
|
||||
}
|
||||
|
||||
// Delete 删除
|
||||
func (c *cRole) Delete(ctx context.Context, req *role.DeleteReq) (res *role.DeleteRes, err error) {
|
||||
err = service.AdminRole().Delete(ctx, &req.RoleDeleteInp)
|
||||
return
|
||||
}
|
||||
|
||||
// Dynamic 动态路由
|
||||
func (c *cRole) Dynamic(ctx context.Context, _ *role.DynamicReq) (res *role.DynamicRes, err error) {
|
||||
return service.AdminMenu().GetMenuList(ctx, contexts.GetUserId(ctx))
|
||||
}
|
||||
|
||||
// GetPermissions 获取指定角色权限
|
||||
func (c *cRole) GetPermissions(ctx context.Context, req *role.GetPermissionsReq) (res *role.GetPermissionsRes, err error) {
|
||||
data, err := service.AdminRole().GetPermissions(ctx, &req.GetPermissionsInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(role.GetPermissionsRes)
|
||||
res.GetPermissionsModel = data
|
||||
return
|
||||
}
|
||||
|
||||
// UpdatePermissions 修改角色菜单权限
|
||||
func (c *cRole) UpdatePermissions(ctx context.Context, req *role.UpdatePermissionsReq) (res *role.UpdatePermissionsRes, err error) {
|
||||
err = service.AdminRole().UpdatePermissions(ctx, &req.UpdatePermissionsInp)
|
||||
return
|
||||
}
|
||||
|
||||
// DataScopeSelect 获取数据权限选项
|
||||
func (c *cRole) DataScopeSelect(_ context.Context, _ *role.DataScopeSelectReq) (res *role.DataScopeSelectRes, err error) {
|
||||
res = new(role.DataScopeSelectRes)
|
||||
res.List = consts.DataScopeSelect
|
||||
return
|
||||
}
|
||||
|
||||
// DataScopeEdit 获取数据权限选项
|
||||
func (c *cRole) DataScopeEdit(ctx context.Context, req *role.DataScopeEditReq) (res *role.DataScopeEditRes, err error) {
|
||||
err = service.AdminRole().DataScopeEdit(ctx, &req.DataScopeEditInp)
|
||||
return
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
// Package common
|
||||
// @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 common
|
||||
|
||||
import (
|
||||
"context"
|
||||
"hotgo/api/admin/common"
|
||||
"hotgo/internal/service"
|
||||
)
|
||||
|
||||
var Console = cConsole{}
|
||||
|
||||
type cConsole struct{}
|
||||
|
||||
// Stat 综合数据统计
|
||||
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
|
||||
res.Visits.Amount = 10403
|
||||
|
||||
res.Saleroom.WeekSaleroom = 20501
|
||||
res.Saleroom.Amount = 21002
|
||||
res.Saleroom.Degree = 83.66
|
||||
|
||||
res.OrderLarge.WeekLarge = 39901
|
||||
res.OrderLarge.Rise = 31012
|
||||
res.OrderLarge.Decline = 30603
|
||||
res.OrderLarge.Amount = 36084
|
||||
|
||||
res.Volume.WeekLarge = 40021
|
||||
res.Volume.Rise = 40202
|
||||
res.Volume.Decline = 45003
|
||||
res.Volume.Amount = 49004
|
||||
return
|
||||
}
|
||||
|
||||
func (c *cConsole) Summary(ctx context.Context, req *common.DashboardSummaryReq) (res *common.DashboardSummaryRes, err error) {
|
||||
data, err := service.SysDashboard().Summary(ctx, &req.DashboardSummaryInp)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &common.DashboardSummaryRes{DashboardSummaryModel: data}, nil
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
// Package common
|
||||
// @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 common
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/gogf/gf/v2/errors/gerror"
|
||||
"hotgo/api/admin/common"
|
||||
"hotgo/internal/consts"
|
||||
"hotgo/internal/dao"
|
||||
"hotgo/internal/library/contexts"
|
||||
"hotgo/internal/model/entity"
|
||||
"hotgo/internal/model/input/sysin"
|
||||
"hotgo/internal/service"
|
||||
)
|
||||
|
||||
var Ems = new(cEms)
|
||||
|
||||
type cEms struct{}
|
||||
|
||||
// SendTest 发送测试邮件
|
||||
func (c *cEms) SendTest(ctx context.Context, req *common.SendTestEmailReq) (res *common.SendTestEmailRes, err error) {
|
||||
err = service.SysEmsLog().Send(ctx, &sysin.SendEmsInp{
|
||||
Event: consts.EmsTemplateText,
|
||||
Email: req.To,
|
||||
Content: `
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="iso-8859-15">
|
||||
<title>这是一封来自HotGo的测试邮件</title>
|
||||
</head>
|
||||
<body>
|
||||
这是您通过HotGo后台发送的测试邮件。当你收到这封邮件的时候,说明已经联调成功了,恭喜你!
|
||||
</body>
|
||||
</html>`,
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
// SendBindEms 发送换绑邮件
|
||||
func (c *cEms) SendBindEms(ctx context.Context, _ *common.SendBindEmsReq) (res *common.SendBindEmsRes, err error) {
|
||||
var (
|
||||
memberId = contexts.GetUserId(ctx)
|
||||
models *entity.AdminMember
|
||||
)
|
||||
|
||||
if memberId <= 0 {
|
||||
err = gerror.New("用户身份异常,请重新登录!")
|
||||
return
|
||||
}
|
||||
|
||||
if err = dao.AdminMember.Ctx(ctx).Fields(dao.AdminMember.Columns().Email).Where(dao.AdminMember.Columns().Id, memberId).Scan(&models); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if models == nil {
|
||||
err = gerror.New("用户信息不存在")
|
||||
return
|
||||
}
|
||||
|
||||
if models.Email == "" {
|
||||
err = gerror.New("未绑定邮箱无需发送")
|
||||
return
|
||||
}
|
||||
|
||||
err = service.SysEmsLog().Send(ctx, &sysin.SendEmsInp{
|
||||
Event: consts.EmsTemplateBind,
|
||||
Email: models.Email,
|
||||
})
|
||||
return
|
||||
}
|
||||
@@ -0,0 +1,155 @@
|
||||
// Package common
|
||||
// @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 common
|
||||
|
||||
import (
|
||||
"context"
|
||||
"hotgo/api/admin/common"
|
||||
"hotgo/internal/consts"
|
||||
"hotgo/internal/library/captcha"
|
||||
"hotgo/internal/library/token"
|
||||
"hotgo/internal/service"
|
||||
"hotgo/utility/validate"
|
||||
|
||||
"github.com/gogf/gf/v2/errors/gerror"
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
"github.com/gogf/gf/v2/net/ghttp"
|
||||
"github.com/gogf/gf/v2/text/gstr"
|
||||
"github.com/gogf/gf/v2/util/gconv"
|
||||
"github.com/gogf/gf/v2/util/gmode"
|
||||
)
|
||||
|
||||
var Site = cSite{}
|
||||
|
||||
type cSite struct{}
|
||||
|
||||
// Ping ping
|
||||
func (c *cSite) Ping(_ context.Context, _ *common.SitePingReq) (res *common.SitePingRes, err error) {
|
||||
return
|
||||
}
|
||||
|
||||
// Config 获取配置
|
||||
func (c *cSite) Config(ctx context.Context, _ *common.SiteConfigReq) (res *common.SiteConfigRes, err error) {
|
||||
request := ghttp.RequestFromCtx(ctx)
|
||||
res = &common.SiteConfigRes{
|
||||
Version: consts.VersionApp,
|
||||
WsAddr: c.getWsAddr(ctx, request),
|
||||
Domain: c.getDomain(ctx, request),
|
||||
Mode: gmode.Mode(),
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func (c *cSite) getWsAddr(ctx context.Context, request *ghttp.Request) string {
|
||||
// 如果是本地IP访问,则认为是调试模式,走实际请求地址,否则走配置中的地址
|
||||
// 尝试读取hostname,兼容本地运行模式
|
||||
ip := ghttp.RequestFromCtx(ctx).GetHeader("hostname")
|
||||
if len(ip) == 0 {
|
||||
ip = ghttp.RequestFromCtx(ctx).GetHost()
|
||||
}
|
||||
|
||||
if validate.IsLocalIPAddr(ip) {
|
||||
return "ws://" + ip + ":" + gstr.StrEx(request.Host, ":") + g.Cfg().MustGet(ctx, "router.websocket.prefix").String()
|
||||
}
|
||||
|
||||
basic, err := service.SysConfig().GetBasic(ctx)
|
||||
if err != nil || basic == nil {
|
||||
return ""
|
||||
}
|
||||
return basic.WsAddr
|
||||
}
|
||||
|
||||
func (c *cSite) getDomain(ctx context.Context, request *ghttp.Request) string {
|
||||
// 如果是本地IP访问,则认为是调试模式,走实际请求地址,否则走配置中的地址
|
||||
// 尝试读取hostname,兼容本地运行模式
|
||||
ip := ghttp.RequestFromCtx(ctx).GetHeader("hostname")
|
||||
if len(ip) == 0 {
|
||||
ip = ghttp.RequestFromCtx(ctx).GetHost()
|
||||
}
|
||||
|
||||
if validate.IsLocalIPAddr(ip) {
|
||||
return "http://" + ip + ":" + gstr.StrEx(request.Host, ":")
|
||||
}
|
||||
|
||||
basic, err := service.SysConfig().GetBasic(ctx)
|
||||
if err != nil || basic == nil {
|
||||
return ""
|
||||
}
|
||||
return basic.Domain
|
||||
}
|
||||
|
||||
// LoginConfig 登录配置
|
||||
func (c *cSite) LoginConfig(ctx context.Context, _ *common.SiteLoginConfigReq) (res *common.SiteLoginConfigRes, err error) {
|
||||
res = new(common.SiteLoginConfigRes)
|
||||
login, err := service.SysConfig().GetLogin(ctx)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res.LoginConfig = login
|
||||
res.I18nSwitch = g.Cfg().MustGet(ctx, "system.i18n.switch", true).Bool()
|
||||
res.DefaultLanguage = g.Cfg().MustGet(ctx, "system.i18n.defaultLanguage", consts.SysDefaultLanguage).String()
|
||||
res.ProjectName = "企业办公管理系统"
|
||||
return
|
||||
}
|
||||
|
||||
// Captcha 登录验证码
|
||||
func (c *cSite) Captcha(ctx context.Context, _ *common.LoginCaptchaReq) (res *common.LoginCaptchaRes, err error) {
|
||||
loginConf, err := service.SysConfig().GetLogin(ctx)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
cid, base64 := captcha.Generate(ctx, loginConf.CaptchaType)
|
||||
res = &common.LoginCaptchaRes{Cid: cid, Base64: base64}
|
||||
return
|
||||
}
|
||||
|
||||
// Register 账号注册
|
||||
func (c *cSite) Register(ctx context.Context, req *common.RegisterReq) (res *common.RegisterRes, err error) {
|
||||
err = service.AdminSite().Register(ctx, &req.RegisterInp)
|
||||
return
|
||||
}
|
||||
|
||||
// AccountLogin 账号登录
|
||||
func (c *cSite) AccountLogin(ctx context.Context, req *common.AccountLoginReq) (res *common.AccountLoginRes, err error) {
|
||||
login, err := service.SysConfig().GetLogin(ctx)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if !req.IsLock && login.CaptchaSwitch == consts.StatusEnabled {
|
||||
// 校验 验证码
|
||||
if !captcha.Verify(req.Cid, req.Code) {
|
||||
err = gerror.New("验证码错误")
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
model, err := service.AdminSite().AccountLogin(ctx, &req.AccountLoginInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
err = gconv.Scan(model, &res)
|
||||
return
|
||||
}
|
||||
|
||||
// MobileLogin 手机号登录
|
||||
func (c *cSite) MobileLogin(ctx context.Context, req *common.MobileLoginReq) (res *common.MobileLoginRes, err error) {
|
||||
model, err := service.AdminSite().MobileLogin(ctx, &req.MobileLoginInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
err = gconv.Scan(model, &res)
|
||||
return
|
||||
}
|
||||
|
||||
// Logout 注销登录
|
||||
func (c *cSite) Logout(ctx context.Context, _ *common.LoginLogoutReq) (res *common.LoginLogoutRes, err error) {
|
||||
err = token.Logout(ghttp.RequestFromCtx(ctx))
|
||||
return
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
// Package common
|
||||
// @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 common
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/gogf/gf/v2/errors/gerror"
|
||||
"hotgo/api/admin/common"
|
||||
"hotgo/internal/consts"
|
||||
"hotgo/internal/dao"
|
||||
"hotgo/internal/library/contexts"
|
||||
"hotgo/internal/model/entity"
|
||||
"hotgo/internal/model/input/sysin"
|
||||
"hotgo/internal/service"
|
||||
)
|
||||
|
||||
var Sms = new(cSms)
|
||||
|
||||
type cSms struct{}
|
||||
|
||||
// SendTest 发送测试短信
|
||||
func (c *cSms) SendTest(ctx context.Context, req *common.SendTestSmsReq) (res *common.SendTestSmsRes, err error) {
|
||||
err = service.SysSmsLog().SendCode(ctx, &req.SendCodeInp)
|
||||
return
|
||||
}
|
||||
|
||||
// SendBindSms 发送换绑短信
|
||||
func (c *cSms) SendBindSms(ctx context.Context, _ *common.SendBindSmsReq) (res *common.SendBindSmsRes, err error) {
|
||||
var (
|
||||
memberId = contexts.GetUserId(ctx)
|
||||
models *entity.AdminMember
|
||||
)
|
||||
|
||||
if memberId <= 0 {
|
||||
err = gerror.New("用户身份异常,请重新登录!")
|
||||
return
|
||||
}
|
||||
|
||||
if err = dao.AdminMember.Ctx(ctx).Fields(dao.AdminMember.Columns().Mobile).Where(dao.AdminMember.Columns().Id, memberId).Scan(&models); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if models == nil {
|
||||
err = gerror.New("用户信息不存在")
|
||||
return
|
||||
}
|
||||
|
||||
if models.Mobile == "" {
|
||||
err = gerror.New("未绑定手机号无需发送")
|
||||
return
|
||||
}
|
||||
|
||||
err = service.SysSmsLog().SendCode(ctx, &sysin.SendCodeInp{
|
||||
Event: consts.SmsTemplateBind,
|
||||
Mobile: models.Mobile,
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
// SendSms 发送短信
|
||||
func (c *cSms) SendSms(ctx context.Context, req *common.SendSmsReq) (res *common.SendSmsRes, err error) {
|
||||
err = service.SysSmsLog().SendCode(ctx, &req.SendCodeInp)
|
||||
return
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
// Package common
|
||||
// @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 common
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/gogf/gf/v2/errors/gerror"
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
"hotgo/api/admin/common"
|
||||
"hotgo/internal/library/storager"
|
||||
"hotgo/internal/service"
|
||||
"hotgo/utility/validate"
|
||||
)
|
||||
|
||||
var Upload = new(cUpload)
|
||||
|
||||
type cUpload struct{}
|
||||
|
||||
// UploadFile 上传文件
|
||||
func (c *cUpload) UploadFile(ctx context.Context, _ *common.UploadFileReq) (res common.UploadFileRes, err error) {
|
||||
r := g.RequestFromCtx(ctx)
|
||||
uploadType := r.Header.Get("uploadType")
|
||||
if uploadType != "default" && !validate.InSlice(storager.KindSlice, uploadType) {
|
||||
err = gerror.New("上传类型是无效的")
|
||||
return
|
||||
}
|
||||
|
||||
file := r.GetUploadFile("file")
|
||||
if file == nil {
|
||||
err = gerror.New("没有找到上传的文件")
|
||||
return
|
||||
}
|
||||
return service.CommonUpload().UploadFile(ctx, uploadType, file)
|
||||
}
|
||||
|
||||
// CheckMultipart 检查文件分片
|
||||
func (c *cUpload) CheckMultipart(ctx context.Context, req *common.CheckMultipartReq) (res *common.CheckMultipartRes, err error) {
|
||||
data, err := service.CommonUpload().CheckMultipart(ctx, &req.CheckMultipartInp)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
res = new(common.CheckMultipartRes)
|
||||
res.CheckMultipartModel = data
|
||||
return
|
||||
}
|
||||
|
||||
// UploadPart 上传分片
|
||||
func (c *cUpload) UploadPart(ctx context.Context, req *common.UploadPartReq) (res *common.UploadPartRes, err error) {
|
||||
data, err := service.CommonUpload().UploadPart(ctx, &req.UploadPartInp)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
res = new(common.UploadPartRes)
|
||||
res.UploadPartModel = data
|
||||
return
|
||||
}
|
||||
|
||||
// ImageTransferStorage 图片链接转存
|
||||
func (c *cUpload) ImageTransferStorage(ctx context.Context, req *common.ImageTransferStorageReq) (res *common.ImageTransferStorageRes, err error) {
|
||||
res = new(common.ImageTransferStorageRes)
|
||||
res.ImageTransferStorageModel, err = service.CommonUpload().ImageTransferStorage(ctx, &req.ImageTransferStorageInp)
|
||||
return
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
// Package common
|
||||
// @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 common
|
||||
|
||||
import (
|
||||
"context"
|
||||
"hotgo/api/admin/common"
|
||||
"hotgo/internal/service"
|
||||
)
|
||||
|
||||
var (
|
||||
Wechat = cWechat{}
|
||||
)
|
||||
|
||||
type cWechat struct{}
|
||||
|
||||
func (c *cWechat) Authorize(ctx context.Context, req *common.WechatAuthorizeReq) (res *common.WechatAuthorizeRes, err error) {
|
||||
_, err = service.CommonWechat().Authorize(ctx, &req.WechatAuthorizeInp)
|
||||
return
|
||||
}
|
||||
|
||||
func (c *cWechat) AuthorizeCall(ctx context.Context, req *common.WechatAuthorizeCallReq) (res *common.WechatAuthorizeCallRes, err error) {
|
||||
_, err = service.CommonWechat().AuthorizeCall(ctx, &req.WechatAuthorizeCallInp)
|
||||
return
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
// Package pay
|
||||
// @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
|
||||
// @AutoGenerate Version 2.5.3
|
||||
// @AutoGenerate Date 2023-04-15 15:59:58
|
||||
package pay
|
||||
|
||||
import (
|
||||
"context"
|
||||
"hotgo/api/admin/pay"
|
||||
"hotgo/internal/service"
|
||||
)
|
||||
|
||||
var (
|
||||
Refund = cRefund{}
|
||||
)
|
||||
|
||||
type cRefund struct{}
|
||||
|
||||
// List 查看交易退款列表
|
||||
func (c *cRefund) List(ctx context.Context, req *pay.RefundListReq) (res *pay.RefundListRes, err error) {
|
||||
list, totalCount, err := service.PayRefund().List(ctx, &req.PayRefundListInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(pay.RefundListRes)
|
||||
res.List = list
|
||||
res.PageRes.Pack(req, totalCount)
|
||||
return
|
||||
}
|
||||
|
||||
// Export 导出交易退款列表
|
||||
func (c *cRefund) Export(ctx context.Context, req *pay.RefundExportReq) (res *pay.RefundExportRes, err error) {
|
||||
err = service.PayRefund().Export(ctx, &req.PayRefundListInp)
|
||||
return
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
// Package sys
|
||||
// @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 sys
|
||||
|
||||
import (
|
||||
"context"
|
||||
"hotgo/api/admin/addons"
|
||||
"hotgo/internal/service"
|
||||
)
|
||||
|
||||
var (
|
||||
Addons = cAddons{}
|
||||
)
|
||||
|
||||
type cAddons struct{}
|
||||
|
||||
// List 查看列表
|
||||
func (c *cAddons) List(ctx context.Context, req *addons.ListReq) (res *addons.ListRes, err error) {
|
||||
list, totalCount, err := service.SysAddons().List(ctx, &req.AddonsListInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(addons.ListRes)
|
||||
res.List = list
|
||||
res.PageRes.Pack(req, totalCount)
|
||||
return
|
||||
}
|
||||
|
||||
// Build 生成预览
|
||||
func (c *cAddons) Build(ctx context.Context, req *addons.BuildReq) (res *addons.BuildRes, err error) {
|
||||
err = service.SysAddons().Build(ctx, &req.AddonsBuildInp)
|
||||
return
|
||||
}
|
||||
|
||||
// Install 安装模块
|
||||
func (c *cAddons) Install(ctx context.Context, req *addons.InstallReq) (res *addons.InstallRes, err error) {
|
||||
if err = service.SysAddons().Install(ctx, &req.AddonsInstallInp); err != nil {
|
||||
return
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// Upgrade 更新模块
|
||||
func (c *cAddons) Upgrade(ctx context.Context, req *addons.UpgradeReq) (res *addons.UpgradeRes, err error) {
|
||||
if err = service.SysAddons().Upgrade(ctx, &req.AddonsUpgradeInp); err != nil {
|
||||
return
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// UnInstall 卸载模块
|
||||
func (c *cAddons) UnInstall(ctx context.Context, req *addons.UnInstallReq) (res *addons.UnInstallRes, err error) {
|
||||
if err = service.SysAddons().UnInstall(ctx, &req.AddonsUnInstallInp); err != nil {
|
||||
return
|
||||
}
|
||||
return
|
||||
}
|
||||
@@ -0,0 +1,157 @@
|
||||
package sys
|
||||
|
||||
import (
|
||||
"context"
|
||||
"hotgo/api/admin/appmember"
|
||||
"hotgo/internal/model/input/sysin"
|
||||
"hotgo/internal/service"
|
||||
)
|
||||
|
||||
var AppMember = cAppMember{}
|
||||
|
||||
type cAppMember struct{}
|
||||
|
||||
func (c *cAppMember) List(ctx context.Context, req *appmember.ListReq) (res *appmember.ListRes, err error) {
|
||||
list, total, err := service.SysAppMember().List(ctx, &req.AppMemberListInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
if list == nil {
|
||||
list = []*sysin.AppMemberListModel{}
|
||||
}
|
||||
res = new(appmember.ListRes)
|
||||
res.List = list
|
||||
res.PageRes.Pack(req, total)
|
||||
return
|
||||
}
|
||||
func (c *cAppMember) View(ctx context.Context, req *appmember.ViewReq) (res *appmember.ViewRes, err error) {
|
||||
data, err := service.SysAppMember().View(ctx, &req.AppMemberViewInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
res = &appmember.ViewRes{AppMemberViewModel: data}
|
||||
return
|
||||
}
|
||||
func (c *cAppMember) Edit(ctx context.Context, req *appmember.EditReq) (*appmember.EditRes, error) {
|
||||
return &appmember.EditRes{}, service.SysAppMember().Edit(ctx, &req.AppMemberEditInp)
|
||||
}
|
||||
func (c *cAppMember) Delete(ctx context.Context, req *appmember.DeleteReq) (*appmember.DeleteRes, error) {
|
||||
return &appmember.DeleteRes{}, service.SysAppMember().Delete(ctx, &req.AppMemberDeleteInp)
|
||||
}
|
||||
func (c *cAppMember) AutoDispatch(ctx context.Context, req *appmember.AutoDispatchReq) (*appmember.AutoDispatchRes, error) {
|
||||
return &appmember.AutoDispatchRes{}, service.SysAppMember().AutoDispatch(ctx, &req.AppMemberAutoDispatchInp)
|
||||
}
|
||||
func (c *cAppMember) Category(ctx context.Context, req *appmember.CategoryReq) (*appmember.CategoryRes, error) {
|
||||
return &appmember.CategoryRes{}, service.SysAppMember().Category(ctx, &req.AppMemberCategoryInp)
|
||||
}
|
||||
func (c *cAppMember) PaymentList(ctx context.Context, req *appmember.PaymentListReq) (*appmember.PaymentListRes, error) {
|
||||
list, err := service.SysAppMember().PaymentList(ctx, &req.AppMemberPaymentListInp)
|
||||
if list == nil {
|
||||
list = []*sysin.AppMemberPaymentModel{}
|
||||
}
|
||||
return &appmember.PaymentListRes{List: list}, err
|
||||
}
|
||||
func (c *cAppMember) PaymentEdit(ctx context.Context, req *appmember.PaymentEditReq) (*appmember.PaymentEditRes, error) {
|
||||
return &appmember.PaymentEditRes{}, service.SysAppMember().PaymentEdit(ctx, &req.AppMemberPaymentEditInp)
|
||||
}
|
||||
func (c *cAppMember) PaymentDelete(ctx context.Context, req *appmember.PaymentDeleteReq) (*appmember.PaymentDeleteRes, error) {
|
||||
return &appmember.PaymentDeleteRes{}, service.SysAppMember().PaymentDelete(ctx, &req.AppMemberPaymentDeleteInp)
|
||||
}
|
||||
func (c *cAppMember) AddressList(ctx context.Context, req *appmember.AddressListReq) (*appmember.AddressListRes, error) {
|
||||
list, err := service.SysAppMember().AddressList(ctx, &req.AppMemberAddressListInp)
|
||||
if list == nil {
|
||||
list = []*sysin.AppMemberAddressModel{}
|
||||
}
|
||||
return &appmember.AddressListRes{List: list}, err
|
||||
}
|
||||
func (c *cAppMember) AddressEdit(ctx context.Context, req *appmember.AddressEditReq) (*appmember.AddressEditRes, error) {
|
||||
return &appmember.AddressEditRes{}, service.SysAppMember().AddressEdit(ctx, &req.AppMemberAddressEditInp)
|
||||
}
|
||||
func (c *cAppMember) AddressDelete(ctx context.Context, req *appmember.AddressDeleteReq) (*appmember.AddressDeleteRes, error) {
|
||||
return &appmember.AddressDeleteRes{}, service.SysAppMember().AddressDelete(ctx, &req.AppMemberAddressDeleteInp)
|
||||
}
|
||||
func (c *cAppMember) Sensitive(ctx context.Context, req *appmember.SensitiveReq) (res *appmember.SensitiveRes, err error) {
|
||||
data, err := service.SysAppMember().Sensitive(ctx, &req.AppMemberSensitiveInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
return &appmember.SensitiveRes{AppMemberSensitiveModel: data}, nil
|
||||
}
|
||||
func (c *cAppMember) Team(ctx context.Context, req *appmember.TeamReq) (res *appmember.TeamRes, err error) {
|
||||
list, total, err := service.SysAppMember().Team(ctx, &req.AppMemberTeamInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
if list == nil {
|
||||
list = []*sysin.AppMemberTeamModel{}
|
||||
}
|
||||
res = new(appmember.TeamRes)
|
||||
res.List = list
|
||||
res.PageRes.Pack(req, total)
|
||||
return
|
||||
}
|
||||
func (c *cAppMember) StatusRequest(ctx context.Context, req *appmember.StatusRequestReq) (res *appmember.StatusRequestRes, err error) {
|
||||
data, err := service.SysAppMember().StatusRequest(ctx, &req.AppMemberStatusRequestInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
return &appmember.StatusRequestRes{AppMemberApprovalModel: data}, nil
|
||||
}
|
||||
func (c *cAppMember) StatusExecute(ctx context.Context, req *appmember.StatusExecuteReq) (*appmember.StatusExecuteRes, error) {
|
||||
return &appmember.StatusExecuteRes{}, service.SysAppMember().StatusExecute(ctx, &req.AppMemberStatusExecuteInp)
|
||||
}
|
||||
func (c *cAppMember) WalletList(ctx context.Context, req *appmember.WalletListReq) (res *appmember.WalletListRes, err error) {
|
||||
list, total, err := service.SysAppMember().WalletList(ctx, &req.WalletAdjustmentListInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
if list == nil {
|
||||
list = []*sysin.WalletAdjustmentListModel{}
|
||||
}
|
||||
res = new(appmember.WalletListRes)
|
||||
res.List = list
|
||||
res.PageRes.Pack(req, total)
|
||||
return
|
||||
}
|
||||
func (c *cAppMember) LedgerList(ctx context.Context, req *appmember.LedgerListReq) (res *appmember.LedgerListRes, err error) {
|
||||
list, total, err := service.SysAppMember().LedgerList(ctx, &req.WalletLedgerListInp)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if list == nil {
|
||||
list = []*sysin.WalletLedgerListModel{}
|
||||
}
|
||||
res = new(appmember.LedgerListRes)
|
||||
res.List = list
|
||||
res.PageRes.Pack(req, total)
|
||||
return
|
||||
}
|
||||
func (c *cAppMember) WalletRequest(ctx context.Context, req *appmember.WalletRequestReq) (res *appmember.WalletRequestRes, err error) {
|
||||
data, err := service.SysAppMember().WalletRequest(ctx, &req.WalletAdjustmentRequestInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
return &appmember.WalletRequestRes{AppMemberApprovalModel: data}, nil
|
||||
}
|
||||
func (c *cAppMember) WalletExecute(ctx context.Context, req *appmember.WalletExecuteReq) (*appmember.WalletExecuteRes, error) {
|
||||
return &appmember.WalletExecuteRes{}, service.SysAppMember().WalletExecute(ctx, &req.WalletAdjustmentExecuteInp)
|
||||
}
|
||||
func (c *cAppMember) NoticeList(ctx context.Context, req *appmember.NoticeListReq) (res *appmember.NoticeListRes, err error) {
|
||||
list, total, err := service.SysAppMember().NoticeList(ctx, &req.MemberNoticeListInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
if list == nil {
|
||||
list = []*sysin.MemberNoticeListModel{}
|
||||
}
|
||||
res = new(appmember.NoticeListRes)
|
||||
res.List = list
|
||||
res.PageRes.Pack(req, total)
|
||||
return
|
||||
}
|
||||
func (c *cAppMember) NoticeEdit(ctx context.Context, req *appmember.NoticeEditReq) (*appmember.NoticeEditRes, error) {
|
||||
return &appmember.NoticeEditRes{}, service.SysAppMember().NoticeEdit(ctx, &req.MemberNoticeEditInp)
|
||||
}
|
||||
func (c *cAppMember) NoticeRevoke(ctx context.Context, req *appmember.NoticeRevokeReq) (*appmember.NoticeRevokeRes, error) {
|
||||
return &appmember.NoticeRevokeRes{}, service.SysAppMember().NoticeRevoke(ctx, &req.MemberNoticeRevokeInp)
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
package sys
|
||||
|
||||
import (
|
||||
"context"
|
||||
"hotgo/api/admin/approval"
|
||||
"hotgo/internal/model/input/sysin"
|
||||
"hotgo/internal/service"
|
||||
)
|
||||
|
||||
var Approval = cApproval{}
|
||||
|
||||
type cApproval struct{}
|
||||
|
||||
func (c *cApproval) List(ctx context.Context, req *approval.ListReq) (res *approval.ListRes, err error) {
|
||||
list, totalCount, err := service.SysApproval().List(ctx, &req.ApprovalListInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
if list == nil {
|
||||
list = []*sysin.ApprovalListModel{}
|
||||
}
|
||||
res = new(approval.ListRes)
|
||||
res.List = list
|
||||
res.PageRes.Pack(req, totalCount)
|
||||
return
|
||||
}
|
||||
|
||||
func (c *cApproval) View(ctx context.Context, req *approval.ViewReq) (res *approval.ViewRes, err error) {
|
||||
data, err := service.SysApproval().View(ctx, &req.ApprovalViewInp)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
res = &approval.ViewRes{ApprovalViewModel: data}
|
||||
return
|
||||
}
|
||||
|
||||
func (c *cApproval) Create(ctx context.Context, req *approval.CreateReq) (res *approval.CreateRes, err error) {
|
||||
data, err := service.SysApproval().Create(ctx, &req.ApprovalCreateInp)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
res = &approval.CreateRes{ApprovalCreateModel: data}
|
||||
return
|
||||
}
|
||||
|
||||
func (c *cApproval) Submit(ctx context.Context, req *approval.SubmitReq) (res *approval.SubmitRes, err error) {
|
||||
err = service.SysApproval().Submit(ctx, &req.ApprovalSubmitInp)
|
||||
return
|
||||
}
|
||||
|
||||
func (c *cApproval) Approve(ctx context.Context, req *approval.ApproveReq) (res *approval.ApproveRes, err error) {
|
||||
err = service.SysApproval().Approve(ctx, &req.ApprovalDecisionInp)
|
||||
return
|
||||
}
|
||||
|
||||
func (c *cApproval) Reject(ctx context.Context, req *approval.RejectReq) (res *approval.RejectRes, err error) {
|
||||
err = service.SysApproval().Reject(ctx, &req.ApprovalDecisionInp)
|
||||
return
|
||||
}
|
||||
|
||||
func (c *cApproval) Cancel(ctx context.Context, req *approval.CancelReq) (res *approval.CancelRes, err error) {
|
||||
err = service.SysApproval().Cancel(ctx, &req.ApprovalCancelInp)
|
||||
return
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
// Package sys
|
||||
// @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 sys
|
||||
|
||||
import (
|
||||
"context"
|
||||
"hotgo/api/admin/attachment"
|
||||
"hotgo/internal/service"
|
||||
)
|
||||
|
||||
var (
|
||||
Attachment = cAttachment{}
|
||||
)
|
||||
|
||||
type cAttachment struct{}
|
||||
|
||||
// Delete 删除附件
|
||||
func (c *cAttachment) Delete(ctx context.Context, req *attachment.DeleteReq) (res *attachment.DeleteRes, err error) {
|
||||
err = service.SysAttachment().Delete(ctx, &req.AttachmentDeleteInp)
|
||||
return
|
||||
}
|
||||
|
||||
// View 获取指定附件信息
|
||||
func (c *cAttachment) View(ctx context.Context, req *attachment.ViewReq) (res *attachment.ViewRes, err error) {
|
||||
data, err := service.SysAttachment().View(ctx, &req.AttachmentViewInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(attachment.ViewRes)
|
||||
res.AttachmentViewModel = data
|
||||
return
|
||||
}
|
||||
|
||||
// List 查看附件列表
|
||||
func (c *cAttachment) List(ctx context.Context, req *attachment.ListReq) (res *attachment.ListRes, err error) {
|
||||
list, totalCount, err := service.SysAttachment().List(ctx, &req.AttachmentListInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(attachment.ListRes)
|
||||
res.List = list
|
||||
res.PageRes.Pack(req, totalCount)
|
||||
return
|
||||
}
|
||||
|
||||
// ClearKind 清空上传类型
|
||||
func (c *cAttachment) ClearKind(ctx context.Context, req *attachment.ClearKindReq) (res *attachment.ClearKindRes, err error) {
|
||||
err = service.SysAttachment().ClearKind(ctx, &req.AttachmentClearKindInp)
|
||||
return
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package sys
|
||||
|
||||
import (
|
||||
"context"
|
||||
"hotgo/api/admin/bizaudit"
|
||||
"hotgo/internal/model/input/sysin"
|
||||
"hotgo/internal/service"
|
||||
)
|
||||
|
||||
var BizAudit = cBizAudit{}
|
||||
|
||||
type cBizAudit struct{}
|
||||
|
||||
func (c *cBizAudit) List(ctx context.Context, req *bizaudit.ListReq) (res *bizaudit.ListRes, err error) {
|
||||
list, totalCount, err := service.SysBizAudit().List(ctx, &req.BizAuditListInp)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if list == nil {
|
||||
list = []*sysin.BizAuditListModel{}
|
||||
}
|
||||
res = new(bizaudit.ListRes)
|
||||
res.List = list
|
||||
res.PageRes.Pack(req, totalCount)
|
||||
return
|
||||
}
|
||||
|
||||
func (c *cBizAudit) View(ctx context.Context, req *bizaudit.ViewReq) (res *bizaudit.ViewRes, err error) {
|
||||
data, err := service.SysBizAudit().View(ctx, &req.BizAuditViewInp)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &bizaudit.ViewRes{BizAuditViewModel: data}, nil
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
// Package sys
|
||||
// @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 sys
|
||||
|
||||
import (
|
||||
"context"
|
||||
"hotgo/api/admin/blacklist"
|
||||
"hotgo/internal/service"
|
||||
)
|
||||
|
||||
var (
|
||||
Blacklist = cBlacklist{}
|
||||
)
|
||||
|
||||
type cBlacklist struct{}
|
||||
|
||||
// Delete 删除
|
||||
func (c *cBlacklist) Delete(ctx context.Context, req *blacklist.DeleteReq) (res *blacklist.DeleteRes, err error) {
|
||||
err = service.SysBlacklist().Delete(ctx, &req.BlacklistDeleteInp)
|
||||
return
|
||||
}
|
||||
|
||||
// Edit 更新
|
||||
func (c *cBlacklist) Edit(ctx context.Context, req *blacklist.EditReq) (res *blacklist.EditRes, err error) {
|
||||
err = service.SysBlacklist().Edit(ctx, &req.BlacklistEditInp)
|
||||
return
|
||||
}
|
||||
|
||||
// View 获取指定信息
|
||||
func (c *cBlacklist) View(ctx context.Context, req *blacklist.ViewReq) (res *blacklist.ViewRes, err error) {
|
||||
data, err := service.SysBlacklist().View(ctx, &req.BlacklistViewInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(blacklist.ViewRes)
|
||||
res.BlacklistViewModel = data
|
||||
return
|
||||
}
|
||||
|
||||
// List 查看列表
|
||||
func (c *cBlacklist) List(ctx context.Context, req *blacklist.ListReq) (res *blacklist.ListRes, err error) {
|
||||
list, totalCount, err := service.SysBlacklist().List(ctx, &req.BlacklistListInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(blacklist.ListRes)
|
||||
res.List = list
|
||||
res.PageRes.Pack(req, totalCount)
|
||||
return
|
||||
}
|
||||
|
||||
// Status 更新黑名单状态
|
||||
func (c *cBlacklist) Status(ctx context.Context, req *blacklist.StatusReq) (res *blacklist.StatusRes, err error) {
|
||||
err = service.SysBlacklist().Status(ctx, &req.BlacklistStatusInp)
|
||||
return
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
// Package sys
|
||||
// @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 sys
|
||||
|
||||
import (
|
||||
"context"
|
||||
"hotgo/api/admin/config"
|
||||
"hotgo/internal/consts"
|
||||
"hotgo/internal/model/input/form"
|
||||
"hotgo/internal/model/input/sysin"
|
||||
"hotgo/internal/service"
|
||||
)
|
||||
|
||||
var (
|
||||
Config = cConfig{}
|
||||
)
|
||||
|
||||
type cConfig struct{}
|
||||
|
||||
// GetConfig 获取指定分组的配置
|
||||
func (c *cConfig) GetConfig(ctx context.Context, req *config.GetReq) (res *config.GetRes, err error) {
|
||||
res = new(config.GetRes)
|
||||
res.GetConfigModel, err = service.SysConfig().GetConfigByGroup(ctx, &req.GetConfigInp)
|
||||
return
|
||||
}
|
||||
|
||||
// UpdateConfig 更新指定分组的配置
|
||||
func (c *cConfig) UpdateConfig(ctx context.Context, req *config.UpdateReq) (res *config.UpdateRes, err error) {
|
||||
err = service.SysConfig().UpdateConfigByGroup(ctx, &req.UpdateConfigInp)
|
||||
return
|
||||
}
|
||||
|
||||
// TypeSelect 数据类型选项
|
||||
func (c *cConfig) TypeSelect(_ context.Context, _ *config.TypeSelectReq) (res config.TypeSelectRes, err error) {
|
||||
for _, v := range consts.ConfigTypes {
|
||||
res = append(res, form.Select{
|
||||
Value: v,
|
||||
Name: v,
|
||||
Label: v,
|
||||
})
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// GetCash 获取提现的配置
|
||||
func (c *cConfig) GetCash(ctx context.Context, _ *config.GetCashReq) (res *config.GetCashRes, err error) {
|
||||
res = new(config.GetCashRes)
|
||||
res.GetConfigModel, err = service.SysConfig().GetConfigByGroup(ctx, &sysin.GetConfigInp{Group: "cash"})
|
||||
return
|
||||
}
|
||||
@@ -0,0 +1,97 @@
|
||||
// Package sys
|
||||
// @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 sys
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/gogf/gf/v2/errors/gerror"
|
||||
"hotgo/api/admin/cron"
|
||||
"hotgo/api/servmsg"
|
||||
"hotgo/internal/model/input/sysin"
|
||||
"hotgo/internal/service"
|
||||
)
|
||||
|
||||
var (
|
||||
Cron = cCron{}
|
||||
)
|
||||
|
||||
type cCron struct{}
|
||||
|
||||
// Delete 删除
|
||||
func (c *cCron) Delete(ctx context.Context, req *cron.DeleteReq) (res *cron.DeleteRes, err error) {
|
||||
err = service.TCPServer().CronDelete(ctx, &servmsg.CronDeleteReq{CronDeleteInp: &req.CronDeleteInp})
|
||||
return
|
||||
}
|
||||
|
||||
// Edit 更新
|
||||
func (c *cCron) Edit(ctx context.Context, req *cron.EditReq) (res *cron.EditRes, err error) {
|
||||
err = service.TCPServer().CronEdit(ctx, &servmsg.CronEditReq{CronEditInp: &req.CronEditInp})
|
||||
return
|
||||
}
|
||||
|
||||
// MaxSort 最大排序
|
||||
func (c *cCron) MaxSort(ctx context.Context, req *cron.MaxSortReq) (res *cron.MaxSortRes, err error) {
|
||||
res = new(cron.MaxSortRes)
|
||||
res.CronMaxSortModel, err = service.SysCron().MaxSort(ctx, &req.CronMaxSortInp)
|
||||
return
|
||||
}
|
||||
|
||||
// View 获取指定信息
|
||||
func (c *cCron) View(ctx context.Context, req *cron.ViewReq) (res *cron.ViewRes, err error) {
|
||||
data, err := service.SysCron().View(ctx, &req.CronViewInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(cron.ViewRes)
|
||||
res.CronViewModel = data
|
||||
return
|
||||
}
|
||||
|
||||
// List 查看列表
|
||||
func (c *cCron) List(ctx context.Context, req *cron.ListReq) (res *cron.ListRes, err error) {
|
||||
list, totalCount, err := service.SysCron().List(ctx, &req.CronListInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(cron.ListRes)
|
||||
res.List = list
|
||||
res.PageRes.Pack(req, totalCount)
|
||||
return
|
||||
}
|
||||
|
||||
// Status 更新状态
|
||||
func (c *cCron) Status(ctx context.Context, req *cron.StatusReq) (res *cron.StatusRes, err error) {
|
||||
if req.Id <= 0 {
|
||||
return nil, gerror.New("定时任务ID不能为空")
|
||||
}
|
||||
|
||||
err = service.TCPServer().CronStatus(ctx, &servmsg.CronStatusReq{CronStatusInp: &req.CronStatusInp})
|
||||
return
|
||||
}
|
||||
|
||||
// OnlineExec 在线执行
|
||||
func (c *cCron) OnlineExec(ctx context.Context, req *cron.OnlineExecReq) (res *cron.OnlineExecRes, err error) {
|
||||
if req.Id <= 0 {
|
||||
return nil, gerror.New("定时任务ID不能为空")
|
||||
}
|
||||
|
||||
err = service.TCPServer().CronOnlineExec(ctx, &servmsg.CronOnlineExecReq{OnlineExecInp: &req.OnlineExecInp})
|
||||
return
|
||||
}
|
||||
|
||||
// DispatchLog 调度日志
|
||||
func (c *cCron) DispatchLog(ctx context.Context, req *cron.DispatchLogReq) (res *cron.DispatchLogRes, err error) {
|
||||
if req.Id <= 0 {
|
||||
return nil, gerror.New("定时任务ID不能为空")
|
||||
}
|
||||
|
||||
res = new(cron.DispatchLogRes)
|
||||
res.DispatchLogModel = new(sysin.DispatchLogModel)
|
||||
res.Log, err = service.TCPServer().DispatchLog(ctx, &servmsg.CronDispatchLogReq{DispatchLogInp: &req.DispatchLogInp})
|
||||
return
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
// Package sys
|
||||
// @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 sys
|
||||
|
||||
import (
|
||||
"context"
|
||||
"hotgo/api/admin/cron"
|
||||
"hotgo/internal/service"
|
||||
)
|
||||
|
||||
var (
|
||||
CronGroup = cCronGroup{}
|
||||
)
|
||||
|
||||
type cCronGroup struct{}
|
||||
|
||||
// Delete 删除
|
||||
func (c *cCronGroup) Delete(ctx context.Context, req *cron.GroupDeleteReq) (res *cron.GroupDeleteRes, err error) {
|
||||
err = service.SysCronGroup().Delete(ctx, &req.CronGroupDeleteInp)
|
||||
return
|
||||
}
|
||||
|
||||
// Edit 更新
|
||||
func (c *cCronGroup) Edit(ctx context.Context, req *cron.GroupEditReq) (res *cron.GroupEditRes, err error) {
|
||||
err = service.SysCronGroup().Edit(ctx, &req.CronGroupEditInp)
|
||||
return
|
||||
}
|
||||
|
||||
// MaxSort 最大排序
|
||||
func (c *cCronGroup) MaxSort(ctx context.Context, req *cron.GroupMaxSortReq) (res *cron.GroupMaxSortRes, err error) {
|
||||
res = new(cron.GroupMaxSortRes)
|
||||
res.CronGroupMaxSortModel, err = service.SysCronGroup().MaxSort(ctx, &req.CronGroupMaxSortInp)
|
||||
return
|
||||
}
|
||||
|
||||
// View 获取指定信息
|
||||
func (c *cCronGroup) View(ctx context.Context, req *cron.GroupViewReq) (res *cron.GroupViewRes, err error) {
|
||||
data, err := service.SysCronGroup().View(ctx, &req.CronGroupViewInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(cron.GroupViewRes)
|
||||
res.CronGroupViewModel = data
|
||||
return
|
||||
}
|
||||
|
||||
// List 查看列表
|
||||
func (c *cCronGroup) List(ctx context.Context, req *cron.GroupListReq) (res *cron.GroupListRes, err error) {
|
||||
list, totalCount, err := service.SysCronGroup().List(ctx, &req.CronGroupListInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(cron.GroupListRes)
|
||||
res.List = list
|
||||
res.PageRes.Pack(req, totalCount)
|
||||
return
|
||||
}
|
||||
|
||||
// Status 更新状态
|
||||
func (c *cCronGroup) Status(ctx context.Context, req *cron.GroupStatusReq) (res *cron.GroupStatusRes, err error) {
|
||||
err = service.SysCronGroup().Status(ctx, &req.CronGroupStatusInp)
|
||||
return
|
||||
}
|
||||
|
||||
// Select 选项
|
||||
func (c *cCronGroup) Select(ctx context.Context, req *cron.GroupSelectReq) (res *cron.GroupSelectRes, err error) {
|
||||
data, err := service.SysCronGroup().Select(ctx, &req.CronGroupSelectInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(cron.GroupSelectRes)
|
||||
res.CronGroupSelectModel = data
|
||||
return
|
||||
}
|
||||
@@ -0,0 +1,91 @@
|
||||
// Package sys
|
||||
// @Link https://github.com/bufanyun/hotgo
|
||||
// @Copyright Copyright (c) 2025 HotGo CLI
|
||||
// @Author Ms <133814250@qq.com>
|
||||
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
|
||||
// @AutoGenerate Version 2.18.6
|
||||
package sys
|
||||
|
||||
import (
|
||||
"context"
|
||||
"hotgo/api/admin/curddemo"
|
||||
"hotgo/internal/model/input/sysin"
|
||||
"hotgo/internal/service"
|
||||
)
|
||||
|
||||
var (
|
||||
CurdDemo = cCurdDemo{}
|
||||
)
|
||||
|
||||
type cCurdDemo struct{}
|
||||
|
||||
// List 查看CURD列表列表
|
||||
func (c *cCurdDemo) List(ctx context.Context, req *curddemo.ListReq) (res *curddemo.ListRes, err error) {
|
||||
list, totalCount, err := service.SysCurdDemo().List(ctx, &req.CurdDemoListInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if list == nil {
|
||||
list = []*sysin.CurdDemoListModel{}
|
||||
}
|
||||
|
||||
res = new(curddemo.ListRes)
|
||||
res.List = list
|
||||
res.PageRes.Pack(req, totalCount)
|
||||
return
|
||||
}
|
||||
|
||||
// Export 导出CURD列表列表
|
||||
func (c *cCurdDemo) Export(ctx context.Context, req *curddemo.ExportReq) (res *curddemo.ExportRes, err error) {
|
||||
err = service.SysCurdDemo().Export(ctx, &req.CurdDemoListInp)
|
||||
return
|
||||
}
|
||||
|
||||
// Edit 更新CURD列表
|
||||
func (c *cCurdDemo) Edit(ctx context.Context, req *curddemo.EditReq) (res *curddemo.EditRes, err error) {
|
||||
err = service.SysCurdDemo().Edit(ctx, &req.CurdDemoEditInp)
|
||||
return
|
||||
}
|
||||
|
||||
// MaxSort 获取CURD列表最大排序
|
||||
func (c *cCurdDemo) MaxSort(ctx context.Context, req *curddemo.MaxSortReq) (res *curddemo.MaxSortRes, err error) {
|
||||
data, err := service.SysCurdDemo().MaxSort(ctx, &req.CurdDemoMaxSortInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(curddemo.MaxSortRes)
|
||||
res.CurdDemoMaxSortModel = data
|
||||
return
|
||||
}
|
||||
|
||||
// View 获取指定CURD列表信息
|
||||
func (c *cCurdDemo) View(ctx context.Context, req *curddemo.ViewReq) (res *curddemo.ViewRes, err error) {
|
||||
data, err := service.SysCurdDemo().View(ctx, &req.CurdDemoViewInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(curddemo.ViewRes)
|
||||
res.CurdDemoViewModel = data
|
||||
return
|
||||
}
|
||||
|
||||
// Delete 删除CURD列表
|
||||
func (c *cCurdDemo) Delete(ctx context.Context, req *curddemo.DeleteReq) (res *curddemo.DeleteRes, err error) {
|
||||
err = service.SysCurdDemo().Delete(ctx, &req.CurdDemoDeleteInp)
|
||||
return
|
||||
}
|
||||
|
||||
// Status 更新CURD列表状态
|
||||
func (c *cCurdDemo) Status(ctx context.Context, req *curddemo.StatusReq) (res *curddemo.StatusRes, err error) {
|
||||
err = service.SysCurdDemo().Status(ctx, &req.CurdDemoStatusInp)
|
||||
return
|
||||
}
|
||||
|
||||
// Switch 更新CURD列表开关状态
|
||||
func (c *cCurdDemo) Switch(ctx context.Context, req *curddemo.SwitchReq) (res *curddemo.SwitchRes, err error) {
|
||||
err = service.SysCurdDemo().Switch(ctx, &req.CurdDemoSwitchInp)
|
||||
return
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package sys
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"hotgo/api/admin/customerservice"
|
||||
"hotgo/internal/model/entity"
|
||||
"hotgo/internal/service"
|
||||
)
|
||||
|
||||
var CustomerService = cCustomerService{}
|
||||
|
||||
type cCustomerService struct{}
|
||||
|
||||
func (c *cCustomerService) List(ctx context.Context, req *customerservice.ListReq) (res *customerservice.ListRes, err error) {
|
||||
list, total, err := service.SysCustomerService().List(ctx, &req.CustomerServiceListInp)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if list == nil {
|
||||
list = []*entity.CustomerService{}
|
||||
}
|
||||
res = new(customerservice.ListRes)
|
||||
res.List = list
|
||||
res.PageRes.Pack(req, total)
|
||||
return
|
||||
}
|
||||
func (c *cCustomerService) View(ctx context.Context, req *customerservice.ViewReq) (*customerservice.ViewRes, error) {
|
||||
v, err := service.SysCustomerService().View(ctx, &req.CustomerServiceViewInp)
|
||||
return &customerservice.ViewRes{CustomerService: v}, err
|
||||
}
|
||||
func (c *cCustomerService) Edit(ctx context.Context, req *customerservice.EditReq) (*customerservice.EditRes, error) {
|
||||
return &customerservice.EditRes{}, service.SysCustomerService().Edit(ctx, &req.CustomerServiceEditInp)
|
||||
}
|
||||
func (c *cCustomerService) Status(ctx context.Context, req *customerservice.StatusReq) (*customerservice.StatusRes, error) {
|
||||
return &customerservice.StatusRes{}, service.SysCustomerService().Status(ctx, &req.CustomerServiceStatusInp)
|
||||
}
|
||||
func (c *cCustomerService) Delete(ctx context.Context, req *customerservice.DeleteReq) (*customerservice.DeleteRes, error) {
|
||||
return &customerservice.DeleteRes{}, service.SysCustomerService().Delete(ctx, &req.CustomerServiceDeleteInp)
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
// Package sys
|
||||
// @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 sys
|
||||
|
||||
import (
|
||||
"context"
|
||||
"hotgo/api/admin/dict"
|
||||
"hotgo/internal/model/input/sysin"
|
||||
"hotgo/internal/service"
|
||||
)
|
||||
|
||||
var (
|
||||
DictData = cDictData{}
|
||||
)
|
||||
|
||||
type cDictData struct{}
|
||||
|
||||
// Delete 删除
|
||||
func (c *cDictData) Delete(ctx context.Context, req *dict.DataDeleteReq) (res *dict.DataDeleteRes, err error) {
|
||||
err = service.SysDictData().Delete(ctx, &req.DictDataDeleteInp)
|
||||
return
|
||||
}
|
||||
|
||||
// Edit 更新
|
||||
func (c *cDictData) Edit(ctx context.Context, req *dict.DataEditReq) (res *dict.DataEditRes, err error) {
|
||||
err = service.SysDictData().Edit(ctx, &req.DictDataEditInp)
|
||||
return
|
||||
}
|
||||
|
||||
// List 查看列表
|
||||
func (c *cDictData) List(ctx context.Context, req *dict.DataListReq) (res *dict.DataListRes, err error) {
|
||||
list, totalCount, err := service.SysDictData().List(ctx, &req.DictDataListInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(dict.DataListRes)
|
||||
res.List = list
|
||||
res.PageRes.Pack(req, totalCount)
|
||||
return
|
||||
}
|
||||
|
||||
// Select 指定选项
|
||||
func (c *cDictData) Select(ctx context.Context, req *dict.DataSelectReq) (res dict.DataSelectRes, err error) {
|
||||
list, err := service.SysDictData().Select(ctx, &req.DataSelectInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = dict.DataSelectRes(list)
|
||||
return
|
||||
}
|
||||
|
||||
// Selects 多个选项
|
||||
func (c *cDictData) Selects(ctx context.Context, req *dict.DataSelectsReq) (res dict.DataSelectsRes, err error) {
|
||||
res = make(dict.DataSelectsRes)
|
||||
for _, v := range req.Types {
|
||||
option, err := service.SysDictData().Select(ctx, &sysin.DataSelectInp{Type: v})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
res[v] = option
|
||||
}
|
||||
return
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
// Package sys
|
||||
// @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 sys
|
||||
|
||||
import (
|
||||
"context"
|
||||
"hotgo/api/admin/dict"
|
||||
"hotgo/internal/service"
|
||||
)
|
||||
|
||||
var (
|
||||
DictType = cDictType{}
|
||||
)
|
||||
|
||||
type cDictType struct{}
|
||||
|
||||
// Tree 树
|
||||
func (c *cDictType) Tree(ctx context.Context, _ *dict.TypeTreeReq) (res *dict.TypeTreeRes, err error) {
|
||||
res = new(dict.TypeTreeRes)
|
||||
res.List, err = service.SysDictType().Tree(ctx)
|
||||
return
|
||||
}
|
||||
|
||||
// Delete 删除
|
||||
func (c *cDictType) Delete(ctx context.Context, req *dict.TypeDeleteReq) (res *dict.TypeDeleteRes, err error) {
|
||||
err = service.SysDictType().Delete(ctx, &req.DictTypeDeleteInp)
|
||||
return
|
||||
}
|
||||
|
||||
// Edit 更新
|
||||
func (c *cDictType) Edit(ctx context.Context, req *dict.TypeEditReq) (res *dict.TypeEditRes, err error) {
|
||||
err = service.SysDictType().Edit(ctx, &req.DictTypeEditInp)
|
||||
return
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
// Package sys
|
||||
// @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 sys
|
||||
|
||||
import (
|
||||
"context"
|
||||
"hotgo/api/admin/emslog"
|
||||
"hotgo/internal/service"
|
||||
)
|
||||
|
||||
var (
|
||||
EmsLog = cEmsLog{}
|
||||
)
|
||||
|
||||
type cEmsLog struct{}
|
||||
|
||||
// Delete 删除
|
||||
func (c *cEmsLog) Delete(ctx context.Context, req *emslog.DeleteReq) (res *emslog.DeleteRes, err error) {
|
||||
err = service.SysEmsLog().Delete(ctx, &req.EmsLogDeleteInp)
|
||||
return
|
||||
}
|
||||
|
||||
// Edit 更新
|
||||
func (c *cEmsLog) Edit(ctx context.Context, req *emslog.EditReq) (res *emslog.EditRes, err error) {
|
||||
err = service.SysEmsLog().Edit(ctx, &req.EmsLogEditInp)
|
||||
return
|
||||
}
|
||||
|
||||
// View 获取指定信息
|
||||
func (c *cEmsLog) View(ctx context.Context, req *emslog.ViewReq) (res *emslog.ViewRes, err error) {
|
||||
data, err := service.SysEmsLog().View(ctx, &req.EmsLogViewInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(emslog.ViewRes)
|
||||
res.EmsLogViewModel = data
|
||||
return
|
||||
}
|
||||
|
||||
// List 查看列表
|
||||
func (c *cEmsLog) List(ctx context.Context, req *emslog.ListReq) (res *emslog.ListRes, err error) {
|
||||
list, totalCount, err := service.SysEmsLog().List(ctx, &req.EmsLogListInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(emslog.ListRes)
|
||||
res.List = list
|
||||
res.PageRes.Pack(req, totalCount)
|
||||
return
|
||||
}
|
||||
|
||||
// Status 更新状态
|
||||
func (c *cEmsLog) Status(ctx context.Context, req *emslog.StatusReq) (res *emslog.StatusRes, err error) {
|
||||
err = service.SysEmsLog().Status(ctx, &req.EmsLogStatusInp)
|
||||
return
|
||||
}
|
||||
@@ -0,0 +1,137 @@
|
||||
// Package sys
|
||||
// @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 sys
|
||||
|
||||
import (
|
||||
"context"
|
||||
"hotgo/api/admin/gencodes"
|
||||
"hotgo/internal/service"
|
||||
)
|
||||
|
||||
var (
|
||||
GenCodes = cGenCodes{}
|
||||
)
|
||||
|
||||
type cGenCodes struct{}
|
||||
|
||||
// Delete 删除
|
||||
func (c *cGenCodes) Delete(ctx context.Context, req *gencodes.DeleteReq) (res *gencodes.DeleteRes, err error) {
|
||||
err = service.SysGenCodes().Delete(ctx, &req.GenCodesDeleteInp)
|
||||
return
|
||||
}
|
||||
|
||||
// Edit 更新
|
||||
func (c *cGenCodes) Edit(ctx context.Context, req *gencodes.EditReq) (res *gencodes.EditRes, err error) {
|
||||
data, err := service.SysGenCodes().Edit(ctx, &req.GenCodesEditInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(gencodes.EditRes)
|
||||
res.GenCodesEditModel = data
|
||||
return
|
||||
}
|
||||
|
||||
// MaxSort 最大排序
|
||||
func (c *cGenCodes) MaxSort(ctx context.Context, req *gencodes.MaxSortReq) (res *gencodes.MaxSortRes, err error) {
|
||||
res = new(gencodes.MaxSortRes)
|
||||
res.GenCodesMaxSortModel, err = service.SysGenCodes().MaxSort(ctx, &req.GenCodesMaxSortInp)
|
||||
return
|
||||
}
|
||||
|
||||
// View 获取指定信息
|
||||
func (c *cGenCodes) View(ctx context.Context, req *gencodes.ViewReq) (res *gencodes.ViewRes, err error) {
|
||||
data, err := service.SysGenCodes().View(ctx, &req.GenCodesViewInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(gencodes.ViewRes)
|
||||
res.GenCodesViewModel = data
|
||||
return
|
||||
}
|
||||
|
||||
// List 查看列表
|
||||
func (c *cGenCodes) List(ctx context.Context, req *gencodes.ListReq) (res *gencodes.ListRes, err error) {
|
||||
list, totalCount, err := service.SysGenCodes().List(ctx, &req.GenCodesListInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(gencodes.ListRes)
|
||||
res.List = list
|
||||
res.PageRes.Pack(req, totalCount)
|
||||
return
|
||||
}
|
||||
|
||||
// Status 更新状态
|
||||
func (c *cGenCodes) Status(ctx context.Context, req *gencodes.StatusReq) (res *gencodes.StatusRes, err error) {
|
||||
err = service.SysGenCodes().Status(ctx, &req.GenCodesStatusInp)
|
||||
return
|
||||
}
|
||||
|
||||
// Selects 获取指定信息
|
||||
func (c *cGenCodes) Selects(ctx context.Context, req *gencodes.SelectsReq) (res *gencodes.SelectsRes, err error) {
|
||||
data, err := service.SysGenCodes().Selects(ctx, &req.GenCodesSelectsInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(gencodes.SelectsRes)
|
||||
res.GenCodesSelectsModel = data
|
||||
return
|
||||
}
|
||||
|
||||
// TableSelect 数据库表选项
|
||||
func (c *cGenCodes) TableSelect(ctx context.Context, req *gencodes.TableSelectReq) (res *gencodes.TableSelectRes, err error) {
|
||||
data, err := service.SysGenCodes().TableSelect(ctx, &req.GenCodesTableSelectInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = (*gencodes.TableSelectRes)(&data)
|
||||
return
|
||||
}
|
||||
|
||||
// ColumnSelect 表字段选项
|
||||
func (c *cGenCodes) ColumnSelect(ctx context.Context, req *gencodes.ColumnSelectReq) (res *gencodes.ColumnSelectRes, err error) {
|
||||
data, err := service.SysGenCodes().ColumnSelect(ctx, &req.GenCodesColumnSelectInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = (*gencodes.ColumnSelectRes)(&data)
|
||||
return
|
||||
}
|
||||
|
||||
// ColumnList 表字段列表
|
||||
func (c *cGenCodes) ColumnList(ctx context.Context, req *gencodes.ColumnListReq) (res *gencodes.ColumnListRes, err error) {
|
||||
data, err := service.SysGenCodes().ColumnList(ctx, &req.GenCodesColumnListInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = (*gencodes.ColumnListRes)(&data)
|
||||
return
|
||||
}
|
||||
|
||||
// Preview 生成预览
|
||||
func (c *cGenCodes) Preview(ctx context.Context, req *gencodes.PreviewReq) (res *gencodes.PreviewRes, err error) {
|
||||
data, err := service.SysGenCodes().Preview(ctx, &req.GenCodesPreviewInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(gencodes.PreviewRes)
|
||||
res.GenCodesPreviewModel = data
|
||||
return
|
||||
}
|
||||
|
||||
// Build 生成预览
|
||||
func (c *cGenCodes) Build(ctx context.Context, req *gencodes.BuildReq) (res *gencodes.BuildRes, err error) {
|
||||
err = service.SysGenCodes().Build(ctx, &req.GenCodesBuildInp)
|
||||
return
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
// Package sys
|
||||
// @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 sys
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/gogf/gf/v2/errors/gerror"
|
||||
"hotgo/api/admin/log"
|
||||
"hotgo/internal/service"
|
||||
)
|
||||
|
||||
// Log 日志
|
||||
var Log = sLog{}
|
||||
|
||||
type sLog struct{}
|
||||
|
||||
// Clear 清空日志
|
||||
func (c *sLog) Clear(ctx context.Context, _ *log.ClearReq) (res *log.ClearRes, err error) {
|
||||
err = gerror.New("暂时考虑到安全问题,请到数据库清空")
|
||||
return
|
||||
}
|
||||
|
||||
// Export 导出
|
||||
func (c *sLog) Export(ctx context.Context, req *log.ExportReq) (res *log.ExportRes, err error) {
|
||||
err = service.SysLog().Export(ctx, &req.LogListInp)
|
||||
return
|
||||
}
|
||||
|
||||
// List 获取访问日志列表
|
||||
func (c *sLog) List(ctx context.Context, req *log.ListReq) (res *log.ListRes, err error) {
|
||||
list, totalCount, err := service.SysLog().List(ctx, &req.LogListInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(log.ListRes)
|
||||
res.List = list
|
||||
res.PageRes.Pack(req, totalCount)
|
||||
return
|
||||
}
|
||||
|
||||
// View 获取指定信息
|
||||
func (c *sLog) View(ctx context.Context, req *log.ViewReq) (res *log.ViewRes, err error) {
|
||||
res = new(log.ViewRes)
|
||||
res.LogViewModel, err = service.SysLog().View(ctx, &req.LogViewInp)
|
||||
return
|
||||
}
|
||||
|
||||
// Delete 删除
|
||||
func (c *sLog) Delete(ctx context.Context, req *log.DeleteReq) (res *log.DeleteRes, err error) {
|
||||
err = service.SysLog().Delete(ctx, &req.LogDeleteInp)
|
||||
return
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
// Package sys
|
||||
// @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
|
||||
// @AutoGenerate Version 2.1.1
|
||||
// @AutoGenerate Date 2023-01-19 16:57:33
|
||||
package sys
|
||||
|
||||
import (
|
||||
"context"
|
||||
"hotgo/api/admin/loginlog"
|
||||
"hotgo/internal/service"
|
||||
)
|
||||
|
||||
var (
|
||||
LoginLog = cLoginLog{}
|
||||
)
|
||||
|
||||
type cLoginLog struct{}
|
||||
|
||||
// List 查看登录日志列表
|
||||
func (c *cLoginLog) List(ctx context.Context, req *loginlog.ListReq) (res *loginlog.ListRes, err error) {
|
||||
list, totalCount, err := service.SysLoginLog().List(ctx, &req.LoginLogListInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(loginlog.ListRes)
|
||||
res.List = list
|
||||
res.PageRes.Pack(req, totalCount)
|
||||
return
|
||||
}
|
||||
|
||||
// Export 导出登录日志列表
|
||||
func (c *cLoginLog) Export(ctx context.Context, req *loginlog.ExportReq) (res *loginlog.ExportRes, err error) {
|
||||
err = service.SysLoginLog().Export(ctx, &req.LoginLogListInp)
|
||||
return
|
||||
}
|
||||
|
||||
// Delete 删除登录日志
|
||||
func (c *cLoginLog) Delete(ctx context.Context, req *loginlog.DeleteReq) (res *loginlog.DeleteRes, err error) {
|
||||
err = service.SysLoginLog().Delete(ctx, &req.LoginLogDeleteInp)
|
||||
return
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
package sys
|
||||
|
||||
import (
|
||||
"context"
|
||||
"hotgo/api/admin/memberlevel"
|
||||
"hotgo/internal/model/entity"
|
||||
"hotgo/internal/model/input/sysin"
|
||||
"hotgo/internal/service"
|
||||
)
|
||||
|
||||
var MemberLevel = cMemberLevel{}
|
||||
|
||||
type cMemberLevel struct{}
|
||||
|
||||
func (c *cMemberLevel) List(ctx context.Context, req *memberlevel.ListReq) (res *memberlevel.ListRes, err error) {
|
||||
list, total, err := service.SysMemberLevel().List(ctx, &req.MemberLevelListInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
if list == nil {
|
||||
list = []*sysin.MemberLevelListModel{}
|
||||
}
|
||||
res = new(memberlevel.ListRes)
|
||||
res.List = list
|
||||
res.PageRes.Pack(req, total)
|
||||
return
|
||||
}
|
||||
func (c *cMemberLevel) View(ctx context.Context, req *memberlevel.ViewReq) (res *memberlevel.ViewRes, err error) {
|
||||
v, err := service.SysMemberLevel().View(ctx, &req.MemberLevelViewInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
return &memberlevel.ViewRes{MemberLevelViewModel: v}, nil
|
||||
}
|
||||
func (c *cMemberLevel) Save(ctx context.Context, req *memberlevel.SaveReq) (res *memberlevel.SaveRes, err error) {
|
||||
id, vid, err := service.SysMemberLevel().Save(ctx, &req.MemberLevelSaveInp)
|
||||
return &memberlevel.SaveRes{Id: id, VersionId: vid}, err
|
||||
}
|
||||
func (c *cMemberLevel) Submit(ctx context.Context, req *memberlevel.SubmitReq) (res *memberlevel.SubmitRes, err error) {
|
||||
v, err := service.SysMemberLevel().Submit(ctx, &req.MemberLevelSubmitInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
return &memberlevel.SubmitRes{MemberLevelApprovalModel: v}, nil
|
||||
}
|
||||
func (c *cMemberLevel) Publish(ctx context.Context, req *memberlevel.PublishReq) (*memberlevel.PublishRes, error) {
|
||||
return &memberlevel.PublishRes{}, service.SysMemberLevel().Publish(ctx, &req.MemberLevelPublishInp)
|
||||
}
|
||||
func (c *cMemberLevel) Rollback(ctx context.Context, req *memberlevel.RollbackReq) (*memberlevel.RollbackRes, error) {
|
||||
id, err := service.SysMemberLevel().Rollback(ctx, &req.MemberLevelRollbackInp)
|
||||
return &memberlevel.RollbackRes{VersionId: id}, err
|
||||
}
|
||||
func (c *cMemberLevel) History(ctx context.Context, req *memberlevel.HistoryReq) (res *memberlevel.HistoryRes, err error) {
|
||||
list, total, err := service.SysMemberLevel().History(ctx, &req.MemberLevelHistoryInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
if list == nil {
|
||||
list = []*entity.AppMemberLevelVersion{}
|
||||
}
|
||||
res = new(memberlevel.HistoryRes)
|
||||
res.List = list
|
||||
res.PageRes.Pack(req, total)
|
||||
return
|
||||
}
|
||||
func (c *cMemberLevel) Status(ctx context.Context, req *memberlevel.StatusReq) (*memberlevel.StatusRes, error) {
|
||||
return &memberlevel.StatusRes{}, service.SysMemberLevel().Status(ctx, &req.MemberLevelStatusInp)
|
||||
}
|
||||
func (c *cMemberLevel) Delete(ctx context.Context, req *memberlevel.DeleteReq) (*memberlevel.DeleteRes, error) {
|
||||
return &memberlevel.DeleteRes{}, service.SysMemberLevel().Delete(ctx, &req.MemberLevelDeleteInp)
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
// Package sys
|
||||
// @Link https://github.com/bufanyun/hotgo
|
||||
// @Copyright Copyright (c) 2024 HotGo CLI
|
||||
// @Author Ms <133814250@qq.com>
|
||||
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
|
||||
// @AutoGenerate Version 2.15.7
|
||||
package sys
|
||||
|
||||
import (
|
||||
"context"
|
||||
"hotgo/api/admin/normaltreedemo"
|
||||
"hotgo/internal/model/input/sysin"
|
||||
"hotgo/internal/service"
|
||||
)
|
||||
|
||||
var (
|
||||
NormalTreeDemo = cNormalTreeDemo{}
|
||||
)
|
||||
|
||||
type cNormalTreeDemo struct{}
|
||||
|
||||
// List 查看普通树表列表
|
||||
func (c *cNormalTreeDemo) List(ctx context.Context, req *normaltreedemo.ListReq) (res *normaltreedemo.ListRes, err error) {
|
||||
list, totalCount, err := service.SysNormalTreeDemo().List(ctx, &req.NormalTreeDemoListInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if list == nil {
|
||||
list = []*sysin.NormalTreeDemoListModel{}
|
||||
}
|
||||
|
||||
res = new(normaltreedemo.ListRes)
|
||||
res.List = list
|
||||
res.PageRes.Pack(req, totalCount)
|
||||
return
|
||||
}
|
||||
|
||||
// Edit 更新普通树表
|
||||
func (c *cNormalTreeDemo) Edit(ctx context.Context, req *normaltreedemo.EditReq) (res *normaltreedemo.EditRes, err error) {
|
||||
err = service.SysNormalTreeDemo().Edit(ctx, &req.NormalTreeDemoEditInp)
|
||||
return
|
||||
}
|
||||
|
||||
// MaxSort 获取普通树表最大排序
|
||||
func (c *cNormalTreeDemo) MaxSort(ctx context.Context, req *normaltreedemo.MaxSortReq) (res *normaltreedemo.MaxSortRes, err error) {
|
||||
data, err := service.SysNormalTreeDemo().MaxSort(ctx, &req.NormalTreeDemoMaxSortInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(normaltreedemo.MaxSortRes)
|
||||
res.NormalTreeDemoMaxSortModel = data
|
||||
return
|
||||
}
|
||||
|
||||
// View 获取指定普通树表信息
|
||||
func (c *cNormalTreeDemo) View(ctx context.Context, req *normaltreedemo.ViewReq) (res *normaltreedemo.ViewRes, err error) {
|
||||
data, err := service.SysNormalTreeDemo().View(ctx, &req.NormalTreeDemoViewInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(normaltreedemo.ViewRes)
|
||||
res.NormalTreeDemoViewModel = data
|
||||
return
|
||||
}
|
||||
|
||||
// Delete 删除普通树表
|
||||
func (c *cNormalTreeDemo) Delete(ctx context.Context, req *normaltreedemo.DeleteReq) (res *normaltreedemo.DeleteRes, err error) {
|
||||
err = service.SysNormalTreeDemo().Delete(ctx, &req.NormalTreeDemoDeleteInp)
|
||||
return
|
||||
}
|
||||
|
||||
// TreeOption 获取普通树表关系树选项
|
||||
func (c *cNormalTreeDemo) TreeOption(ctx context.Context, req *normaltreedemo.TreeOptionReq) (res *normaltreedemo.TreeOptionRes, err error) {
|
||||
data, err := service.SysNormalTreeDemo().TreeOption(ctx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(data) > 0 {
|
||||
res = (*normaltreedemo.TreeOptionRes)(&data)
|
||||
} else {
|
||||
temp := make(normaltreedemo.TreeOptionRes, 0)
|
||||
res = &temp
|
||||
}
|
||||
return
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
// Package sys
|
||||
// @Link https://github.com/bufanyun/hotgo
|
||||
// @Copyright Copyright (c) 2025 HotGo CLI
|
||||
// @Author Ms <133814250@qq.com>
|
||||
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
|
||||
// @AutoGenerate Version 2.17.8
|
||||
package sys
|
||||
|
||||
import (
|
||||
"context"
|
||||
"hotgo/api/admin/optiontreedemo"
|
||||
"hotgo/internal/model/input/sysin"
|
||||
"hotgo/internal/service"
|
||||
)
|
||||
|
||||
var (
|
||||
OptionTreeDemo = cOptionTreeDemo{}
|
||||
)
|
||||
|
||||
type cOptionTreeDemo struct{}
|
||||
|
||||
// List 查看选项树表列表
|
||||
func (c *cOptionTreeDemo) List(ctx context.Context, req *optiontreedemo.ListReq) (res *optiontreedemo.ListRes, err error) {
|
||||
list, totalCount, err := service.SysOptionTreeDemo().List(ctx, &req.OptionTreeDemoListInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if list == nil {
|
||||
list = []*sysin.OptionTreeDemoListModel{}
|
||||
}
|
||||
|
||||
res = new(optiontreedemo.ListRes)
|
||||
res.List = list
|
||||
res.PageRes.Pack(req, totalCount)
|
||||
return
|
||||
}
|
||||
|
||||
// Edit 更新选项树表
|
||||
func (c *cOptionTreeDemo) Edit(ctx context.Context, req *optiontreedemo.EditReq) (res *optiontreedemo.EditRes, err error) {
|
||||
err = service.SysOptionTreeDemo().Edit(ctx, &req.OptionTreeDemoEditInp)
|
||||
return
|
||||
}
|
||||
|
||||
// MaxSort 获取选项树表最大排序
|
||||
func (c *cOptionTreeDemo) MaxSort(ctx context.Context, req *optiontreedemo.MaxSortReq) (res *optiontreedemo.MaxSortRes, err error) {
|
||||
data, err := service.SysOptionTreeDemo().MaxSort(ctx, &req.OptionTreeDemoMaxSortInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(optiontreedemo.MaxSortRes)
|
||||
res.OptionTreeDemoMaxSortModel = data
|
||||
return
|
||||
}
|
||||
|
||||
// View 获取指定选项树表信息
|
||||
func (c *cOptionTreeDemo) View(ctx context.Context, req *optiontreedemo.ViewReq) (res *optiontreedemo.ViewRes, err error) {
|
||||
data, err := service.SysOptionTreeDemo().View(ctx, &req.OptionTreeDemoViewInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(optiontreedemo.ViewRes)
|
||||
res.OptionTreeDemoViewModel = data
|
||||
return
|
||||
}
|
||||
|
||||
// Delete 删除选项树表
|
||||
func (c *cOptionTreeDemo) Delete(ctx context.Context, req *optiontreedemo.DeleteReq) (res *optiontreedemo.DeleteRes, err error) {
|
||||
err = service.SysOptionTreeDemo().Delete(ctx, &req.OptionTreeDemoDeleteInp)
|
||||
return
|
||||
}
|
||||
|
||||
// TreeOption 获取选项树表关系树选项
|
||||
func (c *cOptionTreeDemo) TreeOption(ctx context.Context, req *optiontreedemo.TreeOptionReq) (res *optiontreedemo.TreeOptionRes, err error) {
|
||||
data, err := service.SysOptionTreeDemo().TreeOption(ctx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(data) > 0 {
|
||||
res = (*optiontreedemo.TreeOptionRes)(&data)
|
||||
} else {
|
||||
temp := make(optiontreedemo.TreeOptionRes, 0)
|
||||
res = &temp
|
||||
}
|
||||
return
|
||||
}
|
||||
@@ -0,0 +1,168 @@
|
||||
package sys
|
||||
|
||||
import (
|
||||
"context"
|
||||
"hotgo/api/admin/portal"
|
||||
"hotgo/internal/model/input/sysin"
|
||||
"hotgo/internal/service"
|
||||
)
|
||||
|
||||
var Portal = cPortal{}
|
||||
|
||||
type cPortal struct{}
|
||||
|
||||
func (c *cPortal) SiteConfigCurrent(ctx context.Context, req *portal.SiteConfigCurrentReq) (res *portal.SiteConfigCurrentRes, err error) {
|
||||
data, err := service.SysPortal().SiteConfigCurrent(ctx, &req.SiteConfigCurrentInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
res = &portal.SiteConfigCurrentRes{SiteConfigCurrentModel: data}
|
||||
return
|
||||
}
|
||||
func (c *cPortal) SiteConfigHistory(ctx context.Context, req *portal.SiteConfigHistoryReq) (res *portal.SiteConfigHistoryRes, err error) {
|
||||
list, total, err := service.SysPortal().SiteConfigHistory(ctx, &req.SiteConfigHistoryInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
if list == nil {
|
||||
list = []*sysin.SiteConfigHistoryModel{}
|
||||
}
|
||||
res = new(portal.SiteConfigHistoryRes)
|
||||
res.List = list
|
||||
res.PageRes.Pack(req, total)
|
||||
return
|
||||
}
|
||||
func (c *cPortal) SiteConfigSave(ctx context.Context, req *portal.SiteConfigSaveReq) (res *portal.SiteConfigSaveRes, err error) {
|
||||
id, err := service.SysPortal().SiteConfigSave(ctx, &req.SiteConfigSaveInp)
|
||||
if err == nil {
|
||||
res = &portal.SiteConfigSaveRes{Id: id}
|
||||
}
|
||||
return
|
||||
}
|
||||
func (c *cPortal) SiteConfigSubmit(ctx context.Context, req *portal.SiteConfigSubmitReq) (res *portal.SiteConfigSubmitRes, err error) {
|
||||
data, err := service.SysPortal().SiteConfigSubmit(ctx, &req.SiteConfigSubmitInp)
|
||||
if err == nil {
|
||||
res = &portal.SiteConfigSubmitRes{PortalApprovalModel: data}
|
||||
}
|
||||
return
|
||||
}
|
||||
func (c *cPortal) SiteConfigPublish(ctx context.Context, req *portal.SiteConfigPublishReq) (res *portal.SiteConfigPublishRes, err error) {
|
||||
err = service.SysPortal().SiteConfigPublish(ctx, &req.SiteConfigPublishInp)
|
||||
return
|
||||
}
|
||||
func (c *cPortal) SiteConfigRollback(ctx context.Context, req *portal.SiteConfigRollbackReq) (res *portal.SiteConfigRollbackRes, err error) {
|
||||
id, err := service.SysPortal().SiteConfigRollback(ctx, &req.SiteConfigRollbackInp)
|
||||
if err == nil {
|
||||
res = &portal.SiteConfigRollbackRes{Id: id}
|
||||
}
|
||||
return
|
||||
}
|
||||
func (c *cPortal) ContentList(ctx context.Context, req *portal.ContentListReq) (res *portal.ContentListRes, err error) {
|
||||
list, total, err := service.SysPortal().ContentList(ctx, &req.ContentListInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
if list == nil {
|
||||
list = []*sysin.ContentListModel{}
|
||||
}
|
||||
res = new(portal.ContentListRes)
|
||||
res.List = list
|
||||
res.PageRes.Pack(req, total)
|
||||
return
|
||||
}
|
||||
func (c *cPortal) ContentView(ctx context.Context, req *portal.ContentViewReq) (res *portal.ContentViewRes, err error) {
|
||||
data, err := service.SysPortal().ContentView(ctx, &req.ContentViewInp)
|
||||
if err == nil {
|
||||
res = &portal.ContentViewRes{ContentViewModel: data}
|
||||
}
|
||||
return
|
||||
}
|
||||
func (c *cPortal) ContentEdit(ctx context.Context, req *portal.ContentEditReq) (res *portal.ContentEditRes, err error) {
|
||||
id, err := service.SysPortal().ContentEdit(ctx, &req.ContentEditInp)
|
||||
if err == nil {
|
||||
res = &portal.ContentEditRes{Id: id}
|
||||
}
|
||||
return
|
||||
}
|
||||
func (c *cPortal) ContentDelete(ctx context.Context, req *portal.ContentDeleteReq) (res *portal.ContentDeleteRes, err error) {
|
||||
err = service.SysPortal().ContentDelete(ctx, &req.ContentDeleteInp)
|
||||
return
|
||||
}
|
||||
func (c *cPortal) ContentPublish(ctx context.Context, req *portal.ContentPublishReq) (res *portal.ContentPublishRes, err error) {
|
||||
err = service.SysPortal().ContentPublish(ctx, &req.ContentPublishInp)
|
||||
return
|
||||
}
|
||||
func (c *cPortal) ContentOffline(ctx context.Context, req *portal.ContentOfflineReq) (res *portal.ContentOfflineRes, err error) {
|
||||
err = service.SysPortal().ContentOffline(ctx, &req.ContentOfflineInp)
|
||||
return
|
||||
}
|
||||
func (c *cPortal) BannerList(ctx context.Context, req *portal.BannerListReq) (res *portal.BannerListRes, err error) {
|
||||
list, total, err := service.SysPortal().BannerList(ctx, &req.BannerListInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
if list == nil {
|
||||
list = []*sysin.BannerListModel{}
|
||||
}
|
||||
res = new(portal.BannerListRes)
|
||||
res.List = list
|
||||
res.PageRes.Pack(req, total)
|
||||
return
|
||||
}
|
||||
func (c *cPortal) BannerView(ctx context.Context, req *portal.BannerViewReq) (res *portal.BannerViewRes, err error) {
|
||||
data, err := service.SysPortal().BannerView(ctx, &req.BannerViewInp)
|
||||
if err == nil {
|
||||
res = &portal.BannerViewRes{Banner: data}
|
||||
}
|
||||
return
|
||||
}
|
||||
func (c *cPortal) BannerEdit(ctx context.Context, req *portal.BannerEditReq) (res *portal.BannerEditRes, err error) {
|
||||
id, err := service.SysPortal().BannerEdit(ctx, &req.BannerEditInp)
|
||||
if err == nil {
|
||||
res = &portal.BannerEditRes{Id: id}
|
||||
}
|
||||
return
|
||||
}
|
||||
func (c *cPortal) BannerDelete(ctx context.Context, req *portal.BannerDeleteReq) (res *portal.BannerDeleteRes, err error) {
|
||||
err = service.SysPortal().BannerDelete(ctx, &req.BannerDeleteInp)
|
||||
return
|
||||
}
|
||||
func (c *cPortal) BannerStatus(ctx context.Context, req *portal.BannerStatusReq) (res *portal.BannerStatusRes, err error) {
|
||||
err = service.SysPortal().BannerStatus(ctx, &req.BannerStatusInp)
|
||||
return
|
||||
}
|
||||
func (c *cPortal) ManualProductList(ctx context.Context, req *portal.ManualProductListReq) (res *portal.ManualProductListRes, err error) {
|
||||
list, total, err := service.SysPortal().ManualProductList(ctx, &req.ManualProductListInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
if list == nil {
|
||||
list = []*sysin.ManualProductListModel{}
|
||||
}
|
||||
res = new(portal.ManualProductListRes)
|
||||
res.List = list
|
||||
res.PageRes.Pack(req, total)
|
||||
return
|
||||
}
|
||||
func (c *cPortal) ManualProductView(ctx context.Context, req *portal.ManualProductViewReq) (res *portal.ManualProductViewRes, err error) {
|
||||
data, err := service.SysPortal().ManualProductView(ctx, &req.ManualProductViewInp)
|
||||
if err == nil {
|
||||
res = &portal.ManualProductViewRes{ManualProductViewModel: data}
|
||||
}
|
||||
return
|
||||
}
|
||||
func (c *cPortal) ManualProductEdit(ctx context.Context, req *portal.ManualProductEditReq) (res *portal.ManualProductEditRes, err error) {
|
||||
id, err := service.SysPortal().ManualProductEdit(ctx, &req.ManualProductEditInp)
|
||||
if err == nil {
|
||||
res = &portal.ManualProductEditRes{Id: id}
|
||||
}
|
||||
return
|
||||
}
|
||||
func (c *cPortal) ManualProductDelete(ctx context.Context, req *portal.ManualProductDeleteReq) (res *portal.ManualProductDeleteRes, err error) {
|
||||
err = service.SysPortal().ManualProductDelete(ctx, &req.ManualProductDeleteInp)
|
||||
return
|
||||
}
|
||||
func (c *cPortal) ManualProductStatus(ctx context.Context, req *portal.ManualProductStatusReq) (res *portal.ManualProductStatusRes, err error) {
|
||||
err = service.SysPortal().ManualProductStatus(ctx, &req.ManualProductStatusInp)
|
||||
return
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
package sys
|
||||
|
||||
import (
|
||||
"context"
|
||||
"hotgo/api/admin/product"
|
||||
"hotgo/internal/model/input/sysin"
|
||||
"hotgo/internal/service"
|
||||
)
|
||||
|
||||
var Product = cProduct{}
|
||||
|
||||
type cProduct struct{}
|
||||
|
||||
func (c *cProduct) List(ctx context.Context, req *product.ListReq) (res *product.ListRes, err error) {
|
||||
list, total, err := service.SysProduct().List(ctx, &req.ProductListInp)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if list == nil {
|
||||
list = []*sysin.ProductListModel{}
|
||||
}
|
||||
res = new(product.ListRes)
|
||||
res.List = list
|
||||
res.PageRes.Pack(req, total)
|
||||
return
|
||||
}
|
||||
func (c *cProduct) View(ctx context.Context, req *product.ViewReq) (res *product.ViewRes, err error) {
|
||||
data, err := service.SysProduct().View(ctx, &req.ProductViewInp)
|
||||
if err == nil {
|
||||
res = &product.ViewRes{ProductListModel: data}
|
||||
}
|
||||
return res, err
|
||||
}
|
||||
func (c *cProduct) Edit(ctx context.Context, req *product.EditReq) (res *product.EditRes, err error) {
|
||||
id, err := service.SysProduct().Edit(ctx, &req.ProductEditInp)
|
||||
if err == nil {
|
||||
res = &product.EditRes{Id: id}
|
||||
}
|
||||
return res, err
|
||||
}
|
||||
func (c *cProduct) Status(ctx context.Context, req *product.StatusReq) (res *product.StatusRes, err error) {
|
||||
err = service.SysProduct().Status(ctx, &req.ProductStatusInp)
|
||||
return
|
||||
}
|
||||
func (c *cProduct) Recommend(ctx context.Context, req *product.RecommendReq) (res *product.RecommendRes, err error) {
|
||||
err = service.SysProduct().Recommend(ctx, &req.ProductRecommendInp)
|
||||
return
|
||||
}
|
||||
func (c *cProduct) Delete(ctx context.Context, req *product.DeleteReq) (res *product.DeleteRes, err error) {
|
||||
err = service.SysProduct().Delete(ctx, &req.ProductDeleteInp)
|
||||
return
|
||||
}
|
||||
@@ -0,0 +1,129 @@
|
||||
// Package sys
|
||||
// @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 sys
|
||||
|
||||
import (
|
||||
"context"
|
||||
"hotgo/api/admin/provinces"
|
||||
"hotgo/internal/library/location"
|
||||
"hotgo/internal/service"
|
||||
)
|
||||
|
||||
var (
|
||||
Provinces = cProvinces{}
|
||||
)
|
||||
|
||||
type cProvinces struct{}
|
||||
|
||||
// Tree 关系树选项列表
|
||||
func (c *cProvinces) Tree(ctx context.Context, _ *provinces.TreeReq) (res *provinces.TreeRes, err error) {
|
||||
res = new(provinces.TreeRes)
|
||||
res.List, err = service.SysProvinces().Tree(ctx)
|
||||
return
|
||||
}
|
||||
|
||||
// Delete 删除
|
||||
func (c *cProvinces) Delete(ctx context.Context, req *provinces.DeleteReq) (res *provinces.DeleteRes, err error) {
|
||||
err = service.SysProvinces().Delete(ctx, &req.ProvincesDeleteInp)
|
||||
return
|
||||
}
|
||||
|
||||
// Edit 更新
|
||||
func (c *cProvinces) Edit(ctx context.Context, req *provinces.EditReq) (res *provinces.EditRes, err error) {
|
||||
err = service.SysProvinces().Edit(ctx, &req.ProvincesEditInp)
|
||||
return
|
||||
}
|
||||
|
||||
// MaxSort 最大排序
|
||||
func (c *cProvinces) MaxSort(ctx context.Context, req *provinces.MaxSortReq) (res *provinces.MaxSortRes, err error) {
|
||||
data, err := service.SysProvinces().MaxSort(ctx, &req.ProvincesMaxSortInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(provinces.MaxSortRes)
|
||||
res.ProvincesMaxSortModel = data
|
||||
return
|
||||
}
|
||||
|
||||
// View 获取指定信息
|
||||
func (c *cProvinces) View(ctx context.Context, req *provinces.ViewReq) (res *provinces.ViewRes, err error) {
|
||||
data, err := service.SysProvinces().View(ctx, &req.ProvincesViewInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(provinces.ViewRes)
|
||||
res.ProvincesViewModel = data
|
||||
return
|
||||
}
|
||||
|
||||
// List 查看列表
|
||||
func (c *cProvinces) List(ctx context.Context, req *provinces.ListReq) (res *provinces.ListRes, err error) {
|
||||
list, totalCount, err := service.SysProvinces().List(ctx, &req.ProvincesListInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(provinces.ListRes)
|
||||
res.List = list
|
||||
res.PageRes.Pack(req, totalCount)
|
||||
return
|
||||
}
|
||||
|
||||
// Status 更新省市区状态
|
||||
func (c *cProvinces) Status(ctx context.Context, req *provinces.StatusReq) (res *provinces.StatusRes, err error) {
|
||||
err = service.SysProvinces().Status(ctx, &req.ProvincesStatusInp)
|
||||
return
|
||||
}
|
||||
|
||||
// ChildrenList 获取省市区下级列表
|
||||
func (c *cProvinces) ChildrenList(ctx context.Context, req *provinces.ChildrenListReq) (res *provinces.ChildrenListRes, err error) {
|
||||
list, totalCount, err := service.SysProvinces().ChildrenList(ctx, &req.ProvincesChildrenListInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(provinces.ChildrenListRes)
|
||||
res.List = list
|
||||
res.PageRes.Pack(req, totalCount)
|
||||
return
|
||||
}
|
||||
|
||||
// UniqueId 地区ID是否唯一
|
||||
func (c *cProvinces) UniqueId(ctx context.Context, req *provinces.UniqueIdReq) (res *provinces.UniqueIdRes, err error) {
|
||||
data, err := service.SysProvinces().UniqueId(ctx, &req.ProvincesUniqueIdInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(provinces.UniqueIdRes)
|
||||
res.ProvincesUniqueIdModel = data
|
||||
return
|
||||
}
|
||||
|
||||
// Select 省市区选项
|
||||
func (c *cProvinces) Select(ctx context.Context, req *provinces.SelectReq) (res *provinces.SelectRes, err error) {
|
||||
data, err := service.SysProvinces().Select(ctx, &req.ProvincesSelectInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(provinces.SelectRes)
|
||||
res.ProvincesSelectModel = data
|
||||
return
|
||||
}
|
||||
|
||||
// CityLabel 省市区选项
|
||||
func (c *cProvinces) CityLabel(ctx context.Context, req *provinces.CityLabelReq) (res *provinces.CityLabelRes, err error) {
|
||||
cityLabel, err := location.ParseSimpleRegion(ctx, req.Id, req.Spilt)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = (*provinces.CityLabelRes)(&cityLabel)
|
||||
return
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package sys
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"hotgo/api/admin/rechargeorder"
|
||||
"hotgo/internal/model/input/sysin"
|
||||
"hotgo/internal/service"
|
||||
)
|
||||
|
||||
var RechargeOrder = cRechargeOrder{}
|
||||
|
||||
type cRechargeOrder struct{}
|
||||
|
||||
func (c *cRechargeOrder) List(ctx context.Context, req *rechargeorder.ListReq) (res *rechargeorder.ListRes, err error) {
|
||||
list, total, err := service.SysRechargeOrder().List(ctx, &req.RechargeOrderListInp)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if list == nil {
|
||||
list = []*sysin.RechargeOrderListModel{}
|
||||
}
|
||||
res = new(rechargeorder.ListRes)
|
||||
res.List = list
|
||||
res.PageRes.Pack(req, total)
|
||||
return
|
||||
}
|
||||
func (c *cRechargeOrder) Summary(ctx context.Context, req *rechargeorder.SummaryReq) (*rechargeorder.SummaryRes, error) {
|
||||
v, err := service.SysRechargeOrder().Summary(ctx, &req.RechargeOrderListInp)
|
||||
return &rechargeorder.SummaryRes{RechargeSummaryModel: v}, err
|
||||
}
|
||||
func (c *cRechargeOrder) View(ctx context.Context, req *rechargeorder.ViewReq) (*rechargeorder.ViewRes, error) {
|
||||
v, err := service.SysRechargeOrder().View(ctx, &req.RechargeOrderViewInp)
|
||||
return &rechargeorder.ViewRes{RechargeOrderListModel: v}, err
|
||||
}
|
||||
func (c *cRechargeOrder) Review(ctx context.Context, req *rechargeorder.ReviewReq) (*rechargeorder.ReviewRes, error) {
|
||||
v, err := service.SysRechargeOrder().Review(ctx, &req.RechargeReviewInp)
|
||||
return &rechargeorder.ReviewRes{FinanceApprovalModel: v}, err
|
||||
}
|
||||
func (c *cRechargeOrder) Execute(ctx context.Context, req *rechargeorder.ExecuteReq) (*rechargeorder.ExecuteRes, error) {
|
||||
return &rechargeorder.ExecuteRes{}, service.SysRechargeOrder().Execute(ctx, &req.FinanceExecuteInp)
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
// Package sys
|
||||
// @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
|
||||
// @AutoGenerate Version 2.7.6
|
||||
package sys
|
||||
|
||||
import (
|
||||
"context"
|
||||
"hotgo/api/admin/servelicense"
|
||||
"hotgo/internal/service"
|
||||
)
|
||||
|
||||
var (
|
||||
ServeLicense = cServeLicense{}
|
||||
)
|
||||
|
||||
type cServeLicense struct{}
|
||||
|
||||
// List 查看服务授权许可列表
|
||||
func (c *cServeLicense) List(ctx context.Context, req *servelicense.ListReq) (res *servelicense.ListRes, err error) {
|
||||
list, totalCount, err := service.SysServeLicense().List(ctx, &req.ServeLicenseListInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(servelicense.ListRes)
|
||||
res.List = list
|
||||
res.PageRes.Pack(req, totalCount)
|
||||
return
|
||||
}
|
||||
|
||||
// Export 导出服务授权许可列表
|
||||
func (c *cServeLicense) Export(ctx context.Context, req *servelicense.ExportReq) (res *servelicense.ExportRes, err error) {
|
||||
err = service.SysServeLicense().Export(ctx, &req.ServeLicenseListInp)
|
||||
return
|
||||
}
|
||||
|
||||
// Edit 更新服务授权许可
|
||||
func (c *cServeLicense) Edit(ctx context.Context, req *servelicense.EditReq) (res *servelicense.EditRes, err error) {
|
||||
err = service.SysServeLicense().Edit(ctx, &req.ServeLicenseEditInp)
|
||||
return
|
||||
}
|
||||
|
||||
// View 获取指定服务授权许可信息
|
||||
func (c *cServeLicense) View(ctx context.Context, req *servelicense.ViewReq) (res *servelicense.ViewRes, err error) {
|
||||
data, err := service.SysServeLicense().View(ctx, &req.ServeLicenseViewInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(servelicense.ViewRes)
|
||||
res.ServeLicenseViewModel = data
|
||||
return
|
||||
}
|
||||
|
||||
// Delete 删除服务授权许可
|
||||
func (c *cServeLicense) Delete(ctx context.Context, req *servelicense.DeleteReq) (res *servelicense.DeleteRes, err error) {
|
||||
err = service.SysServeLicense().Delete(ctx, &req.ServeLicenseDeleteInp)
|
||||
return
|
||||
}
|
||||
|
||||
// Status 更新服务授权许可状态
|
||||
func (c *cServeLicense) Status(ctx context.Context, req *servelicense.StatusReq) (res *servelicense.StatusRes, err error) {
|
||||
err = service.SysServeLicense().Status(ctx, &req.ServeLicenseStatusInp)
|
||||
return
|
||||
}
|
||||
|
||||
// AssignRouter 分配服务授权许可路由
|
||||
func (c *cServeLicense) AssignRouter(ctx context.Context, req *servelicense.AssignRouterReq) (res *servelicense.AssignRouterRes, err error) {
|
||||
err = service.SysServeLicense().AssignRouter(ctx, &req.ServeLicenseAssignRouterInp)
|
||||
return
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
// Package sys
|
||||
// @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 sys
|
||||
|
||||
import (
|
||||
"context"
|
||||
"hotgo/api/admin/servelog"
|
||||
"hotgo/internal/service"
|
||||
)
|
||||
|
||||
var (
|
||||
ServeLog = cServeLog{}
|
||||
)
|
||||
|
||||
type cServeLog struct{}
|
||||
|
||||
// List 查看服务日志列表
|
||||
func (c *cServeLog) List(ctx context.Context, req *servelog.ListReq) (res *servelog.ListRes, err error) {
|
||||
list, totalCount, err := service.SysServeLog().List(ctx, &req.ServeLogListInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(servelog.ListRes)
|
||||
res.List = list
|
||||
res.PageRes.Pack(req, totalCount)
|
||||
return
|
||||
}
|
||||
|
||||
// Export 导出服务日志列表
|
||||
func (c *cServeLog) Export(ctx context.Context, req *servelog.ExportReq) (res *servelog.ExportRes, err error) {
|
||||
err = service.SysServeLog().Export(ctx, &req.ServeLogListInp)
|
||||
return
|
||||
}
|
||||
|
||||
// View 获取指定服务日志信息
|
||||
func (c *cServeLog) View(ctx context.Context, req *servelog.ViewReq) (res *servelog.ViewRes, err error) {
|
||||
data, err := service.SysServeLog().View(ctx, &req.ServeLogViewInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(servelog.ViewRes)
|
||||
res.ServeLogViewModel = data
|
||||
return
|
||||
}
|
||||
|
||||
// Delete 删除服务日志
|
||||
func (c *cServeLog) Delete(ctx context.Context, req *servelog.DeleteReq) (res *servelog.DeleteRes, err error) {
|
||||
err = service.SysServeLog().Delete(ctx, &req.ServeLogDeleteInp)
|
||||
return
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
// Package sys
|
||||
// @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 sys
|
||||
|
||||
import (
|
||||
"context"
|
||||
"hotgo/api/admin/smslog"
|
||||
"hotgo/internal/service"
|
||||
)
|
||||
|
||||
var (
|
||||
SmsLog = cSmsLog{}
|
||||
)
|
||||
|
||||
type cSmsLog struct{}
|
||||
|
||||
// Delete 删除
|
||||
func (c *cSmsLog) Delete(ctx context.Context, req *smslog.DeleteReq) (res *smslog.DeleteRes, err error) {
|
||||
err = service.SysSmsLog().Delete(ctx, &req.SmsLogDeleteInp)
|
||||
return
|
||||
}
|
||||
|
||||
// View 获取指定信息
|
||||
func (c *cSmsLog) View(ctx context.Context, req *smslog.ViewReq) (res *smslog.ViewRes, err error) {
|
||||
data, err := service.SysSmsLog().View(ctx, &req.SmsLogViewInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(smslog.ViewRes)
|
||||
res.SmsLogViewModel = data
|
||||
return
|
||||
}
|
||||
|
||||
// List 查看列表
|
||||
func (c *cSmsLog) List(ctx context.Context, req *smslog.ListReq) (res *smslog.ListRes, err error) {
|
||||
list, totalCount, err := service.SysSmsLog().List(ctx, &req.SmsLogListInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(smslog.ListRes)
|
||||
res.List = list
|
||||
res.PageRes.Pack(req, totalCount)
|
||||
return
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
package sys
|
||||
|
||||
import (
|
||||
"context"
|
||||
"hotgo/api/admin/task"
|
||||
"hotgo/internal/model/input/sysin"
|
||||
"hotgo/internal/service"
|
||||
)
|
||||
|
||||
var Task = cTask{}
|
||||
|
||||
type cTask struct{}
|
||||
|
||||
func (c *cTask) List(ctx context.Context, req *task.ListReq) (res *task.ListRes, err error) {
|
||||
list, total, err := service.SysTask().List(ctx, &req.TaskListInp)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if list == nil {
|
||||
list = []*sysin.TaskListModel{}
|
||||
}
|
||||
res = new(task.ListRes)
|
||||
res.List = list
|
||||
res.PageRes.Pack(req, total)
|
||||
return
|
||||
}
|
||||
func (c *cTask) View(ctx context.Context, req *task.ViewReq) (res *task.ViewRes, err error) {
|
||||
data, err := service.SysTask().View(ctx, &req.TaskViewInp)
|
||||
if err == nil {
|
||||
res = &task.ViewRes{TaskListModel: data}
|
||||
}
|
||||
return res, err
|
||||
}
|
||||
func (c *cTask) Edit(ctx context.Context, req *task.EditReq) (res *task.EditRes, err error) {
|
||||
id, err := service.SysTask().Edit(ctx, &req.TaskEditInp)
|
||||
if err == nil {
|
||||
res = &task.EditRes{Id: id}
|
||||
}
|
||||
return res, err
|
||||
}
|
||||
func (c *cTask) Status(ctx context.Context, req *task.StatusReq) (res *task.StatusRes, err error) {
|
||||
err = service.SysTask().Status(ctx, &req.TaskStatusInp)
|
||||
return
|
||||
}
|
||||
func (c *cTask) Delete(ctx context.Context, req *task.DeleteReq) (res *task.DeleteRes, err error) {
|
||||
err = service.SysTask().Delete(ctx, &req.TaskDeleteInp)
|
||||
return
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package sys
|
||||
|
||||
import (
|
||||
"context"
|
||||
"hotgo/api/admin/taskhall"
|
||||
"hotgo/internal/model/input/sysin"
|
||||
"hotgo/internal/service"
|
||||
)
|
||||
|
||||
var TaskHall = cTaskHall{}
|
||||
|
||||
type cTaskHall struct{}
|
||||
|
||||
func (c *cTaskHall) List(ctx context.Context, req *taskhall.ListReq) (res *taskhall.ListRes, err error) {
|
||||
list, total, err := service.SysTaskHall().List(ctx, &req.TaskHallListInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
if list == nil {
|
||||
list = []*sysin.TaskHallListModel{}
|
||||
}
|
||||
res = new(taskhall.ListRes)
|
||||
res.List = list
|
||||
res.PageRes.Pack(req, total)
|
||||
return
|
||||
}
|
||||
func (c *cTaskHall) View(ctx context.Context, req *taskhall.ViewReq) (res *taskhall.ViewRes, err error) {
|
||||
v, err := service.SysTaskHall().View(ctx, &req.TaskHallViewInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
return &taskhall.ViewRes{TaskHallListModel: v}, nil
|
||||
}
|
||||
func (c *cTaskHall) Edit(ctx context.Context, req *taskhall.EditReq) (*taskhall.EditRes, error) {
|
||||
return &taskhall.EditRes{}, service.SysTaskHall().Edit(ctx, &req.TaskHallEditInp)
|
||||
}
|
||||
func (c *cTaskHall) Status(ctx context.Context, req *taskhall.StatusReq) (*taskhall.StatusRes, error) {
|
||||
return &taskhall.StatusRes{}, service.SysTaskHall().Status(ctx, &req.TaskHallStatusInp)
|
||||
}
|
||||
func (c *cTaskHall) Delete(ctx context.Context, req *taskhall.DeleteReq) (*taskhall.DeleteRes, error) {
|
||||
return &taskhall.DeleteRes{}, service.SysTaskHall().Delete(ctx, &req.TaskHallDeleteInp)
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package sys
|
||||
|
||||
import (
|
||||
"context"
|
||||
"hotgo/api/admin/tasksubmission"
|
||||
"hotgo/internal/model/input/sysin"
|
||||
"hotgo/internal/service"
|
||||
)
|
||||
|
||||
var TaskSubmission = cTaskSubmission{}
|
||||
|
||||
type cTaskSubmission struct{}
|
||||
|
||||
func (c *cTaskSubmission) List(ctx context.Context, req *tasksubmission.ListReq) (res *tasksubmission.ListRes, err error) {
|
||||
list, total, err := service.SysTaskSubmission().List(ctx, &req.TaskSubmissionListInp)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if list == nil {
|
||||
list = []*sysin.TaskSubmissionListModel{}
|
||||
}
|
||||
res = new(tasksubmission.ListRes)
|
||||
res.List = list
|
||||
res.PageRes.Pack(req, total)
|
||||
return
|
||||
}
|
||||
func (c *cTaskSubmission) View(ctx context.Context, req *tasksubmission.ViewReq) (res *tasksubmission.ViewRes, err error) {
|
||||
data, err := service.SysTaskSubmission().View(ctx, &req.TaskSubmissionViewInp)
|
||||
if err == nil {
|
||||
res = &tasksubmission.ViewRes{TaskSubmissionListModel: data}
|
||||
}
|
||||
return res, err
|
||||
}
|
||||
func (c *cTaskSubmission) Review(ctx context.Context, req *tasksubmission.ReviewReq) (res *tasksubmission.ReviewRes, err error) {
|
||||
err = service.SysTaskSubmission().Review(ctx, &req.TaskSubmissionReviewInp)
|
||||
return
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
// Package sys
|
||||
// @Link https://github.com/bufanyun/hotgo
|
||||
// @Copyright Copyright (c) 2024 HotGo CLI
|
||||
// @Author Ms <133814250@qq.com>
|
||||
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
|
||||
// @AutoGenerate Version 2.15.7
|
||||
package sys
|
||||
|
||||
import (
|
||||
"context"
|
||||
"hotgo/api/admin/testcategory"
|
||||
"hotgo/internal/model/input/sysin"
|
||||
"hotgo/internal/service"
|
||||
)
|
||||
|
||||
var (
|
||||
TestCategory = cTestCategory{}
|
||||
)
|
||||
|
||||
type cTestCategory struct{}
|
||||
|
||||
// List 查看测试分类列表
|
||||
func (c *cTestCategory) List(ctx context.Context, req *testcategory.ListReq) (res *testcategory.ListRes, err error) {
|
||||
list, totalCount, err := service.SysTestCategory().List(ctx, &req.TestCategoryListInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if list == nil {
|
||||
list = []*sysin.TestCategoryListModel{}
|
||||
}
|
||||
|
||||
res = new(testcategory.ListRes)
|
||||
res.List = list
|
||||
res.PageRes.Pack(req, totalCount)
|
||||
return
|
||||
}
|
||||
|
||||
// Edit 更新测试分类
|
||||
func (c *cTestCategory) Edit(ctx context.Context, req *testcategory.EditReq) (res *testcategory.EditRes, err error) {
|
||||
err = service.SysTestCategory().Edit(ctx, &req.TestCategoryEditInp)
|
||||
return
|
||||
}
|
||||
|
||||
// MaxSort 获取测试分类最大排序
|
||||
func (c *cTestCategory) MaxSort(ctx context.Context, req *testcategory.MaxSortReq) (res *testcategory.MaxSortRes, err error) {
|
||||
data, err := service.SysTestCategory().MaxSort(ctx, &req.TestCategoryMaxSortInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(testcategory.MaxSortRes)
|
||||
res.TestCategoryMaxSortModel = data
|
||||
return
|
||||
}
|
||||
|
||||
// View 获取指定测试分类信息
|
||||
func (c *cTestCategory) View(ctx context.Context, req *testcategory.ViewReq) (res *testcategory.ViewRes, err error) {
|
||||
data, err := service.SysTestCategory().View(ctx, &req.TestCategoryViewInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(testcategory.ViewRes)
|
||||
res.TestCategoryViewModel = data
|
||||
return
|
||||
}
|
||||
|
||||
// Delete 删除测试分类
|
||||
func (c *cTestCategory) Delete(ctx context.Context, req *testcategory.DeleteReq) (res *testcategory.DeleteRes, err error) {
|
||||
err = service.SysTestCategory().Delete(ctx, &req.TestCategoryDeleteInp)
|
||||
return
|
||||
}
|
||||
|
||||
// Status 更新测试分类状态
|
||||
func (c *cTestCategory) Status(ctx context.Context, req *testcategory.StatusReq) (res *testcategory.StatusRes, err error) {
|
||||
err = service.SysTestCategory().Status(ctx, &req.TestCategoryStatusInp)
|
||||
return
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
package sys
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"hotgo/api/admin/tradeorder"
|
||||
"hotgo/internal/model/input/sysin"
|
||||
"hotgo/internal/service"
|
||||
)
|
||||
|
||||
var TradeOrder = cTradeOrder{}
|
||||
|
||||
type cTradeOrder struct{}
|
||||
|
||||
func (c *cTradeOrder) List(ctx context.Context, req *tradeorder.ListReq) (res *tradeorder.ListRes, err error) {
|
||||
list, total, err := service.SysTradeOrder().List(ctx, &req.TradeOrderListInp)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if list == nil {
|
||||
list = []*sysin.TradeOrderListModel{}
|
||||
}
|
||||
res = new(tradeorder.ListRes)
|
||||
res.List = list
|
||||
res.PageRes.Pack(req, total)
|
||||
return
|
||||
}
|
||||
func (c *cTradeOrder) View(ctx context.Context, req *tradeorder.ViewReq) (*tradeorder.ViewRes, error) {
|
||||
v, err := service.SysTradeOrder().View(ctx, &req.TradeOrderViewInp)
|
||||
return &tradeorder.ViewRes{TradeOrderViewModel: v}, err
|
||||
}
|
||||
func (c *cTradeOrder) MatchProducts(ctx context.Context, req *tradeorder.MatchProductsReq) (res *tradeorder.MatchProductsRes, err error) {
|
||||
list, total, err := service.SysTradeOrder().MatchProducts(ctx, &req.TradeOrderMatchProductListInp)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if list == nil {
|
||||
list = []*sysin.TradeOrderMatchProductModel{}
|
||||
}
|
||||
res = new(tradeorder.MatchProductsRes)
|
||||
res.List = list
|
||||
res.PageRes.Pack(req, total)
|
||||
return
|
||||
}
|
||||
func (c *cTradeOrder) Match(ctx context.Context, req *tradeorder.MatchReq) (*tradeorder.MatchRes, error) {
|
||||
return &tradeorder.MatchRes{}, service.SysTradeOrder().Match(ctx, &req.TradeOrderMatchInp)
|
||||
}
|
||||
func (c *cTradeOrder) Apply(ctx context.Context, req *tradeorder.ApplyReq) (*tradeorder.ApplyRes, error) {
|
||||
v, err := service.SysTradeOrder().Apply(ctx, &req.TradeOrderApplyInp)
|
||||
return &tradeorder.ApplyRes{FinanceApprovalModel: v}, err
|
||||
}
|
||||
func (c *cTradeOrder) Execute(ctx context.Context, req *tradeorder.ExecuteReq) (*tradeorder.ExecuteRes, error) {
|
||||
return &tradeorder.ExecuteRes{}, service.SysTradeOrder().Execute(ctx, &req.TradeOrderExecuteInp)
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package sys
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"hotgo/api/admin/withdrawalorder"
|
||||
"hotgo/internal/model/input/sysin"
|
||||
"hotgo/internal/service"
|
||||
)
|
||||
|
||||
var WithdrawalOrder = cWithdrawalOrder{}
|
||||
|
||||
type cWithdrawalOrder struct{}
|
||||
|
||||
func (c *cWithdrawalOrder) List(ctx context.Context, req *withdrawalorder.ListReq) (res *withdrawalorder.ListRes, err error) {
|
||||
list, total, err := service.SysWithdrawalOrder().List(ctx, &req.WithdrawalOrderListInp)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if list == nil {
|
||||
list = []*sysin.WithdrawalOrderListModel{}
|
||||
}
|
||||
res = new(withdrawalorder.ListRes)
|
||||
res.List = list
|
||||
res.PageRes.Pack(req, total)
|
||||
return
|
||||
}
|
||||
func (c *cWithdrawalOrder) View(ctx context.Context, req *withdrawalorder.ViewReq) (*withdrawalorder.ViewRes, error) {
|
||||
v, err := service.SysWithdrawalOrder().View(ctx, &req.WithdrawalOrderViewInp)
|
||||
return &withdrawalorder.ViewRes{WithdrawalOrderListModel: v}, err
|
||||
}
|
||||
func (c *cWithdrawalOrder) Review(ctx context.Context, req *withdrawalorder.ReviewReq) (*withdrawalorder.ReviewRes, error) {
|
||||
v, err := service.SysWithdrawalOrder().Review(ctx, &req.WithdrawalReviewInp)
|
||||
return &withdrawalorder.ReviewRes{FinanceApprovalModel: v}, err
|
||||
}
|
||||
func (c *cWithdrawalOrder) Execute(ctx context.Context, req *withdrawalorder.ExecuteReq) (*withdrawalorder.ExecuteRes, error) {
|
||||
return &withdrawalorder.ExecuteRes{}, service.SysWithdrawalOrder().Execute(ctx, &req.FinanceExecuteInp)
|
||||
}
|
||||
func (c *cWithdrawalOrder) Complete(ctx context.Context, req *withdrawalorder.CompleteReq) (*withdrawalorder.CompleteRes, error) {
|
||||
return &withdrawalorder.CompleteRes{}, service.SysWithdrawalOrder().Complete(ctx, &req.WithdrawalCompleteInp)
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
// =================================================================================
|
||||
// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish.
|
||||
// =================================================================================
|
||||
|
||||
package member
|
||||
@@ -0,0 +1,15 @@
|
||||
// =================================================================================
|
||||
// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish.
|
||||
// =================================================================================
|
||||
|
||||
package member
|
||||
|
||||
import (
|
||||
"hotgo/api/api/member"
|
||||
)
|
||||
|
||||
type ControllerV1 struct{}
|
||||
|
||||
func NewV1() member.IMemberV1 {
|
||||
return &ControllerV1{}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package member
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
v1 "hotgo/api/api/member/v1"
|
||||
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
)
|
||||
|
||||
func (c *ControllerV1) GetIdByCode(ctx context.Context, req *v1.GetIdByCodeReq) (res *v1.GetIdByCodeRes, err error) {
|
||||
g.RequestFromCtx(ctx).Response.Writeln("Hello World api member!")
|
||||
return
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
// =================================================================================
|
||||
// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish.
|
||||
// =================================================================================
|
||||
|
||||
package pay
|
||||
@@ -0,0 +1,15 @@
|
||||
// =================================================================================
|
||||
// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish.
|
||||
// =================================================================================
|
||||
|
||||
package pay
|
||||
|
||||
import (
|
||||
"hotgo/api/api/pay"
|
||||
)
|
||||
|
||||
type ControllerV1 struct{}
|
||||
|
||||
func NewV1() pay.IPayV1 {
|
||||
return &ControllerV1{}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package pay
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
v1 "hotgo/api/api/pay/v1"
|
||||
"hotgo/internal/consts"
|
||||
"hotgo/internal/library/response"
|
||||
"hotgo/internal/model/input/payin"
|
||||
"hotgo/internal/service"
|
||||
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
)
|
||||
|
||||
func (c *ControllerV1) NotifyAliPay(ctx context.Context, req *v1.NotifyAliPayReq) (res *v1.NotifyAliPayRes, err error) {
|
||||
if _, err = service.Pay().Notify(ctx, &payin.PayNotifyInp{PayType: consts.PayTypeAliPay}); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
response.RText(g.RequestFromCtx(ctx), "success")
|
||||
return
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package pay
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
v1 "hotgo/api/api/pay/v1"
|
||||
"hotgo/internal/consts"
|
||||
"hotgo/internal/model/input/payin"
|
||||
"hotgo/internal/service"
|
||||
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
)
|
||||
|
||||
func (c *ControllerV1) NotifyQQPay(ctx context.Context, req *v1.NotifyQQPayReq) (res *v1.NotifyQQPayRes, err error) {
|
||||
if _, err = service.Pay().Notify(ctx, &payin.PayNotifyInp{PayType: consts.PayTypeQQPay}); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
r := g.RequestFromCtx(ctx)
|
||||
r.Response.ClearBuffer()
|
||||
r.Response.Write(`<?xml version="1.0" encoding="UTF-8"?>`)
|
||||
r.Response.WriteXml(g.Map{
|
||||
"return_code": "SUCCESS",
|
||||
})
|
||||
return
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package pay
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
v1 "hotgo/api/api/pay/v1"
|
||||
"hotgo/internal/consts"
|
||||
"hotgo/internal/library/response"
|
||||
"hotgo/internal/model/input/payin"
|
||||
"hotgo/internal/service"
|
||||
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
)
|
||||
|
||||
func (c *ControllerV1) NotifyWxPay(ctx context.Context, req *v1.NotifyWxPayReq) (res *v1.NotifyWxPayRes, err error) {
|
||||
if _, err = service.Pay().Notify(ctx, &payin.PayNotifyInp{PayType: consts.PayTypeWxPay}); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
response.CustomJson(g.RequestFromCtx(ctx), `{"code": "SUCCESS","message": "收单成功"}`)
|
||||
return
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user