This commit is contained in:
孟帅 2023-07-20 18:01:10 +08:00
parent 9113fc5297
commit 373d9627fb
492 changed files with 12170 additions and 6982 deletions

View File

@ -68,8 +68,8 @@
15. 代码生成支持自动化生成前后端代码。CURD关联表、树表、消息队列、定时任务一键生成等。
16. 插件应用:支持一键生成插件模板,每个插件之间开发隔离,拥有独立多应用入口、独立配置。完美支持多人协同开发、插件插拔不会对原系统产生影响等。
17. 服务监控监视当前系统CPU、内存、磁盘、网络、堆栈等相关信息。
18. 附件管理文件图片上传支持本地、阿里云oss、腾讯云cos、ucloud对象存储、七牛云对象存储等多种上传驱动后台一键切换配置。
19. TCP服务基于gtcp的应用实例支持长连接、断线重连、自动维护心跳、签名、服务登录、服务授权等。主要用于C/S服务器和服务进程之间的数据通讯
18. 附件管理文件图片上传支持本地、阿里云oss、腾讯云cos、ucloud对象存储、七牛云对象存储等多种上传驱动后台一键切换配置,并集成了文件选择器
19. TCP服务基于gtcp的服务应用支持长连接、断线重连、服务认证、路由分发、RPC消息、拦截器和数据绑定等。简化和规范了服务器开发流程
20. 消息队列:同时兼容 kafka、redis、rocketmq、磁盘队列一键配置切换到场景适用的MQ。
21. 通知公告采用websocket实时推送在线用户最新通知、公告、私信消息。
22. 地区编码:整合国内通用省市区编码,运用于项目于一身,支持动态省市区选项。

View File

@ -22,15 +22,16 @@
- [支付网关](sys-payment.md)
- [数据库](sys-db.md)
- [代码生成](sys-code.md)
- 定时任务
- [定时任务](sys-cron.md)
- [消息队列](sys-queue.md)
- [功能扩展库](sys-library.md)
- 工具方法
- [工具方法](sys-utility.md)
- RESTful Api
- Websocket服务器
- TCP服务器
- 单元测试
- [TCP服务器](sys-tcp-server.md)
- [单元测试](sys-test.md)
#### 插件模块开发
- [模块介绍及目录](addon-introduce-catalog.md)
@ -38,16 +39,12 @@
- [模块辅助说明](addon-helper.md)
#### 实战开发
- 服务端
- web前端
### 前端开发
- [表单组件](web-form.md)
- Websocket客户端
- 工具库
- [独立部署](web-deploy.md)
#### 附录
- [网址收录](append-website.md)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 33 KiB

View File

@ -12,6 +12,19 @@
> 如果升级(覆盖)代码后打开会出现 sql 报错, 请检查更新的数据库格式或自行调整
### v2.8.4
updated 2023.07.22
- 增加:增加输入预处理中间件
- 增加:增加文件选择器
- 增加:增加在线服务监控,服务许可证管理
- 增加TCP服务器增加RPC路由消息注册、路由分发、拦截器注册更方便的进行应用开发
- 优化gf版本升级到v2.5.0
- 优化优化CURD代码生成简化控制器代码逻辑升级列表数据查询方式
- 修复:修复角色菜单子权限取消导致父级权限失效问题
- 修复:修复上传驱动路径错误
- 修复修复CURD代码生成时间类型字段默认值获取异常
### v2.7.6
updated 2023.06.19
@ -19,7 +32,6 @@ updated 2023.06.19
- 修复:部门管理查询空指针问题
- 优化附件md5生成方式调整与更新前已上传的文件md5不兼容如果业务有影响请注意调整
### v2.7.3
updated 2023.05.14

View File

@ -5,9 +5,11 @@
- 使用条件
- 生成配置
- 一个生成增删改查列表例子
- 内置gf-cli
- 多数据库生成配置
- 自定义生成模板
- 内置gf-cli
- 指定gf-cli版本
- 指定数据库驱动类型
> 在HotGo中可以通过后台开发工具快速的一键生成CRUD自动生成Api、控制器、业务逻辑、Web页面、表单组件、菜单权限等。
@ -263,13 +265,6 @@ INSERT INTO `hg_test_table` (`id`, `category_id`, `title`, `description`, `conte
### 内置gf-cli
> 由于gf版本更新较常出现向下不兼容的情况所以我们为了保证生成代码的依赖稳定性我们将gf-cli工具内置到了系统中并做了一些在线执行的调整。
- 后续我们也将开放在线运行`gf gen dao`、`gf gen service`功能。在做插件开发时也会支持到在线生成插件下的service接口这将会使得插件开发更加方便
## 多数据库生成配置
#### 假设我们要增加一个库名为`hotgo2`、分组为`default2`的数据库,并要为其生成代码
@ -339,3 +334,53 @@ hggen:
- 如果你在实际的开发过程中默认模板需要调整的地方较多时HotGo允许你新建新的模板分组来满足你的需求。新的模板可根据现有模板基础拷贝一份出来做改造默认模板目录[server/resource/generate/default](../../server/resource/generate/default)
### 内置gf-cli
> 为了确保生成代码的依赖稳定性,在面对`gf`版本更新可能导致向下不兼容情况时HotGo将`gf-cli`工具内置到系统中并进行在线执行调整,从而提供更可靠和一致的生成代码功能。
- 后续我们也将开放在线运行`gf gen ...`功能。在做插件开发时也会支持到在线生成插件下的service接口这将会使得插件开发更加方便
### 指定gf-cli版本
> HotGo多数情况下会和最新版本的gf-cli保持同步如果更新不及时或你不想使用最新版本的gf-cli来生成代码可以找到自己想要的版本进行替换即可。
- 下面大致做一些替换步骤说明:
1. 打开https://github.com/gogf/gf找到你想要使用的版本`clone`下来
2. 将`clone`代码中`gf/cmd/gf/internal/`目录覆盖到`server/internal/library/hggen/internal`
3. 将覆盖过来的目录文件中引入包名`github.com/gogf/gf/cmd/gf/v2/`批量改为`hotgo/internal/library/hggen/`
4. 运行`go mod tidy`
5. 运行`go run main.go`,如果没有报错,那么恭喜你已经完成了。如果有报错一般都是版本差异带来的影响,需要根据情况自行调整
### 指定数据库驱动类型
> HotGo默认使用mysql驱动如果你想用其他数据库驱动打开下方文件中注释即可
修改文件路径server/internal/library/hggen/internal/cmd/cmd_gen_dao.go
```go
package cmd
import (
//_ "github.com/gogf/gf/contrib/drivers/clickhouse/v2"
//_ "github.com/gogf/gf/contrib/drivers/mssql/v2"
_ "github.com/gogf/gf/contrib/drivers/mysql/v2"
//_ "github.com/gogf/gf/contrib/drivers/oracle/v2"
//_ "github.com/gogf/gf/contrib/drivers/pgsql/v2"
//_ "github.com/gogf/gf/contrib/drivers/sqlite/v2"
"hotgo/internal/library/hggen/internal/cmd/gendao"
)
type (
cGenDao = gendao.CGenDao
)
```
修改完成后运行`go mod tidy`

View File

@ -0,0 +1,71 @@
## 定时任务
目录
- 实现接口
- 一个例子
- 更多
> 在实际的项目开发中定时任务几乎成为不可或缺的一部分。HotGo为定时任务提供一个方便的后台操作界面让您能够轻松地进行在线启停、修改和立即执行等操作。这样的设计可以极大地改善您在使用定时任务过程中的体验让整个过程更加顺畅、高效。
### 实现接口
- 为了提供高度的扩展性,定时任务在设计上采用了接口化的思路。只需要实现以下接口,您就可以在任何地方注册和使用定时任务功能,从而实现更大的灵活性和可扩展性。
```go
// Cron 定时任务接口
type Cron interface {
// GetName 获取任务名称
GetName() string
// Execute 执行一次任务
Execute(ctx context.Context)
}
```
### 一个例子
定时任务的文件结构可以根据具体需要进行调整,以下是一个常见的参考结构:
- 文件路径server/internal/crons/test.go
```go
package crons
import (
"context"
"hotgo/internal/library/cron"
"time"
)
func init() {
cron.Register(Test)
}
// Test 测试任务(无参数)
var Test = &cTest{name: "test"}
type cTest struct {
name string
}
func (c *cTest) GetName() string {
return c.name
}
// Execute 执行任务
func (c *cTest) Execute(ctx context.Context) {
cron.Logger().Infof(ctx, "cron test Execute:%v", time.Now())
}
```
继续在后台系统设置-定时任务-添加任务,填写的任务名称需要和上面的名称保持一致,再进行简单的策略配置以后,一个后台可控的定时任务就添加好了!
### 更多
定时任务源码路径server/internal/library/cron/cron.go
更多文档请参考https://goframe.org/pages/viewpage.action?pageId=1114187

View File

@ -33,6 +33,9 @@ func main() {
// 演示系統操作限制当开启演示模式时所有POST请求将被拒绝
service.Middleware().DemoLimit()
// 请求输入预处理api使用gf规范路由并且XxxReq结构体实现了validate.Filter接口即可隐式预处理
service.Middleware().PreFilter()
// HTTP响应预处理在业务处理完成后对响应结果进行格式化和错误过滤将处理后的数据发送给请求方
service.Middleware().ResponseHandler()
@ -143,7 +146,6 @@ func main() {
2. 在`server/internal/logic/middleware/response.go`中根据请求的独有特征进行单独的处理兼容后续http处理。
#### 重写响应错误提示
- 在实际开发中我们可能想要隐藏一些敏感错误返回给客户端友好的错误提示但开发者同时又想需要看到真实的敏感错误。对此hotgo已经进行了过滤处理下面是一个简单的例子

View File

@ -0,0 +1,271 @@
## TCP服务器
目录
- 配置文件
- 一个基本的消息收发例子
- 注册路由
- 拦截器
- 服务认证
- 更多
> HotGo基于GF框架的TCP服务器组件提供了一个简单而灵活的方式快速搭建基于TCP的服务应用。集成了许多常用功能如长连接、服务认证、路由分发、RPC消息、拦截器和数据绑定等大大简化和规范了服务器开发流程。
### 配置文件
- 配置文件server/manifest/config/config.yaml
```yaml
tcp:
# 服务器
server:
address: ":8099"
# 客户端
client:
# 定时任务
cron:
group: "cron" # 分组名称
name: "cron1" # 客户端名称
address: "127.0.0.1:8099" # 服务器地址
appId: "1002" # 应用名称
secretKey: "hotgo" # 密钥
# 系统授权
auth:
group: "auth" # 分组名称
name: "auth1" # 客户端名称
address: "127.0.0.1:8099" # 服务器地址
appId: "mengshuai" # 应用名称
secretKey: "123456" # 密钥
```
- 可以看到,除了服务器配置外,还有两个客户端配置`cron` 和`auth`
- `cron`是HotGo内置的定时任务服务和http服务通过RPC通讯以实现和后台交互使其可以独立、集群部署。
- `auth`可以为第三方平台提供授权服务。如果你需要他,可以将它部署在第三方程序中,在重要的位置进行授权验证。
### 一个基本的消息收发测试用例
- 文件路径server/internal/library/network/tcp/tcp_example_test.go
```go
package tcp_test
import (
"context"
"fmt"
"github.com/gogf/gf/v2/os/gctx"
"github.com/gogf/gf/v2/test/gtest"
"hotgo/internal/library/network/tcp"
"testing"
"time"
)
var T *testing.T // 声明一个全局的 *testing.T 变量
type TestMsgReq struct {
Name string `json:"name"`
}
type TestMsgRes struct {
tcp.ServerRes
}
type TestRPCMsgReq struct {
Name string `json:"name"`
}
type TestRPCMsgRes struct {
tcp.ServerRes
}
func onTestMsg(ctx context.Context, req *TestMsgReq) {
fmt.Printf("服务器收到消息 ==> onTestMsg:%+v\n", req)
conn := tcp.ConnFromCtx(ctx)
gtest.C(T, func(t *gtest.T) {
t.AssertNE(conn, nil)
})
res := new(TestMsgRes)
res.Message = fmt.Sprintf("你的名字:%v", req.Name)
conn.Send(ctx, res)
}
func onResponseTestMsg(ctx context.Context, req *TestMsgRes) {
fmt.Printf("客户端收到响应消息 ==> TestMsgRes:%+v\n", req)
err := req.GetError()
gtest.C(T, func(t *gtest.T) {
t.AssertNil(err)
})
}
func onTestRPCMsg(ctx context.Context, req *TestRPCMsgReq) (res *TestRPCMsgRes, err error) {
fmt.Printf("服务器收到消息 ==> onTestRPCMsg:%+v\n", req)
res = new(TestRPCMsgRes)
res.Message = fmt.Sprintf("你的名字:%v", req.Name)
return
}
func startTCPServer() {
serv := tcp.NewServer(&tcp.ServerConfig{
Name: "hotgo",
Addr: ":8002",
})
// 注册路由
serv.RegisterRouter(
onTestMsg,
)
// 注册RPC路由
serv.RegisterRPCRouter(
onTestRPCMsg,
)
// 服务监听
err := serv.Listen()
gtest.C(T, func(t *gtest.T) {
t.AssertNil(err)
})
}
// 一个基本的消息收发
func TestSendMsg(t *testing.T) {
T = t
go startTCPServer()
ctx := gctx.New()
client := tcp.NewClient(&tcp.ClientConfig{
Addr: "127.0.0.1:8002",
})
// 注册路由
client.RegisterRouter(
onResponseTestMsg,
)
go func() {
err := client.Start()
gtest.C(T, func(t *gtest.T) {
t.AssertNil(err)
})
}()
// 确保服务都启动完成
time.Sleep(time.Second * 1)
// 拿到客户端的连接
conn := client.Conn()
gtest.C(T, func(t *gtest.T) {
t.AssertNE(conn, nil)
})
// 向服务器发送tcp消息不会阻塞程序执行
err := conn.Send(ctx, &TestMsgReq{Name: "Tom"})
gtest.C(T, func(t *gtest.T) {
t.AssertNil(err)
})
// 向服务器发送rpc消息会等待服务器响应结果直到拿到结果或响应超时才会继续
var res TestRPCMsgRes
if err = conn.RequestScan(ctx, &TestRPCMsgReq{Name: "Tony"}, &res); err != nil {
gtest.C(T, func(t *gtest.T) {
t.AssertNil(err)
})
}
fmt.Printf("客户端收到RPC消息响应 ==> TestRPCMsgRes:%+v\n", res)
time.Sleep(time.Second * 1)
}
```
### 注册路由
- 从上面的例子可以看到不管是普通TCP消息和RPC消息的请求/响应结构体都采用类似GF框架的规范路由的结构请求`XxxRes`/响应`XxxRes`的格式,是不是很亲切?
### 拦截器
- 不管是服务端还是客户端,在初始化时都可以注册多个拦截器来满足更多场景的服务开发,下面是一个使用例子:
```go
package main
import (
"context"
"github.com/gogf/gf/v2/frame/g"
"hotgo/internal/library/network/tcp"
)
func main() {
serv = tcp.NewServer(&tcp.ServerConfig{
Name: "hotgo",
Addr: ":8002",
})
// 注册拦截器
// 执行顺序是从前到后即Interceptor -> Interceptor2 -> Interceptor3。如果中间有任意一个抛出错误则会中断后续处理
serv.RegisterInterceptor(Interceptor, Interceptor2, Interceptor3)
// 服务监听
if err := serv.Listen(); err != nil {
if !serv.IsClose() {
g.Log().Warningf(ctx, "TCPServer Listen err:%v", err)
}
}
}
func Interceptor(ctx context.Context, msg *tcp.Message) (err error) {
// 可以在拦截器中通过上下文拿到连接
conn := tcp.ConnFromCtx(ctx)
// 拿到原始请求消息
g.Dump(msg)
// 如果想要中断后续处理只需返回一个错误即可,但注意两种情况
// tcp消息如果你还想对该消息进行回复应在拦截器中进行处理例如conn.Send(ctx, 回复消息内容)
// rpc消息返回一个错误后系统会将错误自动回复到rpc响应中无需单独处理
return
}
func Interceptor2(ctx context.Context, msg *tcp.Message) (err error) {
// ...
return
}
func Interceptor3(ctx context.Context, msg *tcp.Message) (err error) {
// ...
return
}
```
### 服务认证
- 一般情况下,建议客户端连接到服务器时都通过`授权许可证`的方式进行登录认证,当初始化客户端配置认证数据时,连接成功后会自动进行登录认证。
```go
// 创建客户端配置
clientConfig := &tcp.ClientConfig{
Addr: "127.0.0.1:8002",
AutoReconnect: true,
// 认证数据
// 认证数据可以在后台-系统监控-在线服务-许可证列表中添加,同一个授权支持多个服务使用,但多个服务不能使用相同的名称进行连接
Auth: &tcp.AuthMeta{
Name: "服务名称",
Group: "服务分组",
AppId: "APPID",
SecretKey: "SecretKey",
},
}
// 初始化客户端
client = tcp.NewClient(clientConfig)
```
### 更多
TCP服务器源码路径server/internal/library/network/tcp
更多文档请参考https://goframe.org/pages/viewpage.action?pageId=1114625

View File

@ -0,0 +1,3 @@
## 单元测试
请参考https://goframe.org/pages/viewpage.action?pageId=1114153

View File

@ -0,0 +1,20 @@
## 工具方法
HotGo还提供一些系统中常用的工具库方法在这里简单说明
```
/server
├── utility
│ ├── charset # 字符串处理
│ ├── convert # 数据类型转换
│ ├── encrypt # 数据加密/解密
│ ├── excel # 电子表格导出/导入
│ ├── file # 文件/目录处理
│ ├── format # 数据格式化
│ ├── simple # 一些简捷函数
│ ├── tree # 树形结构
│ ├── url # URL处理
│ ├── useragent # 请求头代理处理
└── └── validate # 数据验证
```

View File

@ -20,6 +20,7 @@
- 多图上传 UploadImage
- 单文件上传 UploadFile
- 多文件上传 UploadFile
- 文件选择器 FileChooser
- 开关 Switch
- 评分 Rate
- 省市区选择器 CitySelector
@ -765,6 +766,35 @@ const value = ref(null);
</script>
```
### 文件选择器 FileChooser
- 基础用法
```vue
<template>
<FileChooser v-model:value="value" />
</template>
<script lang="ts" setup>
import { ref } from 'vue'
import FileChooser from '@/components/FileChooser/index.vue';
const value = ref(null);
</script>
```
- 指定fileType支持多种选择器类型默认情况是全部都可以选择
```ts
type FileType = 'image' | 'doc' | 'audio' | 'video' | 'zip' | 'other' | 'default';
```
- 图片选择器
```vue
<FileChooser v-model:value="value" fileType="image" />
```
- 多选支持,指定`maxNumber`多选数量
```vue
<FileChooser v-model:value="value" :maxNumber="10" fileType="image" />
```
### 开关 Switch
```vue
<template>

View File

@ -12,63 +12,52 @@ build:
@cd ../web && yarn build && \cp -rf ./dist/* ../server$(ADMIN_RESOURCE_PATH)
@echo "y" | gf build
# 通过热编译启动所有服务
.PHONY: all
all:
gf run main.go --args "all"
.PHONY: http
http:
gf run main.go --args "http"
.PHONY: queue
queue:
gf run main.go --args "queue"
.PHONY: cron
cron:
gf run main.go --args "cron"
.PHONY: auth
auth:
gf run main.go --args "auth"
# 启动web服务
.PHONY: web
web:
@cd ../web && yarn dev
# 刷新casbin权限
.PHONY: refresh
refresh:
@go run main.go tools -m=casbin -a1=refresh
# 清理casbin权限
.PHONY: clear
clear:
@go run main.go tools -m=casbin -a1=clear
# 运行代码质量分析工具
# https://github.com/ywanbing/golangci
.PHONY: ci
ci:
.PHONY: lint
lint:
golangci-lint run
.PHONY: killmain
killmain:
@kill -9 $(ps -ef|grep main|grep -v grep|awk '{print $2}')
# Install/Update to the latest CLI tool.
.PHONY: cli
cli:
@ -78,7 +67,6 @@ cli:
./gf install -y && \
rm ./gf
# Check and install CLI tool.
.PHONY: cli.install
cli.install:
@ -88,19 +76,16 @@ cli.install:
make cli; \
fi;
# Generate Go files for DAO/DO/Entity.
.PHONY: dao
dao: cli.install
@gf gen dao
# Generate Go files for Service.
.PHONY: service
service: cli.install
@gf gen service
# Build image, deploy image and yaml to current kubectl environment and make port forward to local machine.
.PHONY: start
start:
@ -109,27 +94,19 @@ start:
make deploy; \
make port;
# Build docker image and commit to the repository.
# example: make image tag=v0.0.1
.PHONY: image
image:
@echo "y" | gf docker main.go -p -tn hotgo:$(tag)
# Deploy image and yaml to current kubectl environment.
.PHONY: deploy
deploy:
$(eval _TAG = $(if ${TAG}, ${TAG}, develop))
@set -e; \
mkdir -p $(ROOT_DIR)/temp/kustomize;\
cd $(ROOT_DIR)/manifest/deploy/kustomize/overlays/${_TAG};\
kustomize build > $(ROOT_DIR)/temp/kustomize.yaml;\
kubectl apply -f $(ROOT_DIR)/temp/kustomize.yaml; \
kubectl patch -n $(NAMESPACE) deployment/$(DEPLOY_NAME) -p "{\"spec\":{\"template\":{\"metadata\":{\"labels\":{\"date\":\"$(shell date +%s)\"}}}}}";
.PHONY: push
push:
@cd $(ROOT_DIR) && cd .. && ./push.sh

View File

@ -15,6 +15,7 @@ type GetReq struct {
g.Meta `path:"/config/get" method:"get" tags:"配置" summary:"获取指定分组的配置"`
sysin.GetConfigInp
}
type GetRes struct {
*sysin.GetConfigModel
}
@ -24,5 +25,6 @@ type UpdateReq struct {
g.Meta `path:"/config/update" method:"post" tags:"配置" summary:"获取指定分组的配置"`
sysin.UpdateConfigInp
}
type UpdateRes struct {
}

View File

@ -3,7 +3,6 @@
// @Copyright Copyright (c) 2023 HotGo CLI
// @Author Ms <133814250@qq.com>
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
//
package index
import (

View File

@ -3,7 +3,6 @@
// @Copyright Copyright (c) 2023 HotGo CLI
// @Author Ms <133814250@qq.com>
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
//
package table
import (
@ -36,6 +35,7 @@ type ViewReq struct {
g.Meta `path:"/table/view" method:"get" tags:"表格" summary:"获取指定信息"`
sysin.TableViewInp
}
type ViewRes struct {
*sysin.TableViewModel
}
@ -45,6 +45,7 @@ type EditReq struct {
g.Meta `path:"/table/edit" method:"post" tags:"表格" summary:"修改/新增表格"`
sysin.TableEditInp
}
type EditRes struct{}
// DeleteReq 删除
@ -52,12 +53,15 @@ type DeleteReq struct {
g.Meta `path:"/table/delete" method:"post" tags:"表格" summary:"删除表格"`
sysin.TableDeleteInp
}
type DeleteRes struct{}
// MaxSortReq 最大排序
type MaxSortReq struct {
g.Meta `path:"/table/maxSort" method:"get" tags:"表格" summary:"表格最大排序"`
sysin.TableMaxSortInp
}
type MaxSortRes struct {
*sysin.TableMaxSortModel
}
@ -67,6 +71,7 @@ type StatusReq struct {
g.Meta `path:"/table/status" method:"post" tags:"表格" summary:"更新表格状态"`
sysin.TableStatusInp
}
type StatusRes struct{}
// SwitchReq 更新开关状态
@ -74,4 +79,5 @@ type SwitchReq struct {
g.Meta `path:"/table/switch" method:"post" tags:"表格" summary:"更新表格状态"`
sysin.TableSwitchInp
}
type SwitchRes struct{}

View File

@ -3,7 +3,6 @@
// @Copyright Copyright (c) 2023 HotGo CLI
// @Author Ms <133814250@qq.com>
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
//
package index
import (

View File

@ -3,7 +3,6 @@
// @Copyright Copyright (c) 2023 HotGo CLI
// @Author Ms <133814250@qq.com>
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
//
package index
import (

View File

@ -3,7 +3,6 @@
// @Copyright Copyright (c) 2023 HotGo CLI
// @Author Ms <133814250@qq.com>
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
//
package index
import (

View File

@ -7,11 +7,8 @@ package sys
import (
"context"
"github.com/gogf/gf/v2/util/gconv"
"hotgo/addons/hgexample/model/input/sysin"
"hotgo/addons/hgexample/api/admin/config"
"hotgo/addons/hgexample/service"
"hotgo/api/admin/config"
isysin "hotgo/internal/model/input/sysin"
)
var (
@ -22,25 +19,15 @@ type cConfig struct{}
// GetConfig 获取指定分组的配置
func (c *cConfig) GetConfig(ctx context.Context, req *config.GetReq) (res *config.GetRes, err error) {
var in sysin.GetConfigInp
if err = gconv.Scan(req, &in); err != nil {
return
}
data, err := service.SysConfig().GetConfigByGroup(ctx, in)
data, err := service.SysConfig().GetConfigByGroup(ctx, &req.GetConfigInp)
res = new(config.GetRes)
res.GetConfigModel = (*isysin.GetConfigModel)(data)
res.GetConfigModel = data
return
}
// UpdateConfig 更新指定分组的配置
func (c *cConfig) UpdateConfig(ctx context.Context, req *config.UpdateReq) (res *config.UpdateRes, err error) {
var in sysin.UpdateConfigInp
if err = gconv.Scan(req, &in); err != nil {
return
}
err = service.SysConfig().UpdateConfigByGroup(ctx, in)
err = service.SysConfig().UpdateConfigByGroup(ctx, &req.UpdateConfigInp)
return
}

View File

@ -3,16 +3,12 @@
// @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/util/gconv"
"hotgo/addons/hgexample/api/admin/index"
"hotgo/addons/hgexample/model/input/sysin"
"hotgo/addons/hgexample/service"
"hotgo/utility/validate"
)
var (
@ -23,16 +19,7 @@ type cIndex struct{}
// Test 测试
func (c *cIndex) Test(ctx context.Context, req *index.TestReq) (res *index.TestRes, err error) {
var in sysin.IndexTestInp
if err = gconv.Scan(req, &in); err != nil {
return nil, err
}
if err = validate.PreFilter(ctx, &in); err != nil {
return nil, err
}
data, err := service.SysIndex().Test(ctx, in)
data, err := service.SysIndex().Test(ctx, &req.IndexTestInp)
if err != nil {
return
}

View File

@ -3,17 +3,12 @@
// @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/util/gconv"
"hotgo/addons/hgexample/api/admin/table"
"hotgo/addons/hgexample/model/input/sysin"
"hotgo/addons/hgexample/service"
"hotgo/internal/model/input/form"
"hotgo/utility/validate"
)
var (
@ -24,57 +19,32 @@ type cTable struct{}
// List 查看列表
func (c *cTable) List(ctx context.Context, req *table.ListReq) (res *table.ListRes, err error) {
var in sysin.TableListInp
if err = gconv.Scan(req, &in); err != nil {
return
}
if err = validate.PreFilter(ctx, &in); err != nil {
return
}
list, totalCount, err := service.SysTable().List(ctx, in)
list, totalCount, err := service.SysTable().List(ctx, &req.TableListInp)
if err != nil {
return
}
res = new(table.ListRes)
res.List = list
res.PageCount = form.CalPageCount(totalCount, req.PerPage)
res.Page = req.Page
res.PerPage = req.PerPage
res.PageRes.Pack(req, totalCount)
return
}
// Export 导出列表
func (c *cTable) Export(ctx context.Context, req *table.ExportReq) (res *table.ExportRes, err error) {
var in sysin.TableListInp
if err = gconv.Scan(req, &in); err != nil {
return
}
err = service.SysTable().Export(ctx, in)
err = service.SysTable().Export(ctx, &req.TableListInp)
return
}
// Edit 更新
func (c *cTable) Edit(ctx context.Context, req *table.EditReq) (res *table.EditRes, err error) {
var in sysin.TableEditInp
if err = gconv.Scan(req, &in); err != nil {
return
}
if err = validate.PreFilter(ctx, &in); err != nil {
return
}
err = service.SysTable().Edit(ctx, in)
err = service.SysTable().Edit(ctx, &req.TableEditInp)
return
}
// MaxSort 最大排序
func (c *cTable) MaxSort(ctx context.Context, req *table.MaxSortReq) (res *table.MaxSortRes, err error) {
data, err := service.SysTable().MaxSort(ctx, sysin.TableMaxSortInp{})
data, err := service.SysTable().MaxSort(ctx, &req.TableMaxSortInp)
if err != nil {
return
}
@ -86,12 +56,7 @@ func (c *cTable) MaxSort(ctx context.Context, req *table.MaxSortReq) (res *table
// View 获取指定信息
func (c *cTable) View(ctx context.Context, req *table.ViewReq) (res *table.ViewRes, err error) {
var in sysin.TableViewInp
if err = gconv.Scan(req, &in); err != nil {
return
}
data, err := service.SysTable().View(ctx, in)
data, err := service.SysTable().View(ctx, &req.TableViewInp)
if err != nil {
return
}
@ -103,33 +68,18 @@ func (c *cTable) View(ctx context.Context, req *table.ViewReq) (res *table.ViewR
// Delete 删除
func (c *cTable) Delete(ctx context.Context, req *table.DeleteReq) (res *table.DeleteRes, err error) {
var in sysin.TableDeleteInp
if err = gconv.Scan(req, &in); err != nil {
return
}
err = service.SysTable().Delete(ctx, in)
err = service.SysTable().Delete(ctx, &req.TableDeleteInp)
return
}
// Status 更新状态
func (c *cTable) Status(ctx context.Context, req *table.StatusReq) (res *table.StatusRes, err error) {
var in sysin.TableStatusInp
if err = gconv.Scan(req, &in); err != nil {
return
}
err = service.SysTable().Status(ctx, in)
err = service.SysTable().Status(ctx, &req.TableStatusInp)
return
}
// Switch 更新开关状态
func (c *cTable) Switch(ctx context.Context, req *table.SwitchReq) (res *table.SwitchRes, err error) {
var in sysin.TableSwitchInp
if err = gconv.Scan(req, &in); err != nil {
return
}
err = service.SysTable().Switch(ctx, in)
err = service.SysTable().Switch(ctx, &req.TableSwitchInp)
return
}

View File

@ -3,16 +3,12 @@
// @Copyright Copyright (c) 2023 HotGo CLI
// @Author Ms <133814250@qq.com>
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
//
package api
import (
"context"
"github.com/gogf/gf/v2/util/gconv"
"hotgo/addons/hgexample/api/api/index"
"hotgo/addons/hgexample/model/input/sysin"
"hotgo/addons/hgexample/service"
"hotgo/utility/validate"
)
var (
@ -23,16 +19,7 @@ type cIndex struct{}
// Test 测试
func (c *cIndex) Test(ctx context.Context, req *index.TestReq) (res *index.TestRes, err error) {
var in sysin.IndexTestInp
if err = gconv.Scan(req, &in); err != nil {
return nil, err
}
if err = validate.PreFilter(ctx, &in); err != nil {
return nil, err
}
data, err := service.SysIndex().Test(ctx, in)
data, err := service.SysIndex().Test(ctx, &req.IndexTestInp)
if err != nil {
return
}

View File

@ -8,13 +8,10 @@ package home
import (
"context"
"github.com/gogf/gf/v2/frame/g"
"github.com/gogf/gf/v2/util/gconv"
"hotgo/addons/hgexample/api/home/index"
"hotgo/addons/hgexample/model/input/sysin"
"hotgo/addons/hgexample/service"
"hotgo/internal/model"
isc "hotgo/internal/service"
"hotgo/utility/validate"
)
// Index 基础
@ -23,16 +20,7 @@ var Index = cIndex{}
type cIndex struct{}
func (a *cIndex) Index(ctx context.Context, req *index.TestReq) (res *index.TestRes, err error) {
var in sysin.IndexTestInp
if err = gconv.Scan(req, &in); err != nil {
return nil, err
}
if err = validate.PreFilter(ctx, &in); err != nil {
return nil, err
}
data, err := service.SysIndex().Test(ctx, in)
data, err := service.SysIndex().Test(ctx, &req.IndexTestInp)
if err != nil {
return
}

View File

@ -3,16 +3,12 @@
// @Copyright Copyright (c) 2023 HotGo CLI
// @Author Ms <133814250@qq.com>
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
//
package websocket
import (
"context"
"github.com/gogf/gf/v2/util/gconv"
"hotgo/addons/hgexample/api/websocket/index"
"hotgo/addons/hgexample/model/input/sysin"
"hotgo/addons/hgexample/service"
"hotgo/utility/validate"
)
var (
@ -23,16 +19,7 @@ type cIndex struct{}
// Test 测试
func (c *cIndex) Test(ctx context.Context, req *index.TestReq) (res *index.TestRes, err error) {
var in sysin.IndexTestInp
if err = gconv.Scan(req, &in); err != nil {
return nil, err
}
if err = validate.PreFilter(ctx, &in); err != nil {
return nil, err
}
data, err := service.SysIndex().Test(ctx, in)
data, err := service.SysIndex().Test(ctx, &req.IndexTestInp)
if err != nil {
return
}

View File

@ -1,3 +1,8 @@
// Package crons
// @Link https://github.com/bufanyun/hotgo
// @Copyright Copyright (c) 2023 HotGo CLI
// @Author Ms <133814250@qq.com>
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
package crons
// 定时任务.

View File

@ -1,3 +1,8 @@
// 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 (
@ -25,7 +30,7 @@ func (s *sSysConfig) GetBasic(ctx context.Context) (conf *model.BasicConfig, err
var in sysin.GetConfigInp
in.GetAddonsConfigInp.AddonName = global.GetSkeleton().Name
in.GetAddonsConfigInp.Group = "basic"
models, err := isc.SysAddonsConfig().GetConfigByGroup(ctx, in.GetAddonsConfigInp)
models, err := isc.SysAddonsConfig().GetConfigByGroup(ctx, &in.GetAddonsConfigInp)
if err != nil {
return
}
@ -35,9 +40,9 @@ func (s *sSysConfig) GetBasic(ctx context.Context) (conf *model.BasicConfig, err
}
// GetConfigByGroup 获取指定分组配置
func (s *sSysConfig) GetConfigByGroup(ctx context.Context, in sysin.GetConfigInp) (res *sysin.GetConfigModel, err error) {
func (s *sSysConfig) GetConfigByGroup(ctx context.Context, in *sysin.GetConfigInp) (res *sysin.GetConfigModel, err error) {
in.GetAddonsConfigInp.AddonName = global.GetSkeleton().Name
models, err := isc.SysAddonsConfig().GetConfigByGroup(ctx, in.GetAddonsConfigInp)
models, err := isc.SysAddonsConfig().GetConfigByGroup(ctx, &in.GetAddonsConfigInp)
if err != nil {
return
}
@ -48,7 +53,7 @@ func (s *sSysConfig) GetConfigByGroup(ctx context.Context, in sysin.GetConfigInp
}
// UpdateConfigByGroup 更新指定分组的配置
func (s *sSysConfig) UpdateConfigByGroup(ctx context.Context, in sysin.UpdateConfigInp) error {
func (s *sSysConfig) UpdateConfigByGroup(ctx context.Context, in *sysin.UpdateConfigInp) error {
in.UpdateAddonsConfigInp.AddonName = global.GetSkeleton().Name
return isc.SysAddonsConfig().UpdateConfigByGroup(ctx, in.UpdateAddonsConfigInp)
return isc.SysAddonsConfig().UpdateConfigByGroup(ctx, &in.UpdateAddonsConfigInp)
}

View File

@ -26,7 +26,7 @@ func init() {
}
// Test 测试
func (s *sSysIndex) Test(ctx context.Context, in sysin.IndexTestInp) (res *sysin.IndexTestModel, err error) {
func (s *sSysIndex) Test(ctx context.Context, in *sysin.IndexTestInp) (res *sysin.IndexTestModel, err error) {
res = new(sysin.IndexTestModel)
res.Name = in.Name
res.Module = fmt.Sprintf("当前插件模块是:%s当前应用模块是%s", global.GetSkeleton().Name, contexts.Get(ctx).Module)

View File

@ -15,7 +15,6 @@ import (
"github.com/gogf/gf/v2/util/gconv"
"hotgo/addons/hgexample/model/input/sysin"
"hotgo/addons/hgexample/service"
"hotgo/internal/consts"
"hotgo/internal/dao"
"hotgo/internal/library/contexts"
"hotgo/internal/library/hgorm"
@ -42,54 +41,55 @@ func (s *sSysTable) Model(ctx context.Context, option ...*handler.Option) *gdb.M
}
// List 获取列表
func (s *sSysTable) List(ctx context.Context, in sysin.TableListInp) (list []*sysin.TableListModel, totalCount int, err error) {
func (s *sSysTable) List(ctx context.Context, in *sysin.TableListInp) (list []*sysin.TableListModel, totalCount int, err error) {
mod := s.Model(ctx)
cols := dao.AddonHgexampleTable.Columns()
if in.Title != "" {
mod = mod.WhereLike(dao.AddonHgexampleTable.Columns().Title, "%"+in.Title+"%")
mod = mod.WhereLike(cols.Title, "%"+in.Title+"%")
}
if in.Content != "" {
mod = mod.WhereLike(dao.AddonHgexampleTable.Columns().Content, "%"+in.Content+"%")
mod = mod.WhereLike(cols.Content, "%"+in.Content+"%")
}
if in.Status > 0 {
mod = mod.Where(dao.AddonHgexampleTable.Columns().Status, in.Status)
mod = mod.Where(cols.Status, in.Status)
}
if in.Switch > 0 {
mod = mod.Where(dao.AddonHgexampleTable.Columns().Switch, in.Switch)
mod = mod.Where(cols.Switch, in.Switch)
}
if len(in.Price) > 0 {
if in.Price[0] > float64(0) && in.Price[1] > float64(0) {
mod = mod.WhereBetween(dao.AddonHgexampleTable.Columns().Price, in.Price[0], in.Price[1])
} else if in.Price[0] > float64(0) && in.Price[1] == float64(0) {
mod = mod.WhereGTE(dao.AddonHgexampleTable.Columns().Price, in.Price[0])
} else if in.Price[0] == float64(0) && in.Price[1] > float64(0) {
mod = mod.WhereLTE(dao.AddonHgexampleTable.Columns().Price, in.Price[1])
if in.Price[0] > 0 && in.Price[1] > 0 {
mod = mod.WhereBetween(cols.Price, in.Price[0], in.Price[1])
} else if in.Price[0] > 0 && in.Price[1] == 0 {
mod = mod.WhereGTE(cols.Price, in.Price[0])
} else if in.Price[0] == 0 && in.Price[1] > 0 {
mod = mod.WhereLTE(cols.Price, in.Price[1])
}
}
if in.ActivityAt != nil {
mod = mod.Where(dao.AddonHgexampleTable.Columns().ActivityAt, in.ActivityAt)
mod = mod.Where(cols.ActivityAt, in.ActivityAt)
}
if len(in.CreatedAt) == 2 {
mod = mod.WhereBetween(dao.AddonHgexampleTable.Columns().CreatedAt, in.CreatedAt[0], in.CreatedAt[1])
mod = mod.WhereBetween(cols.CreatedAt, in.CreatedAt[0], in.CreatedAt[1])
}
if !in.Flag.IsNil() {
mod = mod.Where(fmt.Sprintf(`JSON_CONTAINS(%s,'%v')`, dao.AddonHgexampleTable.Columns().Flag, in.Flag))
mod = mod.Where(fmt.Sprintf(`JSON_CONTAINS(%s,'%v')`, cols.Flag, in.Flag))
}
if !in.Hobby.IsNil() {
mod = mod.Where(fmt.Sprintf(`JSON_CONTAINS(%s,'%v')`, dao.AddonHgexampleTable.Columns().Hobby, in.Hobby))
mod = mod.Where(fmt.Sprintf(`JSON_CONTAINS(%s,'%v')`, cols.Hobby, in.Hobby))
}
//// 关联表testCategory
//mod = mod.LeftJoin(hgorm.GenJoinOnRelation(
// dao.AddonHgexampleTable.Table(), dao.AddonHgexampleTable.Columns().CategoryId, // 主表表名,关联条件
// dao.AddonHgexampleTable.Table(), cols.CategoryId, // 主表表名,关联条件
// dao.AddonHgexampleTableCategory.Table(), "testCategory", dao.AddonHgexampleTableCategory.Columns().Id, // 关联表表名,别名,关联条件
//)...)
//
@ -97,7 +97,7 @@ func (s *sSysTable) List(ctx context.Context, in sysin.TableListInp) (list []*sy
totalCount, err = mod.Clone().Count(1)
if err != nil {
err = gerror.Wrap(err, consts.ErrorORM)
err = gerror.Wrap(err, "获取表格数据行失败,请稍后重试!")
return
}
@ -105,15 +105,15 @@ func (s *sSysTable) List(ctx context.Context, in sysin.TableListInp) (list []*sy
return
}
if err = mod.Fields(sysin.TableListModel{}).Page(in.Page, in.PerPage).OrderAsc(dao.AddonHgexampleTable.Columns().Sort).OrderDesc(dao.AddonHgexampleTable.Columns().Id).Scan(&list); err != nil {
err = gerror.Wrap(err, consts.ErrorORM)
if err = mod.Fields(sysin.TableListModel{}).Page(in.Page, in.PerPage).OrderAsc(cols.Sort).OrderDesc(cols.Id).Scan(&list); err != nil {
err = gerror.Wrap(err, "获取表格列表失败,请稍后重试!")
return
}
return
}
// Export 导出
func (s *sSysTable) Export(ctx context.Context, in sysin.TableListInp) (err error) {
func (s *sSysTable) Export(ctx context.Context, in *sysin.TableListInp) (err error) {
list, totalCount, err := s.List(ctx, in)
if err != nil {
return
@ -142,57 +142,56 @@ func (s *sSysTable) Export(ctx context.Context, in sysin.TableListInp) (err erro
}
// Edit 修改/新增
func (s *sSysTable) Edit(ctx context.Context, in sysin.TableEditInp) (err error) {
if err = hgorm.IsUnique(ctx, &dao.AddonHgexampleTable, g.Map{dao.AddonHgexampleTable.Columns().Qq: in.Qq}, "QQ号码已存在请换一个", in.Id); err != nil {
func (s *sSysTable) Edit(ctx context.Context, in *sysin.TableEditInp) (err error) {
cols := dao.AddonHgexampleTable.Columns()
if err = hgorm.IsUnique(ctx, &dao.AddonHgexampleTable, g.Map{cols.Qq: in.Qq}, "QQ号码已存在请换一个", in.Id); err != nil {
return
}
// 修改
if in.Id > 0 {
in.UpdatedBy = contexts.GetUserId(ctx)
_, err = s.Model(ctx).Where(dao.AddonHgexampleTable.Columns().Id, in.Id).Data(in).Update()
if _, err = s.Model(ctx).WherePri(in.Id).Data(in).Update(); err != nil {
err = gerror.Wrap(err, "修改表格失败,请稍后重试!")
return
}
return
}
// 新增
in.CreatedBy = contexts.GetUserId(ctx)
_, err = s.Model(ctx, &handler.Option{FilterAuth: false}).Data(in).Insert()
if _, err = s.Model(ctx, &handler.Option{FilterAuth: false}).Data(in).Insert(); err != nil {
err = gerror.Wrap(err, "新增表格失败,请稍后重试!")
return
}
return
}
// Delete 删除
func (s *sSysTable) Delete(ctx context.Context, in sysin.TableDeleteInp) (err error) {
_, err = s.Model(ctx).Where(dao.AddonHgexampleTable.Columns().Id, in.Id).Delete()
func (s *sSysTable) Delete(ctx context.Context, in *sysin.TableDeleteInp) (err error) {
if _, err = s.Model(ctx).WherePri(in.Id).Delete(); err != nil {
err = gerror.Wrap(err, "删除表格失败,请稍后重试!")
return
}
return
}
// Status 更新状态
func (s *sSysTable) Status(ctx context.Context, in sysin.TableStatusInp) (err error) {
if in.Id <= 0 {
err = gerror.New("ID不能为空")
return
}
if in.Status <= 0 {
err = gerror.New("状态不能为空")
return
}
if !validate.InSlice(consts.StatusSlice, in.Status) {
err = gerror.New("状态不正确")
return
}
// 修改
_, err = s.Model(ctx).Where(dao.AddonHgexampleTable.Columns().Id, in.Id).Data(g.Map{
func (s *sSysTable) Status(ctx context.Context, in *sysin.TableStatusInp) (err error) {
update := g.Map{
dao.AddonHgexampleTable.Columns().Status: in.Status,
dao.AddonHgexampleTable.Columns().UpdatedBy: contexts.GetUserId(ctx),
}).Update()
}
if _, err = s.Model(ctx).WherePri(in.Id).Data(update).Update(); err != nil {
err = gerror.Wrap(err, "更新表格状态失败,请稍后重试!")
return
}
return
}
// Switch 更新开关状态
func (s *sSysTable) Switch(ctx context.Context, in sysin.TableSwitchInp) (err error) {
func (s *sSysTable) Switch(ctx context.Context, in *sysin.TableSwitchInp) (err error) {
var fields = []string{
dao.AddonHgexampleTable.Columns().Switch,
// ...
@ -203,18 +202,23 @@ func (s *sSysTable) Switch(ctx context.Context, in sysin.TableSwitchInp) (err er
return
}
// 修改
_, err = s.Model(ctx).Where(dao.AddonHgexampleTable.Columns().Id, in.Id).Data(g.Map{
update := g.Map{
in.Key: in.Value,
dao.AddonHgexampleTable.Columns().UpdatedBy: contexts.GetUserId(ctx),
}).Update()
}
if _, err = s.Model(ctx).Where(dao.AddonHgexampleTable.Columns().Id, in.Id).Data(update).Update(); err != nil {
err = gerror.Wrap(err, "更新表格开关失败,请稍后重试!")
return
}
return
}
// MaxSort 最大排序
func (s *sSysTable) MaxSort(ctx context.Context, in sysin.TableMaxSortInp) (res *sysin.TableMaxSortModel, err error) {
if err = dao.AddonHgexampleTable.Ctx(ctx).Fields(dao.AddonHgexampleTable.Columns().Sort).OrderDesc(dao.AddonHgexampleTable.Columns().Sort).Scan(&res); err != nil {
err = gerror.Wrap(err, consts.ErrorORM)
func (s *sSysTable) MaxSort(ctx context.Context, in *sysin.TableMaxSortInp) (res *sysin.TableMaxSortModel, err error) {
dx := dao.AddonHgexampleTable
if err = dx.Ctx(ctx).Fields(dx.Columns().Sort).OrderDesc(dx.Columns().Sort).Scan(&res); err != nil {
err = gerror.Wrap(err, "获取表格最大排序,请稍后重试!")
return
}
@ -222,12 +226,15 @@ func (s *sSysTable) MaxSort(ctx context.Context, in sysin.TableMaxSortInp) (res
res = new(sysin.TableMaxSortModel)
}
res.Sort = form.DefaultMaxSort(ctx, res.Sort)
res.Sort = form.DefaultMaxSort(res.Sort)
return
}
// View 获取指定信息
func (s *sSysTable) View(ctx context.Context, in sysin.TableViewInp) (res *sysin.TableViewModel, err error) {
err = s.Model(ctx).Where(dao.AddonHgexampleTable.Columns().Id, in.Id).Scan(&res)
func (s *sSysTable) View(ctx context.Context, in *sysin.TableViewInp) (res *sysin.TableViewModel, err error) {
if err = s.Model(ctx).WherePri(in.Id).Scan(&res); err != nil {
err = gerror.Wrap(err, "获取生成演示信息,请稍后重试!")
return
}
return
}

View File

@ -9,6 +9,7 @@ import (
"context"
"errors"
"github.com/gogf/gf/v2/encoding/gjson"
"github.com/gogf/gf/v2/errors/gerror"
"github.com/gogf/gf/v2/frame/g"
"github.com/gogf/gf/v2/os/gtime"
"hotgo/internal/consts"
@ -149,6 +150,24 @@ type TableStatusInp struct {
Status int `json:"status" dc:"状态"`
}
func (in *TableStatusInp) Filter(ctx context.Context) (err error) {
if in.Id <= 0 {
err = gerror.New("ID不能为空")
return
}
if in.Status <= 0 {
err = gerror.New("状态不能为空")
return
}
if !validate.InSlice(consts.StatusSlice, in.Status) {
err = gerror.New("状态不正确")
return
}
return
}
type TableStatusModel struct{}
// TableSwitchInp 更新开关状态

View File

@ -1,3 +1,8 @@
// Package queues
// @Link https://github.com/bufanyun/hotgo
// @Copyright Copyright (c) 2023 HotGo CLI
// @Author Ms <133814250@qq.com>
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
package queues
// 消息队列.

View File

@ -17,29 +17,29 @@ import (
type (
ISysConfig interface {
GetBasic(ctx context.Context) (conf *model.BasicConfig, err error)
GetConfigByGroup(ctx context.Context, in sysin.GetConfigInp) (res *sysin.GetConfigModel, err error)
UpdateConfigByGroup(ctx context.Context, in sysin.UpdateConfigInp) error
GetConfigByGroup(ctx context.Context, in *sysin.GetConfigInp) (res *sysin.GetConfigModel, err error)
UpdateConfigByGroup(ctx context.Context, in *sysin.UpdateConfigInp) error
}
ISysIndex interface {
Test(ctx context.Context, in sysin.IndexTestInp) (res *sysin.IndexTestModel, err error)
Test(ctx context.Context, in *sysin.IndexTestInp) (res *sysin.IndexTestModel, err error)
}
ISysTable interface {
Model(ctx context.Context, option ...*handler.Option) *gdb.Model
List(ctx context.Context, in sysin.TableListInp) (list []*sysin.TableListModel, totalCount int, err error)
Export(ctx context.Context, in sysin.TableListInp) (err error)
Edit(ctx context.Context, in sysin.TableEditInp) (err error)
Delete(ctx context.Context, in sysin.TableDeleteInp) (err error)
Status(ctx context.Context, in sysin.TableStatusInp) (err error)
Switch(ctx context.Context, in sysin.TableSwitchInp) (err error)
MaxSort(ctx context.Context, in sysin.TableMaxSortInp) (res *sysin.TableMaxSortModel, err error)
View(ctx context.Context, in sysin.TableViewInp) (res *sysin.TableViewModel, err error)
List(ctx context.Context, in *sysin.TableListInp) (list []*sysin.TableListModel, totalCount int, err error)
Export(ctx context.Context, in *sysin.TableListInp) (err error)
Edit(ctx context.Context, in *sysin.TableEditInp) (err error)
Delete(ctx context.Context, in *sysin.TableDeleteInp) (err error)
Status(ctx context.Context, in *sysin.TableStatusInp) (err error)
Switch(ctx context.Context, in *sysin.TableSwitchInp) (err error)
MaxSort(ctx context.Context, in *sysin.TableMaxSortInp) (res *sysin.TableMaxSortModel, err error)
View(ctx context.Context, in *sysin.TableViewInp) (res *sysin.TableViewModel, err error)
}
)
var (
localSysTable ISysTable
localSysConfig ISysConfig
localSysIndex ISysIndex
localSysTable ISysTable
)
func SysConfig() ISysConfig {

View File

@ -24,6 +24,7 @@ type ListRes struct {
type SelectsReq struct {
g.Meta `path:"/addons/selects" method:"get" tags:"插件管理" summary:"生成入口选项"`
sysin.AddonsSelectsInp
}
type SelectsRes struct {

View File

@ -13,12 +13,8 @@ import (
// ListReq 查询附件列表
type ListReq struct {
form.PageReq
form.RangeDateReq
form.StatusReq
MemberId int64 `json:"member_id"`
Drive string `json:"drive"`
g.Meta `path:"/attachment/list" method:"get" tags:"附件" summary:"获取附件列表"`
g.Meta `path:"/attachment/list" method:"get" tags:"附件" summary:"获取附件列表"`
sysin.AttachmentListInp
}
type ListRes struct {
@ -28,8 +24,8 @@ type ListRes struct {
// ViewReq 获取附件信息
type ViewReq struct {
Id int64 `json:"id" v:"required#附件ID不能为空" dc:"附件ID"`
g.Meta `path:"/attachment/view" method:"get" tags:"附件" summary:"获取指定附件信息"`
sysin.AttachmentViewInp
}
type ViewRes struct {
@ -38,8 +34,34 @@ type ViewRes struct {
// DeleteReq 删除附件
type DeleteReq struct {
Id interface{} `json:"id" v:"required#附件ID不能为空" dc:"附件ID"`
g.Meta `path:"/attachment/delete" method:"post" tags:"附件" summary:"删除附件"`
sysin.AttachmentDeleteInp
}
type DeleteRes struct{}
// ClearKindReq 清空上传类型
type ClearKindReq struct {
g.Meta `path:"/attachment/clearKind" method:"post" tags:"附件" summary:"清空上传类型"`
sysin.AttachmentClearKindInp
}
type ClearKindRes struct{}
// ChooserOptionReq 获取选择器选项
type ChooserOptionReq struct {
g.Meta `path:"/attachment/chooserOption" method:"get" tags:"附件" summary:"获取选择器选项"`
}
type ChooserOptionRes struct {
Drive sysin.DataSelectModel `json:"drive" dc:"驱动"`
Kind []KindSelect `json:"kind" dc:"上传类型"`
}
type KindSelect struct {
Key string `json:"key"`
Value string `json:"value"`
Tag string `json:"listClass"`
Label string `json:"label"`
Icon string `json:"icon"`
}

View File

@ -7,19 +7,14 @@ package blacklist
import (
"github.com/gogf/gf/v2/frame/g"
"hotgo/internal/model/entity"
"hotgo/internal/model/input/form"
"hotgo/internal/model/input/sysin"
)
// ListReq 查询列表
type ListReq struct {
form.PageReq
form.RangeDateReq
form.StatusReq
Title string `json:"title"`
Content string `json:"content"`
g.Meta `path:"/blacklist/list" method:"get" tags:"黑名单" summary:"获取黑名单列表"`
g.Meta `path:"/blacklist/list" method:"get" tags:"黑名单" summary:"获取黑名单列表"` // v:"RequestPreFilter"
sysin.BlacklistListInp
}
type ListRes struct {
@ -29,8 +24,8 @@ type ListRes struct {
// ViewReq 获取信息
type ViewReq struct {
Id int64 `json:"id" v:"required#黑名单ID不能为空" dc:"黑名单ID"`
g.Meta `path:"/blacklist/view" method:"get" tags:"黑名单" summary:"获取指定信息"`
sysin.BlacklistViewInp
}
type ViewRes struct {
@ -39,34 +34,24 @@ type ViewRes struct {
// EditReq 修改/新增
type EditReq struct {
entity.SysBlacklist
g.Meta `path:"/blacklist/edit" method:"post" tags:"黑名单" summary:"修改/新增黑名单"`
sysin.BlacklistEditInp
}
type EditRes struct{}
// DeleteReq 删除
type DeleteReq struct {
Id interface{} `json:"id" v:"required#黑名单ID不能为空" dc:"黑名单ID"`
g.Meta `path:"/blacklist/delete" method:"post" tags:"黑名单" summary:"删除黑名单"`
sysin.BlacklistDeleteInp
}
type DeleteRes struct{}
// MaxSortReq 最大排序
type MaxSortReq struct {
Id int64 `json:"id" dc:"黑名单ID"`
g.Meta `path:"/blacklist/maxSort" method:"get" tags:"黑名单" summary:"黑名单最大排序"`
}
type MaxSortRes struct {
Sort int `json:"sort" dc:"排序"`
}
// StatusReq 更新状态
type StatusReq struct {
entity.SysBlacklist
g.Meta `path:"/blacklist/status" method:"post" tags:"黑名单" summary:"更新黑名单状态"`
sysin.BlacklistStatusInp
}
type StatusRes struct{}

View File

@ -34,18 +34,16 @@ type ViewRes struct {
// ApplyReq 申请提现
type ApplyReq struct {
Money float64 `json:"money" description:"提现金额"`
g.Meta `path:"/cash/apply" method:"post" tags:"提现" summary:"申请提现"`
Money float64 `json:"money" description:"提现金额"`
}
type ApplyRes struct{}
// PaymentReq 提现打款处理
type PaymentReq struct {
Id int64 `json:"id" description:"ID"`
Status int64 `json:"status" description:"状态码"`
Msg string `json:"msg" description:"处理结果"`
g.Meta `path:"/cash/payment" method:"post" tags:"提现" summary:"提现打款处理"`
adminin.CashPaymentInp
}
type PaymentRes struct{}

View File

@ -11,8 +11,8 @@ import (
// SendTestEmailReq 发送测试邮件
type SendTestEmailReq struct {
To string `json:"to" v:"required#接收者邮件不能为空" dc:"接收者邮件,多个用;隔开"`
g.Meta `path:"/ems/sendTest" tags:"邮件" method:"post" summary:"发送测试邮件"`
To string `json:"to" v:"required#接收者邮件不能为空" dc:"接收者邮件,多个用;隔开"`
}
type SendTestEmailRes struct {

View File

@ -5,14 +5,15 @@
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
package common
import "github.com/gogf/gf/v2/frame/g"
import (
"github.com/gogf/gf/v2/frame/g"
"hotgo/internal/model/input/sysin"
)
// SendTestSmsReq 发送测试短信
type SendTestSmsReq struct {
Event string `json:"event" v:"required#事件模板不能为空" dc:"事件模板"`
Mobile string `json:"mobile" v:"required#接收手机号不能为空" dc:"接收手机号"`
Code string `json:"code" v:"required#接收验证码不能为空" dc:"接收验证码"`
g.Meta `path:"/sms/sendTest" tags:"短信" method:"post" summary:"发送测试短信"`
sysin.SendCodeInp
}
type SendTestSmsRes struct {
@ -29,8 +30,7 @@ type SendBindSmsRes struct {
// SendSmsReq 发送短信
type SendSmsReq struct {
g.Meta `path:"/sms/send" tags:"短信" method:"post" summary:"发送短信"`
Event string `json:"event" v:"required#事件模板不能为空" dc:"事件模板"`
Mobile string `json:"mobile" v:"required#接收手机号不能为空" dc:"接收手机号"`
sysin.SendCodeInp
}
type SendSmsRes struct {

View File

@ -3,7 +3,6 @@
// @Copyright Copyright (c) 2023 HotGo CLI
// @Author Ms <133814250@qq.com>
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
//
package common
import (
@ -11,13 +10,6 @@ import (
"hotgo/internal/model/input/sysin"
)
// UploadImageReq 上传图片
type UploadImageReq struct {
g.Meta `path:"/upload/image" tags:"上传" method:"post" summary:"上传图片"`
}
type UploadImageRes *sysin.AttachmentListModel
// UploadFileReq 上传文件
type UploadFileReq struct {
g.Meta `path:"/upload/file" tags:"上传" method:"post" summary:"上传附件"`

View File

@ -13,8 +13,8 @@ import (
// GetReq 获取指定分组的配置
type GetReq struct {
Group string `json:"group" dc:"分组名称" v:"required#分组名称不能为空" `
g.Meta `path:"/config/get" method:"get" tags:"配置" summary:"获取指定分组的配置"`
sysin.GetConfigInp
}
type GetRes struct {
@ -23,9 +23,8 @@ type GetRes struct {
// UpdateReq 获取指定分组的配置
type UpdateReq struct {
Group string `json:"group" dc:"分组名称" v:"required#分组名称不能为空" `
List g.Map `json:"list" dc:"更新配置列表" `
g.Meta `path:"/config/update" method:"post" tags:"配置" summary:"获取指定分组的配置"`
sysin.UpdateConfigInp
}
type UpdateRes struct {

View File

@ -75,6 +75,7 @@ type GroupStatusRes struct {
// GroupSelectReq 定时任务分组选项
type GroupSelectReq struct {
g.Meta `path:"/cronGroup/select" method:"get" tags:"定时任务分组" summary:"定时任务分组选项"`
sysin.CronGroupSelectInp
}
type GroupSelectRes struct {

View File

@ -3,7 +3,7 @@
// @Copyright Copyright (c) 2023 HotGo CLI
// @Author Ms <133814250@qq.com>
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
// @AutoGenerate Version 2.7.3
// @AutoGenerate Version 2.7.6
package curddemo
import (
@ -47,6 +47,7 @@ type EditReq struct {
g.Meta `path:"/curdDemo/edit" method:"post" tags:"生成演示" summary:"修改/新增生成演示"`
sysin.CurdDemoEditInp
}
type EditRes struct{}
// DeleteReq 删除生成演示
@ -60,6 +61,7 @@ type DeleteRes struct{}
// MaxSortReq 获取生成演示最大排序
type MaxSortReq struct {
g.Meta `path:"/curdDemo/maxSort" method:"get" tags:"生成演示" summary:"获取生成演示最大排序"`
sysin.CurdDemoMaxSortInp
}
type MaxSortRes struct {

View File

@ -7,26 +7,22 @@ package dept
import (
"github.com/gogf/gf/v2/frame/g"
"hotgo/internal/model/entity"
"hotgo/internal/model/input/adminin"
"hotgo/internal/model/input/form"
)
// ListReq 查询列表
type ListReq struct {
Name string `json:"name" dc:"部门名称"`
Code string `json:"code" dc:"部门编码"`
g.Meta `path:"/dept/list" method:"get" tags:"部门" summary:"获取部门列表"`
adminin.DeptListInp
}
type ListRes struct {
adminin.DeptListModel
}
type ListRes *adminin.DeptListModel
// ViewReq 获取指定信息
type ViewReq struct {
Id int64 `json:"id" v:"required#部门ID不能为空" dc:"部门ID"`
g.Meta `path:"/dept/view" method:"get" tags:"部门" summary:"获取指定信息"`
adminin.DeptViewInp
}
type ViewRes struct {
@ -35,24 +31,24 @@ type ViewRes struct {
// EditReq 修改/新增字典数据
type EditReq struct {
entity.AdminDept
g.Meta `path:"/dept/edit" method:"post" tags:"部门" summary:"修改/新增部门"`
adminin.DeptEditInp
}
type EditRes struct{}
// DeleteReq 删除字典类型
type DeleteReq struct {
Id interface{} `json:"id" v:"required#部门ID不能为空" dc:"部门ID"`
g.Meta `path:"/dept/delete" method:"post" tags:"部门" summary:"删除部门"`
adminin.DeptDeleteInp
}
type DeleteRes struct{}
// MaxSortReq 最大排序
type MaxSortReq struct {
Id int64 `json:"id" dc:"部门ID"`
g.Meta `path:"/dept/maxSort" method:"get" tags:"部门" summary:"部门最大排序"`
adminin.DeptMaxSortInp
}
type MaxSortRes struct {
@ -61,8 +57,8 @@ type MaxSortRes struct {
// StatusReq 更新部门状态
type StatusReq struct {
entity.AdminDept
g.Meta `path:"/dept/status" method:"post" tags:"部门" summary:"更新部门状态"`
adminin.DeptStatusInp
}
type StatusRes struct{}

View File

@ -7,37 +7,30 @@ package dict
import (
"github.com/gogf/gf/v2/frame/g"
"hotgo/internal/model/entity"
"hotgo/internal/model/input/form"
"hotgo/internal/model/input/sysin"
)
// DataEditReq 修改/新增字典数据
type DataEditReq struct {
entity.SysDictData
TypeID int64 `json:"typeID" dc:"字典类型ID"`
g.Meta `path:"/dictData/edit" method:"post" tags:"字典数据" summary:"修改/新增字典数据"`
sysin.DictDataEditInp
}
type DataEditRes struct{}
// DataDeleteReq 删除字典数据
type DataDeleteReq struct {
Id interface{} `json:"id" v:"required#字典数据ID不能为空" dc:"字典数据ID"`
g.Meta `path:"/dictData/delete" method:"post" tags:"字典数据" summary:"删除字典数据"`
sysin.DictDataDeleteInp
}
type DataDeleteRes struct{}
// DataListReq 查询列表
type DataListReq struct {
form.PageReq
form.RangeDateReq
form.StatusReq
TypeID int64 `json:"typeId" v:"required#字典类型ID不能为空" dc:"字典类型ID"` //
Type string `json:"type"`
Label string `json:"label"`
g.Meta `path:"/dictData/list" method:"get" tags:"字典数据" summary:"获取字典数据列表"`
sysin.DictDataListInp
}
type DataListRes struct {
@ -47,7 +40,7 @@ type DataListRes struct {
type DataSelectReq struct {
g.Meta `path:"/dictData/option/{Type}" method:"get" summary:"字典数据" tags:"获取指定字典选项"`
Type string `in:"path" v:"required#字典类型不能为空" dc:"字典类型"`
sysin.DataSelectInp
}
type DataSelectRes sysin.DataSelectModel

View File

@ -7,7 +7,6 @@ package dict
import (
"github.com/gogf/gf/v2/frame/g"
"hotgo/internal/model/entity"
"hotgo/internal/model/input/sysin"
)
@ -22,16 +21,16 @@ type TypeTreeRes struct {
// TypeEditReq 修改/新增字典数据
type TypeEditReq struct {
entity.AdminDept
g.Meta `path:"/dictType/edit" method:"post" tags:"字典类型" summary:"修改/新增字典类型"`
sysin.DictTypeEditInp
}
type TypeEditRes struct{}
// TypeDeleteReq 删除字典类型
type TypeDeleteReq struct {
Id interface{} `json:"id" v:"required#字典类型ID不能为空" dc:"字典类型ID"`
g.Meta `path:"/dictType/delete" method:"post" tags:"字典类型" summary:"删除字典类型"`
sysin.DictTypeDeleteInp
}
type TypeDeleteRes struct{}

View File

@ -7,7 +7,6 @@ package gencodes
import (
"github.com/gogf/gf/v2/frame/g"
"hotgo/internal/model/entity"
"hotgo/internal/model/input/form"
"hotgo/internal/model/input/sysin"
)
@ -25,8 +24,8 @@ type ListRes struct {
// ViewReq 获取指定信息
type ViewReq struct {
Id int64 `json:"id" v:"required#生成代码ID不能为空" dc:"生成代码ID"`
g.Meta `path:"/genCodes/view" method:"get" tags:"生成代码" summary:"获取指定信息"`
sysin.GenCodesViewInp
}
type ViewRes struct {
@ -35,8 +34,8 @@ type ViewRes struct {
// EditReq 修改/新增数据
type EditReq struct {
entity.SysGenCodes
g.Meta `path:"/genCodes/edit" method:"post" tags:"生成代码" summary:"修改/新增生成代码"`
sysin.GenCodesEditInp
}
type EditRes struct {
@ -45,32 +44,33 @@ type EditRes struct {
// DeleteReq 删除
type DeleteReq struct {
Id interface{} `json:"id" v:"required#生成代码ID不能为空" dc:"生成代码ID"`
g.Meta `path:"/genCodes/delete" method:"post" tags:"生成代码" summary:"删除生成代码"`
sysin.GenCodesDeleteInp
}
type DeleteRes struct{}
// MaxSortReq 最大排序
type MaxSortReq struct {
Id int64 `json:"id" dc:"生成代码ID"`
g.Meta `path:"/genCodes/maxSort" method:"get" tags:"生成代码" summary:"生成代码最大排序"`
sysin.GenCodesMaxSortInp
}
type MaxSortRes struct {
Sort int `json:"sort" dc:"排序"`
*sysin.GenCodesMaxSortModel
}
// StatusReq 更新状态
type StatusReq struct {
entity.SysGenCodes
g.Meta `path:"/genCodes/status" method:"post" tags:"生成代码" summary:"更新生成代码状态"`
sysin.GenCodesStatusInp
}
type StatusRes struct{}
type SelectsReq struct {
g.Meta `path:"/genCodes/selects" method:"get" tags:"生成代码" summary:"生成入口选项"`
sysin.GenCodesSelectsInp
}
type SelectsRes struct {
@ -111,7 +111,7 @@ type PreviewRes struct {
// BuildReq 提交生成
type BuildReq struct {
g.Meta `path:"/genCodes/build" method:"post" tags:"生成代码" summary:"提交生成"`
sysin.GenCodesPreviewInp
sysin.GenCodesBuildInp
}
type BuildRes struct {

View File

@ -21,15 +21,7 @@ type ClearRes struct{}
// ExportReq 导出
type ExportReq struct {
g.Meta `path:"/log/export" method:"get" tags:"日志" summary:"导出日志"`
form.PageReq
form.RangeDateReq
Module string `json:"module" dc:"应用端口"`
MemberId int `json:"member_id" dc:"用户ID"`
TakeUpTime int `json:"take_up_time" dc:"请求耗时"`
Method string `json:"method" dc:"请求方式"`
Url string `json:"url" dc:"请求路径"`
Ip string `json:"ip" dc:"访问IP"`
ErrorCode string `json:"error_code" dc:"状态码"`
sysin.LogListInp
}
type ExportRes struct{}
@ -37,16 +29,7 @@ type ExportRes struct{}
// ListReq 获取菜单列表
type ListReq struct {
g.Meta `path:"/log/list" method:"get" tags:"日志" summary:"获取日志列表"`
form.PageReq
form.RangeDateReq
Module string `json:"module" dc:"应用端口"`
MemberId int `json:"member_id" dc:"用户ID"`
TakeUpTime int `json:"take_up_time" dc:"请求耗时"`
Method string `json:"method" dc:"请求方式"`
Url string `json:"url" dc:"请求路径"`
Ip string `json:"ip" dc:"访问IP"`
ErrorCode string `json:"error_code" dc:"状态码"`
CreatedAt []int64 `json:"created_at " dc:"访问时间区间"`
sysin.LogListInp
}
type ListRes struct {
@ -57,7 +40,7 @@ type ListRes struct {
// DeleteReq 删除
type DeleteReq struct {
g.Meta `path:"/log/delete" method:"post" tags:"日志" summary:"删除日志"`
Id interface{} `json:"id" v:"required#日志ID不能为空" description:"日志ID"`
sysin.LogDeleteInp
}
type DeleteRes struct{}
@ -65,7 +48,7 @@ type DeleteRes struct{}
// ViewReq 获取指定信息
type ViewReq struct {
g.Meta `path:"/log/view" method:"get" tags:"日志" summary:"获取指定信息"`
Id string `json:"id" v:"required#日志ID不能为空" description:"日志ID"`
sysin.LogViewInp
}
type ViewRes struct {

View File

@ -3,7 +3,6 @@
// @Copyright Copyright (c) 2023 HotGo CLI
// @Author Ms <133814250@qq.com>
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
//
package loginlog
import (

View File

@ -107,6 +107,7 @@ type StatusRes struct{}
// SelectReq 获取可选的后台用户选项
type SelectReq struct {
g.Meta `path:"/member/option" method:"get" tags:"用户" summary:"获取可选的后台用户选项"`
adminin.MemberSelectInp
}
type SelectRes []*adminin.MemberSelectModel

View File

@ -34,7 +34,6 @@ type ListReq struct {
}
type ListRes struct {
//List adminin.MenuList `json:"list" dc:"数据列表"`
*adminin.MenuListModel
form.PageRes
}

View File

@ -7,43 +7,35 @@ package monitor
import (
"github.com/gogf/gf/v2/frame/g"
"github.com/gogf/gf/v2/os/gtime"
"hotgo/internal/library/network/tcp"
"hotgo/internal/model/input/form"
)
// OfflineReq 下线用户
type OfflineReq struct {
g.Meta `path:"/monitor/offline" method:"post" tags:"在线用户" summary:"下线用户"`
// UserOfflineReq 下线用户
type UserOfflineReq struct {
g.Meta `path:"/monitor/userOffline" method:"post" tags:"在线用户" summary:"下线用户"`
Id string `json:"id" v:"required#SID不能为空" description:"SID"`
}
type OfflineRes struct{}
type UserOfflineRes struct{}
// OnlineListReq 获取在线用户列表
type OnlineListReq struct {
g.Meta `path:"/monitor/onlineList" method:"get" tags:"在线用户" summary:"获取监控列表"`
// UserOnlineListReq 获取在线用户列表
type UserOnlineListReq struct {
g.Meta `path:"/monitor/userOnlineList" method:"get" tags:"在线用户" summary:"获取在线用户列表"`
form.PageReq
form.RangeDateReq
form.StatusReq
UserId int64 `json:"userId" description:"用户ID"`
Addr string `json:"addr" description:"登录地址"`
UserId int64 `json:"userId" description:"用户ID"`
Username string `json:"username" description:"用户名"`
Addr string `json:"addr" description:"登录地址"`
FirstTime []*gtime.Time `json:"firstTime" description:"登录时间"`
}
type OnlineListRes struct {
List []*OnlineModel `json:"list" description:"数据列表"`
type UserOnlineListRes struct {
List []*UserOnlineModel `json:"list" description:"数据列表"`
form.PageRes
}
// OnlineViewReq 获取指定信息
type OnlineViewReq struct {
g.Meta `path:"/monitor/onlineView" method:"get" tags:"在线用户" summary:"获取指定用户信息"`
Id string `json:"id" v:"required#SID不能为空" description:"SID"`
}
type OnlineViewRes struct {
*OnlineModel
}
type OnlineModel struct {
type UserOnlineModel struct {
ID string `json:"id"` // 连接唯一标识
Addr string `json:"addr"` // 客户端地址
Os string `json:"os"` // 客户端系统名称
@ -56,14 +48,60 @@ type OnlineModel struct {
Avatar string `json:"avatar"` // 头像
}
type OnlineModels []*OnlineModel
// NetOnlineListReq 获取在线服务列表
type NetOnlineListReq struct {
g.Meta `path:"/monitor/netOnlineList" method:"get" tags:"在线服务" summary:"获取在线服务列表"`
form.PageReq
Name string `json:"name" description:"应用名称"`
Group string `json:"group" description:"分组"`
AppId string `json:"appId" description:"APPID"`
Addr string `json:"addr" description:"登录地址"`
FirstTime []*gtime.Time `json:"firstTime" description:"登录时间"`
}
func (p OnlineModels) Len() int {
return len(p)
type NetOnlineListRes struct {
List []*NetOnlineModel `json:"list" description:"数据列表"`
form.PageRes
}
func (p OnlineModels) Swap(i, j int) {
p[i], p[j] = p[j], p[i]
type NetOnlineModel struct {
*tcp.AuthMeta
Id int64 `json:"id" description:"连接ID"`
IsAuth bool `json:"isAuth" description:"是否认证"`
Addr string `json:"addr" description:"登录地址"`
Port string `json:"port" description:"连接端口"`
FirstTime int64 `json:"firstTime" description:"首次连接时间"`
HeartbeatTime int64 `json:"heartbeatTime" description:"上次心跳时间"`
LicenseId int64 `json:"licenseId" description:"许可ID"`
LicenseName string `json:"licenseName" description:"许可名称"`
LoginTimes int64 `json:"loginTimes" description:"许可累计登录次数"`
Online int `json:"online" description:"许可在线数量"`
OnlineLimit int `json:"onlineLimit" description:"许可在线数量限制"`
Desc string `json:"desc" description:"许可说明"`
Proto string `json:"proto" description:"网络协议"`
}
func (p OnlineModels) Less(i, j int) bool {
return p[j].FirstTime < p[i].FirstTime
// NetOptionReq 获取服务选项
type NetOptionReq struct {
g.Meta `path:"/monitor/netOption" method:"get" tags:"在线服务" summary:"获取服务选项"`
}
type NetOptionRes struct {
LicenseGroup form.Selects `json:"licenseGroup" dc:"授权分组"`
Routes []*RouteSelect `json:"routes" dc:"路由选项"`
}
type RouteSelect struct {
Value interface{} `json:"value"`
Label string `json:"label"`
Disabled bool `json:"disabled"`
IsRPC bool `json:"isRPC"`
}
// NetOfflineReq 下线服务
type NetOfflineReq struct {
g.Meta `path:"/monitor/netOffline" method:"post" tags:"在线服务" summary:"下线服务"`
Id int64 `json:"id" v:"required#连接ID不能为空" description:"连接ID"`
}
type NetOfflineRes struct{}

View File

@ -3,7 +3,6 @@
// @Copyright Copyright (c) 2023 HotGo CLI
// @Author Ms <133814250@qq.com>
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
//
package notice
import (
@ -56,7 +55,7 @@ type MaxSortReq struct {
}
type MaxSortRes struct {
Sort int `json:"sort" dc:"排序"`
*adminin.NoticeMaxSortModel
}
// StatusReq 更新公告状态

View File

@ -7,7 +7,6 @@ package post
import (
"github.com/gogf/gf/v2/frame/g"
"hotgo/internal/model/entity"
"hotgo/internal/model/input/adminin"
"hotgo/internal/model/input/form"
)
@ -15,7 +14,7 @@ import (
// EditReq 修改/新增岗位
type EditReq struct {
g.Meta `path:"/post/edit" method:"post" tags:"岗位" summary:"修改/新增岗位"`
entity.AdminPost
adminin.PostEditInp
}
type EditRes struct{}
@ -23,7 +22,7 @@ type EditRes struct{}
// DeleteReq 删除岗位
type DeleteReq struct {
g.Meta `path:"/post/delete" method:"post" tags:"岗位" summary:"删除岗位"`
Id interface{} `json:"id" v:"required#岗位ID不能为空" description:"岗位ID"`
adminin.PostDeleteInp
}
type DeleteRes struct{}
@ -31,21 +30,17 @@ type DeleteRes struct{}
// MaxSortReq 最大排序
type MaxSortReq struct {
g.Meta `path:"/post/maxSort" method:"get" tags:"岗位" summary:"岗位最大排序"`
Id int64 `json:"id" description:"岗位ID"`
adminin.PostMaxSortInp
}
type MaxSortRes struct {
Sort int `json:"sort" description:"排序"`
*adminin.PostMaxSortModel
}
// ListReq 获取列表
type ListReq struct {
g.Meta `path:"/post/list" method:"get" tags:"岗位" summary:"获取岗位列表"`
form.PageReq
form.RangeDateReq
form.StatusReq
Name string `json:"name" description:"岗位名称"`
Code string `json:"code" description:"岗位编码"`
adminin.PostListInp
}
type ListRes struct {
@ -56,39 +51,17 @@ type ListRes struct {
// ViewReq 获取指定信息
type ViewReq struct {
g.Meta `path:"/post/view" method:"get" tags:"岗位" summary:"获取指定信息"`
Id string `json:"id" v:"required#岗位ID不能为空" description:"岗位ID"`
adminin.PostViewInp
}
type ViewRes struct {
*adminin.PostViewModel
}
// CodeUniqueReq 编码是否唯一
type CodeUniqueReq struct {
g.Meta `path:"/post/code_unique" method:"get" tags:"岗位" summary:"岗位编码是否唯一"`
Code string `json:"code" v:"required#岗位编码不能为空" description:"岗位编码"`
Id int64 `json:"id" description:"岗位ID"`
}
type CodeUniqueRes struct {
IsUnique bool `json:"is_unique" description:"是否唯一"`
}
// NameUniqueReq 名称是否唯一
type NameUniqueReq struct {
g.Meta `path:"/post/name_unique" method:"get" tags:"岗位" summary:"岗位名称是否唯一"`
Name string `json:"name" v:"required#岗位名称不能为空" description:"岗位名称"`
Id int64 `json:"id" description:"岗位ID"`
}
type NameUniqueRes struct {
IsUnique bool `json:"is_unique" description:"是否唯一"`
}
// StatusReq 更新状态
type StatusReq struct {
entity.AdminPost
g.Meta `path:"/post/status" method:"post" tags:"岗位" summary:"更新岗位状态"`
adminin.PostStatusInp
}
type StatusRes struct{}

View File

@ -7,19 +7,14 @@ package provinces
import (
"github.com/gogf/gf/v2/frame/g"
"hotgo/internal/model/entity"
"hotgo/internal/model/input/form"
"hotgo/internal/model/input/sysin"
)
// ListReq 查询列表
type ListReq struct {
form.PageReq
form.RangeDateReq
form.StatusReq
Title string `json:"title"`
Content string `json:"content"`
g.Meta `path:"/provinces/list" method:"get" tags:"省市区" summary:"获取省市区列表"`
g.Meta `path:"/provinces/list" method:"get" tags:"省市区" summary:"获取省市区列表"`
sysin.ProvincesListInp
}
type ListRes struct {
@ -29,8 +24,8 @@ type ListRes struct {
// ViewReq 获取信息
type ViewReq struct {
Id int64 `json:"id" v:"required#省市区ID不能为空" dc:"省市区ID"`
g.Meta `path:"/provinces/view" method:"get" tags:"省市区" summary:"获取指定信息"`
sysin.ProvincesViewInp
}
type ViewRes struct {
@ -56,6 +51,7 @@ type DeleteRes struct{}
// MaxSortReq 最大排序
type MaxSortReq struct {
g.Meta `path:"/provinces/maxSort" method:"get" tags:"省市区" summary:"省市区最大排序"`
sysin.ProvincesMaxSortInp
}
type MaxSortRes struct {
@ -64,8 +60,8 @@ type MaxSortRes struct {
// StatusReq 更新状态
type StatusReq struct {
entity.SysProvinces
g.Meta `path:"/provinces/status" method:"post" tags:"省市区" summary:"更新省市区状态"`
sysin.ProvincesStatusInp
}
type StatusRes struct{}

View File

@ -27,34 +27,8 @@ type DynamicReq struct {
g.Meta `path:"/role/dynamic" method:"get" tags:"路由" summary:"获取动态路由" description:"获取登录用户动态路由"`
}
type DynamicMeta struct {
Title string `json:"title" description:"菜单标题"`
Icon string `json:"icon" description:"菜单图标"`
NoCache bool `json:"noCache" description:"是否缓存"`
Remark string `json:"remark" description:"备注"`
}
type DynamicBase struct {
Id int64 `json:"id" description:"菜单ID"`
Pid int64 `json:"pid" description:"父ID"`
Name string `json:"name" description:"菜单名称"`
Code string `json:"code" description:"菜单编码"`
Path string `json:"path" description:"路由地址"`
Hidden bool `json:"hidden" description:"是否隐藏"`
Redirect string `json:"redirect" description:"重定向"`
Component string `json:"component" description:"组件路径"`
AlwaysShow bool `json:"alwaysShow" description:"暂时不知道干啥"`
IsFrame string `json:"isFrame" description:"是否为外链0是 1否"`
Meta *DynamicMeta `json:"meta" description:"配置数据集"`
}
type DynamicMenu struct {
DynamicBase
Children []*DynamicBase `json:"children" description:"子菜单"`
}
type DynamicRes struct {
List []adminin.MenuRoute `json:"list" description:"数据列表"`
List []*adminin.MenuRoute `json:"list" description:"数据列表"`
}
type UpdatePermissionsReq struct {

View File

@ -0,0 +1,74 @@
// Package servelicense
// @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 servelicense
import (
"github.com/gogf/gf/v2/frame/g"
"hotgo/internal/model/input/form"
"hotgo/internal/model/input/sysin"
)
// ListReq 查询服务许可证列表
type ListReq struct {
g.Meta `path:"/serveLicense/list" method:"get" tags:"服务许可证" summary:"获取服务许可证列表"`
sysin.ServeLicenseListInp
}
type ListRes struct {
form.PageRes
List []*sysin.ServeLicenseListModel `json:"list" dc:"数据列表"`
}
// ExportReq 导出服务许可证列表
type ExportReq struct {
g.Meta `path:"/serveLicense/export" method:"get" tags:"服务许可证" summary:"导出服务许可证列表"`
sysin.ServeLicenseListInp
}
type ExportRes struct{}
// ViewReq 获取服务许可证指定信息
type ViewReq struct {
g.Meta `path:"/serveLicense/view" method:"get" tags:"服务许可证" summary:"获取服务许可证指定信息"`
sysin.ServeLicenseViewInp
}
type ViewRes struct {
*sysin.ServeLicenseViewModel
}
// EditReq 修改/新增服务许可证
type EditReq struct {
g.Meta `path:"/serveLicense/edit" method:"post" tags:"服务许可证" summary:"修改/新增服务许可证"`
sysin.ServeLicenseEditInp
}
type EditRes struct{}
// DeleteReq 删除服务许可证
type DeleteReq struct {
g.Meta `path:"/serveLicense/delete" method:"post" tags:"服务许可证" summary:"删除服务许可证"`
sysin.ServeLicenseDeleteInp
}
type DeleteRes struct{}
// StatusReq 更新服务许可证状态
type StatusReq struct {
g.Meta `path:"/serveLicense/status" method:"post" tags:"服务许可证" summary:"更新服务许可证状态"`
sysin.ServeLicenseStatusInp
}
type StatusRes struct{}
// AssignRouterReq 分配服务许可证路由
type AssignRouterReq struct {
g.Meta `path:"/serveLicense/assignRouter" method:"post" tags:"服务许可证" summary:"分配服务许可证路由"`
sysin.ServeLicenseAssignRouterInp
}
type AssignRouterRes struct{}

View File

@ -3,7 +3,6 @@
// @Copyright Copyright (c) 2023 HotGo CLI
// @Author Ms <133814250@qq.com>
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
//
package servelog
import (

View File

@ -2,7 +2,6 @@ package smslog
import (
"github.com/gogf/gf/v2/frame/g"
"hotgo/internal/model/entity"
"hotgo/internal/model/input/form"
"hotgo/internal/model/input/sysin"
)
@ -20,8 +19,8 @@ type ListRes struct {
// ViewReq 获取指定信息
type ViewReq struct {
Id int64 `json:"id" v:"required#短信记录ID不能为空" dc:"短信记录ID"`
g.Meta `path:"/smsLog/view" method:"get" tags:"短信记录" summary:"获取指定信息"`
sysin.SmsLogViewInp
}
type ViewRes struct {
@ -30,42 +29,24 @@ type ViewRes struct {
// EditReq 修改/新增数据
type EditReq struct {
entity.SysSmsLog
g.Meta `path:"/smsLog/edit" method:"post" tags:"短信记录" summary:"修改/新增短信记录"`
sysin.SmsLogEditInp
}
type EditRes struct{}
// DeleteReq 删除
type DeleteReq struct {
Id interface{} `json:"id" v:"required#短信记录ID不能为空" dc:"短信记录ID"`
g.Meta `path:"/smsLog/delete" method:"post" tags:"短信记录" summary:"删除短信记录"`
sysin.SmsLogDeleteInp
}
type DeleteRes struct{}
// MaxSortReq 最大排序
type MaxSortReq struct {
Id int64 `json:"id" dc:"短信记录ID"`
g.Meta `path:"/smsLog/maxSort" method:"get" tags:"短信记录" summary:"短信记录最大排序"`
}
type MaxSortRes struct {
Sort int `json:"sort" dc:"排序"`
}
// StatusReq 更新状态
type StatusReq struct {
entity.SysSmsLog
g.Meta `path:"/smsLog/status" method:"post" tags:"短信记录" summary:"更新短信记录状态"`
sysin.SmsLogStatusInp
}
type StatusRes struct{}
// SendTestReq 更新状态
type SendTestReq struct {
entity.SysSmsLog
g.Meta `path:"/smsLog/sendTest" method:"post" tags:"短信记录" summary:"发送测试短信"`
}
type SendTestRes struct{}

View File

@ -1,18 +0,0 @@
// Package user
// @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 user
import (
"github.com/gogf/gf/v2/frame/g"
)
type HelloReq struct {
g.Meta `path:"/hello" tags:"Hello" method:"get" summary:"You first hello api"`
}
type HelloRes struct {
g.Meta `mime:"text/html" example:"string"`
}

View File

@ -12,7 +12,7 @@ type NotifyAliPayReq struct {
type NotifyAliPayRes struct {
g.Meta `mime:"text/html" type:"string" example:"<html/>"`
payin.PayNotifyModel
*payin.PayNotifyModel
}
// NotifyWxPayReq 微信支付回调
@ -20,7 +20,9 @@ type NotifyWxPayReq struct {
g.Meta `path:"/pay/notify/wxpay" method:"post" tags:"支付异步通知" summary:"微信支付回调"`
}
type NotifyWxPayRes payin.PayNotifyModel
type NotifyWxPayRes struct {
*payin.PayNotifyModel
}
// NotifyQQPayReq QQ支付回调
type NotifyQQPayReq struct {
@ -29,5 +31,5 @@ type NotifyQQPayReq struct {
type NotifyQQPayRes struct {
g.Meta `mime:"text/xml" type:"string"`
payin.PayNotifyModel
*payin.PayNotifyModel
}

View File

@ -0,0 +1,16 @@
package servmsg
import (
"hotgo/internal/library/network/tcp"
"hotgo/internal/model/input/servmsgin"
)
// AuthSummaryReq 授权信息
type AuthSummaryReq struct {
}
// AuthSummaryRes 响应授权信息
type AuthSummaryRes struct {
tcp.ServerRes
Data *servmsgin.AuthSummaryModel `json:"data,omitempty" description:"数据集"`
}

View File

@ -0,0 +1,46 @@
package servmsg
import (
"hotgo/internal/library/network/tcp"
"hotgo/internal/model/input/sysin"
)
// CronDeleteReq 删除任务
type CronDeleteReq struct {
*sysin.CronDeleteInp
}
type CronDeleteRes struct {
tcp.ServerRes
sysin.CronDeleteModel
}
// CronEditReq 编辑任务
type CronEditReq struct {
*sysin.CronEditInp
}
type CronEditRes struct {
tcp.ServerRes
*sysin.CronEditModel
}
// CronStatusReq 修改任务状态
type CronStatusReq struct {
*sysin.CronStatusInp
}
type CronStatusRes struct {
tcp.ServerRes
*sysin.CronStatusModel
}
// CronOnlineExecReq 在线执行
type CronOnlineExecReq struct {
*sysin.OnlineExecInp
}
type CronOnlineExecRes struct {
tcp.ServerRes
*sysin.OnlineExecModel
}

View File

@ -0,0 +1,28 @@
package servmsg
import (
"hotgo/internal/library/network/tcp"
"hotgo/internal/model/input/servmsgin"
)
// 一些例子.
// ExampleHelloReq 一个tcp请求例子
type ExampleHelloReq struct {
Name string `json:"name" description:"名字"`
}
type ExampleHelloRes struct {
tcp.ServerRes
Data *servmsgin.ExampleHelloModel `json:"data,omitempty" description:"数据集"`
}
// ExampleRPCHelloReq 一个rpc请求例子
type ExampleRPCHelloReq struct {
Name string `json:"name" description:"名字"`
}
type ExampleRPCHelloRes struct {
tcp.ServerRes
Data *servmsgin.ExampleHelloModel `json:"data,omitempty" description:"数据集"`
}

View File

@ -8,7 +8,7 @@ import (
// SendToTagReq 发送标签消息
type SendToTagReq struct {
g.Meta `path:"/send/toTag" method:"post" tags:"WebSocket" summary:"发送标签消息"`
websocketin.SendToTagInput
websocketin.SendToTagInp
}
type SendToTagRes struct {

View File

@ -13,13 +13,14 @@ require (
github.com/casbin/casbin/v2 v2.55.0
github.com/forgoer/openssl v1.4.0
github.com/go-pay/gopay v1.5.91
github.com/gogf/gf/contrib/drivers/mysql/v2 v2.4.3
github.com/gogf/gf/contrib/nosql/redis/v2 v2.4.3
github.com/gogf/gf/contrib/trace/jaeger/v2 v2.4.3
github.com/gogf/gf/v2 v2.4.3
github.com/gogf/gf/contrib/drivers/mysql/v2 v2.5.0
github.com/gogf/gf/contrib/nosql/redis/v2 v2.5.0
github.com/gogf/gf/contrib/trace/jaeger/v2 v2.4.4
github.com/gogf/gf/v2 v2.5.0
github.com/golang-jwt/jwt/v5 v5.0.0
github.com/gorilla/websocket v1.5.0
github.com/kayon/iploc v0.0.0-20200312105652-bda3e968a794
github.com/minio/selfupdate v0.6.0
github.com/mojocn/base64Captcha v1.3.5
github.com/olekukonko/tablewriter v0.0.5
github.com/qiniu/go-sdk/v7 v7.14.0
@ -31,11 +32,13 @@ require (
github.com/ufilesdk-dev/ufile-gosdk v1.0.3
github.com/xuri/excelize/v2 v2.6.0
go.opentelemetry.io/otel v1.16.0
golang.org/x/mod v0.9.0
golang.org/x/tools v0.7.0
gopkg.in/yaml.v3 v3.0.1
)
require (
aead.dev/minisign v0.2.0 // indirect
github.com/BurntSushi/toml v1.3.2 // indirect
github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible // indirect
github.com/alibabacloud-go/alibabacloud-gateway-spi v0.0.4 // indirect
@ -114,13 +117,12 @@ require (
go.opentelemetry.io/otel/sdk v1.16.0 // indirect
go.opentelemetry.io/otel/trace v1.16.0 // indirect
go.uber.org/atomic v1.7.0 // indirect
golang.org/x/crypto v0.10.0 // indirect
golang.org/x/image v0.0.0-20211028202545-6944b10bf410 // indirect
golang.org/x/mod v0.9.0 // indirect
golang.org/x/net v0.11.0 // indirect
golang.org/x/crypto v0.11.0 // indirect
golang.org/x/image v0.1.0 // indirect
golang.org/x/net v0.12.0 // indirect
golang.org/x/sync v0.1.0 // indirect
golang.org/x/sys v0.9.0 // indirect
golang.org/x/text v0.10.0 // indirect
golang.org/x/sys v0.10.0 // indirect
golang.org/x/text v0.11.0 // indirect
golang.org/x/time v0.0.0-20191024005414-555d28b269f0 // indirect
gopkg.in/ini.v1 v1.56.0 // indirect
stathat.com/c/consistent v1.0.0 // indirect

View File

@ -1,3 +1,5 @@
aead.dev/minisign v0.2.0 h1:kAWrq/hBRu4AARY6AlciO83xhNnW9UaC8YipS2uhLPk=
aead.dev/minisign v0.2.0/go.mod h1:zdq6LdSd9TbuSxchxwhpA9zEb9YXcVGoE8JakuiGaIQ=
cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU=
@ -168,14 +170,15 @@ github.com/go-sql-driver/mysql v1.7.1 h1:lUIinVbN1DY0xBg0eMOzmmtGoHwWBbvnWubQUrt
github.com/go-sql-driver/mysql v1.7.1/go.mod h1:OXbVy3sEdcQ2Doequ6Z5BW6fXNQTmx+9S1MCJN5yJMI=
github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE=
github.com/gogf/gf/contrib/drivers/mysql/v2 v2.4.3 h1:KQ+NbjzRnc6vI59txxb7xh1z7XUNSECuVrKagunpdNU=
github.com/gogf/gf/contrib/drivers/mysql/v2 v2.4.3/go.mod h1:6X8mwgoByuHnal8X+iLYWvtQQf5ONfOUgsXd9309rJ8=
github.com/gogf/gf/contrib/nosql/redis/v2 v2.4.3 h1:mDOAJJ3H6LSPdAR+0urO5S5WpglVFGuZTQx31L3o01Y=
github.com/gogf/gf/contrib/nosql/redis/v2 v2.4.3/go.mod h1:t/9bT/mPQfoO4IhXTeGpPXooQ0STSoe/4ZspJLJoGug=
github.com/gogf/gf/contrib/trace/jaeger/v2 v2.4.3 h1:yUNE2/LiACU36uFNeSEISwtWVyEQtFhRV0tVec8hOTU=
github.com/gogf/gf/contrib/trace/jaeger/v2 v2.4.3/go.mod h1:Q/BRwWQUKKRbrr3blYV2M5ukNXJHlITJJLCw0RNfjss=
github.com/gogf/gf/v2 v2.4.3 h1:OP91EICmypAEaEpwSyjFnAZtTfcmeKXJQnPP4FZR/BM=
github.com/gogf/gf/v2 v2.4.3/go.mod h1:tsbmtwcAl2chcYoq/fP9W2FZf06aw4i89X34nbSHo9Y=
github.com/gogf/gf/contrib/drivers/mysql/v2 v2.5.0 h1:HfZOhkqsOAH/zmVLn6Ay3WDAxEItEhVtGVVlIYghaLI=
github.com/gogf/gf/contrib/drivers/mysql/v2 v2.5.0/go.mod h1:x5EfQfDMycTBfFHIGNUHU0ZIznHnPQP4adpxz3TByAM=
github.com/gogf/gf/contrib/nosql/redis/v2 v2.5.0 h1:1o/ynDWETKdWuS8tj8iKWods9c1pV/UC2dxFIG6W8z4=
github.com/gogf/gf/contrib/nosql/redis/v2 v2.5.0/go.mod h1:vOV5lfJOkQhf95J9dUqQ/cUzbMyDbljDitHetmEZOcg=
github.com/gogf/gf/contrib/trace/jaeger/v2 v2.4.4 h1:c3Ra9uhi5YU73vGHE2d1GCTGci8BAhbmJxbF+dRPedo=
github.com/gogf/gf/contrib/trace/jaeger/v2 v2.4.4/go.mod h1:gw64aC/Sa+N+qr5qsUZ0gCs6Ep9FEVEePa/6Xv59wf4=
github.com/gogf/gf/v2 v2.4.4/go.mod h1:tsbmtwcAl2chcYoq/fP9W2FZf06aw4i89X34nbSHo9Y=
github.com/gogf/gf/v2 v2.5.0 h1:dFZbIOq/3TmHNWTodSxHbAluuyh274hTvqoNe67pAbE=
github.com/gogf/gf/v2 v2.5.0/go.mod h1:tsbmtwcAl2chcYoq/fP9W2FZf06aw4i89X34nbSHo9Y=
github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=
github.com/golang-jwt/jwt/v5 v5.0.0 h1:1n1XNM9hk7O9mnQoNBGolZvzebBQ7p93ULHRc28XJUE=
github.com/golang-jwt/jwt/v5 v5.0.0/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk=
@ -330,6 +333,8 @@ github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m
github.com/mattn/go-runewidth v0.0.14 h1:+xnbZSEeDbOIg5/mE6JF0w6n9duR1l3/WmbinWVwUuU=
github.com/mattn/go-runewidth v0.0.14/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
github.com/minio/selfupdate v0.6.0 h1:i76PgT0K5xO9+hjzKcacQtO7+MjJ4JKA8Ak8XQ9DDwU=
github.com/minio/selfupdate v0.6.0/go.mod h1:bO02GTIPCMQFTEvE5h4DjYB58bCoZ35XLeBf0buTDdM=
github.com/mitchellh/mapstructure v1.4.3 h1:OVowDSCllw/YjdLkam3/sm7wEtOy59d8ndGgCcyj8cs=
github.com/mitchellh/mapstructure v1.4.3/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
@ -494,6 +499,7 @@ github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9de
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
github.com/yuin/goldmark v1.4.0/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
github.com/yusufpapurcu/wmi v1.2.2 h1:KBNDSne4vP5mbSWnJbO+51IMOXJB67QiYCSBrubbPRg=
github.com/yusufpapurcu/wmi v1.2.2/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0=
go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU=
@ -527,13 +533,15 @@ golang.org/x/crypto v0.0.0-20191219195013-becbf705a915/go.mod h1:LzIPMQfyMNhhGPh
golang.org/x/crypto v0.0.0-20200510223506-06a226fb4e37/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20201112155050-0c6587e931a9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20210220033148-5ea612d1eb83/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I=
golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.0.0-20211209193657-4570a0811e8b/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
golang.org/x/crypto v0.0.0-20220214200702-86341886e292/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
golang.org/x/crypto v0.0.0-20220408190544-5352b0902921/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
golang.org/x/crypto v0.10.0 h1:LKqV2xt9+kDzSTfOhx4FrkEBcMrAgHSYgzywV9zcGmM=
golang.org/x/crypto v0.10.0/go.mod h1:o4eNf7Ede1fv+hwOwZsTHl9EsPFO6q6ZvYR8vYfY45I=
golang.org/x/crypto v0.11.0 h1:6Ewdq3tDic1mg5xRO4milcWCfMVQhI4NkqWWvqejpuA=
golang.org/x/crypto v0.11.0/go.mod h1:xgJhtzW8F9jGdVFWZESrid1U1bjeNy4zgy5cRr/CIio=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8=
@ -549,6 +557,8 @@ golang.org/x/image v0.0.0-20190501045829-6d32002ffd75/go.mod h1:kZ7UVZpmo3dzQBMx
golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
golang.org/x/image v0.0.0-20211028202545-6944b10bf410 h1:hTftEOvwiOq2+O8k2D5/Q7COC7k5Qcrgc2TFURJYnvQ=
golang.org/x/image v0.0.0-20211028202545-6944b10bf410/go.mod h1:023OzeP/+EPmXeapQh35lcL3II3LrY8Ic+EFFKVhULM=
golang.org/x/image v0.1.0 h1:r8Oj8ZA2Xy12/b5KZYj3tuv7NG/fBz3TwQVvpJ9l8Rk=
golang.org/x/image v0.1.0/go.mod h1:iyPr49SD/G/TBxYVB/9RRtGUT5eNbo2u4NamWeQcD5c=
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU=
golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
@ -568,6 +578,7 @@ golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzB
golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
golang.org/x/mod v0.9.0 h1:KENHtAZL2y3NLMYZeHY9DW8HW8V+kQyJsY/V9JlKvCs=
golang.org/x/mod v0.9.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
@ -609,8 +620,9 @@ golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d/go.mod h1:9nx3DQGgdP8bBQD5qx
golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20220407224826-aac1ed45d8e3/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk=
golang.org/x/net v0.0.0-20220520000938-2e3eb7b945c2/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk=
golang.org/x/net v0.11.0 h1:Gi2tvZIJyBtO9SDr1q9h5hEQCp/4L2RQ+ar0qjx2oNU=
golang.org/x/net v0.11.0/go.mod h1:2L/ixqYpgIVXmeoSA/4Lu7BzTG4KIyPIryS4IsOd1oQ=
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
golang.org/x/net v0.12.0 h1:cfawfvKITfUsFCeJIHJrbSxpeu/E81khclypR0GVT50=
golang.org/x/net v0.12.0/go.mod h1:zEVYFnQC7m/vmpQFELhcD1EWkZlX69l4oqgmer6hfKA=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
@ -628,6 +640,7 @@ golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJ
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.1.0 h1:wsuoTGHzEhffawBOhz5CYhcrV4IdKZbEyZjBMuTp12o=
golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
@ -674,6 +687,7 @@ golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20201204225414-ed752295db88/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210228012217-479acdf4ea46/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
@ -686,13 +700,16 @@ golang.org/x/sys v0.0.0-20211020174200-9d6173849985/go.mod h1:oPkhp1MJrh7nUepCBc
golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220114195835-da31bd327af9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220412211240-33da011f77ad/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.9.0 h1:KS/R3tvhPqvJvwcKfnBHJwwthS11LRhmM5D59eEXa0s=
golang.org/x/sys v0.9.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.10.0 h1:SqMFp9UcQJZa+pmYuAKjd9xq1f0j5rLcDIk0mj4qAsA=
golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
@ -703,8 +720,9 @@ golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
golang.org/x/text v0.3.8-0.20211105212822-18b340fc7af2/go.mod h1:EFNZuWvGYxIRUEX+K8UmCFwYmZjqcrnq15ZuVldZkZ0=
golang.org/x/text v0.10.0 h1:UpjohKhiEgNc0CSauXmwYftY1+LlaC75SJwh0SgCX58=
golang.org/x/text v0.10.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
golang.org/x/text v0.11.0 h1:LAntKIrcmeSKERyiOh0XMV39LXS8IE9UL2yP7+f5ij4=
golang.org/x/text v0.11.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20191024005414-555d28b269f0 h1:/5xXl8Y5W96D+TtHSlonuFqGHIWVuyCkGJLwGh9JJFs=
@ -755,6 +773,7 @@ golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc
golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
golang.org/x/tools v0.1.7/go.mod h1:LGqMHiF4EqQNHR1JncWGqT5BVaXmza+X+BDGol+dOxo=
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
golang.org/x/tools v0.7.0 h1:W4OVu8VVOaIO0yzWMNdepAulS7YfoS3Zabrm8DOXXU4=
golang.org/x/tools v0.7.0/go.mod h1:4pg6aUX35JBAogB10C9AtvVL+qowtN4pT3CGSQex14s=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=

View File

@ -52,6 +52,7 @@ var (
service.Middleware().CORS, // 跨域中间件,自动处理跨域问题
service.Middleware().Blacklist, // IP黑名单中间件如果请求IP被后台拉黑所有请求将被拒绝
service.Middleware().DemoLimit, // 演示系統操作限制当开启演示模式时所有POST请求将被拒绝
service.Middleware().PreFilter, // 请求输入预处理api使用gf规范路由并且XxxReq结构体实现了validate.Filter接口即可隐式预处理
service.Middleware().ResponseHandler, // HTTP响应预处理在业务处理完成后对响应结果进行格式化和错误过滤将处理后的数据发送给请求方
)

View File

@ -7,6 +7,7 @@ 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/library/casbin"
@ -18,44 +19,50 @@ var (
Brief: "常用工具",
Description: ``,
Func: func(ctx context.Context, parser *gcmd.Parser) (err error) {
flags := parser.GetOptAll()
g.Log().Debugf(ctx, "flags:%+v", flags)
if len(flags) == 0 {
g.Log().Fatal(ctx, "工具参数不能为空")
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 := flags["m"]
method, ok := args["m"]
if !ok {
g.Log().Fatal(ctx, "工具方法不能为空")
err = gerror.New("tools method cannot be empty.")
return
}
switch method {
case "casbin":
a1, ok := flags["a1"]
if !ok {
g.Log().Fatal(ctx, "casbin参数不能为空")
return
}
casbin.InitEnforcer(ctx)
if a1 == "clear" {
if err := casbin.Clear(ctx); err != nil {
return err
}
} else if a1 == "refresh" {
if err := casbin.Refresh(ctx); err != nil {
return err
}
} else {
g.Log().Fatalf(ctx, "casbin参数无效,a1%+v", a1)
return
}
err = handleCasbin(ctx, args)
default:
g.Log().Fatal(ctx, "工具方法不存在")
err = gerror.Newf("tools method[%v] does not exist", method)
}
if err == nil {
g.Log().Info(ctx, "tools exec successful!")
}
g.Log().Info(ctx, "执行完成!")
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
}

View File

@ -11,5 +11,4 @@ type CtxKey string
const (
ContextHTTPKey CtxKey = "httpContext" // http上下文变量名称
ContextKeyCronArgs CtxKey = "cronArgs" // 定时任务参数上下文变量名称
ContextTCPKey CtxKey = "tcpContext" // tcp上下文变量名称
)

View File

@ -8,8 +8,16 @@ package consts
// 碎片
const (
DemoTips = "演示系统已隐藏"
NilJsonToString = "{}" // 空json初始化值
RegionSpilt = " / " // 地区分隔符
Unknown = "Unknown"
DemoTips = "演示系统已隐藏" // 演示系统敏感数据打码
NilJsonToString = "{}" // 空json初始化值
RegionSpilt = " / " // 地区分隔符
Unknown = "Unknown" // Unknown
SuperRoleKey = "super" // 超管角色唯一标识符,通过角色验证超管
)
// curd.
const (
DefaultPage = 10 // 默认列表分页加载数量
DefaultPageSize = 1 // 默认列表分页加载页码
MaxSortIncr = 10 // 最大排序值增量
)

View File

@ -0,0 +1,14 @@
package consts
// 授权分组
const (
LicenseGroupDefault = "default" // 默认组
LicenseGroupCron = "cron" // 定时任务
LicenseGroupAuth = "auth" // 服务授权
)
var LicenseGroupNameMap = map[string]string{
LicenseGroupDefault: "默认组",
LicenseGroupCron: "定时任务",
LicenseGroupAuth: "服务授权",
}

View File

@ -1,24 +0,0 @@
package consts
const (
TCPMsgCodeSuccess = 2000 // 成功的状态码
)
// 定时任务
const (
TCPCronHeartbeatVerify = "tcpHeartbeatVerify"
TCPCronHeartbeat = "tcpHeartbeat"
TCPCronAuthVerify = "tcpAuthVerify"
)
// 认证分组
const (
TCPClientGroupCron = "cron" // 定时任务
TCPClientGroupQueue = "queue" // 消息队列
TCPClientGroupAuth = "auth" // 服务授权
)
const (
TCPHeartbeatTimeout = 300 // tcp心跳超时默认300s
TCPRpcTimeout = 10 // rpc通讯超时时间 默认10s
)

View File

@ -5,15 +5,6 @@
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
package consts
// 上传类型
const (
UploadTypeFile = 1 // 文件
UploadTypeImage = 2 // 图片
UploadTypeDoc = 3 // 文档
UploadTypeAudio = 4 // 音频
UploadTypeVideo = 5 // 视频
)
// 上传存储驱动
const (
UploadDriveLocal = "local" // 本地驱动

View File

@ -7,5 +7,5 @@ package consts
// VersionApp HotGo版本
const (
VersionApp = "2.7.6"
VersionApp = "2.8.4"
)

View File

@ -7,11 +7,9 @@ package admin
import (
"context"
"github.com/gogf/gf/v2/util/gconv"
"hotgo/api/admin/cash"
"hotgo/internal/library/contexts"
"hotgo/internal/model/input/adminin"
"hotgo/internal/model/input/form"
"hotgo/internal/service"
)
@ -23,7 +21,7 @@ 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, adminin.CashViewInp{Id: req.Id})
data, err := service.AdminCash().View(ctx, &req.CashViewInp)
if err != nil {
return
}
@ -35,27 +33,20 @@ func (c *cCash) View(ctx context.Context, req *cash.ViewReq) (res *cash.ViewRes,
// List 查看列表
func (c *cCash) List(ctx context.Context, req *cash.ListReq) (res *cash.ListRes, err error) {
var in adminin.CashListInp
if err = gconv.Scan(req, &in); err != nil {
return
}
list, totalCount, err := service.AdminCash().List(ctx, in)
list, totalCount, err := service.AdminCash().List(ctx, &req.CashListInp)
if err != nil {
return
}
res = new(cash.ListRes)
res.List = list
res.PageCount = form.CalPageCount(totalCount, req.PerPage)
res.Page = req.Page
res.PerPage = req.PerPage
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{
err = service.AdminCash().Apply(ctx, &adminin.CashApplyInp{
Money: req.Money,
MemberId: contexts.GetUserId(ctx),
})
@ -64,10 +55,6 @@ func (c *cCash) Apply(ctx context.Context, req *cash.ApplyReq) (res *cash.ApplyR
// Payment 提现打款处理
func (c *cCash) Payment(ctx context.Context, req *cash.PaymentReq) (res *cash.PaymentRes, err error) {
err = service.AdminCash().Payment(ctx, adminin.CashPaymentInp{
Id: req.Id,
Status: req.Status,
Msg: req.Msg,
})
err = service.AdminCash().Payment(ctx, &req.CashPaymentInp)
return
}

View File

@ -11,12 +11,7 @@ import (
"context"
"hotgo/api/admin/creditslog"
"hotgo/internal/consts"
"hotgo/internal/model/input/adminin"
"hotgo/internal/model/input/form"
"hotgo/internal/service"
"hotgo/utility/validate"
"github.com/gogf/gf/v2/util/gconv"
)
var (
@ -27,40 +22,20 @@ type cCreditsLog struct{}
// List 查看资产变动列表
func (c *cCreditsLog) List(ctx context.Context, req *creditslog.ListReq) (res *creditslog.ListRes, err error) {
var in adminin.CreditsLogListInp
if err = gconv.Scan(req, &in); err != nil {
return
}
if err = validate.PreFilter(ctx, &in); err != nil {
return
}
list, totalCount, err := service.AdminCreditsLog().List(ctx, in)
list, totalCount, err := service.AdminCreditsLog().List(ctx, &req.CreditsLogListInp)
if err != nil {
return
}
res = new(creditslog.ListRes)
res.List = list
res.PageCount = form.CalPageCount(totalCount, req.PerPage)
res.Page = req.Page
res.PerPage = req.PerPage
res.PageRes.Pack(req, totalCount)
return
}
// Export 导出资产变动列表
func (c *cCreditsLog) Export(ctx context.Context, req *creditslog.ExportReq) (res *creditslog.ExportRes, err error) {
var in adminin.CreditsLogListInp
if err = gconv.Scan(req, &in); err != nil {
return
}
if err = validate.PreFilter(ctx, &in); err != nil {
return
}
err = service.AdminCreditsLog().Export(ctx, in)
err = service.AdminCreditsLog().Export(ctx, &req.CreditsLogListInp)
return
}

View File

@ -7,12 +7,8 @@ package admin
import (
"context"
"github.com/gogf/gf/v2/util/gconv"
"hotgo/api/admin/dept"
"hotgo/internal/model/input/adminin"
"hotgo/internal/model/input/form"
"hotgo/internal/service"
"hotgo/utility/validate"
)
var (
@ -23,33 +19,19 @@ type cDept struct{}
// Delete 删除
func (c *cDept) Delete(ctx context.Context, req *dept.DeleteReq) (res *dept.DeleteRes, err error) {
var in adminin.DeptDeleteInp
if err = gconv.Scan(req, &in); err != nil {
return
}
err = service.AdminDept().Delete(ctx, in)
err = service.AdminDept().Delete(ctx, &req.DeptDeleteInp)
return
}
// Edit 更新
func (c *cDept) Edit(ctx context.Context, req *dept.EditReq) (res *dept.EditRes, err error) {
var in adminin.DeptEditInp
if err = gconv.Scan(req, &in); err != nil {
return nil, err
}
if err = validate.PreFilter(ctx, &in); err != nil {
return
}
err = service.AdminDept().Edit(ctx, in)
err = service.AdminDept().Edit(ctx, &req.DeptEditInp)
return
}
// MaxSort 最大排序
func (c *cDept) MaxSort(ctx context.Context, req *dept.MaxSortReq) (res *dept.MaxSortRes, err error) {
data, err := service.AdminDept().MaxSort(ctx, adminin.DeptMaxSortInp{Id: req.Id})
data, err := service.AdminDept().MaxSort(ctx, &req.DeptMaxSortInp)
if err != nil {
return
}
@ -61,64 +43,37 @@ func (c *cDept) MaxSort(ctx context.Context, req *dept.MaxSortReq) (res *dept.Ma
// View 获取指定信息
func (c *cDept) View(ctx context.Context, req *dept.ViewReq) (res *dept.ViewRes, err error) {
data, err := service.AdminDept().View(ctx, adminin.DeptViewInp{Id: req.Id})
if err != nil {
return
}
res = new(dept.ViewRes)
res.DeptViewModel = data
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) {
var in adminin.DeptListInp
if err = gconv.Scan(req, &in); err != nil {
return
}
data, err := service.AdminDept().List(ctx, in)
data, err := service.AdminDept().List(ctx, &req.DeptListInp)
if err != nil || data == nil {
return
}
res = new(dept.ListRes)
res.List = data.List
res = (*dept.ListRes)(&data)
return
}
// Status 更新部门状态
func (c *cDept) Status(ctx context.Context, req *dept.StatusReq) (res *dept.StatusRes, err error) {
var in adminin.DeptStatusInp
if err = gconv.Scan(req, &in); err != nil {
return
}
if err = validate.PreFilter(ctx, &in); err != nil {
return
}
err = service.AdminDept().Status(ctx, in)
err = service.AdminDept().Status(ctx, &req.DeptStatusInp)
return
}
// Option 获取部门选项树
func (c *cDept) Option(ctx context.Context, req *dept.OptionReq) (res *dept.OptionRes, err error) {
var in adminin.DeptOptionInp
if err = gconv.Scan(req, &in); err != nil {
return
}
list, totalCount, err := service.AdminDept().Option(ctx, in)
list, totalCount, err := service.AdminDept().Option(ctx, &req.DeptOptionInp)
if err != nil {
return
}
res = new(dept.OptionRes)
res.DeptOptionModel = list
res.PageCount = form.CalPageCount(totalCount, req.PerPage)
res.Page = req.Page
res.PerPage = req.PerPage
res.PageRes.Pack(req, totalCount)
return
}

View File

@ -8,13 +8,10 @@ package admin
import (
"context"
"github.com/gogf/gf/v2/errors/gerror"
"github.com/gogf/gf/v2/util/gconv"
"hotgo/api/admin/member"
"hotgo/internal/library/contexts"
"hotgo/internal/model/input/adminin"
"hotgo/internal/model/input/form"
"hotgo/internal/service"
"hotgo/utility/validate"
)
var (
@ -25,45 +22,25 @@ type cMember struct{}
// UpdateCash 修改代理商提现信息
func (c *cMember) UpdateCash(ctx context.Context, req *member.UpdateCashReq) (res *member.UpdateCashRes, err error) {
var in adminin.MemberUpdateCashInp
if err = gconv.Scan(req, &in); err != nil {
return
}
err = service.AdminMember().UpdateCash(ctx, in)
err = service.AdminMember().UpdateCash(ctx, &req.MemberUpdateCashInp)
return
}
// UpdateEmail 换绑邮箱
func (c *cMember) UpdateEmail(ctx context.Context, req *member.UpdateEmailReq) (res *member.UpdateEmailRes, err error) {
var in adminin.MemberUpdateEmailInp
if err = gconv.Scan(req, &in); err != nil {
return
}
err = service.AdminMember().UpdateEmail(ctx, in)
err = service.AdminMember().UpdateEmail(ctx, &req.MemberUpdateEmailInp)
return
}
// UpdateMobile 换绑手机号
func (c *cMember) UpdateMobile(ctx context.Context, req *member.UpdateMobileReq) (res *member.UpdateMobileRes, err error) {
var in adminin.MemberUpdateMobileInp
if err = gconv.Scan(req, &in); err != nil {
return
}
err = service.AdminMember().UpdateMobile(ctx, in)
err = service.AdminMember().UpdateMobile(ctx, &req.MemberUpdateMobileInp)
return
}
// UpdateProfile 更新用户资料
func (c *cMember) UpdateProfile(ctx context.Context, req *member.UpdateProfileReq) (res *member.UpdateProfileRes, err error) {
var in adminin.MemberUpdateProfileInp
if err = gconv.Scan(req, &in); err != nil {
return
}
err = service.AdminMember().UpdateProfile(ctx, in)
err = service.AdminMember().UpdateProfile(ctx, &req.MemberUpdateProfileInp)
return
}
@ -72,27 +49,20 @@ func (c *cMember) UpdatePwd(ctx context.Context, req *member.UpdatePwdReq) (res
var memberId = contexts.Get(ctx).User.Id
if memberId <= 0 {
err = gerror.New("获取用户信息失败!")
return nil, err
return
}
var in = adminin.MemberUpdatePwdInp{
err = service.AdminMember().UpdatePwd(ctx, &adminin.MemberUpdatePwdInp{
Id: memberId,
OldPassword: req.OldPassword,
NewPassword: req.NewPassword,
}
err = service.AdminMember().UpdatePwd(ctx, in)
})
return
}
// ResetPwd 重置密码
func (c *cMember) ResetPwd(ctx context.Context, req *member.ResetPwdReq) (res *member.ResetPwdRes, err error) {
var in = adminin.MemberResetPwdInp{
Id: req.Id,
Password: req.Password,
}
err = service.AdminMember().ResetPwd(ctx, in)
err = service.AdminMember().ResetPwd(ctx, &req.MemberResetPwdInp)
return
}
@ -108,40 +78,21 @@ func (c *cMember) MemberInfo(ctx context.Context, _ *member.InfoReq) (res *membe
return
}
// Delete 删除
// Delete 删除用户
func (c *cMember) Delete(ctx context.Context, req *member.DeleteReq) (res *member.DeleteRes, err error) {
var in adminin.MemberDeleteInp
if err = gconv.Scan(req, &in); err != nil {
return
}
if err = validate.PreFilter(ctx, &in); err != nil {
return
}
err = service.AdminMember().Delete(ctx, in)
err = service.AdminMember().Delete(ctx, &req.MemberDeleteInp)
return
}
// Edit 修改/新增
// Edit 修改/新增用户
func (c *cMember) Edit(ctx context.Context, req *member.EditReq) (res *member.EditRes, err error) {
var in adminin.MemberEditInp
if err = gconv.Scan(req, &in); err != nil {
return
}
if err = validate.PreFilter(ctx, &in); err != nil {
return
}
in.PostIds = req.PostIds
err = service.AdminMember().Edit(ctx, in)
err = service.AdminMember().Edit(ctx, &req.MemberEditInp)
return
}
// View 获取指定信息
// View 获取指定用户信息
func (c *cMember) View(ctx context.Context, req *member.ViewReq) (res *member.ViewRes, err error) {
data, err := service.AdminMember().View(ctx, adminin.MemberViewInp{Id: req.Id})
data, err := service.AdminMember().View(ctx, &req.MemberViewInp)
if err != nil {
return
}
@ -151,44 +102,28 @@ func (c *cMember) View(ctx context.Context, req *member.ViewReq) (res *member.Vi
return
}
// List 查看列表
// List 查看用户列表
func (c *cMember) List(ctx context.Context, req *member.ListReq) (res *member.ListRes, err error) {
var in adminin.MemberListInp
if err = gconv.Scan(req, &in); err != nil {
return
}
list, totalCount, err := service.AdminMember().List(ctx, in)
list, totalCount, err := service.AdminMember().List(ctx, &req.MemberListInp)
if err != nil {
return
}
res = new(member.ListRes)
res.List = list
res.PageCount = form.CalPageCount(totalCount, req.PerPage)
res.Page = req.Page
res.PerPage = req.PerPage
res.PageRes.Pack(req, totalCount)
return
}
// Status 更新状态
// Status 更新用户状态
func (c *cMember) Status(ctx context.Context, req *member.StatusReq) (res *member.StatusRes, err error) {
var in adminin.MemberStatusInp
if err = gconv.Scan(req, &in); err != nil {
return
}
if err = validate.PreFilter(ctx, &in); err != nil {
return
}
err = service.AdminMember().Status(ctx, in)
err = service.AdminMember().Status(ctx, &req.MemberStatusInp)
return
}
// Select 获取可选的后台用户选项
func (c *cMember) Select(ctx context.Context, _ *member.SelectReq) (res *member.SelectRes, err error) {
data, err := service.AdminMember().Select(ctx, adminin.MemberSelectInp{})
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
}
@ -197,32 +132,14 @@ func (c *cMember) Select(ctx context.Context, _ *member.SelectReq) (res *member.
return
}
// AddBalance 增加余额
// AddBalance 增加用户余额
func (c *cMember) AddBalance(ctx context.Context, req *member.AddBalanceReq) (res *member.AddBalanceRes, err error) {
var in adminin.MemberAddBalanceInp
if err = gconv.Scan(req, &in); err != nil {
return
}
if err = validate.PreFilter(ctx, &in); err != nil {
return
}
err = service.AdminMember().AddBalance(ctx, in)
err = service.AdminMember().AddBalance(ctx, &req.MemberAddBalanceInp)
return
}
// AddIntegral 增加积分
// AddIntegral 增加用户积分
func (c *cMember) AddIntegral(ctx context.Context, req *member.AddIntegralReq) (res *member.AddIntegralRes, err error) {
var in adminin.MemberAddIntegralInp
if err = gconv.Scan(req, &in); err != nil {
return
}
if err = validate.PreFilter(ctx, &in); err != nil {
return
}
err = service.AdminMember().AddIntegral(ctx, in)
err = service.AdminMember().AddIntegral(ctx, &req.MemberAddIntegralInp)
return
}

View File

@ -7,11 +7,8 @@ package admin
import (
"context"
"github.com/gogf/gf/v2/util/gconv"
"hotgo/api/admin/menu"
"hotgo/internal/model/input/adminin"
"hotgo/internal/service"
"hotgo/utility/validate"
)
// Menu 菜单
@ -23,45 +20,18 @@ type cMenu struct{}
// Delete 删除
func (c *cMenu) Delete(ctx context.Context, req *menu.DeleteReq) (res *menu.DeleteRes, err error) {
var in adminin.MenuDeleteInp
if err = gconv.Scan(req, &in); err != nil {
return
}
if err = validate.PreFilter(ctx, &in); err != nil {
return
}
err = service.AdminMenu().Delete(ctx, in)
err = service.AdminMenu().Delete(ctx, &req.MenuDeleteInp)
return
}
// Edit 更新
func (c *cMenu) Edit(ctx context.Context, req *menu.EditReq) (res *menu.EditRes, err error) {
var in adminin.MenuEditInp
if err = gconv.Scan(req, &in); err != nil {
return
}
if err = validate.PreFilter(ctx, &in); err != nil {
return
}
err = service.AdminMenu().Edit(ctx, in)
err = service.AdminMenu().Edit(ctx, &req.MenuEditInp)
return
}
// List 获取列表
func (c *cMenu) List(ctx context.Context, req *menu.ListReq) (res menu.ListRes, err error) {
var in adminin.MenuListInp
if err = gconv.Scan(req, &in); err != nil {
return
}
if err = validate.PreFilter(ctx, &in); err != nil {
return
}
res.MenuListModel, err = service.AdminMenu().List(ctx, in)
res.MenuListModel, err = service.AdminMenu().List(ctx, &req.MenuListInp)
return
}

View File

@ -13,7 +13,10 @@ import (
"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"
@ -29,8 +32,8 @@ type cMonitor struct {
wsManager *websocket.ClientManager
}
// Offline 下线用户
func (c *cMonitor) Offline(ctx context.Context, req *monitor.OfflineReq) (res *monitor.OfflineRes, err error) {
// 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("客户端已离线")
@ -44,15 +47,10 @@ func (c *cMonitor) Offline(ctx context.Context, req *monitor.OfflineReq) (res *m
return
}
// View 获取指定信息
func (c *cMonitor) View(ctx context.Context, req *monitor.OnlineViewReq) (res *monitor.OnlineViewRes, err error) {
return
}
// OnlineList 获取在线列表
func (c *cMonitor) OnlineList(ctx context.Context, req *monitor.OnlineListReq) (res *monitor.OnlineListRes, err error) {
// UserOnlineList 获取用户在线列表
func (c *cMonitor) UserOnlineList(ctx context.Context, req *monitor.UserOnlineListReq) (res *monitor.UserOnlineListRes, err error) {
var (
clients []*monitor.OnlineModel
clients []*monitor.UserOnlineModel
i int
)
@ -69,16 +67,24 @@ func (c *cMonitor) OnlineList(ctx context.Context, req *monitor.OnlineListReq) (
continue
}
if req.Username != "" && req.Username != conn.User.Username {
continue
}
if req.Addr != "" && !gstr.Contains(conn.Addr, req.Addr) {
continue
}
clients = append(clients, &monitor.OnlineModel{
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,
Addr: conn.Addr,
Os: useragent.GetOs(conn.UserAgent),
Browser: useragent.GetBrowser(conn.UserAgent),
FirstTime: gtime.New(conn.User.LoginAt).Unix(),
FirstTime: conn.User.LoginAt.Unix(),
HeartbeatTime: conn.HeartbeatTime,
App: conn.User.App,
UserId: conn.User.Id,
@ -87,14 +93,18 @@ func (c *cMonitor) OnlineList(ctx context.Context, req *monitor.OnlineListReq) (
})
}
res = new(monitor.OnlineListRes)
res.PageCount = form.CalPageCount(len(clients), req.PerPage)
res.Page = req.Page
res.PerPage = req.PerPage
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
})
sort.Sort(monitor.OnlineModels(clients))
isDemo := g.Cfg().MustGet(ctx, "hotgo.isDemo", false).Bool()
_, perPage, offset := form.CalPage(ctx, req.Page, req.PerPage)
_, perPage, offset := form.CalPage(req.Page, req.PerPage)
for k, v := range clients {
if k >= offset && i <= perPage {
@ -107,3 +117,138 @@ func (c *cMonitor) OnlineList(ctx context.Context, req *monitor.OnlineListReq) (
}
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 {
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 k, v := range consts.LicenseGroupNameMap {
res.LicenseGroup = append(res.LicenseGroup, &form.Select{
Value: k,
Name: v,
Label: v,
})
}
sort.Sort(res.LicenseGroup)
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
}

View File

@ -3,16 +3,12 @@
// @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/util/gconv"
"hotgo/api/admin/notice"
"hotgo/internal/consts"
"hotgo/internal/model/input/adminin"
"hotgo/internal/model/input/form"
"hotgo/internal/service"
)
@ -24,30 +20,19 @@ type cNotice struct{}
// Delete 删除
func (c *cNotice) Delete(ctx context.Context, req *notice.DeleteReq) (res *notice.DeleteRes, err error) {
var in adminin.NoticeDeleteInp
if err = gconv.Scan(req, &in); err != nil {
return
}
err = service.AdminNotice().Delete(ctx, in)
err = service.AdminNotice().Delete(ctx, &req.NoticeDeleteInp)
return
}
// Edit 更新
func (c *cNotice) Edit(ctx context.Context, req *notice.EditReq) (res *notice.EditRes, err error) {
var in adminin.NoticeEditInp
if err = gconv.Scan(req, &in); err != nil {
return
}
in.Receiver = req.Receiver
err = service.AdminNotice().Edit(ctx, in)
err = service.AdminNotice().Edit(ctx, &req.NoticeEditInp)
return
}
// MaxSort 最大排序
func (c *cNotice) MaxSort(ctx context.Context, req *notice.MaxSortReq) (res *notice.MaxSortRes, err error) {
data, err := service.AdminNotice().MaxSort(ctx, adminin.NoticeMaxSortInp{Id: req.Id})
data, err := service.AdminNotice().MaxSort(ctx, &req.NoticeMaxSortInp)
if err != nil {
return
}
@ -59,7 +44,7 @@ func (c *cNotice) MaxSort(ctx context.Context, req *notice.MaxSortReq) (res *not
// View 获取指定信息
func (c *cNotice) View(ctx context.Context, req *notice.ViewReq) (res *notice.ViewRes, err error) {
data, err := service.AdminNotice().View(ctx, adminin.NoticeViewInp{Id: req.Id})
data, err := service.AdminNotice().View(ctx, &req.NoticeViewInp)
if err != nil {
return
}
@ -71,97 +56,53 @@ func (c *cNotice) View(ctx context.Context, req *notice.ViewReq) (res *notice.Vi
// List 查看列表
func (c *cNotice) List(ctx context.Context, req *notice.ListReq) (res *notice.ListRes, err error) {
var in adminin.NoticeListInp
if err = gconv.Scan(req, &in); err != nil {
return nil, err
}
list, totalCount, err := service.AdminNotice().List(ctx, in)
list, totalCount, err := service.AdminNotice().List(ctx, &req.NoticeListInp)
if err != nil {
return nil, err
}
res = new(notice.ListRes)
res.List = list
res.PageCount = form.CalPageCount(totalCount, req.PerPage)
res.Page = req.Page
res.PerPage = req.PerPage
res.PageRes.Pack(req, totalCount)
return
}
// Status 更新部门状态
// Status 更新状态
func (c *cNotice) Status(ctx context.Context, req *notice.StatusReq) (res *notice.StatusRes, err error) {
var in adminin.NoticeStatusInp
if err = gconv.Scan(req, &in); err != nil {
return nil, err
}
err = service.AdminNotice().Status(ctx, in)
err = service.AdminNotice().Status(ctx, &req.NoticeStatusInp)
return
}
// Notify 更新通知
func (c *cNotice) Notify(ctx context.Context, req *notice.EditNotifyReq) (res *notice.EditNotifyRes, err error) {
var in adminin.NoticeEditInp
if err = gconv.Scan(req, &in); err != nil {
return
}
in.Type = consts.NoticeTypeNotify
in.Receiver = req.Receiver
err = service.AdminNotice().Edit(ctx, in)
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) {
var in adminin.NoticeEditInp
if err = gconv.Scan(req, &in); err != nil {
return
}
in.Type = consts.NoticeTypeNotice
in.Receiver = req.Receiver
err = service.AdminNotice().Edit(ctx, in)
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) {
var in adminin.NoticeEditInp
if err = gconv.Scan(req, &in); err != nil {
return
}
in.Type = consts.NoticeTypeLetter
in.Receiver = req.Receiver
err = service.AdminNotice().Edit(ctx, in)
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) {
var in adminin.NoticeUpReadInp
if err = gconv.Scan(req, &in); err != nil {
return
}
err = service.AdminNotice().UpRead(ctx, in)
err = service.AdminNotice().UpRead(ctx, &req.NoticeUpReadInp)
return
}
// PullMessages 拉取未读消息列表
func (c *cNotice) PullMessages(ctx context.Context, req *notice.PullMessagesReq) (res *notice.PullMessagesRes, err error) {
var in adminin.PullMessagesInp
if err = gconv.Scan(req, &in); err != nil {
return
}
if in.Limit == 0 {
in.Limit = 100
}
data, err := service.AdminNotice().PullMessages(ctx, in)
data, err := service.AdminNotice().PullMessages(ctx, &req.PullMessagesInp)
if err != nil {
return
}
@ -173,31 +114,19 @@ func (c *cNotice) PullMessages(ctx context.Context, req *notice.PullMessagesReq)
// ReadAll 全部已读
func (c *cNotice) ReadAll(ctx context.Context, req *notice.ReadAllReq) (res *notice.ReadAllRes, err error) {
var in adminin.NoticeReadAllInp
if err = gconv.Scan(req, &in); err != nil {
return
}
err = service.AdminNotice().ReadAll(ctx, in)
err = service.AdminNotice().ReadAll(ctx, &req.NoticeReadAllInp)
return
}
// MessageList 我的消息列表
func (c *cNotice) MessageList(ctx context.Context, req *notice.MessageListReq) (res *notice.MessageListRes, err error) {
var in adminin.NoticeMessageListInp
if err = gconv.Scan(req, &in); err != nil {
return
}
list, totalCount, err := service.AdminNotice().MessageList(ctx, in)
list, totalCount, err := service.AdminNotice().MessageList(ctx, &req.NoticeMessageListInp)
if err != nil {
return
}
res = new(notice.MessageListRes)
res.List = list
res.PageCount = form.CalPageCount(totalCount, req.PerPage)
res.Page = req.Page
res.PerPage = req.PerPage
res.PageRes.Pack(req, totalCount)
return
}

View File

@ -9,12 +9,7 @@ import (
"context"
"hotgo/api/admin/order"
"hotgo/internal/consts"
"hotgo/internal/model/input/adminin"
"hotgo/internal/model/input/form"
"hotgo/internal/service"
"hotgo/utility/validate"
"github.com/gogf/gf/v2/util/gconv"
)
var (
@ -25,31 +20,13 @@ type cOrder struct{}
// AcceptRefund 受理申请退款
func (c *cOrder) AcceptRefund(ctx context.Context, req *order.AcceptRefundReq) (res *order.AcceptRefundRes, err error) {
var in adminin.OrderAcceptRefundInp
if err = gconv.Scan(req, &in); err != nil {
return
}
if err = validate.PreFilter(ctx, &in); err != nil {
return
}
err = service.AdminOrder().AcceptRefund(ctx, in)
err = service.AdminOrder().AcceptRefund(ctx, &req.OrderAcceptRefundInp)
return
}
// ApplyRefund 申请退款
func (c *cOrder) ApplyRefund(ctx context.Context, req *order.ApplyRefundReq) (res *order.ApplyRefundRes, err error) {
var in adminin.OrderApplyRefundInp
if err = gconv.Scan(req, &in); err != nil {
return
}
if err = validate.PreFilter(ctx, &in); err != nil {
return
}
err = service.AdminOrder().ApplyRefund(ctx, in)
err = service.AdminOrder().ApplyRefund(ctx, &req.OrderApplyRefundInp)
return
}
@ -65,16 +42,7 @@ func (c *cOrder) Option(ctx context.Context, req *order.OptionReq) (res *order.O
// Create 创建充值订单
func (c *cOrder) Create(ctx context.Context, req *order.CreateReq) (res *order.CreateRes, err error) {
var in adminin.OrderCreateInp
if err = gconv.Scan(req, &in); err != nil {
return
}
if err = validate.PreFilter(ctx, &in); err != nil {
return
}
data, err := service.AdminOrder().Create(ctx, in)
data, err := service.AdminOrder().Create(ctx, &req.OrderCreateInp)
if err != nil {
return
}
@ -86,70 +54,32 @@ func (c *cOrder) Create(ctx context.Context, req *order.CreateReq) (res *order.C
// List 查看充值订单列表
func (c *cOrder) List(ctx context.Context, req *order.ListReq) (res *order.ListRes, err error) {
var in adminin.OrderListInp
if err = gconv.Scan(req, &in); err != nil {
return
}
if err = validate.PreFilter(ctx, &in); err != nil {
return
}
list, totalCount, err := service.AdminOrder().List(ctx, in)
list, totalCount, err := service.AdminOrder().List(ctx, &req.OrderListInp)
if err != nil {
return
}
res = new(order.ListRes)
res.List = list
res.PageCount = form.CalPageCount(totalCount, req.PerPage)
res.Page = req.Page
res.PerPage = req.PerPage
res.PageRes.Pack(req, totalCount)
return
}
// Export 导出充值订单列表
func (c *cOrder) Export(ctx context.Context, req *order.ExportReq) (res *order.ExportRes, err error) {
var in adminin.OrderListInp
if err = gconv.Scan(req, &in); err != nil {
return
}
if err = validate.PreFilter(ctx, &in); err != nil {
return
}
err = service.AdminOrder().Export(ctx, in)
err = service.AdminOrder().Export(ctx, &req.OrderListInp)
return
}
// Edit 更新充值订单
func (c *cOrder) Edit(ctx context.Context, req *order.EditReq) (res *order.EditRes, err error) {
var in adminin.OrderEditInp
if err = gconv.Scan(req, &in); err != nil {
return
}
if err = validate.PreFilter(ctx, &in); err != nil {
return
}
err = service.AdminOrder().Edit(ctx, in)
err = service.AdminOrder().Edit(ctx, &req.OrderEditInp)
return
}
// View 获取指定充值订单信息
func (c *cOrder) View(ctx context.Context, req *order.ViewReq) (res *order.ViewRes, err error) {
var in adminin.OrderViewInp
if err = gconv.Scan(req, &in); err != nil {
return
}
if err = validate.PreFilter(ctx, &in); err != nil {
return
}
data, err := service.AdminOrder().View(ctx, in)
data, err := service.AdminOrder().View(ctx, &req.OrderViewInp)
if err != nil {
return
}
@ -161,30 +91,12 @@ func (c *cOrder) View(ctx context.Context, req *order.ViewReq) (res *order.ViewR
// Delete 删除充值订单
func (c *cOrder) Delete(ctx context.Context, req *order.DeleteReq) (res *order.DeleteRes, err error) {
var in adminin.OrderDeleteInp
if err = gconv.Scan(req, &in); err != nil {
return
}
if err = validate.PreFilter(ctx, &in); err != nil {
return
}
err = service.AdminOrder().Delete(ctx, in)
err = service.AdminOrder().Delete(ctx, &req.OrderDeleteInp)
return
}
// Status 更新充值订单状态
func (c *cOrder) Status(ctx context.Context, req *order.StatusReq) (res *order.StatusRes, err error) {
var in adminin.OrderStatusInp
if err = gconv.Scan(req, &in); err != nil {
return
}
if err = validate.PreFilter(ctx, &in); err != nil {
return
}
err = service.AdminOrder().Status(ctx, in)
err = service.AdminOrder().Status(ctx, &req.OrderStatusInp)
return
}

View File

@ -7,10 +7,7 @@ package admin
import (
"context"
"github.com/gogf/gf/v2/util/gconv"
"hotgo/api/admin/post"
"hotgo/internal/model/input/adminin"
"hotgo/internal/model/input/form"
"hotgo/internal/service"
)
@ -21,29 +18,19 @@ type cPost struct{}
// Delete 删除
func (c *cPost) Delete(ctx context.Context, req *post.DeleteReq) (res *post.DeleteRes, err error) {
var in adminin.PostDeleteInp
if err = gconv.Scan(req, &in); err != nil {
return
}
err = service.AdminPost().Delete(ctx, in)
err = service.AdminPost().Delete(ctx, &req.PostDeleteInp)
return
}
// Edit 修改/新增
func (c *cPost) Edit(ctx context.Context, req *post.EditReq) (res *post.EditRes, err error) {
var in adminin.PostEditInp
if err = gconv.Scan(req, &in); err != nil {
return
}
err = service.AdminPost().Edit(ctx, in)
err = service.AdminPost().Edit(ctx, &req.PostEditInp)
return
}
// MaxSort 最大排序
func (c *cPost) MaxSort(ctx context.Context, req *post.MaxSortReq) (res *post.MaxSortRes, err error) {
data, err := service.AdminPost().MaxSort(ctx, adminin.PostMaxSortInp{Id: req.Id})
data, err := service.AdminPost().MaxSort(ctx, &req.PostMaxSortInp)
if err != nil {
return
}
@ -53,33 +40,9 @@ func (c *cPost) MaxSort(ctx context.Context, req *post.MaxSortReq) (res *post.Ma
return
}
// NameUnique 名称是否唯一
func (c *cPost) NameUnique(ctx context.Context, req *post.NameUniqueReq) (res *post.NameUniqueRes, err error) {
data, err := service.AdminPost().NameUnique(ctx, adminin.PostNameUniqueInp{Id: req.Id, Name: req.Name})
if err != nil {
return
}
res = new(post.NameUniqueRes)
res.IsUnique = data.IsUnique
return
}
// CodeUnique 编码是否唯一
func (c *cPost) CodeUnique(ctx context.Context, req *post.CodeUniqueReq) (res *post.CodeUniqueRes, err error) {
data, err := service.AdminPost().CodeUnique(ctx, adminin.PostCodeUniqueInp{Id: req.Id, Code: req.Code})
if err != nil {
return nil, err
}
res = new(post.CodeUniqueRes)
res.IsUnique = data.IsUnique
return
}
// View 获取指定信息
func (c *cPost) View(ctx context.Context, req *post.ViewReq) (res *post.ViewRes, err error) {
data, err := service.AdminPost().View(ctx, adminin.PostViewInp{Id: req.Id})
data, err := service.AdminPost().View(ctx, &req.PostViewInp)
if err != nil {
return
}
@ -91,31 +54,19 @@ func (c *cPost) View(ctx context.Context, req *post.ViewReq) (res *post.ViewRes,
// List 获取列表
func (c *cPost) List(ctx context.Context, req *post.ListReq) (res *post.ListRes, err error) {
var in adminin.PostListInp
if err = gconv.Scan(req, &in); err != nil {
return
}
list, totalCount, err := service.AdminPost().List(ctx, in)
list, totalCount, err := service.AdminPost().List(ctx, &req.PostListInp)
if err != nil {
return
}
res = new(post.ListRes)
res.List = list
res.PageCount = form.CalPageCount(totalCount, req.PerPage)
res.Page = req.Page
res.PerPage = req.PerPage
res.PageRes.Pack(req, totalCount)
return
}
// Status 更新状态
func (c *cPost) Status(ctx context.Context, req *post.StatusReq) (res *post.StatusRes, err error) {
var in adminin.PostStatusInp
if err = gconv.Scan(req, &in); err != nil {
return
}
err = service.AdminPost().Status(ctx, in)
err = service.AdminPost().Status(ctx, &req.PostStatusInp)
return
}

View File

@ -7,13 +7,9 @@ package admin
import (
"context"
"github.com/gogf/gf/v2/util/gconv"
"hotgo/api/admin/role"
"hotgo/internal/library/contexts"
"hotgo/internal/model/input/adminin"
"hotgo/internal/model/input/form"
"hotgo/internal/service"
"hotgo/utility/validate"
)
var (
@ -24,51 +20,26 @@ type cRole struct{}
// List 获取列表
func (c *cRole) List(ctx context.Context, req *role.ListReq) (res *role.ListRes, err error) {
var in adminin.RoleListInp
if err = gconv.Scan(req, &in); err != nil {
return
}
list, totalCount, err := service.AdminRole().List(ctx, in)
list, totalCount, err := service.AdminRole().List(ctx, &req.RoleListInp)
if err != nil {
return
}
res = new(role.ListRes)
res.RoleListModel = list
res.PageCount = form.CalPageCount(totalCount, req.PerPage)
res.Page = req.Page
res.PerPage = req.PerPage
res.PageRes.Pack(req, totalCount)
return
}
// Edit 修改角色
func (c *cRole) Edit(ctx context.Context, req *role.EditReq) (res *role.EditRes, err error) {
var in adminin.RoleEditInp
if err = gconv.Scan(req, &in); err != nil {
return
}
if err = validate.PreFilter(ctx, &in); err != nil {
return
}
err = service.AdminRole().Edit(ctx, in)
err = service.AdminRole().Edit(ctx, &req.RoleEditInp)
return
}
// Delete 删除
func (c *cRole) Delete(ctx context.Context, req *role.DeleteReq) (res *role.DeleteRes, err error) {
var in adminin.RoleDeleteInp
if err = gconv.Scan(req, &in); err != nil {
return
}
if err = validate.PreFilter(ctx, &in); err != nil {
return
}
err = service.AdminRole().Delete(ctx, in)
err = service.AdminRole().Delete(ctx, &req.RoleDeleteInp)
return
}
@ -79,16 +50,7 @@ func (c *cRole) Dynamic(ctx context.Context, _ *role.DynamicReq) (res *role.Dyna
// GetPermissions 获取指定角色权限
func (c *cRole) GetPermissions(ctx context.Context, req *role.GetPermissionsReq) (res *role.GetPermissionsRes, err error) {
var in adminin.GetPermissionsInp
if err = gconv.Scan(req, &in); err != nil {
return
}
if err = validate.PreFilter(ctx, &in); err != nil {
return
}
data, err := service.AdminRole().GetPermissions(ctx, in)
data, err := service.AdminRole().GetPermissions(ctx, &req.GetPermissionsInp)
if err != nil {
return
}
@ -100,16 +62,7 @@ func (c *cRole) GetPermissions(ctx context.Context, req *role.GetPermissionsReq)
// UpdatePermissions 修改角色菜单权限
func (c *cRole) UpdatePermissions(ctx context.Context, req *role.UpdatePermissionsReq) (res *role.UpdatePermissionsRes, err error) {
var in adminin.UpdatePermissionsInp
if err = gconv.Scan(req, &in); err != nil {
return
}
if err = validate.PreFilter(ctx, &in); err != nil {
return
}
err = service.AdminRole().UpdatePermissions(ctx, in)
err = service.AdminRole().UpdatePermissions(ctx, &req.UpdatePermissionsInp)
return
}
@ -122,16 +75,6 @@ func (c *cRole) DataScopeSelect(_ context.Context, _ *role.DataScopeSelectReq) (
// DataScopeEdit 获取数据权限选项
func (c *cRole) DataScopeEdit(ctx context.Context, req *role.DataScopeEditReq) (res *role.DataScopeEditRes, err error) {
var in adminin.DataScopeEditInp
if err = gconv.Scan(req, &in); err != nil {
return
}
in.CustomDept = req.CustomDept
if err = validate.PreFilter(ctx, &in); err != nil {
return
}
err = service.AdminRole().DataScopeEdit(ctx, &in)
err = service.AdminRole().DataScopeEdit(ctx, &req.DataScopeEditInp)
return
}

View File

@ -23,7 +23,7 @@ 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{
err = service.SysEmsLog().Send(ctx, &sysin.SendEmsInp{
Event: consts.EmsTemplateText,
Email: req.To,
Content: `
@ -47,16 +47,13 @@ func (c *cSms) SendBindEms(ctx context.Context, _ *common.SendBindEmsReq) (res *
memberId = contexts.GetUserId(ctx)
models *entity.AdminMember
)
if memberId <= 0 {
err = gerror.New("用户身份异常,请重新登录!")
return
}
err = g.Model("admin_member").
Fields("email").
Where("id", memberId).
Scan(&models)
if err != nil {
if err = g.Model("admin_member").Fields("email").Where("id", memberId).Scan(&models); err != nil {
return
}
@ -70,7 +67,7 @@ func (c *cSms) SendBindEms(ctx context.Context, _ *common.SendBindEmsReq) (res *
return
}
err = service.SysEmsLog().Send(ctx, sysin.SendEmsInp{
err = service.SysEmsLog().Send(ctx, &sysin.SendEmsInp{
Event: consts.EmsTemplateBind,
Email: models.Email,
})

View File

@ -15,7 +15,6 @@ import (
"hotgo/internal/consts"
"hotgo/internal/library/captcha"
"hotgo/internal/library/token"
"hotgo/internal/model/input/adminin"
"hotgo/internal/service"
"hotgo/utility/validate"
)
@ -51,7 +50,6 @@ func (c *cSite) getWsAddr(ctx context.Context, request *ghttp.Request) string {
if err != nil || basic == nil {
return ""
}
return basic.WsAddr
}
@ -66,7 +64,6 @@ func (c *cSite) getDomain(ctx context.Context, request *ghttp.Request) string {
if err != nil || basic == nil {
return ""
}
return basic.Domain
}
@ -91,26 +88,12 @@ func (c *cSite) Captcha(ctx context.Context, _ *common.LoginCaptchaReq) (res *co
// Register 账号注册
func (c *cSite) Register(ctx context.Context, req *common.RegisterReq) (res *common.RegisterRes, err error) {
var in adminin.RegisterInp
if err = gconv.Scan(req, &in); err != nil {
return
}
if err = validate.PreFilter(ctx, &in); err != nil {
return
}
err = service.AdminSite().Register(ctx, in)
err = service.AdminSite().Register(ctx, &req.RegisterInp)
return
}
// AccountLogin 账号登录
func (c *cSite) AccountLogin(ctx context.Context, req *common.AccountLoginReq) (res *common.AccountLoginRes, err error) {
var in adminin.AccountLoginInp
if err = gconv.Scan(req, &in); err != nil {
return
}
login, err := service.SysConfig().GetLogin(ctx)
if err != nil {
return
@ -124,7 +107,7 @@ func (c *cSite) AccountLogin(ctx context.Context, req *common.AccountLoginReq) (
}
}
model, err := service.AdminSite().AccountLogin(ctx, in)
model, err := service.AdminSite().AccountLogin(ctx, &req.AccountLoginInp)
if err != nil {
return
}
@ -135,12 +118,7 @@ func (c *cSite) AccountLogin(ctx context.Context, req *common.AccountLoginReq) (
// MobileLogin 手机号登录
func (c *cSite) MobileLogin(ctx context.Context, req *common.MobileLoginReq) (res *common.MobileLoginRes, err error) {
var in adminin.MobileLoginInp
if err = gconv.Scan(req, &in); err != nil {
return
}
model, err := service.AdminSite().MobileLogin(ctx, in)
model, err := service.AdminSite().MobileLogin(ctx, &req.MobileLoginInp)
if err != nil {
return
}

View File

@ -9,14 +9,12 @@ import (
"context"
"github.com/gogf/gf/v2/errors/gerror"
"github.com/gogf/gf/v2/frame/g"
"github.com/gogf/gf/v2/util/gconv"
"hotgo/api/admin/common"
"hotgo/internal/consts"
"hotgo/internal/library/contexts"
"hotgo/internal/model/entity"
"hotgo/internal/model/input/sysin"
"hotgo/internal/service"
"hotgo/utility/validate"
)
var Sms = new(cSms)
@ -25,16 +23,7 @@ type cSms struct{}
// SendTest 发送测试短信
func (c *cSms) SendTest(ctx context.Context, req *common.SendTestSmsReq) (res *common.SendTestSmsRes, err error) {
var in sysin.SendCodeInp
if err = gconv.Scan(req, &in); err != nil {
return
}
if err = validate.PreFilter(ctx, &in); err != nil {
return
}
err = service.SysSmsLog().SendCode(ctx, in)
err = service.SysSmsLog().SendCode(ctx, &req.SendCodeInp)
return
}
@ -50,11 +39,7 @@ func (c *cSms) SendBindSms(ctx context.Context, _ *common.SendBindSmsReq) (res *
return
}
err = g.Model("admin_member").
Fields("mobile").
Where("id", memberId).
Scan(&models)
if err != nil {
if err = g.Model("admin_member").Fields("mobile").Where("id", memberId).Scan(&models); err != nil {
return
}
@ -68,7 +53,7 @@ func (c *cSms) SendBindSms(ctx context.Context, _ *common.SendBindSmsReq) (res *
return
}
err = service.SysSmsLog().SendCode(ctx, sysin.SendCodeInp{
err = service.SysSmsLog().SendCode(ctx, &sysin.SendCodeInp{
Event: consts.SmsTemplateBind,
Mobile: models.Mobile,
})
@ -77,15 +62,6 @@ func (c *cSms) SendBindSms(ctx context.Context, _ *common.SendBindSmsReq) (res *
// SendSms 发送短信
func (c *cSms) SendSms(ctx context.Context, req *common.SendSmsReq) (res *common.SendSmsRes, err error) {
var in sysin.SendCodeInp
if err = gconv.Scan(req, &in); err != nil {
return
}
if err = validate.PreFilter(ctx, &in); err != nil {
return
}
err = service.SysSmsLog().SendCode(ctx, in)
err = service.SysSmsLog().SendCode(ctx, &req.SendCodeInp)
return
}

View File

@ -10,29 +10,28 @@ import (
"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{}
// UploadImage 上传图片
func (c *cUpload) UploadImage(ctx context.Context, _ *common.UploadImageReq) (res common.UploadImageRes, err error) {
file := g.RequestFromCtx(ctx).GetUploadFile("file")
if file == nil {
err = gerror.New("没有找到上传的文件")
return
}
return service.CommonUpload().UploadImage(ctx, file)
}
// UploadFile 上传附件
// UploadFile 上传文件
func (c *cUpload) UploadFile(ctx context.Context, _ *common.UploadFileReq) (res common.UploadFileRes, err error) {
file := g.RequestFromCtx(ctx).GetUploadFile("file")
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, file)
return service.CommonUpload().UploadFile(ctx, uploadType, file)
}

View File

@ -7,11 +7,8 @@ package common
import (
"context"
"github.com/gogf/gf/v2/util/gconv"
"hotgo/api/admin/common"
"hotgo/internal/model/input/commonin"
"hotgo/internal/service"
"hotgo/utility/validate"
)
var (
@ -21,29 +18,11 @@ var (
type cWechat struct{}
func (c *cWechat) Authorize(ctx context.Context, req *common.WechatAuthorizeReq) (res *common.WechatAuthorizeRes, err error) {
var in commonin.WechatAuthorizeInp
if err = gconv.Scan(req, &in); err != nil {
return
}
if err = validate.PreFilter(ctx, &in); err != nil {
return
}
_, err = service.CommonWechat().Authorize(ctx, in)
_, err = service.CommonWechat().Authorize(ctx, &req.WechatAuthorizeInp)
return
}
func (c *cWechat) AuthorizeCall(ctx context.Context, req *common.WechatAuthorizeCallReq) (res *common.WechatAuthorizeCallRes, err error) {
var in commonin.WechatAuthorizeCallInp
if err = gconv.Scan(req, &in); err != nil {
return
}
if err = validate.PreFilter(ctx, &in); err != nil {
return
}
_, err = service.CommonWechat().AuthorizeCall(ctx, in)
_, err = service.CommonWechat().AuthorizeCall(ctx, &req.WechatAuthorizeCallInp)
return
}

View File

@ -10,12 +10,7 @@ package pay
import (
"context"
"hotgo/api/admin/pay"
"hotgo/internal/model/input/form"
"hotgo/internal/model/input/payin"
"hotgo/internal/service"
"hotgo/utility/validate"
"github.com/gogf/gf/v2/util/gconv"
)
var (
@ -26,39 +21,19 @@ type cRefund struct{}
// List 查看交易退款列表
func (c *cRefund) List(ctx context.Context, req *pay.RefundListReq) (res *pay.RefundListRes, err error) {
var in payin.PayRefundListInp
if err = gconv.Scan(req, &in); err != nil {
return
}
if err = validate.PreFilter(ctx, &in); err != nil {
return
}
list, totalCount, err := service.PayRefund().List(ctx, in)
list, totalCount, err := service.PayRefund().List(ctx, &req.PayRefundListInp)
if err != nil {
return
}
res = new(pay.RefundListRes)
res.List = list
res.PageCount = form.CalPageCount(totalCount, req.PerPage)
res.Page = req.Page
res.PerPage = req.PerPage
res.PageRes.Pack(req, totalCount)
return
}
// Export 导出交易退款列表
func (c *cRefund) Export(ctx context.Context, req *pay.RefundExportReq) (res *pay.RefundExportRes, err error) {
var in payin.PayRefundListInp
if err = gconv.Scan(req, &in); err != nil {
return
}
if err = validate.PreFilter(ctx, &in); err != nil {
return
}
err = service.PayRefund().Export(ctx, in)
err = service.PayRefund().Export(ctx, &req.PayRefundListInp)
return
}

View File

@ -7,12 +7,8 @@ package sys
import (
"context"
"github.com/gogf/gf/v2/util/gconv"
"hotgo/api/admin/addons"
"hotgo/internal/model/input/form"
"hotgo/internal/model/input/sysin"
"hotgo/internal/service"
"hotgo/utility/validate"
)
var (
@ -23,27 +19,20 @@ type cAddons struct{}
// List 查看列表
func (c *cAddons) List(ctx context.Context, req *addons.ListReq) (res *addons.ListRes, err error) {
var in sysin.AddonsListInp
if err = gconv.Scan(req, &in); err != nil {
return
}
list, totalCount, err := service.SysAddons().List(ctx, in)
list, totalCount, err := service.SysAddons().List(ctx, &req.AddonsListInp)
if err != nil {
return
}
res = new(addons.ListRes)
res.List = list
res.PageCount = form.CalPageCount(totalCount, req.PerPage)
res.Page = req.Page
res.PerPage = req.PerPage
res.PageRes.Pack(req, totalCount)
return
}
// Selects 获取指定信息
func (c *cAddons) Selects(ctx context.Context, req *addons.SelectsReq) (res *addons.SelectsRes, err error) {
data, err := service.SysAddons().Selects(ctx, sysin.AddonsSelectsInp{})
data, err := service.SysAddons().Selects(ctx, &req.AddonsSelectsInp)
if err != nil {
return
}
@ -55,27 +44,13 @@ func (c *cAddons) Selects(ctx context.Context, req *addons.SelectsReq) (res *add
// Build 生成预览
func (c *cAddons) Build(ctx context.Context, req *addons.BuildReq) (res *addons.BuildRes, err error) {
var in sysin.AddonsBuildInp
if err = gconv.Scan(req, &in); err != nil {
return
}
if err = validate.PreFilter(ctx, &in); err != nil {
return
}
err = service.SysAddons().Build(ctx, in)
err = service.SysAddons().Build(ctx, &req.AddonsBuildInp)
return
}
// Install 安装模块
func (c *cAddons) Install(ctx context.Context, req *addons.InstallReq) (res *addons.InstallRes, err error) {
var in sysin.AddonsInstallInp
if err = gconv.Scan(req, &in); err != nil {
return
}
if err = service.SysAddons().Install(ctx, in); err != nil {
if err = service.SysAddons().Install(ctx, &req.AddonsInstallInp); err != nil {
return
}
return
@ -83,12 +58,7 @@ func (c *cAddons) Install(ctx context.Context, req *addons.InstallReq) (res *add
// Upgrade 更新模块
func (c *cAddons) Upgrade(ctx context.Context, req *addons.UpgradeReq) (res *addons.UpgradeRes, err error) {
var in sysin.AddonsUpgradeInp
if err = gconv.Scan(req, &in); err != nil {
return
}
if err = service.SysAddons().Upgrade(ctx, in); err != nil {
if err = service.SysAddons().Upgrade(ctx, &req.AddonsUpgradeInp); err != nil {
return
}
return
@ -96,12 +66,7 @@ func (c *cAddons) Upgrade(ctx context.Context, req *addons.UpgradeReq) (res *add
// UnInstall 卸载模块
func (c *cAddons) UnInstall(ctx context.Context, req *addons.UnInstallReq) (res *addons.UnInstallRes, err error) {
var in sysin.AddonsUnInstallInp
if err = gconv.Scan(req, &in); err != nil {
return
}
if err = service.SysAddons().UnInstall(ctx, in); err != nil {
if err = service.SysAddons().UnInstall(ctx, &req.AddonsUnInstallInp); err != nil {
return
}
return

View File

@ -7,9 +7,8 @@ package sys
import (
"context"
"github.com/gogf/gf/v2/util/gconv"
"hotgo/api/admin/attachment"
"hotgo/internal/model/input/form"
"hotgo/internal/library/storager"
"hotgo/internal/model/input/sysin"
"hotgo/internal/service"
)
@ -22,18 +21,13 @@ type cAttachment struct{}
// Delete 删除附件
func (c *cAttachment) Delete(ctx context.Context, req *attachment.DeleteReq) (res *attachment.DeleteRes, err error) {
var in sysin.AttachmentDeleteInp
if err = gconv.Scan(req, &in); err != nil {
return
}
err = service.SysAttachment().Delete(ctx, in)
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, sysin.AttachmentViewInp{Id: req.Id})
data, err := service.SysAttachment().View(ctx, &req.AttachmentViewInp)
if err != nil {
return
}
@ -45,20 +39,55 @@ func (c *cAttachment) View(ctx context.Context, req *attachment.ViewReq) (res *a
// List 查看附件列表
func (c *cAttachment) List(ctx context.Context, req *attachment.ListReq) (res *attachment.ListRes, err error) {
var in sysin.AttachmentListInp
if err = gconv.Scan(req, &in); err != nil {
return
}
list, totalCount, err := service.SysAttachment().List(ctx, in)
list, totalCount, err := service.SysAttachment().List(ctx, &req.AttachmentListInp)
if err != nil {
return
}
res = new(attachment.ListRes)
res.List = list
res.PageCount = form.CalPageCount(totalCount, req.PerPage)
res.Page = req.Page
res.PerPage = req.PerPage
res.PageRes.Pack(req, totalCount)
return
}
// ChooserOption 获取选择器选项
func (c *cAttachment) ChooserOption(ctx context.Context, req *attachment.ChooserOptionReq) (res *attachment.ChooserOptionRes, err error) {
res = new(attachment.ChooserOptionRes)
res.Drive, err = service.SysDictData().Select(ctx, &sysin.DataSelectInp{Type: "config_upload_drive"})
if err != nil {
return
}
var kinds = []attachment.KindSelect{
{
Label: "全部", Key: "", Value: "",
},
{
Label: "图片", Key: storager.KindImg, Value: storager.KindImg, Icon: "PictureOutlined", Tag: "success",
},
{
Label: "文档", Key: storager.KindDoc, Value: storager.KindDoc, Icon: "FileWordOutlined", Tag: "primary",
},
{
Label: "音频", Key: storager.KindAudio, Value: storager.KindAudio, Icon: "CustomerServiceOutlined", Tag: "info",
},
{
Label: "视频", Key: storager.KindVideo, Value: storager.KindVideo, Icon: "PlaySquareOutlined", Tag: "warning",
},
{
Label: "压缩包", Key: storager.KindZip, Value: storager.KindZip, Icon: "FileZipOutlined", Tag: "error",
},
{
Label: "其他", Key: storager.KindOther, Value: storager.KindOther, Icon: "PlusOutlined", Tag: "default",
},
}
res.Kind = append(res.Kind, kinds...)
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
}

View File

@ -3,15 +3,11 @@
// @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/util/gconv"
"hotgo/api/admin/blacklist"
"hotgo/internal/model/input/form"
"hotgo/internal/model/input/sysin"
"hotgo/internal/service"
)
@ -23,41 +19,19 @@ type cBlacklist struct{}
// Delete 删除
func (c *cBlacklist) Delete(ctx context.Context, req *blacklist.DeleteReq) (res *blacklist.DeleteRes, err error) {
var in sysin.BlacklistDeleteInp
if err = gconv.Scan(req, &in); err != nil {
return
}
err = service.SysBlacklist().Delete(ctx, in)
err = service.SysBlacklist().Delete(ctx, &req.BlacklistDeleteInp)
return
}
// Edit 更新
func (c *cBlacklist) Edit(ctx context.Context, req *blacklist.EditReq) (res *blacklist.EditRes, err error) {
var in sysin.BlacklistEditInp
if err = gconv.Scan(req, &in); err != nil {
return
}
err = service.SysBlacklist().Edit(ctx, in)
return
}
// MaxSort 最大排序
func (c *cBlacklist) MaxSort(ctx context.Context, req *blacklist.MaxSortReq) (res *blacklist.MaxSortRes, err error) {
data, err := service.SysBlacklist().MaxSort(ctx, sysin.BlacklistMaxSortInp{Id: req.Id})
if err != nil {
return
}
res = new(blacklist.MaxSortRes)
res.Sort = data.Sort
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, sysin.BlacklistViewInp{Id: req.Id})
data, err := service.SysBlacklist().View(ctx, &req.BlacklistViewInp)
if err != nil {
return
}
@ -69,31 +43,19 @@ func (c *cBlacklist) View(ctx context.Context, req *blacklist.ViewReq) (res *bla
// List 查看列表
func (c *cBlacklist) List(ctx context.Context, req *blacklist.ListReq) (res *blacklist.ListRes, err error) {
var in sysin.BlacklistListInp
if err = gconv.Scan(req, &in); err != nil {
return
}
list, totalCount, err := service.SysBlacklist().List(ctx, in)
list, totalCount, err := service.SysBlacklist().List(ctx, &req.BlacklistListInp)
if err != nil {
return
}
res = new(blacklist.ListRes)
res.List = list
res.PageCount = form.CalPageCount(totalCount, req.PerPage)
res.Page = req.Page
res.PerPage = req.PerPage
res.PageRes.Pack(req, totalCount)
return
}
// Status 更新部门状态
// Status 更新黑名单状态
func (c *cBlacklist) Status(ctx context.Context, req *blacklist.StatusReq) (res *blacklist.StatusRes, err error) {
var in sysin.BlacklistStatusInp
if err = gconv.Scan(req, &in); err != nil {
return
}
err = service.SysBlacklist().Status(ctx, in)
err = service.SysBlacklist().Status(ctx, &req.BlacklistStatusInp)
return
}

View File

@ -7,7 +7,6 @@ package sys
import (
"context"
"github.com/gogf/gf/v2/util/gconv"
"hotgo/api/admin/config"
"hotgo/internal/consts"
"hotgo/internal/model/input/form"
@ -23,24 +22,14 @@ type cConfig struct{}
// GetConfig 获取指定分组的配置
func (c *cConfig) GetConfig(ctx context.Context, req *config.GetReq) (res *config.GetRes, err error) {
var in sysin.GetConfigInp
if err = gconv.Scan(req, &in); err != nil {
return
}
res = new(config.GetRes)
res.GetConfigModel, err = service.SysConfig().GetConfigByGroup(ctx, in)
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) {
var in sysin.UpdateConfigInp
if err = gconv.Scan(req, &in); err != nil {
return
}
err = service.SysConfig().UpdateConfigByGroup(ctx, in)
err = service.SysConfig().UpdateConfigByGroup(ctx, &req.UpdateConfigInp)
return
}
@ -56,9 +45,9 @@ func (c *cConfig) TypeSelect(_ context.Context, _ *config.TypeSelectReq) (res co
return
}
// GetCash 获取指定分组的配置
// 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"})
res.GetConfigModel, err = service.SysConfig().GetConfigByGroup(ctx, &sysin.GetConfigInp{Group: "cash"})
return
}

View File

@ -8,11 +8,8 @@ package sys
import (
"context"
"github.com/gogf/gf/v2/errors/gerror"
"github.com/gogf/gf/v2/util/gconv"
"hotgo/api/admin/cron"
"hotgo/internal/model/input/form"
"hotgo/internal/model/input/msgin"
"hotgo/internal/model/input/sysin"
"hotgo/api/servmsg"
"hotgo/internal/service"
)
@ -24,29 +21,19 @@ type cCron struct{}
// Delete 删除
func (c *cCron) Delete(ctx context.Context, req *cron.DeleteReq) (res *cron.DeleteRes, err error) {
var in = new(msgin.CronDelete)
if err = gconv.Scan(req, &in.CronDeleteInp); err != nil {
return
}
err = service.TCPServer().CronDelete(ctx, in)
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) {
var in = new(msgin.CronEdit)
if err = gconv.Scan(req, &in.CronEditInp); err != nil {
return
}
err = service.TCPServer().CronEdit(ctx, in)
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) {
data, err := service.SysCron().MaxSort(ctx, sysin.CronMaxSortInp{Id: req.Id})
data, err := service.SysCron().MaxSort(ctx, &req.CronMaxSortInp)
if err != nil {
return
}
@ -58,7 +45,7 @@ func (c *cCron) MaxSort(ctx context.Context, req *cron.MaxSortReq) (res *cron.Ma
// View 获取指定信息
func (c *cCron) View(ctx context.Context, req *cron.ViewReq) (res *cron.ViewRes, err error) {
data, err := service.SysCron().View(ctx, sysin.CronViewInp{Id: req.Id})
data, err := service.SysCron().View(ctx, &req.CronViewInp)
if err != nil {
return
}
@ -70,32 +57,20 @@ func (c *cCron) View(ctx context.Context, req *cron.ViewReq) (res *cron.ViewRes,
// List 查看列表
func (c *cCron) List(ctx context.Context, req *cron.ListReq) (res *cron.ListRes, err error) {
var in sysin.CronListInp
if err = gconv.Scan(req, &in); err != nil {
return
}
list, totalCount, err := service.SysCron().List(ctx, in)
list, totalCount, err := service.SysCron().List(ctx, &req.CronListInp)
if err != nil {
return
}
res = new(cron.ListRes)
res.List = list
res.PageCount = form.CalPageCount(totalCount, req.PerPage)
res.Page = req.Page
res.PerPage = req.PerPage
res.PageRes.Pack(req, totalCount)
return
}
// Status 更新部门状态
func (c *cCron) Status(ctx context.Context, req *cron.StatusReq) (res *cron.StatusRes, err error) {
var in sysin.CronStatusInp
if err = gconv.Scan(req, &in); err != nil {
return
}
err = service.SysCron().Status(ctx, in)
err = service.SysCron().Status(ctx, &req.CronStatusInp)
return
}
@ -105,11 +80,6 @@ func (c *cCron) OnlineExec(ctx context.Context, req *cron.OnlineExecReq) (res *c
return nil, gerror.New("定时任务ID不能为空")
}
var in = new(msgin.CronOnlineExec)
if err = gconv.Scan(req, &in.OnlineExecInp); err != nil {
return
}
err = service.TCPServer().CronOnlineExec(ctx, in)
err = service.TCPServer().CronOnlineExec(ctx, &servmsg.CronOnlineExecReq{OnlineExecInp: &req.OnlineExecInp})
return
}

View File

@ -7,12 +7,8 @@ package sys
import (
"context"
"github.com/gogf/gf/v2/util/gconv"
"hotgo/api/admin/cron"
"hotgo/internal/model/input/form"
"hotgo/internal/model/input/sysin"
"hotgo/internal/service"
"hotgo/utility/validate"
)
var (
@ -23,33 +19,19 @@ type cCronGroup struct{}
// Delete 删除
func (c *cCronGroup) Delete(ctx context.Context, req *cron.GroupDeleteReq) (res *cron.GroupDeleteRes, err error) {
var in sysin.CronGroupDeleteInp
if err = gconv.Scan(req, &in); err != nil {
return
}
err = service.SysCronGroup().Delete(ctx, in)
err = service.SysCronGroup().Delete(ctx, &req.CronGroupDeleteInp)
return
}
// Edit 更新
func (c *cCronGroup) Edit(ctx context.Context, req *cron.GroupEditReq) (res *cron.GroupEditRes, err error) {
var in sysin.CronGroupEditInp
if err = gconv.Scan(req, &in); err != nil {
return
}
if err = validate.PreFilter(ctx, &in); err != nil {
return
}
err = service.SysCronGroup().Edit(ctx, in)
err = service.SysCronGroup().Edit(ctx, &req.CronGroupEditInp)
return
}
// MaxSort 最大排序
func (c *cCronGroup) MaxSort(ctx context.Context, req *cron.GroupMaxSortReq) (res *cron.GroupMaxSortRes, err error) {
data, err := service.SysCronGroup().MaxSort(ctx, sysin.CronGroupMaxSortInp{Id: req.Id})
data, err := service.SysCronGroup().MaxSort(ctx, &req.CronGroupMaxSortInp)
if err != nil {
return
}
@ -61,7 +43,7 @@ func (c *cCronGroup) MaxSort(ctx context.Context, req *cron.GroupMaxSortReq) (re
// View 获取指定信息
func (c *cCronGroup) View(ctx context.Context, req *cron.GroupViewReq) (res *cron.GroupViewRes, err error) {
data, err := service.SysCronGroup().View(ctx, sysin.CronGroupViewInp{Id: req.Id})
data, err := service.SysCronGroup().View(ctx, &req.CronGroupViewInp)
if err != nil {
return
}
@ -73,42 +55,26 @@ func (c *cCronGroup) View(ctx context.Context, req *cron.GroupViewReq) (res *cro
// List 查看列表
func (c *cCronGroup) List(ctx context.Context, req *cron.GroupListReq) (res *cron.GroupListRes, err error) {
var in sysin.CronGroupListInp
if err = gconv.Scan(req, &in); err != nil {
return
}
list, totalCount, err := service.SysCronGroup().List(ctx, in)
list, totalCount, err := service.SysCronGroup().List(ctx, &req.CronGroupListInp)
if err != nil {
return
}
res = new(cron.GroupListRes)
res.List = list
res.PageCount = form.CalPageCount(totalCount, req.PerPage)
res.Page = req.Page
res.PerPage = req.PerPage
res.PageRes.Pack(req, totalCount)
return
}
// Status 更新状态
func (c *cCronGroup) Status(ctx context.Context, req *cron.GroupStatusReq) (res *cron.GroupStatusRes, err error) {
var in sysin.CronGroupStatusInp
if err = gconv.Scan(req, &in); err != nil {
return
}
if err = validate.PreFilter(ctx, &in); err != nil {
return
}
err = service.SysCronGroup().Status(ctx, in)
err = service.SysCronGroup().Status(ctx, &req.CronGroupStatusInp)
return
}
// Select 选项
func (c *cCronGroup) Select(ctx context.Context, _ *cron.GroupSelectReq) (res *cron.GroupSelectRes, err error) {
data, err := service.SysCronGroup().Select(ctx, sysin.CronGroupSelectInp{})
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
}

View File

@ -3,18 +3,13 @@
// @Copyright Copyright (c) 2023 HotGo CLI
// @Author Ms <133814250@qq.com>
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
// @AutoGenerate Version 2.7.3
// @AutoGenerate Version 2.7.6
package sys
import (
"context"
"hotgo/api/admin/curddemo"
"hotgo/internal/model/input/form"
"hotgo/internal/model/input/sysin"
"hotgo/internal/service"
"hotgo/utility/validate"
"github.com/gogf/gf/v2/util/gconv"
)
var (
@ -25,61 +20,32 @@ type cCurdDemo struct{}
// List 查看生成演示列表
func (c *cCurdDemo) List(ctx context.Context, req *curddemo.ListReq) (res *curddemo.ListRes, err error) {
var in sysin.CurdDemoListInp
if err = gconv.Scan(req, &in); err != nil {
return
}
if err = validate.PreFilter(ctx, &in); err != nil {
return
}
list, totalCount, err := service.SysCurdDemo().List(ctx, in)
list, totalCount, err := service.SysCurdDemo().List(ctx, &req.CurdDemoListInp)
if err != nil {
return
}
res = new(curddemo.ListRes)
res.List = list
res.PageCount = form.CalPageCount(totalCount, req.PerPage)
res.Page = req.Page
res.PerPage = req.PerPage
res.PageRes.Pack(req, totalCount)
return
}
// Export 导出生成演示列表
func (c *cCurdDemo) Export(ctx context.Context, req *curddemo.ExportReq) (res *curddemo.ExportRes, err error) {
var in sysin.CurdDemoListInp
if err = gconv.Scan(req, &in); err != nil {
return
}
if err = validate.PreFilter(ctx, &in); err != nil {
return
}
err = service.SysCurdDemo().Export(ctx, in)
err = service.SysCurdDemo().Export(ctx, &req.CurdDemoListInp)
return
}
// Edit 更新生成演示
func (c *cCurdDemo) Edit(ctx context.Context, req *curddemo.EditReq) (res *curddemo.EditRes, err error) {
var in sysin.CurdDemoEditInp
if err = gconv.Scan(req, &in); err != nil {
return
}
if err = validate.PreFilter(ctx, &in); err != nil {
return
}
err = service.SysCurdDemo().Edit(ctx, in)
err = service.SysCurdDemo().Edit(ctx, &req.CurdDemoEditInp)
return
}
// MaxSort 获取生成演示最大排序
func (c *cCurdDemo) MaxSort(ctx context.Context, req *curddemo.MaxSortReq) (res *curddemo.MaxSortRes, err error) {
data, err := service.SysCurdDemo().MaxSort(ctx, sysin.CurdDemoMaxSortInp{})
data, err := service.SysCurdDemo().MaxSort(ctx, &req.CurdDemoMaxSortInp)
if err != nil {
return
}
@ -91,16 +57,7 @@ func (c *cCurdDemo) MaxSort(ctx context.Context, req *curddemo.MaxSortReq) (res
// View 获取指定生成演示信息
func (c *cCurdDemo) View(ctx context.Context, req *curddemo.ViewReq) (res *curddemo.ViewRes, err error) {
var in sysin.CurdDemoViewInp
if err = gconv.Scan(req, &in); err != nil {
return
}
if err = validate.PreFilter(ctx, &in); err != nil {
return
}
data, err := service.SysCurdDemo().View(ctx, in)
data, err := service.SysCurdDemo().View(ctx, &req.CurdDemoViewInp)
if err != nil {
return
}
@ -112,45 +69,18 @@ func (c *cCurdDemo) View(ctx context.Context, req *curddemo.ViewReq) (res *curdd
// Delete 删除生成演示
func (c *cCurdDemo) Delete(ctx context.Context, req *curddemo.DeleteReq) (res *curddemo.DeleteRes, err error) {
var in sysin.CurdDemoDeleteInp
if err = gconv.Scan(req, &in); err != nil {
return
}
if err = validate.PreFilter(ctx, &in); err != nil {
return
}
err = service.SysCurdDemo().Delete(ctx, in)
err = service.SysCurdDemo().Delete(ctx, &req.CurdDemoDeleteInp)
return
}
// Status 更新生成演示状态
func (c *cCurdDemo) Status(ctx context.Context, req *curddemo.StatusReq) (res *curddemo.StatusRes, err error) {
var in sysin.CurdDemoStatusInp
if err = gconv.Scan(req, &in); err != nil {
return
}
if err = validate.PreFilter(ctx, &in); err != nil {
return
}
err = service.SysCurdDemo().Status(ctx, in)
err = service.SysCurdDemo().Status(ctx, &req.CurdDemoStatusInp)
return
}
// Switch 更新生成演示开关状态
func (c *cCurdDemo) Switch(ctx context.Context, req *curddemo.SwitchReq) (res *curddemo.SwitchRes, err error) {
var in sysin.CurdDemoSwitchInp
if err = gconv.Scan(req, &in); err != nil {
return
}
if err = validate.PreFilter(ctx, &in); err != nil {
return
}
err = service.SysCurdDemo().Switch(ctx, in)
err = service.SysCurdDemo().Switch(ctx, &req.CurdDemoSwitchInp)
return
}

View File

@ -7,12 +7,9 @@ package sys
import (
"context"
"github.com/gogf/gf/v2/util/gconv"
"hotgo/api/admin/dict"
"hotgo/internal/model/input/form"
"hotgo/internal/model/input/sysin"
"hotgo/internal/service"
"hotgo/utility/validate"
)
var (
@ -23,58 +20,32 @@ type cDictData struct{}
// Delete 删除
func (c *cDictData) Delete(ctx context.Context, req *dict.DataDeleteReq) (res *dict.DataDeleteRes, err error) {
var in sysin.DictDataDeleteInp
if err = gconv.Scan(req, &in); err != nil {
return
}
err = service.SysDictData().Delete(ctx, in)
err = service.SysDictData().Delete(ctx, &req.DictDataDeleteInp)
return
}
// Edit 更新
func (c *cDictData) Edit(ctx context.Context, req *dict.DataEditReq) (res *dict.DataEditRes, err error) {
var in sysin.DictDataEditInp
if err = gconv.Scan(req, &in); err != nil {
return
}
if err = validate.PreFilter(ctx, &in); err != nil {
return
}
err = service.SysDictData().Edit(ctx, in)
err = service.SysDictData().Edit(ctx, &req.DictDataEditInp)
return
}
// List 查看列表
func (c *cDictData) List(ctx context.Context, req *dict.DataListReq) (res *dict.DataListRes, err error) {
var in sysin.DictDataListInp
if err = gconv.Scan(req, &in); err != nil {
return
}
list, totalCount, err := service.SysDictData().List(ctx, in)
list, totalCount, err := service.SysDictData().List(ctx, &req.DictDataListInp)
if err != nil {
return
}
res = new(dict.DataListRes)
res.List = list
res.PageCount = form.CalPageCount(totalCount, req.PerPage)
res.Page = req.Page
res.PerPage = req.PerPage
res.PageRes.Pack(req, totalCount)
return
}
// Select 指定选项
func (c *cDictData) Select(ctx context.Context, req *dict.DataSelectReq) (res dict.DataSelectRes, err error) {
var in sysin.DataSelectInp
if err = gconv.Scan(req, &in); err != nil {
return
}
list, err := service.SysDictData().Select(ctx, in)
list, err := service.SysDictData().Select(ctx, &req.DataSelectInp)
if err != nil {
return
}
@ -87,7 +58,7 @@ func (c *cDictData) Select(ctx context.Context, req *dict.DataSelectReq) (res di
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})
option, err := service.SysDictData().Select(ctx, &sysin.DataSelectInp{Type: v})
if err != nil {
return nil, err
}

View File

@ -7,11 +7,8 @@ package sys
import (
"context"
"github.com/gogf/gf/v2/util/gconv"
"hotgo/api/admin/dict"
"hotgo/internal/model/input/sysin"
"hotgo/internal/service"
"hotgo/utility/validate"
)
var (
@ -29,26 +26,12 @@ func (c *cDictType) Tree(ctx context.Context, _ *dict.TypeTreeReq) (res *dict.Ty
// Delete 删除
func (c *cDictType) Delete(ctx context.Context, req *dict.TypeDeleteReq) (res *dict.TypeDeleteRes, err error) {
var in sysin.DictTypeDeleteInp
if err = gconv.Scan(req, &in); err != nil {
return
}
err = service.SysDictType().Delete(ctx, in)
err = service.SysDictType().Delete(ctx, &req.DictTypeDeleteInp)
return
}
// Edit 更新
func (c *cDictType) Edit(ctx context.Context, req *dict.TypeEditReq) (res *dict.TypeEditRes, err error) {
var in sysin.DictTypeEditInp
if err = gconv.Scan(req, &in); err != nil {
return
}
if err = validate.PreFilter(ctx, &in); err != nil {
return
}
err = service.SysDictType().Edit(ctx, in)
err = service.SysDictType().Edit(ctx, &req.DictTypeEditInp)
return
}

View File

@ -3,15 +3,11 @@
// @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/util/gconv"
"hotgo/api/admin/emslog"
"hotgo/internal/model/input/form"
"hotgo/internal/model/input/sysin"
"hotgo/internal/service"
)
@ -23,29 +19,19 @@ type cEmsLog struct{}
// Delete 删除
func (c *cEmsLog) Delete(ctx context.Context, req *emslog.DeleteReq) (res *emslog.DeleteRes, err error) {
var in sysin.EmsLogDeleteInp
if err = gconv.Scan(req, &in); err != nil {
return
}
err = service.SysEmsLog().Delete(ctx, in)
err = service.SysEmsLog().Delete(ctx, &req.EmsLogDeleteInp)
return
}
// Edit 更新
func (c *cEmsLog) Edit(ctx context.Context, req *emslog.EditReq) (res *emslog.EditRes, err error) {
var in sysin.EmsLogEditInp
if err = gconv.Scan(req, &in); err != nil {
return
}
err = service.SysEmsLog().Edit(ctx, in)
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, sysin.EmsLogViewInp{Id: req.Id})
data, err := service.SysEmsLog().View(ctx, &req.EmsLogViewInp)
if err != nil {
return
}
@ -57,31 +43,19 @@ func (c *cEmsLog) View(ctx context.Context, req *emslog.ViewReq) (res *emslog.Vi
// List 查看列表
func (c *cEmsLog) List(ctx context.Context, req *emslog.ListReq) (res *emslog.ListRes, err error) {
var in sysin.EmsLogListInp
if err = gconv.Scan(req, &in); err != nil {
return
}
list, totalCount, err := service.SysEmsLog().List(ctx, in)
list, totalCount, err := service.SysEmsLog().List(ctx, &req.EmsLogListInp)
if err != nil {
return
}
res = new(emslog.ListRes)
res.List = list
res.PageCount = form.CalPageCount(totalCount, req.PerPage)
res.Page = req.Page
res.PerPage = req.PerPage
res.PageRes.Pack(req, totalCount)
return
}
// Status 更新部门状态
// Status 更新状态
func (c *cEmsLog) Status(ctx context.Context, req *emslog.StatusReq) (res *emslog.StatusRes, err error) {
var in sysin.EmsLogStatusInp
if err = gconv.Scan(req, &in); err != nil {
return
}
err = service.SysEmsLog().Status(ctx, in)
err = service.SysEmsLog().Status(ctx, &req.EmsLogStatusInp)
return
}

View File

@ -3,17 +3,12 @@
// @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/util/gconv"
"hotgo/api/admin/gencodes"
"hotgo/internal/model/input/form"
"hotgo/internal/model/input/sysin"
"hotgo/internal/service"
"hotgo/utility/validate"
)
var (
@ -24,27 +19,13 @@ type cGenCodes struct{}
// Delete 删除
func (c *cGenCodes) Delete(ctx context.Context, req *gencodes.DeleteReq) (res *gencodes.DeleteRes, err error) {
var in sysin.GenCodesDeleteInp
if err = gconv.Scan(req, &in); err != nil {
return
}
err = service.SysGenCodes().Delete(ctx, in)
err = service.SysGenCodes().Delete(ctx, &req.GenCodesDeleteInp)
return
}
// Edit 更新
func (c *cGenCodes) Edit(ctx context.Context, req *gencodes.EditReq) (res *gencodes.EditRes, err error) {
var in sysin.GenCodesEditInp
if err = gconv.Scan(req, &in); err != nil {
return
}
if err = validate.PreFilter(ctx, &in); err != nil {
return
}
data, err := service.SysGenCodes().Edit(ctx, in)
data, err := service.SysGenCodes().Edit(ctx, &req.GenCodesEditInp)
if err != nil {
return
}
@ -56,7 +37,7 @@ func (c *cGenCodes) Edit(ctx context.Context, req *gencodes.EditReq) (res *genco
// MaxSort 最大排序
func (c *cGenCodes) MaxSort(ctx context.Context, req *gencodes.MaxSortReq) (res *gencodes.MaxSortRes, err error) {
data, err := service.SysGenCodes().MaxSort(ctx, sysin.GenCodesMaxSortInp{Id: req.Id})
data, err := service.SysGenCodes().MaxSort(ctx, &req.GenCodesMaxSortInp)
if err != nil {
return
}
@ -68,7 +49,7 @@ func (c *cGenCodes) MaxSort(ctx context.Context, req *gencodes.MaxSortReq) (res
// View 获取指定信息
func (c *cGenCodes) View(ctx context.Context, req *gencodes.ViewReq) (res *gencodes.ViewRes, err error) {
data, err := service.SysGenCodes().View(ctx, sysin.GenCodesViewInp{Id: req.Id})
data, err := service.SysGenCodes().View(ctx, &req.GenCodesViewInp)
if err != nil {
return
}
@ -80,38 +61,26 @@ func (c *cGenCodes) View(ctx context.Context, req *gencodes.ViewReq) (res *genco
// List 查看列表
func (c *cGenCodes) List(ctx context.Context, req *gencodes.ListReq) (res *gencodes.ListRes, err error) {
var in sysin.GenCodesListInp
if err = gconv.Scan(req, &in); err != nil {
return
}
list, totalCount, err := service.SysGenCodes().List(ctx, in)
list, totalCount, err := service.SysGenCodes().List(ctx, &req.GenCodesListInp)
if err != nil {
return
}
res = new(gencodes.ListRes)
res.List = list
res.PageCount = form.CalPageCount(totalCount, req.PerPage)
res.Page = req.Page
res.PerPage = req.PerPage
res.PageRes.Pack(req, totalCount)
return
}
// Status 更新部门状态
// Status 更新状态
func (c *cGenCodes) Status(ctx context.Context, req *gencodes.StatusReq) (res *gencodes.StatusRes, err error) {
var in sysin.GenCodesStatusInp
if err = gconv.Scan(req, &in); err != nil {
return
}
err = service.SysGenCodes().Status(ctx, in)
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, sysin.GenCodesSelectsInp{})
data, err := service.SysGenCodes().Selects(ctx, &req.GenCodesSelectsInp)
if err != nil {
return
}
@ -123,7 +92,7 @@ func (c *cGenCodes) Selects(ctx context.Context, req *gencodes.SelectsReq) (res
// TableSelect 数据库表选项
func (c *cGenCodes) TableSelect(ctx context.Context, req *gencodes.TableSelectReq) (res *gencodes.TableSelectRes, err error) {
data, err := service.SysGenCodes().TableSelect(ctx, sysin.GenCodesTableSelectInp{Name: req.Name})
data, err := service.SysGenCodes().TableSelect(ctx, &req.GenCodesTableSelectInp)
if err != nil {
return
}
@ -134,7 +103,7 @@ func (c *cGenCodes) TableSelect(ctx context.Context, req *gencodes.TableSelectRe
// ColumnSelect 表字段选项
func (c *cGenCodes) ColumnSelect(ctx context.Context, req *gencodes.ColumnSelectReq) (res *gencodes.ColumnSelectRes, err error) {
data, err := service.SysGenCodes().ColumnSelect(ctx, sysin.GenCodesColumnSelectInp{Name: req.Name, Table: req.Table})
data, err := service.SysGenCodes().ColumnSelect(ctx, &req.GenCodesColumnSelectInp)
if err != nil {
return
}
@ -145,12 +114,7 @@ func (c *cGenCodes) ColumnSelect(ctx context.Context, req *gencodes.ColumnSelect
// ColumnList 表字段列表
func (c *cGenCodes) ColumnList(ctx context.Context, req *gencodes.ColumnListReq) (res *gencodes.ColumnListRes, err error) {
var in sysin.GenCodesColumnListInp
if err = gconv.Scan(req, &in); err != nil {
return
}
data, err := service.SysGenCodes().ColumnList(ctx, in)
data, err := service.SysGenCodes().ColumnList(ctx, &req.GenCodesColumnListInp)
if err != nil {
return
}
@ -161,16 +125,7 @@ func (c *cGenCodes) ColumnList(ctx context.Context, req *gencodes.ColumnListReq)
// Preview 生成预览
func (c *cGenCodes) Preview(ctx context.Context, req *gencodes.PreviewReq) (res *gencodes.PreviewRes, err error) {
var in sysin.GenCodesPreviewInp
if err = gconv.Scan(req, &in); err != nil {
return
}
if err = validate.PreFilter(ctx, &in); err != nil {
return
}
data, err := service.SysGenCodes().Preview(ctx, in)
data, err := service.SysGenCodes().Preview(ctx, &req.GenCodesPreviewInp)
if err != nil {
return
}
@ -182,15 +137,6 @@ func (c *cGenCodes) Preview(ctx context.Context, req *gencodes.PreviewReq) (res
// Build 生成预览
func (c *cGenCodes) Build(ctx context.Context, req *gencodes.BuildReq) (res *gencodes.BuildRes, err error) {
var in sysin.GenCodesBuildInp
if err = gconv.Scan(req, &in); err != nil {
return
}
if err = validate.PreFilter(ctx, &in); err != nil {
return
}
err = service.SysGenCodes().Build(ctx, in)
err = service.SysGenCodes().Build(ctx, &req.GenCodesBuildInp)
return
}

Some files were not shown because too many files have changed in this diff Show More