mirror of
https://github.com/bufanyun/hotgo.git
synced 2025-01-23 02:40:23 +08:00
发布v2.2.10版本,更新内容请查看:https://github.com/bufanyun/hotgo/tree/v2.0/docs/guide-zh-CN/addon-version-upgrade.md
This commit is contained in:
parent
7cf1b8ce8e
commit
61d0988d2c
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,6 +1,7 @@
|
||||
*.zip
|
||||
.idea
|
||||
.user.ini
|
||||
.DS_Store
|
||||
pull.bat
|
||||
push.sh
|
||||
/dist
|
||||
|
108
README.md
108
README.md
@ -28,20 +28,21 @@
|
||||
|
||||
|
||||
## 平台简介
|
||||
* 基于全新Go Frame 2+Vue3+Naive UI开发的全栈前后端分离的管理系统
|
||||
* 前端采用naive-ui-admin 、Vue、Naive UI。
|
||||
* 基于全新Go Frame 2+Vue3+Naive UI+UinApp开发的全栖框架,为二次开发而生,适合中小型完整应用开发。
|
||||
* 前端采用naive-ui-admin 、Vue、Naive UI、UinApp。
|
||||
|
||||
|
||||
## 特征
|
||||
* 高生产率:几分钟即可搭建一个后台管理系统
|
||||
* 模块化:单应用多系统的模式,将一个完整的应用拆分为多个系统,后续扩展更加便捷,增加代码复用性。
|
||||
* 插件化: 可通过插件的方式扩展系统功能
|
||||
* 认证机制:采用jwt的用户状态认证及casbin的权限认证
|
||||
* 路由模式:得利于goframe2.0提供了规范化的路由注册方式,无需注解自动生成api文档
|
||||
* 面向接口开发
|
||||
* 高生产率:极强的可扩展性,应用化、模块化、插件化机制敏捷开发,几分钟即可搭建一个应用开发骨架。
|
||||
* 多应用入口:多入口分为 Admin (后台)、Home (前台页面)、Api (对外通用接口)、Websocket (即时通讯接口),不同的业务,进入不同的应用入口。
|
||||
* 极致的插件化: 微核架构,功能隔离,高可定制性,可以渐进式开发,亦可以多人协同开发。支持一键创建插件模板、一键安装、更新、卸载插件、可以非常方便的将插件迁移到新项目中。
|
||||
* 快速生成代码:无需编写代码,只需创建表进行简单配置就能生成一个完善的 CURD、树表等常用的开发代码,其中所需表单控件也是勾选即可直接生成。
|
||||
* 认证机制:采用 JWT 的用户状态认证及 casbin 的权限认证
|
||||
* 路由模式:得益于 goframe2.0 提供了规范化的路由注册方式,无需注解自动生成api文档
|
||||
* 模块化设计,面向接口开发
|
||||
|
||||
|
||||
## 内置功能
|
||||
## 后台内置功能
|
||||
|
||||
1. 用户管理:用户是系统操作者,该功能主要完成系统用户配置。
|
||||
2. 部门管理:配置系统组织机构(公司、部门、岗位),树结构展现支持数据权限。
|
||||
@ -56,12 +57,13 @@
|
||||
11. 在线用户:当前系统中活跃用户状态监控。
|
||||
12. 定时任务:在线(添加、修改、删除)任务调度包含执行结果日志。
|
||||
13. 代码生成:支持自动化生成前后端代码。CURD关联表、树表、消息队列、定时任务一键生成等。
|
||||
14. 服务监控:监视当前系统CPU、内存、磁盘、网络、堆栈等相关信息。
|
||||
15. 附件管理:文件上传,多种上传方式适配。
|
||||
16. 消息队列:同时兼容 kafka、redis、rocketmq、磁盘队列,一键配置切换到场景适用的MQ。
|
||||
17. 通知公告:采用websocket实时推送在线用户最新通知、公告、私信消息。
|
||||
18. 地区编码:整合国内通用省市区编码,运用于项目于一身,支持动态省市区选项。
|
||||
19. 常用工具:集成常用的工具包和命令行工具,可以快速开发自定义命令行,多种启动入口。
|
||||
14. 插件应用:支持一键生成插件模板,每个插件之间开发隔离,拥有独立多应用入口、独立配置。完美支持多人协同开发、插件插拔不会对原系统产生影响等。
|
||||
15. 服务监控:监视当前系统CPU、内存、磁盘、网络、堆栈等相关信息。
|
||||
16. 附件管理:文件上传,多种上传方式适配。
|
||||
17. 消息队列:同时兼容 kafka、redis、rocketmq、磁盘队列,一键配置切换到场景适用的MQ。
|
||||
18. 通知公告:采用websocket实时推送在线用户最新通知、公告、私信消息。
|
||||
19. 地区编码:整合国内通用省市区编码,运用于项目于一身,支持动态省市区选项。
|
||||
20. 常用工具:集成常用的工具包和命令行工具,可以快速开发自定义命令行,多种启动入口。
|
||||
|
||||
|
||||
> HotGo开源以来得到了大家的很多支持,本项目初衷只为互相学习交流,没有任何盈利性目的!欢迎为HotGo贡献代码或提供建议!
|
||||
@ -70,81 +72,9 @@
|
||||
- [https://hotgo.facms.cn/admin](https://hotgo.facms.cn/admin)
|
||||
> 账号:admin 密码:123456
|
||||
|
||||
### 使用文档
|
||||
|
||||
## 环境要求
|
||||
- node版本 >= v16.0.0
|
||||
- golang版本 >= v1.18
|
||||
- gf版本 >=v2.3.1 (会保持同步gf最新版本,gf小版本更新可能存在兼容问题,旧版本需自行处理,如非必要不建议更新!)
|
||||
- IDE推荐:Goland
|
||||
- mysql版本 >=5.7
|
||||
- redis版本 >=3.0
|
||||
|
||||
## 快速开始
|
||||
一、拉取代码到你已经安装好以上环境的服务器中
|
||||
```shell script
|
||||
git clone https://github.com/bufanyun/hotgo.git && cd hotgo
|
||||
```
|
||||
|
||||
二、配置你的站点信息
|
||||
|
||||
服务端:
|
||||
- 项目数据库文件 `resource/data/db.sql` 创建数据库并导入
|
||||
- 修改配置 `manifest/config/config.yaml.bak` 复制改为`manifest/config/config.yaml`
|
||||
|
||||
|
||||
后台前端:
|
||||
- 配置服务端地址,包含在以下文件中:
|
||||
* /hotgo/web/.env.development
|
||||
* /hotgo/web/.env.production
|
||||
* /hotgo/web/.env
|
||||
|
||||
其中必改配置
|
||||
```
|
||||
VITE_PROXY=[["/admin","http://你的IP:8000/admin"]]
|
||||
```
|
||||
|
||||
三、 启动服务
|
||||
服务端:
|
||||
```shell script
|
||||
cd server
|
||||
|
||||
# 设置国内代理,如果已经设置好了代理可以跳过
|
||||
go env -w GOPROXY=https://goproxy.io,direct
|
||||
|
||||
# 更新包
|
||||
go mod tidy
|
||||
|
||||
# 查看命令行方法
|
||||
go run main.go hlep
|
||||
|
||||
# 启动所有服务
|
||||
go run main.go # 热编译启动: gf run main.go
|
||||
|
||||
# 如果顺利,至此到浏览器打开:http://你的IP:8000/admin,即可看到后台登录地址
|
||||
# 登录账号:admin, 密码:123456
|
||||
# 好奇为什么没有运行前端代码就能将后台运行起来?这要得益于gf强大的pack功能!
|
||||
# 当然这只是为了降低运行门槛,如果想对前端进行开发请继续往下看
|
||||
|
||||
```
|
||||
|
||||
web端:
|
||||
```shell script
|
||||
cd web
|
||||
# 首先确定你以安装node16.0以上版本并安装了包[npm、yarn],否则可能会出现一些未知报错
|
||||
|
||||
# 安装依赖
|
||||
yarn install
|
||||
|
||||
# 启动web项目
|
||||
yarn dev
|
||||
|
||||
# 如果顺利,至此到浏览器打开:http://你的IP:8001/admin
|
||||
```
|
||||
|
||||
|
||||
## 文档地址
|
||||
> 文档正在书写中,请耐心等一等。
|
||||
|
||||
[安装文档](docs/guide-zh-CN/start-installation.md) · [本地文档](docs/guide-zh-CN/README.md) · [更新历史](docs/guide-zh-CN/start-update-log.md) · [常见问题](docs/guide-zh-CN/start-issue.md)
|
||||
|
||||
## 演示图
|
||||
|
||||
|
50
docs/guide-zh-CN/README.md
Normal file
50
docs/guide-zh-CN/README.md
Normal file
@ -0,0 +1,50 @@
|
||||
## 目录
|
||||
|
||||
#### 介绍安装
|
||||
|
||||
- [系统介绍](../../README.md)
|
||||
- [环境搭建](start-environment.md)
|
||||
- [系统安装](start-installation.md)
|
||||
- 生产部署
|
||||
- [如何提问](start-questions.md)
|
||||
- [常见问题](start-issue.md)
|
||||
- [更新历史](start-update-log.md)
|
||||
|
||||
|
||||
#### 系统开发
|
||||
|
||||
- [目录结构](sys-catalog.md)
|
||||
- 开发规范
|
||||
- [控制台](sys-console.md)
|
||||
- 请求中间件和WebHook
|
||||
- 权限控制
|
||||
- 代码生成
|
||||
- 定时任务
|
||||
- [消息队列](sys-queue.md)
|
||||
- [功能扩展库](sys-library.md)
|
||||
- 工具方法
|
||||
- RESTful Api
|
||||
- Websocket服务器
|
||||
- 单元测试
|
||||
|
||||
#### 插件模块开发
|
||||
|
||||
- [模块介绍及目录](addon-introduce-catalog.md)
|
||||
- [模块开发流程](addon-flow.md)
|
||||
- [模块辅助说明](addon-helper.md)
|
||||
|
||||
|
||||
#### 实战开发
|
||||
- 服务端
|
||||
- web前端
|
||||
|
||||
|
||||
### 前端开发
|
||||
- 表单组件
|
||||
- 权限
|
||||
- Websocket客户端
|
||||
- 工具库
|
||||
- 发布部署
|
||||
|
||||
#### 附录
|
||||
- [网址收录](append-website.md)
|
195
docs/guide-zh-CN/addon-flow.md
Normal file
195
docs/guide-zh-CN/addon-flow.md
Normal file
@ -0,0 +1,195 @@
|
||||
## 模块开发流程
|
||||
|
||||
目录
|
||||
|
||||
- 创建新插件
|
||||
- 开发
|
||||
- 调用主模块服务接口
|
||||
- 访问路径
|
||||
- 数据迁移
|
||||
|
||||
|
||||
|
||||
### 创建新插件
|
||||
|
||||
1、HotGo 后台进入 开发工具->插件管理->找到创建新插件,根据引导进行创建即可。
|
||||
|
||||
> 创建成功后会在 根目录的 addons 目录下生成插件文件
|
||||
|
||||
2、创建插件完毕重启服务端后,插件管理中会出现你新创建的插件信息。操作栏有几个按钮,在此进行说明
|
||||
- 安装:会自动执行 server/xxx插件/main.go 文件中的Install方法,方法中的具体逻辑默认为空,可以根据实际情况自行配置。如生成后台菜单、生成插件配置表初始化数据、迁移home页面、web项目文件等。
|
||||
```
|
||||
// Install 安装模块
|
||||
func (m *module) Install(ctx context.Context) (err error) {
|
||||
// ...
|
||||
return
|
||||
}
|
||||
```
|
||||
|
||||
- 更新:会自动执行 server/xxx插件/main.go 文件中的Upgrade方法,方法中的具体逻辑默认为空,可以根据实际情况自行配置。
|
||||
```
|
||||
// Upgrade 更新模块
|
||||
func (m *module) Upgrade(ctx context.Context) (err error) {
|
||||
// ...
|
||||
return
|
||||
}
|
||||
```
|
||||
|
||||
- 卸载:会自动执行 server/xxx插件/main.go 文件中的UnInstall方法,方法中的具体逻辑默认为空,可以根据实际情况自行配置。如会清除所有的数据表和已安装的信息等。
|
||||
```
|
||||
// UnInstall 卸载模块
|
||||
func (m *module) UnInstall(ctx context.Context) (err error) {
|
||||
// ...
|
||||
return
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
|
||||
### 开发
|
||||
|
||||
完全可以根据HotGo正常的开发流程去开发对应的API、控制器、业务逻辑、插件内的应用
|
||||
|
||||
### 调用主模块服务接口
|
||||
|
||||
这里推荐的方式是在插件input层新建一个结构,继承主模块中的input结构。这样做的目的是为了服务与服务之间的输入/输出关系解耦,便于参数扩展和避免插件模块下使用`gf gen service`时出现`import cycle not allowed`。
|
||||
|
||||
一个简单的例子:
|
||||
> 假设hgexample插件模块要通过主模块的服务接口更新插件配置
|
||||
|
||||
文件:\server\addons\hgexample\model\input\sysin\config.go
|
||||
```go
|
||||
package sysin
|
||||
|
||||
import (
|
||||
"hotgo/internal/model/input/sysin"
|
||||
)
|
||||
|
||||
// UpdateConfigInp 更新指定配置
|
||||
type UpdateConfigInp struct {
|
||||
sysin.UpdateAddonsConfigInp
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
插件模块业务逻辑:\server\addons\hgexample\logic\sys\config.go
|
||||
```go
|
||||
package sys
|
||||
|
||||
import (
|
||||
"context"
|
||||
"hotgo/addons/hgexample/global"
|
||||
"hotgo/addons/hgexample/model/input/sysin"
|
||||
"hotgo/addons/hgexample/service"
|
||||
isc "hotgo/internal/service"
|
||||
)
|
||||
|
||||
type sSysConfig struct{}
|
||||
|
||||
func NewSysConfig() *sSysConfig {
|
||||
return &sSysConfig{}
|
||||
}
|
||||
|
||||
func init() {
|
||||
service.RegisterSysConfig(NewSysConfig())
|
||||
}
|
||||
|
||||
// UpdateConfigByGroup 更新指定分组的配置
|
||||
func (s *sSysConfig) UpdateConfigByGroup(ctx context.Context, in sysin.UpdateConfigInp) error {
|
||||
in.UpdateAddonsConfigInp.AddonName = global.GetSkeleton().Name
|
||||
return isc.SysAddonsConfig().UpdateConfigByGroup(ctx, in.UpdateAddonsConfigInp)
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
主模块input:\server\internal\model\input\sysin\addons_config.go
|
||||
```go
|
||||
package sysin
|
||||
|
||||
import (
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
)
|
||||
|
||||
// UpdateAddonsConfigInp 更新指定插件的配置
|
||||
type UpdateAddonsConfigInp struct {
|
||||
AddonName string `json:"addonName"`
|
||||
Group string `json:"group"`
|
||||
List g.Map `json:"list"`
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
主模块业务逻辑:\server\internal\logic\sys\addons_config.go
|
||||
```go
|
||||
package sys
|
||||
|
||||
import (
|
||||
"context"
|
||||
"hotgo/internal/model/input/sysin"
|
||||
"hotgo/internal/service"
|
||||
)
|
||||
|
||||
type sSysAddonsConfig struct{}
|
||||
|
||||
func NewSysAddonsConfig() *sSysAddonsConfig {
|
||||
return &sSysAddonsConfig{}
|
||||
}
|
||||
|
||||
func init() {
|
||||
service.RegisterSysAddonsConfig(NewSysAddonsConfig())
|
||||
}
|
||||
|
||||
// UpdateConfigByGroup 更新指定分组的配置
|
||||
func (s *sSysAddonsConfig) UpdateConfigByGroup(ctx context.Context, in sysin.UpdateAddonsConfigInp) error {
|
||||
// ...
|
||||
return nil
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
### 访问路径
|
||||
|
||||
#### 后台插件访问路径
|
||||
|
||||
```
|
||||
// IP+端口或域名/admin/插件名称/API路径
|
||||
如:127.0.0.1:8000/admin/hgexample/index/test
|
||||
```
|
||||
|
||||
对应控制器路径:`server/addons/hgexample/controller/admin/sys/index.go`
|
||||
|
||||
#### 前端API插件访问路径
|
||||
|
||||
```
|
||||
// IP+端口或域名/api/插件名称/API路径
|
||||
如:127.0.0.1:8000/api/hgexample/index/test
|
||||
```
|
||||
|
||||
对应控制器路径:`server/addons/hgexample/controller/api/index.go`
|
||||
|
||||
#### 前台页面插件访问路径
|
||||
|
||||
```
|
||||
// IP+端口或域名/home/插件名称/API路径
|
||||
如:127.0.0.1:8000/home/hgexample/index/test
|
||||
```
|
||||
|
||||
对应控制器路径:`server/addons/hgexample/controller/home/index.go`
|
||||
|
||||
|
||||
#### Websocket插件访问路径
|
||||
|
||||
```
|
||||
// IP+端口或域名/socket/插件名称/API路径
|
||||
如:127.0.0.1:8000/socket/hgexample/index/test
|
||||
```
|
||||
|
||||
对应控制器路径:`server/addons/hgexample/controller/socket/index.go`
|
||||
|
||||
|
||||
### 数据迁移
|
||||
|
||||
可以将数据迁移逻辑写进server/xxx插件/main.go 文件中的Install方法中,并遵循系统规范进行数据安装
|
109
docs/guide-zh-CN/addon-helper.md
Normal file
109
docs/guide-zh-CN/addon-helper.md
Normal file
@ -0,0 +1,109 @@
|
||||
## 模块辅助说明
|
||||
|
||||
目录
|
||||
|
||||
- 模块结构
|
||||
- 获取模块信息
|
||||
- 插件路由规则
|
||||
|
||||
|
||||
#### 模块结构
|
||||
```go
|
||||
// Skeleton 模块骨架
|
||||
type Skeleton struct {
|
||||
Label string `json:"label"` // 标识
|
||||
Name string `json:"name"` // 名称
|
||||
Group int `json:"group"` // 分组
|
||||
Logo string `json:"logo"` // logo
|
||||
Brief string `json:"brief"` // 简介
|
||||
Description string `json:"description"` // 详细描述
|
||||
Author string `json:"author"` // 作者
|
||||
Version string `json:"version"` // 版本号
|
||||
RootPath string `json:"rootPath"` // 根路径
|
||||
}
|
||||
|
||||
func (s *Skeleton) GetModule() Module {
|
||||
return GetModule(s.Name)
|
||||
}
|
||||
|
||||
// Module 插件模块
|
||||
type Module interface {
|
||||
Init(ctx context.Context) // 初始化
|
||||
InitRouter(ctx context.Context, group *ghttp.RouterGroup) // 初始化并注册路由
|
||||
Ctx() context.Context // 上下文
|
||||
GetSkeleton() *Skeleton // 架子
|
||||
Install(ctx context.Context) error // 安装模块
|
||||
Upgrade(ctx context.Context) error // 更新模块
|
||||
UnInstall(ctx context.Context) error // 卸载模块
|
||||
}
|
||||
```
|
||||
|
||||
#### 获取模块信息
|
||||
|
||||
- 在插件模块内
|
||||
```go
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"hotgo/addons/hgexample/global"
|
||||
)
|
||||
|
||||
func test() {
|
||||
fmt.Printf("当前插件模块是:%+v", global.GetSkeleton())
|
||||
}
|
||||
```
|
||||
|
||||
- 在插件模块外
|
||||
```go
|
||||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"hotgo/internal/library/addons"
|
||||
"hotgo/internal/library/contexts"
|
||||
)
|
||||
|
||||
func test(ctx context.Context) {
|
||||
fmt.Printf("当前是否为插件请求:%v", contexts.IsAddonRequest(ctx))
|
||||
if contexts.IsAddonRequest(ctx) {
|
||||
fmt.Printf("当前插件名称:%v", contexts.GetAddonName(ctx))
|
||||
fmt.Printf("当前插件信息:%v", addons.GetModule(contexts.GetAddonName(ctx)))
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
- 更多辅助方法请参考:\server\internal\library\addons
|
||||
|
||||
#### 插件路由规则
|
||||
- 如果你不喜欢现在的路由风格,可以自行调整。修改位置在:\server\internal\library\addons\addons.go的RouterPrefix方法。
|
||||
- 调整后如web前端页面中有之前的路由风格也需同步修改。
|
||||
|
||||
```go
|
||||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
"hotgo/internal/consts"
|
||||
)
|
||||
|
||||
// RouterPrefix 路由前缀
|
||||
// 最终效果:/应用名称/插件模块名称/xxx/xxx
|
||||
func RouterPrefix(ctx context.Context, app, name string) string {
|
||||
var prefix = "/"
|
||||
switch app {
|
||||
case consts.AppAdmin:
|
||||
prefix = g.Cfg().MustGet(ctx, "router.admin.prefix", "/admin").String()
|
||||
case consts.AppApi:
|
||||
prefix = g.Cfg().MustGet(ctx, "router.api.prefix", "/api").String()
|
||||
case consts.AppHome:
|
||||
prefix = g.Cfg().MustGet(ctx, "router.home.prefix", "/home").String()
|
||||
case consts.AppWebSocket:
|
||||
prefix = g.Cfg().MustGet(ctx, "router.ws.prefix", "/socket").String()
|
||||
}
|
||||
|
||||
return prefix + "/" + name
|
||||
}
|
||||
```
|
36
docs/guide-zh-CN/addon-introduce-catalog.md
Normal file
36
docs/guide-zh-CN/addon-introduce-catalog.md
Normal file
@ -0,0 +1,36 @@
|
||||
## 模块介绍及目录
|
||||
|
||||
目录
|
||||
|
||||
- 模块介绍
|
||||
- 启动流程
|
||||
- 目录结构
|
||||
|
||||
### 模块介绍
|
||||
|
||||
> 定位:开发独立、临时性、工具类型的功能时推荐使用插件化开发,例如:小游戏(大转盘/消消乐/抽奖/大屏互动/红包等)、小插件(广告管理/文章管理/友情链接等等)、小模块(报名/投票/签到)、小程序、大型插件微商城等等。
|
||||
|
||||
> 插件模块方便多项目复用,同时完美支持多人协同开发,每个插件模块都有独立的微架构目录结构,多插件之间完全隔离。
|
||||
|
||||
### 启动流程
|
||||
|
||||
HotGo 入口文件->隐式注入(hotgo/addons/modules)->注册所有插件->初始化已安装的插件->写入路由组->根据 HotGo 正常的开发和访问流程去开发访问插件
|
||||
|
||||
|
||||
### 目录结构
|
||||
- 详细介绍请参考:[目录结构](sys-catalog.md)
|
||||
```
|
||||
/server
|
||||
├── addons
|
||||
│ ├── modules
|
||||
│ ├── xxx插件
|
||||
│ | ├── api
|
||||
│ | ├── controller
|
||||
│ | ├── global
|
||||
│ | ├── logic
|
||||
│ | ├── model
|
||||
│ | ├── router
|
||||
│ | ├── service
|
||||
│ | ├── main.go
|
||||
│ | └── README.md
|
||||
```
|
104
docs/guide-zh-CN/addon-version-upgrade.md
Normal file
104
docs/guide-zh-CN/addon-version-upgrade.md
Normal file
@ -0,0 +1,104 @@
|
||||
## RageFrame 2.x 插件升级到 3.x
|
||||
|
||||
目录
|
||||
|
||||
- 路由替换
|
||||
- 配置移除
|
||||
- UI 替换
|
||||
- Icons 替换
|
||||
- 表单组件 替换
|
||||
- 安装
|
||||
|
||||
> 注意:默认当已安装 PhpStorm 等可以批量替换的编译器/软件
|
||||
|
||||
### 路由替换
|
||||
|
||||
1. 查找 `插件/common/config` 目录
|
||||
|
||||
2. 替换 `route` 为 `name`
|
||||
|
||||
### 配置移除
|
||||
|
||||
1. 查找 `插件/AddonConfig.php` 文件
|
||||
|
||||
2. 找到 `appsConfig` 变量的 `merapi` 删除掉,移除掉以后的配置
|
||||
|
||||
```
|
||||
public $appsConfig = [
|
||||
'backend' => 'common/config/backend.php',
|
||||
'frontend' => 'common/config/frontend.php',
|
||||
'merchant' => 'common/config/merchant.php',
|
||||
'html5' => 'common/config/html5.php',
|
||||
'api' => 'common/config/api.php',
|
||||
'oauth2' => 'common/config/oauth2.php',
|
||||
];
|
||||
```
|
||||
|
||||
### UI 替换
|
||||
|
||||
1. 查找 `插件` 目录
|
||||
|
||||
2. 替换 `<div class='col-sm-1 text-right'>{label}</div><div class='col-sm-11'>{input}{hint}{error}</div>` 为 `<div class='row'><div class='col-sm-1 text-right'>{label}</div><div class='col-sm-11'>{input}\n{hint}\n{error}</div></div>`
|
||||
|
||||
3. 替换 `<div class='col-sm-2 text-right'>{label}</div><div class='col-sm-10'>{input}{hint}{error}</div>` 为 `<div class='row'><div class='col-sm-2 text-right'>{label}</div><div class='col-sm-10'>{input}\n{hint}\n{error}</div></div>`
|
||||
|
||||
4. 替换 `<div class='col-sm-2 text-right'>{label}</div><div class='col-sm-10'>{input}\n{hint}\n{error}</div>` 为 `<div class='row'><div class='col-sm-2 text-right'>{label}</div><div class='col-sm-10'>{input}\n{hint}\n{error}</div></div>`
|
||||
|
||||
5. 替换 `<div class='col-sm-3 text-right'>{label}</div><div class='col-sm-9'>{input}{hint}{error}</div>` 为 `<div class='row'><div class='col-sm-3 text-right'>{label}</div><div class='col-sm-9'>{input}\n{hint}\n{error}</div></div>`
|
||||
|
||||
6. 替换 `modal`
|
||||
|
||||
> 批量替换估计难查找到,可以看见了手动替换掉,关键词搜索 `基本信息`
|
||||
|
||||
```
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span><span class="sr-only">关闭</span></button>
|
||||
<h4 class="modal-title">基本信息</h4>
|
||||
</div>
|
||||
```
|
||||
|
||||
为
|
||||
|
||||
```
|
||||
<div class="modal-header">
|
||||
<h4 class="modal-title">基本信息</h4>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
|
||||
</div>
|
||||
```
|
||||
|
||||
7. 替换布局
|
||||
|
||||
如果单独使用了 `col-*` 这种布局出现页面失调的,需要在 `col-*` 外层加上 `<div class='row'></div>`。
|
||||
|
||||
例如:
|
||||
|
||||
```
|
||||
<div class="row">
|
||||
<div class="col-6">
|
||||
|
||||
</div>
|
||||
<div class="col-6">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
```
|
||||
|
||||
### Icons 替换
|
||||
|
||||
Icons 找不到请使用最新的 Icons 库 https://fontawesome.com/v5/search?s=solid
|
||||
|
||||
### 表单组件替换
|
||||
|
||||
个别表单组件报错请参考最新的使用文档 [表单控件](sys-widget.md)
|
||||
|
||||
### 安装
|
||||
|
||||
1. 放入 3.x 的 `addons` 目录,在后台->应用管理查找安装即可
|
||||
|
||||
2. 个别页面出现大小表格缩短显示问题可以修改替换
|
||||
|
||||
- `col-xs-12` 为 `col-12`
|
||||
- `col-lg-12` 为 `col-12`
|
||||
- `col-sm-12` 为 `col-12`
|
||||
|
||||
> 个别报错找不到的组件需要自己替换修复
|
21
docs/guide-zh-CN/append-website.md
Normal file
21
docs/guide-zh-CN/append-website.md
Normal file
@ -0,0 +1,21 @@
|
||||
目录
|
||||
|
||||
- 框架文档
|
||||
- [goframe](https://goframe.org/pages/viewpage.action?pageId=1114119)
|
||||
- [naiveui](https://www.naiveui.com)
|
||||
- [naive-ui-admin](https://docs.naiveadmin.com/)
|
||||
- [naiveui](https://www.naiveui.com)
|
||||
|
||||
|
||||
- 常用组件
|
||||
- [websocket](https://github.com/gorilla/websocket)
|
||||
- [casbin](https://github.com/casbin/casbin)
|
||||
|
||||
|
||||
- 系统通用
|
||||
- [redis](https://redis.io/)
|
||||
|
||||
|
||||
- 其他
|
||||
- [awesome-go](https://github.com/avelino/awesome-go)
|
||||
|
31
docs/guide-zh-CN/start-environment.md
Normal file
31
docs/guide-zh-CN/start-environment.md
Normal file
@ -0,0 +1,31 @@
|
||||
## 环境搭建
|
||||
|
||||
目录
|
||||
|
||||
- 前端环境
|
||||
- 后端环境
|
||||
- 使用说明
|
||||
|
||||
### 前端环境
|
||||
|
||||
1. 前往https://nodejs.org/zh-cn/下载当前版本node
|
||||
2. 命令行运行 `node -v` 若控制台输出版本号则node安装成功
|
||||
3. node 版本需大于 `16.0`
|
||||
4. 安装yarn:`npm install -g yarn`
|
||||
5. 命令行运行 `yarn -v` 若控制台输出版本号则前端环境搭建成功
|
||||
|
||||
### 后端环境
|
||||
1. 下载golang安装 版本号需>=1.18
|
||||
2. 国际: https://golang.org/dl/
|
||||
3. 国内: https://golang.google.cn/dl/
|
||||
4. 命令行运行 go 若控制台输出各类提示命令 则安装成功 输入 `go version` 确认版本大于1.18
|
||||
5. 开发工具推荐 [Goland](https://www.jetbrains.com/go/)
|
||||
|
||||
### 使用说明
|
||||
|
||||
> 需要本地具有 git node golang 环境
|
||||
|
||||
- node版本 >= 16.0.0
|
||||
- golang版本 >= v1.18
|
||||
- mysql 引擎需要是 innoDB
|
||||
- IDE推荐:Goland
|
92
docs/guide-zh-CN/start-installation.md
Normal file
92
docs/guide-zh-CN/start-installation.md
Normal file
@ -0,0 +1,92 @@
|
||||
## 系统安装
|
||||
|
||||
目录
|
||||
|
||||
- 环境要求
|
||||
- 安装
|
||||
|
||||
### 环境要求
|
||||
|
||||
- node版本 >= v16.0.0
|
||||
- golang版本 >= v1.18
|
||||
- goframe版本 >=v2.3.2
|
||||
- mysql版本 >=5.7
|
||||
|
||||
> 必须先看[环境搭建文档](start-environment.md),如果安装遇到问题务必先查看[常见问题文档](start-issue.md)
|
||||
|
||||
### 安装
|
||||
|
||||
|
||||
一、克隆项目
|
||||
|
||||
```
|
||||
git clone https://github.com/bufanyun/hotgo.git && cd hotgo
|
||||
```
|
||||
|
||||
二、配置你的站点信息
|
||||
|
||||
1、服务端:
|
||||
- 项目数据库文件 `storage/data/db.sql` 创建数据库并导入
|
||||
- 修改配置 `manifest/config/config.yaml.bak` 复制改为`manifest/config/config.yaml`
|
||||
- 将`manifest/config/config.yaml`中的数据库配置改为你自己的:
|
||||
```yaml
|
||||
database:
|
||||
logger:
|
||||
level: "all"
|
||||
stdout: true
|
||||
default:
|
||||
link: "mysql:hotgo:hg123456.@tcp(127.0.0.1:3306)/hotgo?loc=Local&parseTime=true"
|
||||
debug: true
|
||||
Prefix: "hg_"
|
||||
```
|
||||
|
||||
2、web前端:
|
||||
- 配置服务端地址,包含在以下文件中:
|
||||
* /hotgo/web/.env.development
|
||||
* /hotgo/web/.env.production
|
||||
* /hotgo/web/.env
|
||||
|
||||
其中必改配置
|
||||
```
|
||||
VITE_PROXY=[["/admin","http://你的IP:8000/admin"]]
|
||||
```
|
||||
|
||||
|
||||
三、 启动服务
|
||||
|
||||
1、服务端:
|
||||
```shell script
|
||||
cd server
|
||||
|
||||
# 设置国内代理,如果已经设置好了代理可以跳过
|
||||
go env -w GOPROXY=https://goproxy.io,direct
|
||||
|
||||
# 更新包
|
||||
go mod tidy
|
||||
|
||||
# 查看命令行方法
|
||||
go run main.go hlep
|
||||
|
||||
# 启动所有服务
|
||||
go run main.go # 热编译启动: gf run main.go
|
||||
```
|
||||
|
||||
2、web前端:
|
||||
```shell script
|
||||
cd web
|
||||
# 首先确定你以安装node16.0以上版本并安装了包[npm、yarn],否则可能会出现一些未知报错
|
||||
|
||||
# 安装依赖
|
||||
yarn install
|
||||
|
||||
# 启动web项目
|
||||
yarn dev
|
||||
|
||||
# 如果顺利,至此到浏览器打开:http://你的IP:8001/admin
|
||||
# 登录账号:admin, 密码:123456
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
34
docs/guide-zh-CN/start-issue.md
Normal file
34
docs/guide-zh-CN/start-issue.md
Normal file
@ -0,0 +1,34 @@
|
||||
## 常见问题
|
||||
|
||||
目录
|
||||
|
||||
- 一、后台相关
|
||||
- 二、数据库相关
|
||||
- 三、环境相关
|
||||
|
||||
|
||||
### 一、后台相关
|
||||
|
||||
#### 1、连接超时,请刷新重试。如仍未解决请检查websocket连接是否正确!
|
||||
|
||||
线上或非本地运行时,请到 系统设置 -> 配置管理 -> 基本设置 -> 找到网站域名和websocket地址,改成你自己实际的地址,保存刷新页面即可
|
||||
|
||||
|
||||
|
||||
### 二、数据库相关
|
||||
|
||||
#### 1、安装数据库出现 json 报错不支持
|
||||
|
||||
请安装 mysql5.7 及以上版本的数据库
|
||||
|
||||
|
||||
|
||||
### 三、环境相关
|
||||
|
||||
#### 1、not found in resource manager or following system searching paths
|
||||
|
||||
> 报错信息:panic: possible config files "config" or "config.toml/yaml/yml/json/ini/xml/properties" not found in resource manager or following system searching paths:
|
||||
|
||||
这是因为系统没有找到配置文件,修改配置 `manifest/config/config.yaml.bak` 复制改为`manifest/config/config.yaml`
|
||||
|
||||
详细请参考 - [系统安装](start-installation.md)
|
21
docs/guide-zh-CN/start-questions.md
Normal file
21
docs/guide-zh-CN/start-questions.md
Normal file
@ -0,0 +1,21 @@
|
||||
## 如何提问
|
||||
|
||||
#### 说明环境情况
|
||||
|
||||
- 平台: windows/linux
|
||||
- 软件与版本:golang 1.18, Mysql 5.7 ...
|
||||
- 系统版本:gotho 2.1.4
|
||||
|
||||
#### 你做了什么?
|
||||
|
||||
- 我按文档(附链接)上写了一个控制器xxx,代码如下:xxxx
|
||||
- 然后我使用xxx访问
|
||||
- 这其中我还做了啥
|
||||
- ...
|
||||
|
||||
#### 出现什么错误?
|
||||
|
||||
- 当我试图xxx的时候,xxx报了如下错误:(截图)
|
||||
- 我确认过我的目录权限是正确的,xxx是正确的(必要时带上截图)
|
||||
|
||||
以上是举例提问时所应该描述的情况,当别人看到详细的情况时,也便于快速定位问题所在。
|
130
docs/guide-zh-CN/start-rewrite.md
Normal file
130
docs/guide-zh-CN/start-rewrite.md
Normal file
@ -0,0 +1,130 @@
|
||||
## 伪静态
|
||||
|
||||
目录
|
||||
|
||||
- Nginx
|
||||
- Apache
|
||||
- IIS
|
||||
|
||||
### Nginx
|
||||
|
||||
推荐配置
|
||||
|
||||
```
|
||||
location / {
|
||||
try_files $uri $uri/ /index.php$is_args$args;
|
||||
}
|
||||
location /backend {
|
||||
try_files $uri $uri/ /backend/index.php$is_args$args;
|
||||
}
|
||||
location /api {
|
||||
try_files $uri $uri/ /api/index.php$is_args$args;
|
||||
}
|
||||
location /merchant {
|
||||
try_files $uri $uri/ /merchant/index.php$is_args$args;
|
||||
}
|
||||
location /html5 {
|
||||
try_files $uri $uri/ /html5/index.php$is_args$args;
|
||||
}
|
||||
location /oauth2 {
|
||||
try_files $uri $uri/ /oauth2/index.php$is_args$args;
|
||||
}
|
||||
|
||||
location ~* ^/attachment/.*\.(php|php5)$
|
||||
{
|
||||
deny all;
|
||||
}
|
||||
```
|
||||
|
||||
类似Apache的配置
|
||||
|
||||
```
|
||||
location /
|
||||
{
|
||||
index index.html index.htm index.php;
|
||||
|
||||
if (!-e $request_filename) {
|
||||
rewrite ^/backend(.*)$ /backend/index.php?s=$1 last;
|
||||
rewrite ^/merchant(.*)$ /merchant/index.php?s=$1 last;
|
||||
rewrite ^/api(.*)$ /api/index.php?s=$1 last;
|
||||
rewrite ^/html5(.*)$ /html5/index.php?s=$1 last;
|
||||
rewrite ^/oauth2(.*)$ /oauth2/index.php?s=$1 last;
|
||||
rewrite ^/(.*)$ /index.php?s=$1 last;
|
||||
break;
|
||||
}
|
||||
|
||||
#autoindex on;
|
||||
}
|
||||
```
|
||||
|
||||
### Apache
|
||||
|
||||
> 注意系统默认自带了.htaccess,所以环境如果是apache可以不用再配置
|
||||
|
||||
```
|
||||
Options +FollowSymLinks
|
||||
IndexIgnore */*
|
||||
RewriteEngine on
|
||||
|
||||
# if a directory or a file exists, use it directly
|
||||
RewriteCond %{REQUEST_FILENAME} !-f
|
||||
RewriteCond %{REQUEST_FILENAME} !-d
|
||||
|
||||
# otherwise forward it to index.php
|
||||
RewriteRule . index.php
|
||||
```
|
||||
|
||||
### IIS
|
||||
|
||||
> rule 部分配置
|
||||
|
||||
```
|
||||
<rule name="backend" stopProcessing="true">
|
||||
<match url="^backend/(.*)" />
|
||||
<conditions logicalGrouping="MatchAll">
|
||||
<add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
|
||||
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
|
||||
</conditions>
|
||||
<action type="Rewrite" url="backend/index.php/{R:1}" />
|
||||
</rule>
|
||||
<rule name="merchant" stopProcessing="true">
|
||||
<match url="^merchant/(.*)" />
|
||||
<conditions logicalGrouping="MatchAll">
|
||||
<add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
|
||||
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
|
||||
</conditions>
|
||||
<action type="Rewrite" url="merchant/index.php/{R:1}" />
|
||||
</rule>
|
||||
<rule name="html5" stopProcessing="true">
|
||||
<match url="^html5/(.*)" />
|
||||
<conditions logicalGrouping="MatchAll">
|
||||
<add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
|
||||
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
|
||||
</conditions>
|
||||
<action type="Rewrite" url="html5/index.php/{R:1}" />
|
||||
</rule>
|
||||
<rule name="api" stopProcessing="true">
|
||||
<match url="^api/(.*)" />
|
||||
<conditions logicalGrouping="MatchAll">
|
||||
<add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
|
||||
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
|
||||
</conditions>
|
||||
<action type="Rewrite" url="api/index.php/{R:1}" />
|
||||
</rule>
|
||||
<rule name="oauth2" stopProcessing="true">
|
||||
<match url="^oauth2/(.*)" />
|
||||
<conditions logicalGrouping="MatchAll">
|
||||
<add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
|
||||
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
|
||||
</conditions>
|
||||
<action type="Rewrite" url="oauth2/index.php/{R:1}" />
|
||||
</rule>
|
||||
<rule name="frontend" stopProcessing="true">
|
||||
<match url="^(.*)$" />
|
||||
<conditions logicalGrouping="MatchAll">
|
||||
<add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
|
||||
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
|
||||
</conditions>
|
||||
<action type="Rewrite" url="index.php/{R:1}" />
|
||||
</rule>
|
||||
```
|
76
docs/guide-zh-CN/start-update-log.md
Normal file
76
docs/guide-zh-CN/start-update-log.md
Normal file
@ -0,0 +1,76 @@
|
||||
## 更新历史
|
||||
|
||||
升级说明:
|
||||
|
||||
> 创建一个Git版本库,并创建二个分支比如A、B,A分支默认为你的二开分支、B分支为你的版本库分支。
|
||||
> 等需要升级的时候,把版本库分支(B)升级为最新的版本,然后切换到A分支,把B分支合并过来,解决掉合并冲突即可。
|
||||
|
||||
注意:
|
||||
|
||||
> 各个小版本升级例如 2.1.x 升级到 2.2.x 以上不能完美升级最好重新安装
|
||||
|
||||
> 如果升级(覆盖)代码后打开会出现 sql 报错, 请检查更新的数据库格式或自行调整
|
||||
|
||||
|
||||
### v2.2.10
|
||||
updated 2023.02.23
|
||||
|
||||
- 增加: 增加插件管理、设计新插件等插件模块
|
||||
- 增加: 增加插件应用:`功能案例`
|
||||
- 增加: 增加使用文档
|
||||
- 优化: 生成代码适配插件模块
|
||||
- 优化:消息队列增加磁盘队列,默认队列从`redis`改为`disk`
|
||||
- 优化:缓存驱动增加文件适配器,默认驱动从`redis`改为`file`,项目安装不再依赖`redis`
|
||||
- 优化:优化系统监控加载流程
|
||||
- 优化:gf版本升级到v2.3.2
|
||||
- 修复:生成代码刷新后偶尔出现加载失败问题
|
||||
|
||||
### v2.2.1
|
||||
updated 2023.01.12
|
||||
|
||||
- 优化: 缓存清理各个应用的缓存文件夹读写判断
|
||||
- 修复: Linux 环境下创建插件报找不到模板文件
|
||||
- 修复: Excel 导入找不到最后一列数据
|
||||
- 增加: 无权限菜单不显示
|
||||
- 优化: 省市区数据为最新的 2023.01.11 的国家统计局省市区数据
|
||||
- 优化: 前台关于图片上传的 js 和 css 引入,避免资源依赖找不到
|
||||
- 优化: 插件模块查询机制, 增加数据缓存依赖,依赖时间为 360 秒
|
||||
- 优化: 文件上传的处理
|
||||
- 修复: 网站配置的多图上传引入路径错误
|
||||
- 修复: 定时任务协程问题导致执行失败
|
||||
-
|
||||
### v2.1.1
|
||||
updated 2022.9.26
|
||||
|
||||
- 优化: 多图上传的显示样式及功能
|
||||
- 修复: 由于上传视频和语音开启了全域名返回导致的上传到服务器错误
|
||||
- 增加: 由增加home页面入口,前台页面
|
||||
|
||||
### v2.0.8
|
||||
updated 2022.9.21
|
||||
|
||||
- 优化: 优化菜单和角色数据权限,支持数据权限和按钮细分权限
|
||||
- 优化: 优化附件上传,增加文件上传选项
|
||||
|
||||
### v2.0.6
|
||||
updated 2022.9.18
|
||||
|
||||
- 增加: 增加阿里云短信配置和发送短信API
|
||||
- 增加: 增加高德地图配置
|
||||
- 优化: 优化数据字典,增加数据类型和标签支持
|
||||
-
|
||||
### v2.0.3
|
||||
updated 2022.9.10
|
||||
|
||||
- 2.0 全新上线
|
||||
|
||||
### v2.0.2
|
||||
updated 2022.6.11
|
||||
|
||||
- 增加: 增加生成代码功能,目前已支持一键生成CURD和关联表
|
||||
- 增加: 增加云存储UCloud配置,后台一键切换驱动
|
||||
|
||||
### v2.0.0
|
||||
updated 2022.5.20
|
||||
|
||||
- 初始化: 2.0 基础框架
|
215
docs/guide-zh-CN/sys-auth.md
Normal file
215
docs/guide-zh-CN/sys-auth.md
Normal file
@ -0,0 +1,215 @@
|
||||
## 权限控制
|
||||
|
||||
- 控制说明
|
||||
- 如何页面块/按钮自由控制显示权限
|
||||
- 不进行权限认证的路由
|
||||
- 新增应用的 RBAC 授权
|
||||
|
||||
> RageFrame已经内置的 RBAC 权限管理,并对其进行了二次开发,无限父子级权限分组、可自由分配子级权限
|
||||
|
||||
### 控制说明
|
||||
|
||||
可以把权限理解为一个大的库,往里面丢各种名称,可以是路由、自定义名称等
|
||||
|
||||
系统自定义了几个默认的名称
|
||||
|
||||
- menuCate:1 => 平台管理导航菜单
|
||||
- menuCate:2 => 微信公众号导航菜单
|
||||
- menuCate:3 => 系统管理导航菜单
|
||||
- menuCate:4 => 应用中心导航菜单
|
||||
|
||||
> 为什么要命名为cate:1这种名称呢,因为是后面带的是菜单分类数据库自带的id,如果自己有改动比如删除后添加注意修改权限名称
|
||||
|
||||
> 注意!!!
|
||||
> 注意!!!
|
||||
> 注意!!!
|
||||
>
|
||||
> 权限的路由一定要包含菜单路由才会显示
|
||||
|
||||
**举个例子**
|
||||
|
||||
已授权权限
|
||||
|
||||
```
|
||||
[
|
||||
'/test/index',
|
||||
'/test/system',
|
||||
|
||||
...
|
||||
],
|
||||
```
|
||||
|
||||
你的菜单
|
||||
|
||||
```
|
||||
[
|
||||
'testList', // 这里是菜单的顶级别名
|
||||
'child' => [
|
||||
'/test/index', // 子菜单
|
||||
'/test/system', // 子菜单
|
||||
'/test/test', // 子菜单
|
||||
...
|
||||
]
|
||||
|
||||
...
|
||||
],
|
||||
```
|
||||
|
||||
这里看到你授权菜单的子菜单但是没有授权 testList 别名,那么你整个菜单都会被隐藏,如果想显示你必须把 testList 也加入权限
|
||||
|
||||
### 如何页面块/按钮自由控制显示权限
|
||||
|
||||
按钮快捷方式:使用 [Html](helper-html.md) 辅助类
|
||||
自定义验证如下:使用 [Auth](helper-auth.md) 辅助类
|
||||
|
||||
### 不进行权限认证的路由
|
||||
|
||||
> 修改地址 `backend/config/params` 找到 `noAuthRoute`
|
||||
|
||||
```
|
||||
/**
|
||||
* 不需要验证的路由全称
|
||||
*
|
||||
* 注意: 前面以绝对路径/为开头
|
||||
*/
|
||||
'noAuthRoute' => [
|
||||
'/main/index',// 系统主页
|
||||
'/main/system',// 系统首页
|
||||
'/menu-provinces/index',// 微信个性化菜单省市区
|
||||
'/wechat/common/select-news',// 微信自动回复获取图文
|
||||
'/wechat/common/select-attachment',// 微信自动回复获取图片/视频/
|
||||
'/wechat/analysis/image',// 微信显示素材图片
|
||||
],
|
||||
```
|
||||
|
||||
### 新增应用的 RBAC 授权
|
||||
|
||||
获取分配角色列表
|
||||
|
||||
```
|
||||
/**
|
||||
* @param string $app_id 应用id
|
||||
* @param bool $sourceAuthChild 权限来源(false:所有权限,true:当前角色)
|
||||
* @return array
|
||||
*/
|
||||
Yii::$app->services->rbacAuthRole->getDropDown($app_id, $sourceAuthChild)
|
||||
```
|
||||
|
||||
分配为用户角色
|
||||
|
||||
```
|
||||
/**
|
||||
* @param array $role_ids 角色id
|
||||
* @param int $user_id 用户id
|
||||
* @param string $app_id 应用id
|
||||
* @throws UnprocessableEntityHttpException
|
||||
*/
|
||||
Yii::$app->services->rbacAuthAssignment->assign($role_ids, $user_id, $app_id);
|
||||
```
|
||||
|
||||
权限管理
|
||||
|
||||
> 下面为新增应用权限(比如增加前台会员的权限)案例
|
||||
|
||||
```
|
||||
<?php
|
||||
|
||||
namespace addons\Merchants\backend\controllers;
|
||||
|
||||
use common\enums\AppEnum;
|
||||
use common\models\rbac\AuthItem;
|
||||
use common\traits\AuthItemTrait;
|
||||
|
||||
/**
|
||||
* Class AuthItemController
|
||||
* @package backend\modules\common\controllers
|
||||
* @author jianyan74 <751393839@qq.com>
|
||||
*/
|
||||
class AuthItemController extends BaseController
|
||||
{
|
||||
use AuthItemTrait;
|
||||
|
||||
/**
|
||||
* @var AuthItem
|
||||
*/
|
||||
public $modelClass = AuthItem::class;
|
||||
|
||||
/**
|
||||
* 默认应用
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $appId = AppEnum::MERCHANT;
|
||||
|
||||
/**
|
||||
* 渲染视图前缀(默认)
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $viewPrefix = '@backend/modules/base/views/auth-item/';
|
||||
}
|
||||
```
|
||||
|
||||
角色管理
|
||||
|
||||
> 下面为新增应用权限(比如增加前台会员的角色)案例
|
||||
|
||||
```
|
||||
<?php
|
||||
|
||||
namespace addons\Merchants\backend\controllers;
|
||||
|
||||
use Yii;
|
||||
use common\traits\AuthRoleTrait;
|
||||
use common\models\rbac\AuthRole;
|
||||
use common\enums\AppEnum;
|
||||
|
||||
/**
|
||||
* Class RoleController
|
||||
* @package addons\Merchants\backend\controllers
|
||||
* @author jianyan74 <751393839@qq.com>
|
||||
*/
|
||||
class AuthRoleController extends BaseController
|
||||
{
|
||||
use AuthRoleTrait;
|
||||
|
||||
/**
|
||||
* @var AuthRole
|
||||
*/
|
||||
public $modelClass = AuthRole::class;
|
||||
|
||||
/**
|
||||
* 默认应用
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $appId = AppEnum::MERCHANT;
|
||||
|
||||
/**
|
||||
* 权限来源
|
||||
*
|
||||
* false:所有权限,true:当前角色
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
public $sourceAuthChild = false;
|
||||
|
||||
/**
|
||||
* 渲染视图前缀(默认)
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $viewPrefix = '@backend/modules/base/views/auth-role/';
|
||||
|
||||
/**
|
||||
* @throws \yii\base\InvalidConfigException
|
||||
*/
|
||||
public function init()
|
||||
{
|
||||
parent::init();
|
||||
|
||||
$this->merchant_id = Yii::$app->request->get('merchant_id');
|
||||
$this->merchant_id && Yii::$app->services->merchant->setId($this->merchant_id);
|
||||
}
|
||||
}
|
||||
```
|
169
docs/guide-zh-CN/sys-catalog.md
Normal file
169
docs/guide-zh-CN/sys-catalog.md
Normal file
@ -0,0 +1,169 @@
|
||||
## 目录结构
|
||||
|
||||
目录
|
||||
|
||||
- 服务端
|
||||
- web前端
|
||||
- uinapp端(待开放)
|
||||
|
||||
|
||||
#### 服务端
|
||||
```
|
||||
/server
|
||||
├── addons
|
||||
│ ├── modules
|
||||
│ ├── xxx插件
|
||||
│ | ├── api
|
||||
│ | ├── controller
|
||||
│ | ├── global
|
||||
│ | ├── logic
|
||||
│ | ├── model
|
||||
│ | ├── router
|
||||
│ | ├── service
|
||||
│ | ├── main.go
|
||||
│ | └── README.md
|
||||
├── api
|
||||
│ ├── admin
|
||||
│ ├── api
|
||||
│ ├── home
|
||||
│ ├── websocket
|
||||
├── hack
|
||||
├── internal
|
||||
│ ├── cmd
|
||||
│ ├── consts
|
||||
│ ├── controller
|
||||
│ ├── crons
|
||||
│ ├── dao
|
||||
│ ├── global
|
||||
│ ├── library
|
||||
│ ├── logic
|
||||
│ ├── model
|
||||
│ | ├── do
|
||||
│ │ ├── entity
|
||||
│ │ └── input
|
||||
│ ├── packed
|
||||
│ ├── queues
|
||||
│ ├── router
|
||||
│ ├── service
|
||||
│ └── websocket
|
||||
├── manifest
|
||||
├── resource
|
||||
├── storage
|
||||
├── utility
|
||||
├── go.mod
|
||||
├── main.go
|
||||
├── Makefile
|
||||
└── README.md
|
||||
```
|
||||
|
||||
| 目录 | 描述 |
|
||||
|--------------------------|-----------------------------------------------------------------|
|
||||
| 基于gf的工程目录结构做了部分调整 | 参考地址: https://goframe.org/pages/viewpage.action?pageId=30740166 |
|
||||
| **addons** | 所有的插件模块都放在这里 |
|
||||
| --- modules | 为插件模块提供隐式初始化 |
|
||||
| --- xxx插件 | 插件模块名称 |
|
||||
| --- --- api | 对外接口。提供服务的输入/输出数据结构定义 |
|
||||
| --- --- --- admin | 后台接口 |
|
||||
| --- --- --- api | 前台通用接口,包含PC页面、uinapp接口等 |
|
||||
| --- --- --- home | 前台PC端页面 |
|
||||
| --- --- --- websocket | 可同时为多应用提供websocket接口 |
|
||||
| --- --- controller | 接收/解析用户输入参数的入口/接口层,也可以理解为控制器 |
|
||||
| --- --- global | 项目内主要的全局变量和系统的一些初始化操作 |
|
||||
| --- --- logic | 业务逻辑封装管理,特定的业务逻辑实现和封装往往是项目中最复杂的部分 |
|
||||
| --- --- model | 数据结构管理模块,管理数据实体对象,以及输入与输出数据结构定义 |
|
||||
| --- --- --- input | 对内接口。用于controller调用service或service之间调用时的输入/输出结构定义和输入过滤和预处理 |
|
||||
| --- --- router | 注册对外接口和分组中间件 |
|
||||
| --- --- service | 用于业务模块解耦的接口定义层具体的接口实现在logic中进行注入 |
|
||||
| --- main.go | 插件始化文件和模块插拔接口 |
|
||||
| **api** | 对外接口。提供服务的输入/输出数据结构定义 |
|
||||
| --- admin | 后台接口 |
|
||||
| --- api | 前台通用接口,包含PC页面、uinapp接口等 |
|
||||
| --- home | 前台PC端页面 |
|
||||
| --- websocket | 可同时为多应用提供websocket接口 |
|
||||
| **hack** | 存放项目开发工具、脚本等内容例如,CLI工具的配置,各种shell/bat脚本等文件 |
|
||||
| **internal** | 业务逻辑存放目录通过Golang internal特性对外部隐藏可见性 |
|
||||
| --- cmd | 命令行管理目录可以管理维护多个命令行 |
|
||||
| --- consts | 项目内主要的常量定义 |
|
||||
| --- controller | 接收/解析用户输入参数的入口/接口层,也可以理解为控制器 |
|
||||
| --- crons | 项目中由系统统一接管的定时任务处理 |
|
||||
| --- dao | 数据访问对象,这是一层抽象对象,用于和底层数据库交互,仅包含最基础的 CURD 方法 |
|
||||
| --- global | 项目内主要的全局变量和系统的一些初始化操作 |
|
||||
| --- library | 项目内常用功能的扩展库 |
|
||||
| --- logic | 业务逻辑封装管理,特定的业务逻辑实现和封装往往是项目中最复杂的部分 |
|
||||
| --- model | 数据结构管理模块,管理数据实体对象,以及输入与输出数据结构定义 |
|
||||
| --- --- do | 用于dao数据操作中业务模型与实例模型转换,由工具维护,用户不能修改 |
|
||||
| --- --- entity | 与数据集合绑定的程序数据结构定义,通常和数据表一一对应 |
|
||||
| --- --- input | 对内接口。用于controller调用service或service之间调用时的输入/输出结构定义和输入过滤和预处理 |
|
||||
| --- packed | 将静态资源打包进可执行文件,无需单独部署 |
|
||||
| --- queues | 为项目内所有的消息队列的消费者提供统一的初始化和处理 |
|
||||
| --- router | 注册对外接口和分组中间件 |
|
||||
| --- service | 用于业务模块解耦的接口定义层具体的接口实现在logic中进行注入 |
|
||||
| **manifest** | 包含程序编译、部署、运行、配置的文件常见内容如下: |
|
||||
| --- config | 配置文件存放目录 |
|
||||
| --- docker | Docker镜像相关依赖文件,脚本文件等等 |
|
||||
| --- deploy | 部署相关的文件默认提供了Kubernetes集群化部署的Yaml模板,通过kustomize管理 |
|
||||
| **resource** | 静态资源文件。这些文件往往可以通过 资源打包/镜像编译 的形式注入到发布文件中 |
|
||||
| **storage** | 本地数据存储目录,例如文件缓存、磁盘队列数据、sql数据文件、SSL证书等 |
|
||||
| **utility** | 一些常用的工具方法 |
|
||||
| go.mod | 使用Go Module包管理的依赖描述文件 |
|
||||
| main.go | 程序入口文件 |
|
||||
| Makefile | 程序构建发布和开发快捷指令 |
|
||||
| README.md | 项目介绍文件 |
|
||||
|
||||
|
||||
|
||||
|
||||
#### web前端
|
||||
```
|
||||
/web
|
||||
├── build # 打包脚本相关
|
||||
│ ├── config # 配置文件
|
||||
│ ├── generate # 生成器
|
||||
│ ├── script # 脚本
|
||||
│ └── vite # vite配置
|
||||
├── mock # mock文件夹
|
||||
├── public # 公共静态资源目录
|
||||
├── src # 主目录
|
||||
│ ├── api # 接口文件
|
||||
│ ├── assets # 资源文件
|
||||
│ │ ├── icons # icon sprite 图标文件夹
|
||||
│ │ ├── images # 项目存放图片的文件夹
|
||||
│ │ └── svg # 项目存放svg图片的文件夹
|
||||
│ ├── components # 公共组件
|
||||
│ ├── design # 样式文件
|
||||
│ ├── directives # 指令
|
||||
│ ├── enums # 枚举/常量
|
||||
│ ├── hooks # hook
|
||||
│ │ ├── component # 组件相关hook
|
||||
│ │ ├── core # 基础hook
|
||||
│ │ ├── event # 事件相关hook
|
||||
│ │ ├── setting # 配置相关hook
|
||||
│ │ └── web # web相关hook
|
||||
│ ├── layouts # 布局文件
|
||||
│ │ ├── default # 默认布局
|
||||
│ │ ├── iframe # iframe布局
|
||||
│ │ └── page # 页面布局
|
||||
│ ├── locales # 多语言
|
||||
│ ├── logics # 逻辑
|
||||
│ ├── main.ts # 主入口
|
||||
│ ├── router # 路由配置
|
||||
│ ├── settings # 项目配置
|
||||
│ │ ├── componentSetting.ts # 组件配置
|
||||
│ │ ├── designSetting.ts # 样式配置
|
||||
│ │ ├── encryptionSetting.ts # 加密配置
|
||||
│ │ ├── localeSetting.ts # 多语言配置
|
||||
│ │ ├── projectSetting.ts # 项目配置
|
||||
│ │ └── siteSetting.ts # 站点配置
|
||||
│ ├── store # 数据仓库
|
||||
│ ├── utils # 工具类
|
||||
│ └── views # 页面
|
||||
├── types # 类型文件
|
||||
├── vite.config.ts # vite配置文件
|
||||
└── windi.config.ts # windcss配置文件
|
||||
```
|
||||
|
||||
|
||||
#### uinapp端
|
||||
```
|
||||
// 待开放
|
||||
```
|
70
docs/guide-zh-CN/sys-console.md
Normal file
70
docs/guide-zh-CN/sys-console.md
Normal file
@ -0,0 +1,70 @@
|
||||
## 控制台
|
||||
|
||||
目录
|
||||
|
||||
- 启动所有服务
|
||||
- HTTP服务
|
||||
- 消息队列
|
||||
- 定时任务
|
||||
- 常用工具
|
||||
- Makefile
|
||||
|
||||
### 启动所有服务
|
||||
- 仅推荐在开发期间快速调试使用,线上实际部署时建议将各个服务分开部署,这样重新部署某个服务时无需全部重启。
|
||||
|
||||
```shell
|
||||
# 默认
|
||||
go run main.go
|
||||
|
||||
# 通过热编译启动
|
||||
gf run main.go
|
||||
```
|
||||
|
||||
### HTTP服务
|
||||
- 启动HTTP服务,包含websocket。
|
||||
```shell
|
||||
# 默认
|
||||
go run main.go http
|
||||
|
||||
# 通过热编译启动
|
||||
gf run main.go --args "http"
|
||||
```
|
||||
|
||||
### 消息队列
|
||||
- 启动消息队列的消费者。
|
||||
|
||||
```shell
|
||||
# 默认
|
||||
go run main.go queue
|
||||
|
||||
# 通过热编译启动
|
||||
gf run main.go --args "queue"
|
||||
```
|
||||
|
||||
### 定时任务(暂未拆分,目前随HTTP服务启动)
|
||||
- 启动系统中统一注册的定时任务。
|
||||
|
||||
```shell
|
||||
# 默认
|
||||
go run main.go cron
|
||||
|
||||
# 通过热编译启动
|
||||
gf run main.go --args "cron"
|
||||
```
|
||||
|
||||
|
||||
### 常用工具
|
||||
- 释放casbin权限,用于清理无效的权限设置。
|
||||
```shell
|
||||
go run main.go tools -m=casbin -a1=refresh
|
||||
```
|
||||
|
||||
|
||||
### Makefile
|
||||
- 通过make提供一些快捷命令
|
||||
```shell
|
||||
# 一键编译,打包前后端代码到可执行文件
|
||||
make build
|
||||
|
||||
# 更多请查看 /server/Makefile文件
|
||||
```
|
69
docs/guide-zh-CN/sys-library.md
Normal file
69
docs/guide-zh-CN/sys-library.md
Normal file
@ -0,0 +1,69 @@
|
||||
## 消息队列
|
||||
|
||||
目录
|
||||
|
||||
- 缓存驱动
|
||||
- 上下文(待写)
|
||||
- JWT(待写)
|
||||
- 地理定位(待写)
|
||||
- 通知(待写)
|
||||
|
||||
|
||||
### 缓存驱动
|
||||
|
||||
> 系统默认的缓存驱动为file,目前已支持:memory|redis|file等多种驱动。请自行选择适合你的驱动使用。
|
||||
|
||||
- 配置文件:server/manifest/config/config.yaml
|
||||
|
||||
```yaml
|
||||
#缓存
|
||||
cache:
|
||||
adapter: "file" # 缓存驱动方式,支持:memory|redis|file,不填默认memory
|
||||
fileDir: "./storage/cache" # 文件缓存路径,adapter=file时必填
|
||||
```
|
||||
|
||||
#### 使用方式
|
||||
```go
|
||||
package main
|
||||
|
||||
import (
|
||||
"hotgo/internal/library/cache"
|
||||
"github.com/gogf/gf/v2/os/gctx"
|
||||
)
|
||||
|
||||
func test() {
|
||||
ctx := gctx.New()
|
||||
|
||||
// 添加/修改
|
||||
cache.Instance().Set(ctx, "qwe", 123, 0)
|
||||
|
||||
// 查询
|
||||
cache.Instance().Get(ctx, "qwe")
|
||||
|
||||
// 删除
|
||||
cache.Instance().Remove(ctx, "qwe")
|
||||
|
||||
// 更多方法请参考:https://goframe.org/pages/viewpage.action?pageId=27755640
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
### 上下文
|
||||
```go
|
||||
// 待写
|
||||
```
|
||||
|
||||
### JWT
|
||||
```go
|
||||
// 待写
|
||||
```
|
||||
|
||||
### 地理定位
|
||||
```go
|
||||
// 待写
|
||||
```
|
||||
|
||||
### 通知
|
||||
```go
|
||||
// 待写
|
||||
```
|
155
docs/guide-zh-CN/sys-queue.md
Normal file
155
docs/guide-zh-CN/sys-queue.md
Normal file
@ -0,0 +1,155 @@
|
||||
## 消息队列
|
||||
|
||||
目录
|
||||
|
||||
- 配置文件
|
||||
- 一个例子
|
||||
- 控制台
|
||||
- 自定义队列驱动
|
||||
|
||||
> 系统默认的队列驱动为disk(磁盘队列),目前已支持:disk、redis、rocketmq、kafka等多种驱动。请自行选择适合你的驱动使用。
|
||||
|
||||
### 配置文件
|
||||
- 配置文件:server/manifest/config/config.yaml
|
||||
|
||||
```yaml
|
||||
#消息队列
|
||||
queue:
|
||||
switch: true # 队列开关,可选:true|false,默认为true
|
||||
driver: "disk" # 队列驱动,可选:redis|rocketmq|kafka,默认为disk
|
||||
retry: 2 # 重试次数,仅rocketmq|redis支持
|
||||
groupName: "hotgo" # mq群组名称
|
||||
#磁盘队列
|
||||
disk:
|
||||
path: "./storage/diskqueue" # 数据存放路径
|
||||
batchSize: 100 # 每100条消息同步一次,batchSize和batchTime满足其一就会同步一次
|
||||
batchTime: 1 # 每1秒消息同步一次
|
||||
segmentSize: 10485760 # 每个topic分片数据文件最大字节,默认10M
|
||||
segmentLimit: 3000 # 每个topic最大分片数据文件数量,超出部分将会丢弃
|
||||
redis:
|
||||
address: "127.0.0.1:6379" # redis服务地址,默认为127.0.0.1:6379
|
||||
db: 2 # 指定redis库
|
||||
pass: "" # redis密码
|
||||
timeout: 0 # 队列超时时间(s) ,0为永不超时,当队列一直没有被消费到达超时时间则队列会被销毁
|
||||
rocketmq:
|
||||
address: "127.0.0.1:9876" # brocker地址+端口
|
||||
logLevel: "all" # 系统日志级别,可选:all|close|debug|info|warn|error|fatal
|
||||
kafka:
|
||||
address: "127.0.0.1:9092" # kafka地址+端口
|
||||
version: "2.0.0.0" # kafka专属配置,默认2.0.0.0
|
||||
randClient: true # 开启随机生成clientID,可以实现启动多实例同时一起消费相同topic,加速消费能力的特性,默认为true
|
||||
multiConsumer: true # 是否支持创建多个消费者
|
||||
|
||||
```
|
||||
|
||||
### 一个例子
|
||||
|
||||
每个被发送到队列的消息应该被定义为一个文件的结构。
|
||||
|
||||
例如,如果您需要异步记录系统日志,内容大致如下:
|
||||
|
||||
- 文件路径:server/internal/queues/sys_log.go
|
||||
|
||||
```go
|
||||
package queues
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"hotgo/internal/consts"
|
||||
"hotgo/internal/library/queue"
|
||||
"hotgo/internal/model/entity"
|
||||
"hotgo/internal/service"
|
||||
)
|
||||
|
||||
func init() {
|
||||
jobList = append(jobList, SysLog)
|
||||
}
|
||||
|
||||
// SysLog 系统日志
|
||||
var SysLog = &qSysLog{}
|
||||
|
||||
type qSysLog struct{}
|
||||
|
||||
// getTopic 主题
|
||||
func (q *qSysLog) getTopic() string {
|
||||
return consts.QueueLogTopic
|
||||
}
|
||||
|
||||
// handle 处理消息
|
||||
func (q *qSysLog) handle(ctx context.Context, mqMsg queue.MqMsg) (err error) {
|
||||
var data entity.SysLog
|
||||
if err = json.Unmarshal(mqMsg.Body, &data); err != nil {
|
||||
return err
|
||||
}
|
||||
return service.SysLog().RealWrite(ctx, data)
|
||||
}
|
||||
|
||||
|
||||
```
|
||||
|
||||
下面是将消息添加到队列的方式,大概内容如下:
|
||||
|
||||
```go
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"hotgo/internal/consts"
|
||||
"hotgo/internal/library/queue"
|
||||
"hotgo/internal/model/entity"
|
||||
)
|
||||
|
||||
func test() {
|
||||
data := &entity.SysLog{}
|
||||
if err := queue.Push(consts.QueueLogTopic, data); err != nil {
|
||||
fmt.Printf("queue.Push err:%+v", err)
|
||||
}
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
### 控制台
|
||||
|
||||
控制台用于处理队列消息,即消费者。
|
||||
|
||||
相关命令请参考: [控制台](sys-console.md)
|
||||
|
||||
|
||||
### 自定义队列驱动
|
||||
|
||||
只需实现消息队列的生成者和消费者接口,并加入到初始化中进行相应调用即可。
|
||||
|
||||
- 接口片段:server/internal/library/queue/init.go
|
||||
|
||||
```go
|
||||
package queue
|
||||
|
||||
import (
|
||||
"time"
|
||||
)
|
||||
|
||||
type MqMsg struct {
|
||||
RunType int `json:"run_type"`
|
||||
Topic string `json:"topic"`
|
||||
MsgId string `json:"msg_id"`
|
||||
Offset int64 `json:"offset"`
|
||||
Partition int32 `json:"partition"`
|
||||
Timestamp time.Time `json:"timestamp"`
|
||||
Body []byte `json:"body"`
|
||||
}
|
||||
|
||||
|
||||
type MqProducer interface {
|
||||
SendMsg(topic string, body string) (mqMsg MqMsg, err error)
|
||||
SendByteMsg(topic string, body []byte) (mqMsg MqMsg, err error)
|
||||
}
|
||||
|
||||
type MqConsumer interface {
|
||||
ListenReceiveMsgDo(topic string, receiveDo func(mqMsg MqMsg)) (err error)
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
将实现过接口(MqProducer、MqConsumer)的实例方法分别加入到NewProducer、NewConsumer中进行相应调用即可。
|
||||
|
6
server/.gitignore
vendored
6
server/.gitignore
vendored
@ -19,8 +19,10 @@ manifest/output/
|
||||
resource/log/
|
||||
resource/public/admin/
|
||||
resource/public/attachment/
|
||||
resource/ssl/server.crt
|
||||
resource/ssl/server.key
|
||||
storage/cache/
|
||||
storage/diskqueue/
|
||||
storage/ssl/server.crt
|
||||
storage/ssl/server.key
|
||||
temp/
|
||||
main.exe
|
||||
main.exe~
|
||||
|
@ -2,22 +2,27 @@ ROOT_DIR = $(shell pwd)
|
||||
NAMESPACE = "default"
|
||||
DEPLOY_NAME = "template-single"
|
||||
DOCKER_NAME = "template-single"
|
||||
ADMIN_RESOURCE_PATH = "/resource/public/admin/"
|
||||
|
||||
# 一键编译。编译web前端,并将编译后的包移动到服务端对应静态资源路径下,最后编译服务端
|
||||
.PHONY: build
|
||||
build:
|
||||
@rm -rf ./resource/public/admin/*
|
||||
@cd ../web && yarn build && \cp -rf ./dist/* ../server/resource/public/admin/
|
||||
@rm -rf ./$(ADMIN_RESOURCE_PATH)
|
||||
@mkdir ./$(ADMIN_RESOURCE_PATH)
|
||||
@cd ../web && yarn build && \cp -rf ./dist/* ../server$(ADMIN_RESOURCE_PATH)
|
||||
@echo "y" | gf build
|
||||
|
||||
push:
|
||||
@cd $(ROOT_DIR) && cd .. && ./push.sh
|
||||
|
||||
# 通过热编译启动所有服务
|
||||
.PHONY: all
|
||||
all:
|
||||
gf run main.go --args "all"
|
||||
|
||||
# 启动web服务
|
||||
.PHONY: web
|
||||
web:
|
||||
@cd ../web && yarn serve
|
||||
@cd ../web && yarn dev
|
||||
|
||||
# 清理gf调试进程
|
||||
.PHONY: killmain
|
||||
killmain:
|
||||
@kill -9 $(ps -ef|grep main|grep -v grep|awk '{print $2}')
|
||||
|
||||
@ -91,3 +96,6 @@ deploy:
|
||||
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
|
||||
|
2
server/addons/addons.go
Normal file
2
server/addons/addons.go
Normal file
@ -0,0 +1,2 @@
|
||||
package addons
|
||||
|
39
server/addons/hgexample/README.MD
Normal file
39
server/addons/hgexample/README.MD
Normal file
@ -0,0 +1,39 @@
|
||||
## 功能案例
|
||||
|
||||
### 简介
|
||||
|
||||
系统的一些功能案例
|
||||
|
||||
|
||||
### 使用说明
|
||||
|
||||
系统自带的功能使用示例及其说明,包含一些简单的交互
|
||||
|
||||
|
||||
### 安装
|
||||
|
||||
1、安装 HotGo (2.1.4及以上)
|
||||
|
||||
项目介绍:https://github.com/bufanyun/hotgo
|
||||
|
||||
2、将当前插件项目拷贝进 HotGo 根目录的 server/addons 目录下
|
||||
|
||||
3、在 HotGo 根目录的 server/addons/modules 目录下创建go文件:hgexample.go,内容如下:
|
||||
```go
|
||||
package modules
|
||||
|
||||
import _ "hotgo/addons/hgexample"
|
||||
```
|
||||
|
||||
4、HotGo 后台进入 开发工具->插件管理->找到 功能案例 (hgexample) 进行安装
|
||||
|
||||
5、重启服务即可生效
|
||||
|
||||
|
||||
### 常用命令行
|
||||
|
||||
```shell
|
||||
# 接口维护-gen service
|
||||
gf gen service -s=addons/hgexample/logic -d=addons/hgexample/service
|
||||
|
||||
```
|
28
server/addons/hgexample/api/admin/config/config.go
Normal file
28
server/addons/hgexample/api/admin/config/config.go
Normal file
@ -0,0 +1,28 @@
|
||||
// Package config
|
||||
// @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 config
|
||||
|
||||
import (
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
"hotgo/addons/hgexample/model/input/sysin"
|
||||
)
|
||||
|
||||
// GetReq 获取指定分组的配置
|
||||
type GetReq struct {
|
||||
g.Meta `path:"/config/get" method:"get" tags:"配置" summary:"获取指定分组的配置"`
|
||||
sysin.GetConfigInp
|
||||
}
|
||||
type GetRes struct {
|
||||
*sysin.GetConfigModel
|
||||
}
|
||||
|
||||
// UpdateReq 获取指定分组的配置
|
||||
type UpdateReq struct {
|
||||
g.Meta `path:"/config/update" method:"post" tags:"配置" summary:"获取指定分组的配置"`
|
||||
sysin.UpdateConfigInp
|
||||
}
|
||||
type UpdateRes struct {
|
||||
}
|
22
server/addons/hgexample/api/admin/index/index.go
Normal file
22
server/addons/hgexample/api/admin/index/index.go
Normal file
@ -0,0 +1,22 @@
|
||||
// Package index
|
||||
// @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 index
|
||||
|
||||
import (
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
"hotgo/addons/hgexample/model/input/sysin"
|
||||
)
|
||||
|
||||
// TestReq 测试
|
||||
type TestReq struct {
|
||||
g.Meta `path:"/index/test" method:"get" tags:"功能案例" summary:"测试"`
|
||||
sysin.IndexTestInp
|
||||
}
|
||||
|
||||
type TestRes struct {
|
||||
*sysin.IndexTestModel
|
||||
}
|
77
server/addons/hgexample/api/admin/table/table.go
Normal file
77
server/addons/hgexample/api/admin/table/table.go
Normal file
@ -0,0 +1,77 @@
|
||||
// Package table
|
||||
// @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 table
|
||||
|
||||
import (
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
"hotgo/addons/hgexample/model/input/sysin"
|
||||
"hotgo/internal/model/input/form"
|
||||
)
|
||||
|
||||
// ListReq 查询列表
|
||||
type ListReq struct {
|
||||
g.Meta `path:"/table/list" method:"get" tags:"表格" summary:"获取表格列表"`
|
||||
sysin.TableListInp
|
||||
}
|
||||
|
||||
type ListRes struct {
|
||||
form.PageRes
|
||||
List []*sysin.TableListModel `json:"list" dc:"数据列表"`
|
||||
}
|
||||
|
||||
// ExportReq 导出列表
|
||||
type ExportReq struct {
|
||||
g.Meta `path:"/table/export" method:"get" tags:"表格" summary:"导出表格列表"`
|
||||
sysin.TableListInp
|
||||
}
|
||||
|
||||
type ExportRes struct{}
|
||||
|
||||
// ViewReq 获取信息
|
||||
type ViewReq struct {
|
||||
g.Meta `path:"/table/view" method:"get" tags:"表格" summary:"获取指定信息"`
|
||||
sysin.TableViewInp
|
||||
}
|
||||
type ViewRes struct {
|
||||
*sysin.TableViewModel
|
||||
}
|
||||
|
||||
// EditReq 修改/新增
|
||||
type EditReq struct {
|
||||
g.Meta `path:"/table/edit" method:"post" tags:"表格" summary:"修改/新增表格"`
|
||||
sysin.TableEditInp
|
||||
}
|
||||
type EditRes struct{}
|
||||
|
||||
// DeleteReq 删除
|
||||
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:"表格最大排序"`
|
||||
}
|
||||
type MaxSortRes struct {
|
||||
*sysin.TableMaxSortModel
|
||||
}
|
||||
|
||||
// StatusReq 更新状态
|
||||
type StatusReq struct {
|
||||
g.Meta `path:"/table/status" method:"post" tags:"表格" summary:"更新表格状态"`
|
||||
sysin.TableStatusInp
|
||||
}
|
||||
type StatusRes struct{}
|
||||
|
||||
// SwitchReq 更新开关状态
|
||||
type SwitchReq struct {
|
||||
g.Meta `path:"/table/switch" method:"post" tags:"表格" summary:"更新表格状态"`
|
||||
sysin.TableSwitchInp
|
||||
}
|
||||
type SwitchRes struct{}
|
22
server/addons/hgexample/api/api/index/index.go
Normal file
22
server/addons/hgexample/api/api/index/index.go
Normal file
@ -0,0 +1,22 @@
|
||||
// Package index
|
||||
// @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 index
|
||||
|
||||
import (
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
"hotgo/addons/hgexample/model/input/sysin"
|
||||
)
|
||||
|
||||
// TestReq 测试
|
||||
type TestReq struct {
|
||||
g.Meta `path:"/index/test" method:"get" tags:"功能案例" summary:"测试"`
|
||||
sysin.IndexTestInp
|
||||
}
|
||||
|
||||
type TestRes struct {
|
||||
*sysin.IndexTestModel
|
||||
}
|
22
server/addons/hgexample/api/home/index/index.go
Normal file
22
server/addons/hgexample/api/home/index/index.go
Normal file
@ -0,0 +1,22 @@
|
||||
// Package index
|
||||
// @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 index
|
||||
|
||||
import (
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
"hotgo/addons/hgexample/model/input/sysin"
|
||||
)
|
||||
|
||||
// TestReq 测试
|
||||
type TestReq struct {
|
||||
g.Meta `path:"/index/test" method:"get" summary:"功能案例" tags:"测试首页"`
|
||||
sysin.IndexTestInp
|
||||
}
|
||||
|
||||
type TestRes struct {
|
||||
g.Meta `mime:"text/html" type:"string" example:"<html/>"`
|
||||
}
|
22
server/addons/hgexample/api/websocket/index/index.go
Normal file
22
server/addons/hgexample/api/websocket/index/index.go
Normal file
@ -0,0 +1,22 @@
|
||||
// Package index
|
||||
// @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 index
|
||||
|
||||
import (
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
"hotgo/addons/hgexample/model/input/sysin"
|
||||
)
|
||||
|
||||
// TestReq 测试
|
||||
type TestReq struct {
|
||||
g.Meta `path:"/index/test" method:"get" tags:"功能案例" summary:"测试"`
|
||||
sysin.IndexTestInp
|
||||
}
|
||||
|
||||
type TestRes struct {
|
||||
*sysin.IndexTestModel
|
||||
}
|
46
server/addons/hgexample/controller/admin/sys/config.go
Normal file
46
server/addons/hgexample/controller/admin/sys/config.go
Normal file
@ -0,0 +1,46 @@
|
||||
// Package sys
|
||||
// @Link https://github.com/bufanyun/hotgo
|
||||
// @Copyright Copyright (c) 2023 HotGo CLI
|
||||
// @Author Ms <133814250@qq.com>
|
||||
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
|
||||
package sys
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/gogf/gf/v2/util/gconv"
|
||||
"hotgo/addons/hgexample/model/input/sysin"
|
||||
"hotgo/addons/hgexample/service"
|
||||
"hotgo/api/admin/config"
|
||||
isysin "hotgo/internal/model/input/sysin"
|
||||
)
|
||||
|
||||
var (
|
||||
Config = cConfig{}
|
||||
)
|
||||
|
||||
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)
|
||||
|
||||
res = new(config.GetRes)
|
||||
res.GetConfigModel = (*isysin.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)
|
||||
return
|
||||
}
|
43
server/addons/hgexample/controller/admin/sys/index.go
Normal file
43
server/addons/hgexample/controller/admin/sys/index.go
Normal file
@ -0,0 +1,43 @@
|
||||
// Package sys
|
||||
// @Link https://github.com/bufanyun/hotgo
|
||||
// @Copyright Copyright (c) 2023 HotGo CLI
|
||||
// @Author Ms <133814250@qq.com>
|
||||
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
|
||||
//
|
||||
package sys
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/gogf/gf/v2/util/gconv"
|
||||
"hotgo/addons/hgexample/api/admin/index"
|
||||
"hotgo/addons/hgexample/model/input/sysin"
|
||||
"hotgo/addons/hgexample/service"
|
||||
"hotgo/utility/validate"
|
||||
)
|
||||
|
||||
var (
|
||||
Index = cIndex{}
|
||||
)
|
||||
|
||||
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)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(index.TestRes)
|
||||
res.IndexTestModel = data
|
||||
return
|
||||
}
|
135
server/addons/hgexample/controller/admin/sys/table.go
Normal file
135
server/addons/hgexample/controller/admin/sys/table.go
Normal file
@ -0,0 +1,135 @@
|
||||
// Package sys
|
||||
// @Link https://github.com/bufanyun/hotgo
|
||||
// @Copyright Copyright (c) 2023 HotGo CLI
|
||||
// @Author Ms <133814250@qq.com>
|
||||
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
|
||||
//
|
||||
package sys
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/gogf/gf/v2/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 (
|
||||
Table = cTable{}
|
||||
)
|
||||
|
||||
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)
|
||||
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
|
||||
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)
|
||||
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)
|
||||
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{})
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(table.MaxSortRes)
|
||||
res.TableMaxSortModel = data
|
||||
return
|
||||
}
|
||||
|
||||
// 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)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(table.ViewRes)
|
||||
res.TableViewModel = data
|
||||
return
|
||||
}
|
||||
|
||||
// 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)
|
||||
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)
|
||||
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)
|
||||
return
|
||||
}
|
43
server/addons/hgexample/controller/api/index.go
Normal file
43
server/addons/hgexample/controller/api/index.go
Normal file
@ -0,0 +1,43 @@
|
||||
// Package api
|
||||
// @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 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 (
|
||||
Index = cIndex{}
|
||||
)
|
||||
|
||||
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)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(index.TestRes)
|
||||
res.IndexTestModel = data
|
||||
return
|
||||
}
|
48
server/addons/hgexample/controller/home/index.go
Normal file
48
server/addons/hgexample/controller/home/index.go
Normal file
@ -0,0 +1,48 @@
|
||||
// Package home
|
||||
// @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 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/global"
|
||||
"hotgo/addons/hgexample/model/input/sysin"
|
||||
"hotgo/addons/hgexample/service"
|
||||
"hotgo/internal/model"
|
||||
isc "hotgo/internal/service"
|
||||
"hotgo/utility/validate"
|
||||
)
|
||||
|
||||
// Index 基础
|
||||
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)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
isc.View().RenderTpl(ctx, global.Tpl("home/index.html"), model.View{Data: g.Map{
|
||||
"name": data.Name,
|
||||
"module": data.Module,
|
||||
"time": data.Time,
|
||||
}})
|
||||
return
|
||||
}
|
43
server/addons/hgexample/controller/websocket/index.go
Normal file
43
server/addons/hgexample/controller/websocket/index.go
Normal file
@ -0,0 +1,43 @@
|
||||
// Package websocket
|
||||
// @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 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 (
|
||||
Index = cIndex{}
|
||||
)
|
||||
|
||||
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)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(index.TestRes)
|
||||
res.IndexTestModel = data
|
||||
return
|
||||
}
|
12
server/addons/hgexample/global/global.go
Normal file
12
server/addons/hgexample/global/global.go
Normal file
@ -0,0 +1,12 @@
|
||||
// Package global
|
||||
// @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 global
|
||||
|
||||
import "hotgo/internal/library/addons"
|
||||
|
||||
var (
|
||||
skeleton *addons.Skeleton // 插件架子
|
||||
)
|
26
server/addons/hgexample/global/init.go
Normal file
26
server/addons/hgexample/global/init.go
Normal file
@ -0,0 +1,26 @@
|
||||
// Package global
|
||||
// @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 global
|
||||
|
||||
import (
|
||||
"context"
|
||||
"hotgo/internal/library/addons"
|
||||
)
|
||||
|
||||
func Init(ctx context.Context, sk *addons.Skeleton) {
|
||||
skeleton = sk
|
||||
}
|
||||
|
||||
func GetSkeleton() *addons.Skeleton {
|
||||
if skeleton == nil {
|
||||
panic("addon skeleton not initialized.")
|
||||
}
|
||||
return skeleton
|
||||
}
|
||||
|
||||
func Tpl(tpl string) string {
|
||||
return addons.Tpl(skeleton.Name, tpl)
|
||||
}
|
9
server/addons/hgexample/logic/logic.go
Normal file
9
server/addons/hgexample/logic/logic.go
Normal file
@ -0,0 +1,9 @@
|
||||
// ==========================================================================
|
||||
// Code generated by GoFrame CLI tool. DO NOT EDIT.
|
||||
// ==========================================================================
|
||||
|
||||
package logic
|
||||
|
||||
import (
|
||||
_ "hotgo/addons/hgexample/logic/sys"
|
||||
)
|
54
server/addons/hgexample/logic/sys/config.go
Normal file
54
server/addons/hgexample/logic/sys/config.go
Normal file
@ -0,0 +1,54 @@
|
||||
package sys
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/gogf/gf/v2/util/gconv"
|
||||
"hotgo/addons/hgexample/global"
|
||||
"hotgo/addons/hgexample/model"
|
||||
"hotgo/addons/hgexample/model/input/sysin"
|
||||
"hotgo/addons/hgexample/service"
|
||||
isc "hotgo/internal/service"
|
||||
)
|
||||
|
||||
type sSysConfig struct{}
|
||||
|
||||
func NewSysConfig() *sSysConfig {
|
||||
return &sSysConfig{}
|
||||
}
|
||||
|
||||
func init() {
|
||||
service.RegisterSysConfig(NewSysConfig())
|
||||
}
|
||||
|
||||
// GetBasic 获取基础配置
|
||||
func (s *sSysConfig) GetBasic(ctx context.Context) (conf *model.BasicConfig, err error) {
|
||||
var in sysin.GetConfigInp
|
||||
in.GetAddonsConfigInp.AddonName = global.GetSkeleton().Name
|
||||
in.GetAddonsConfigInp.Group = "basic"
|
||||
models, err := isc.SysAddonsConfig().GetConfigByGroup(ctx, in.GetAddonsConfigInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
err = gconv.Struct(models.List, &conf)
|
||||
return
|
||||
}
|
||||
|
||||
// GetConfigByGroup 获取指定分组配置
|
||||
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)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(sysin.GetConfigModel)
|
||||
res.List = models.List
|
||||
return
|
||||
}
|
||||
|
||||
// UpdateConfigByGroup 更新指定分组的配置
|
||||
func (s *sSysConfig) UpdateConfigByGroup(ctx context.Context, in sysin.UpdateConfigInp) error {
|
||||
in.UpdateAddonsConfigInp.AddonName = global.GetSkeleton().Name
|
||||
return isc.SysAddonsConfig().UpdateConfigByGroup(ctx, in.UpdateAddonsConfigInp)
|
||||
}
|
35
server/addons/hgexample/logic/sys/index.go
Normal file
35
server/addons/hgexample/logic/sys/index.go
Normal file
@ -0,0 +1,35 @@
|
||||
// Package sys
|
||||
// @Link https://github.com/bufanyun/hotgo
|
||||
// @Copyright Copyright (c) 2023 HotGo CLI
|
||||
// @Author Ms <133814250@qq.com>
|
||||
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
|
||||
package sys
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"github.com/gogf/gf/v2/os/gtime"
|
||||
"hotgo/addons/hgexample/global"
|
||||
"hotgo/addons/hgexample/model/input/sysin"
|
||||
"hotgo/addons/hgexample/service"
|
||||
"hotgo/internal/library/contexts"
|
||||
)
|
||||
|
||||
type sSysIndex struct{}
|
||||
|
||||
func NewSysIndex() *sSysIndex {
|
||||
return &sSysIndex{}
|
||||
}
|
||||
|
||||
func init() {
|
||||
service.RegisterSysIndex(NewSysIndex())
|
||||
}
|
||||
|
||||
// Test 测试
|
||||
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)
|
||||
res.Time = gtime.Now()
|
||||
return
|
||||
}
|
244
server/addons/hgexample/logic/sys/table.go
Normal file
244
server/addons/hgexample/logic/sys/table.go
Normal file
@ -0,0 +1,244 @@
|
||||
// Package sys
|
||||
// @Link https://github.com/bufanyun/hotgo
|
||||
// @Copyright Copyright (c) 2023 HotGo CLI
|
||||
// @Author Ms <133814250@qq.com>
|
||||
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
|
||||
package sys
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"github.com/gogf/gf/v2/database/gdb"
|
||||
"github.com/gogf/gf/v2/errors/gerror"
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
"github.com/gogf/gf/v2/os/gctx"
|
||||
"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"
|
||||
"hotgo/internal/library/hgorm/handler"
|
||||
"hotgo/internal/model/input/form"
|
||||
"hotgo/utility/convert"
|
||||
"hotgo/utility/excel"
|
||||
"hotgo/utility/validate"
|
||||
)
|
||||
|
||||
type sSysTable struct{}
|
||||
|
||||
func NewSysTable() *sSysTable {
|
||||
return &sSysTable{}
|
||||
}
|
||||
|
||||
func init() {
|
||||
service.RegisterSysTable(NewSysTable())
|
||||
}
|
||||
|
||||
// Model Orm模型
|
||||
func (s *sSysTable) Model(ctx context.Context, option ...*handler.Option) *gdb.Model {
|
||||
return handler.Model(dao.AddonHgexampleTable.Ctx(ctx), option...)
|
||||
}
|
||||
|
||||
// List 获取列表
|
||||
func (s *sSysTable) List(ctx context.Context, in sysin.TableListInp) (list []*sysin.TableListModel, totalCount int, err error) {
|
||||
mod := s.Model(ctx)
|
||||
|
||||
if in.Title != "" {
|
||||
mod = mod.WhereLike(dao.AddonHgexampleTable.Columns().Title, "%"+in.Title+"%")
|
||||
}
|
||||
|
||||
if in.Content != "" {
|
||||
mod = mod.WhereLike(dao.AddonHgexampleTable.Columns().Content, "%"+in.Content+"%")
|
||||
}
|
||||
|
||||
if in.Status > 0 {
|
||||
mod = mod.Where(dao.AddonHgexampleTable.Columns().Status, in.Status)
|
||||
}
|
||||
|
||||
if in.Switch > 0 {
|
||||
mod = mod.Where(dao.AddonHgexampleTable.Columns().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.ActivityAt != nil {
|
||||
mod = mod.Where(dao.AddonHgexampleTable.Columns().ActivityAt, in.ActivityAt)
|
||||
}
|
||||
|
||||
if len(in.CreatedAt) == 2 {
|
||||
mod = mod.WhereBetween(dao.AddonHgexampleTable.Columns().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))
|
||||
}
|
||||
|
||||
if !in.Hobby.IsNil() {
|
||||
mod = mod.Where(fmt.Sprintf(`JSON_CONTAINS(%s,'%v')`, dao.AddonHgexampleTable.Columns().Hobby, in.Hobby))
|
||||
}
|
||||
|
||||
//// 关联表testCategory
|
||||
//mod = mod.LeftJoin(hgorm.GenJoinOnRelation(
|
||||
// dao.AddonHgexampleTable.Table(), dao.AddonHgexampleTable.Columns().CategoryId, // 主表表名,关联条件
|
||||
// dao.AddonHgexampleTableCategory.Table(), "testCategory", dao.AddonHgexampleTableCategory.Columns().Id, // 关联表表名,别名,关联条件
|
||||
//)...)
|
||||
//
|
||||
//mod = mod.Where(`testCategory.`+dao.AddonHgexampleTableCategory.Columns().Name, "微信公众号")
|
||||
|
||||
totalCount, err = mod.Clone().Count(1)
|
||||
if err != nil {
|
||||
err = gerror.Wrap(err, consts.ErrorORM)
|
||||
return
|
||||
}
|
||||
|
||||
if totalCount == 0 {
|
||||
return
|
||||
}
|
||||
|
||||
////关联表select
|
||||
//fields, err := hgorm.GenJoinSelect(ctx, sysin.TableListModel{}, dao.AddonHgexampleTable, []*hgorm.Join{
|
||||
// {Dao: dao.AddonHgexampleTableCategory, Alias: "testCategory"},
|
||||
// //{Dao: dao.AddonHgexampleTableCategory, Alias: "testCategory"},
|
||||
//})
|
||||
|
||||
fields, err := hgorm.GenSelect(ctx, sysin.TableListModel{}, dao.AddonHgexampleTable)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if err = mod.Fields(fields).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)
|
||||
return
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// Export 导出
|
||||
func (s *sSysTable) Export(ctx context.Context, in sysin.TableListInp) (err error) {
|
||||
list, totalCount, err := s.List(ctx, in)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
// 字段的排序是依据tags的字段顺序,如果你不想使用默认的排序方式,可以直接定义 tags = []string{"字段名称", "字段名称2", ...}
|
||||
tags, err := convert.GetEntityDescTags(sysin.TableExportModel{})
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
var (
|
||||
fileName = "表格例子导出-" + gctx.CtxId(ctx) + ".xlsx"
|
||||
sheetName = fmt.Sprintf("索引条件共%v行,共%v页,当前导出是第%v页,本页共%v行", totalCount, form.CalPageCount(totalCount, in.PerPage), in.Page, len(list))
|
||||
exports []sysin.TableExportModel
|
||||
)
|
||||
|
||||
if err = gconv.Scan(list, &exports); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if err = excel.ExportByStructs(ctx, tags, exports, fileName, sheetName); err != nil {
|
||||
return
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// 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 {
|
||||
return
|
||||
}
|
||||
|
||||
// 修改
|
||||
if in.Id > 0 {
|
||||
in.UpdatedBy = contexts.GetUserId(ctx)
|
||||
_, err = s.Model(ctx).Where(dao.AddonHgexampleTable.Columns().Id, in.Id).Data(in).Update()
|
||||
return
|
||||
}
|
||||
|
||||
// 新增
|
||||
in.CreatedBy = contexts.GetUserId(ctx)
|
||||
_, err = s.Model(ctx, &handler.Option{FilterAuth: false}).Data(in).Insert()
|
||||
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()
|
||||
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.InSliceInt(consts.StatusMap, in.Status) {
|
||||
err = gerror.New("状态不正确")
|
||||
return
|
||||
}
|
||||
|
||||
// 修改
|
||||
_, err = s.Model(ctx).Where(dao.AddonHgexampleTable.Columns().Id, in.Id).Data(g.Map{
|
||||
dao.AddonHgexampleTable.Columns().Status: in.Status,
|
||||
dao.AddonHgexampleTable.Columns().UpdatedBy: contexts.GetUserId(ctx),
|
||||
}).Update()
|
||||
return
|
||||
}
|
||||
|
||||
// Switch 更新开关状态
|
||||
func (s *sSysTable) Switch(ctx context.Context, in sysin.TableSwitchInp) (err error) {
|
||||
var fields = []string{
|
||||
dao.AddonHgexampleTable.Columns().Switch,
|
||||
// ...
|
||||
}
|
||||
|
||||
if !validate.InSliceString(fields, in.Key) {
|
||||
err = gerror.New("开关键名不在白名单")
|
||||
return
|
||||
}
|
||||
|
||||
// 修改
|
||||
_, err = s.Model(ctx).Where(dao.AddonHgexampleTable.Columns().Id, in.Id).Data(g.Map{
|
||||
in.Key: in.Value,
|
||||
dao.AddonHgexampleTable.Columns().UpdatedBy: contexts.GetUserId(ctx),
|
||||
}).Update()
|
||||
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)
|
||||
return
|
||||
}
|
||||
|
||||
if res == nil {
|
||||
res = new(sysin.TableMaxSortModel)
|
||||
}
|
||||
|
||||
res.Sort = form.DefaultMaxSort(ctx, 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)
|
||||
return
|
||||
}
|
89
server/addons/hgexample/main.go
Normal file
89
server/addons/hgexample/main.go
Normal file
@ -0,0 +1,89 @@
|
||||
// Package hgexample
|
||||
// @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 hgexample
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/gogf/gf/v2/net/ghttp"
|
||||
"github.com/gogf/gf/v2/os/gctx"
|
||||
"hotgo/addons/hgexample/global"
|
||||
_ "hotgo/addons/hgexample/logic"
|
||||
"hotgo/addons/hgexample/router"
|
||||
"hotgo/internal/library/addons"
|
||||
"sync"
|
||||
)
|
||||
|
||||
type module struct {
|
||||
skeleton *addons.Skeleton
|
||||
ctx context.Context
|
||||
sync.Mutex
|
||||
}
|
||||
|
||||
func init() {
|
||||
newModule()
|
||||
}
|
||||
|
||||
func newModule() {
|
||||
m := &module{
|
||||
skeleton: &addons.Skeleton{
|
||||
Label: "功能案例",
|
||||
Name: "hgexample",
|
||||
Group: 1,
|
||||
Logo: "",
|
||||
Brief: "系统的一些功能案例",
|
||||
Description: "系统自带的功能使用示例及其说明,包含一些简单的交互",
|
||||
Author: "孟帅",
|
||||
Version: "v1.0.0", // 当该版本号高于已安装的版本号时,会提示可以更新
|
||||
RootPath: addons.GetModulePath("hgexample"),
|
||||
},
|
||||
ctx: gctx.New(),
|
||||
}
|
||||
|
||||
addons.RegisterModule(m)
|
||||
}
|
||||
|
||||
// Init 初始化
|
||||
func (m *module) Init(ctx context.Context) {
|
||||
global.Init(ctx, m.skeleton)
|
||||
// ...
|
||||
}
|
||||
|
||||
// InitRouter 初始化WEB路由
|
||||
func (m *module) InitRouter(ctx context.Context, group *ghttp.RouterGroup) {
|
||||
m.Init(ctx)
|
||||
router.Admin(ctx, group)
|
||||
router.Api(ctx, group)
|
||||
router.Home(ctx, group)
|
||||
router.WebSocket(ctx, group)
|
||||
}
|
||||
|
||||
// Ctx 上下文
|
||||
func (m *module) Ctx() context.Context {
|
||||
return m.ctx
|
||||
}
|
||||
|
||||
// GetSkeleton 架子
|
||||
func (m *module) GetSkeleton() *addons.Skeleton {
|
||||
return m.skeleton
|
||||
}
|
||||
|
||||
// Install 安装模块
|
||||
func (m *module) Install(ctx context.Context) (err error) {
|
||||
// ...
|
||||
return
|
||||
}
|
||||
|
||||
// Upgrade 更新模块
|
||||
func (m *module) Upgrade(ctx context.Context) (err error) {
|
||||
// ...
|
||||
return
|
||||
}
|
||||
|
||||
// UnInstall 卸载模块
|
||||
func (m *module) UnInstall(ctx context.Context) (err error) {
|
||||
// ...
|
||||
return
|
||||
}
|
11
server/addons/hgexample/model/config.go
Normal file
11
server/addons/hgexample/model/config.go
Normal file
@ -0,0 +1,11 @@
|
||||
// Package model
|
||||
// @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 model
|
||||
|
||||
// BasicConfig 基础配置
|
||||
type BasicConfig struct {
|
||||
Test string `json:"basicTest"`
|
||||
}
|
24
server/addons/hgexample/model/input/sysin/config.go
Normal file
24
server/addons/hgexample/model/input/sysin/config.go
Normal file
@ -0,0 +1,24 @@
|
||||
// Package sysin
|
||||
// @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 sysin
|
||||
|
||||
import (
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
"hotgo/internal/model/input/sysin"
|
||||
)
|
||||
|
||||
// UpdateConfigInp 更新指定配置
|
||||
type UpdateConfigInp struct {
|
||||
sysin.UpdateAddonsConfigInp
|
||||
}
|
||||
|
||||
type GetConfigInp struct {
|
||||
sysin.GetAddonsConfigInp
|
||||
}
|
||||
|
||||
type GetConfigModel struct {
|
||||
List g.Map `json:"list"`
|
||||
}
|
27
server/addons/hgexample/model/input/sysin/index.go
Normal file
27
server/addons/hgexample/model/input/sysin/index.go
Normal file
@ -0,0 +1,27 @@
|
||||
// Package sysin
|
||||
// @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 sysin
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/gogf/gf/v2/os/gtime"
|
||||
)
|
||||
|
||||
// IndexTestInp 测试
|
||||
type IndexTestInp struct {
|
||||
Name string `json:"name" d:"HotGo" dc:"名称"`
|
||||
}
|
||||
|
||||
func (in *IndexTestInp) Filter(ctx context.Context) (err error) {
|
||||
return
|
||||
}
|
||||
|
||||
type IndexTestModel struct {
|
||||
Name string `json:"name" dc:"名称"`
|
||||
Module string `json:"module" dc:"当前插件模块"`
|
||||
Time *gtime.Time `json:"time" dc:"当前时间"`
|
||||
}
|
@ -1,10 +1,10 @@
|
||||
// Package adminin
|
||||
// Package sysin
|
||||
// @Link https://github.com/bufanyun/hotgo
|
||||
// @Copyright Copyright (c) 2022 HotGo CLI
|
||||
// @Copyright Copyright (c) 2023 HotGo CLI
|
||||
// @Author Ms <133814250@qq.com>
|
||||
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
|
||||
//
|
||||
package adminin
|
||||
package sysin
|
||||
|
||||
import (
|
||||
"context"
|
||||
@ -18,14 +18,14 @@ import (
|
||||
"hotgo/utility/validate"
|
||||
)
|
||||
|
||||
// TestEditInp 修改/新增
|
||||
type TestEditInp struct {
|
||||
entity.Test
|
||||
// TableEditInp 修改/新增
|
||||
type TableEditInp struct {
|
||||
entity.AddonHgexampleTable
|
||||
}
|
||||
|
||||
type TestEditModel struct{}
|
||||
type TableEditModel struct{}
|
||||
|
||||
func (in *TestEditInp) Filter(ctx context.Context) (err error) {
|
||||
func (in *TableEditInp) Filter(ctx context.Context) (err error) {
|
||||
if in.Map.IsNil() {
|
||||
in.Map = gjson.New(consts.NilJsonToString)
|
||||
}
|
||||
@ -57,24 +57,24 @@ func (in *TestEditInp) Filter(ctx context.Context) (err error) {
|
||||
return
|
||||
}
|
||||
|
||||
// TestDeleteInp 删除类型
|
||||
type TestDeleteInp struct {
|
||||
Id interface{} `json:"id" v:"required#测试ID不能为空" dc:"测试ID"`
|
||||
// TableDeleteInp 删除类型
|
||||
type TableDeleteInp struct {
|
||||
Id interface{} `json:"id" v:"required#表格ID不能为空" dc:"表格ID"`
|
||||
}
|
||||
|
||||
type TestDeleteModel struct{}
|
||||
type TableDeleteModel struct{}
|
||||
|
||||
// TestViewInp 获取信息
|
||||
type TestViewInp struct {
|
||||
Id int64 `json:"id" v:"required#测试ID不能为空" dc:"测试ID"`
|
||||
// TableViewInp 获取信息
|
||||
type TableViewInp struct {
|
||||
Id int64 `json:"id" v:"required#表格ID不能为空" dc:"表格ID"`
|
||||
}
|
||||
|
||||
type TestViewModel struct {
|
||||
entity.Test
|
||||
type TableViewModel struct {
|
||||
entity.AddonHgexampleTable
|
||||
}
|
||||
|
||||
// TestListInp 获取列表
|
||||
type TestListInp struct {
|
||||
// TableListInp 获取列表
|
||||
type TableListInp struct {
|
||||
form.PageReq
|
||||
Id int64 `json:"id" description:""`
|
||||
Flag *gjson.Json `json:"flag" description:"标签"`
|
||||
@ -88,15 +88,15 @@ type TestListInp struct {
|
||||
CreatedAt []*gtime.Time `json:"createdAt" description:"创建时间"`
|
||||
}
|
||||
|
||||
type TestListModel struct {
|
||||
entity.Test
|
||||
TestCategoryName string `json:"testCategoryName" description:"分类名称"`
|
||||
TestCategoryDescription string `json:"testCategoryDescription" description:"分类描述"`
|
||||
TestCategoryRemark string `json:"testCategoryRemark" description:"分类备注"`
|
||||
type TableListModel struct {
|
||||
entity.AddonHgexampleTable
|
||||
TableCategoryName string `json:"TableCategoryName" description:"分类名称"`
|
||||
TableCategoryDescription string `json:"TableCategoryDescription" description:"分类描述"`
|
||||
TableCategoryRemark string `json:"TableCategoryRemark" description:"分类备注"`
|
||||
SysProvincesTitle string `json:"sysProvincesTitle" description:""`
|
||||
}
|
||||
|
||||
func (in *TestListInp) Filter(ctx context.Context) (err error) {
|
||||
func (in *TableListInp) Filter(ctx context.Context) (err error) {
|
||||
if !in.Flag.IsNil() {
|
||||
in.Flag = gjson.New(in.Flag.Var().Ints())
|
||||
}
|
||||
@ -106,7 +106,7 @@ func (in *TestListInp) Filter(ctx context.Context) (err error) {
|
||||
return
|
||||
}
|
||||
|
||||
type TestExportModel struct {
|
||||
type TableExportModel struct {
|
||||
Id int64 `json:"id" description:""`
|
||||
CategoryId int64 `json:"categoryId" description:"分类ID"`
|
||||
Flag *gjson.Json `json:"flag" description:"标签"`
|
||||
@ -138,25 +138,25 @@ type TestExportModel struct {
|
||||
DeletedAt *gtime.Time `json:"deletedAt" description:"删除时间"`
|
||||
}
|
||||
|
||||
// TestMaxSortInp 最大排序
|
||||
type TestMaxSortInp struct{}
|
||||
// TableMaxSortInp 最大排序
|
||||
type TableMaxSortInp struct{}
|
||||
|
||||
type TestMaxSortModel struct {
|
||||
type TableMaxSortModel struct {
|
||||
Sort int `json:"sort" description:"排序"`
|
||||
}
|
||||
|
||||
// TestStatusInp 更新状态
|
||||
type TestStatusInp struct {
|
||||
Id int64 `json:"id" v:"required#测试ID不能为空" dc:"测试ID"`
|
||||
// TableStatusInp 更新状态
|
||||
type TableStatusInp struct {
|
||||
Id int64 `json:"id" v:"required#表格ID不能为空" dc:"表格ID"`
|
||||
Status int `json:"status" dc:"状态"`
|
||||
}
|
||||
|
||||
type TestStatusModel struct{}
|
||||
type TableStatusModel struct{}
|
||||
|
||||
// TestSwitchInp 更新开关状态
|
||||
type TestSwitchInp struct {
|
||||
// TableSwitchInp 更新开关状态
|
||||
type TableSwitchInp struct {
|
||||
form.SwitchReq
|
||||
Id int64 `json:"id" v:"required#测试ID不能为空" dc:"测试ID"`
|
||||
Id int64 `json:"id" v:"required#表格ID不能为空" dc:"表格ID"`
|
||||
}
|
||||
|
||||
type TestSwitchModel struct{}
|
||||
type TableSwitchModel struct{}
|
34
server/addons/hgexample/router/admin.go
Normal file
34
server/addons/hgexample/router/admin.go
Normal file
@ -0,0 +1,34 @@
|
||||
// Package router
|
||||
// @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 router
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/gogf/gf/v2/net/ghttp"
|
||||
"hotgo/addons/hgexample/controller/admin/sys"
|
||||
"hotgo/addons/hgexample/global"
|
||||
"hotgo/addons/hgexample/router/genrouter"
|
||||
"hotgo/internal/consts"
|
||||
"hotgo/internal/library/addons"
|
||||
"hotgo/internal/service"
|
||||
)
|
||||
|
||||
func Admin(ctx context.Context, group *ghttp.RouterGroup) {
|
||||
prefix := addons.RouterPrefix(ctx, consts.AppAdmin, global.GetSkeleton().Name)
|
||||
group.Group(prefix, func(group *ghttp.RouterGroup) {
|
||||
group.Bind(
|
||||
sys.Index,
|
||||
)
|
||||
group.Middleware(service.Middleware().AdminAuth)
|
||||
group.Bind(
|
||||
sys.Config,
|
||||
sys.Table,
|
||||
)
|
||||
})
|
||||
|
||||
// 注册生成路由
|
||||
genrouter.Register(ctx, group)
|
||||
}
|
32
server/addons/hgexample/router/api.go
Normal file
32
server/addons/hgexample/router/api.go
Normal file
@ -0,0 +1,32 @@
|
||||
// Package router
|
||||
// @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 router
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/gogf/gf/v2/net/ghttp"
|
||||
"hotgo/addons/hgexample/controller/api"
|
||||
"hotgo/addons/hgexample/global"
|
||||
"hotgo/internal/consts"
|
||||
"hotgo/internal/library/addons"
|
||||
"hotgo/internal/service"
|
||||
)
|
||||
|
||||
// Api 前台路由
|
||||
func Api(ctx context.Context, group *ghttp.RouterGroup) {
|
||||
prefix := addons.RouterPrefix(ctx, consts.AppApi, global.GetSkeleton().Name)
|
||||
group.Group(prefix, func(group *ghttp.RouterGroup) {
|
||||
group.Bind(
|
||||
// 无需验证的路由
|
||||
api.Index,
|
||||
)
|
||||
group.Middleware(service.Middleware().ApiAuth)
|
||||
group.Bind(
|
||||
// 需要验证的路由
|
||||
// ...
|
||||
)
|
||||
})
|
||||
}
|
34
server/addons/hgexample/router/genrouter/init.go
Normal file
34
server/addons/hgexample/router/genrouter/init.go
Normal file
@ -0,0 +1,34 @@
|
||||
// Package genrouter
|
||||
// @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 genrouter
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/gogf/gf/v2/net/ghttp"
|
||||
"hotgo/addons/hgexample/global"
|
||||
"hotgo/internal/consts"
|
||||
"hotgo/internal/library/addons"
|
||||
"hotgo/internal/service"
|
||||
)
|
||||
|
||||
var (
|
||||
NoLogin []interface{} // 无需登录
|
||||
LoginRequiredRouter []interface{} // 需要登录
|
||||
)
|
||||
|
||||
// Register 注册通过代码生成的后台路由
|
||||
func Register(ctx context.Context, group *ghttp.RouterGroup) {
|
||||
prefix := addons.RouterPrefix(ctx, consts.AppAdmin, global.GetSkeleton().Name)
|
||||
group.Group(prefix, func(group *ghttp.RouterGroup) {
|
||||
if len(NoLogin) > 0 {
|
||||
group.Bind(NoLogin...)
|
||||
}
|
||||
group.Middleware(service.Middleware().AdminAuth)
|
||||
if len(LoginRequiredRouter) > 0 {
|
||||
group.Bind(LoginRequiredRouter...)
|
||||
}
|
||||
})
|
||||
}
|
25
server/addons/hgexample/router/home.go
Normal file
25
server/addons/hgexample/router/home.go
Normal file
@ -0,0 +1,25 @@
|
||||
// Package router
|
||||
// @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 router
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/gogf/gf/v2/net/ghttp"
|
||||
"hotgo/addons/hgexample/controller/home"
|
||||
"hotgo/addons/hgexample/global"
|
||||
"hotgo/internal/consts"
|
||||
"hotgo/internal/library/addons"
|
||||
)
|
||||
|
||||
// Home 前台页面路由
|
||||
func Home(ctx context.Context, group *ghttp.RouterGroup) {
|
||||
prefix := addons.RouterPrefix(ctx, consts.AppHome, global.GetSkeleton().Name)
|
||||
group.Group(prefix, func(group *ghttp.RouterGroup) {
|
||||
group.Bind(
|
||||
home.Index,
|
||||
)
|
||||
})
|
||||
}
|
40
server/addons/hgexample/router/websocket.go
Normal file
40
server/addons/hgexample/router/websocket.go
Normal file
@ -0,0 +1,40 @@
|
||||
// Package router
|
||||
// @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 router
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/gogf/gf/v2/net/ghttp"
|
||||
"hotgo/addons/hgexample/controller/websocket"
|
||||
"hotgo/addons/hgexample/global"
|
||||
"hotgo/internal/consts"
|
||||
"hotgo/internal/library/addons"
|
||||
"hotgo/internal/service"
|
||||
ws "hotgo/internal/websocket"
|
||||
)
|
||||
|
||||
// WebSocket ws路由配置
|
||||
func WebSocket(ctx context.Context, group *ghttp.RouterGroup) {
|
||||
prefix := addons.RouterPrefix(ctx, consts.AppWebSocket, global.GetSkeleton().Name)
|
||||
group.Group(prefix, func(group *ghttp.RouterGroup) {
|
||||
group.Bind(
|
||||
// 无需验证的路由
|
||||
websocket.Index,
|
||||
)
|
||||
// ws连接中间件
|
||||
group.Middleware(service.Middleware().WebSocketToken)
|
||||
group.Bind(
|
||||
// 需要验证的路由
|
||||
// ..
|
||||
)
|
||||
})
|
||||
|
||||
// 注册消息路由
|
||||
ws.RegisterMsg(ws.EventHandlers{
|
||||
// ...
|
||||
})
|
||||
|
||||
}
|
0
server/addons/hgexample/service/.gitkeep
Normal file
0
server/addons/hgexample/service/.gitkeep
Normal file
76
server/addons/hgexample/service/sys.go
Normal file
76
server/addons/hgexample/service/sys.go
Normal file
@ -0,0 +1,76 @@
|
||||
// ================================================================================
|
||||
// Code generated by GoFrame CLI tool. DO NOT EDIT.
|
||||
// You can delete these comments if you wish manually maintain this interface file.
|
||||
// ================================================================================
|
||||
|
||||
package service
|
||||
|
||||
import (
|
||||
"context"
|
||||
"hotgo/addons/hgexample/model"
|
||||
"hotgo/addons/hgexample/model/input/sysin"
|
||||
"hotgo/internal/library/hgorm/handler"
|
||||
|
||||
"github.com/gogf/gf/v2/database/gdb"
|
||||
)
|
||||
|
||||
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
|
||||
}
|
||||
ISysIndex interface {
|
||||
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)
|
||||
}
|
||||
)
|
||||
|
||||
var (
|
||||
localSysTable ISysTable
|
||||
localSysConfig ISysConfig
|
||||
localSysIndex ISysIndex
|
||||
)
|
||||
|
||||
func SysConfig() ISysConfig {
|
||||
if localSysConfig == nil {
|
||||
panic("implement not found for interface ISysConfig, forgot register?")
|
||||
}
|
||||
return localSysConfig
|
||||
}
|
||||
|
||||
func RegisterSysConfig(i ISysConfig) {
|
||||
localSysConfig = i
|
||||
}
|
||||
|
||||
func SysIndex() ISysIndex {
|
||||
if localSysIndex == nil {
|
||||
panic("implement not found for interface ISysIndex, forgot register?")
|
||||
}
|
||||
return localSysIndex
|
||||
}
|
||||
|
||||
func RegisterSysIndex(i ISysIndex) {
|
||||
localSysIndex = i
|
||||
}
|
||||
|
||||
func SysTable() ISysTable {
|
||||
if localSysTable == nil {
|
||||
panic("implement not found for interface ISysTable, forgot register?")
|
||||
}
|
||||
return localSysTable
|
||||
}
|
||||
|
||||
func RegisterSysTable(i ISysTable) {
|
||||
localSysTable = i
|
||||
}
|
0
server/addons/modules/.gitkeep
Normal file
0
server/addons/modules/.gitkeep
Normal file
8
server/addons/modules/hgexample.go
Normal file
8
server/addons/modules/hgexample.go
Normal file
@ -0,0 +1,8 @@
|
||||
// Package modules
|
||||
// @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 modules
|
||||
|
||||
import _ "hotgo/addons/hgexample"
|
62
server/api/admin/addons/addons.go
Normal file
62
server/api/admin/addons/addons.go
Normal file
@ -0,0 +1,62 @@
|
||||
// Package addons
|
||||
// @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 addons
|
||||
|
||||
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:"/addons/list" method:"get" tags:"插件管理" summary:"获取插件列表"`
|
||||
sysin.AddonsListInp
|
||||
}
|
||||
|
||||
type ListRes struct {
|
||||
List []*sysin.AddonsListModel `json:"list" dc:"数据列表"`
|
||||
form.PageRes
|
||||
}
|
||||
|
||||
type SelectsReq struct {
|
||||
g.Meta `path:"/addons/selects" method:"get" tags:"插件管理" summary:"生成入口选项"`
|
||||
}
|
||||
type SelectsRes struct {
|
||||
*sysin.AddonsSelectsModel
|
||||
}
|
||||
|
||||
// BuildReq 提交生成
|
||||
type BuildReq struct {
|
||||
g.Meta `path:"/addons/build" method:"post" tags:"插件管理" summary:"提交生成"`
|
||||
sysin.AddonsBuildInp
|
||||
}
|
||||
type BuildRes struct {
|
||||
}
|
||||
|
||||
// InstallReq 安装模块
|
||||
type InstallReq struct {
|
||||
g.Meta `path:"/addons/install" method:"post" tags:"插件管理" summary:"安装模块"`
|
||||
sysin.AddonsInstallInp
|
||||
}
|
||||
type InstallRes struct {
|
||||
}
|
||||
|
||||
// UpgradeReq 更新模块
|
||||
type UpgradeReq struct {
|
||||
g.Meta `path:"/addons/upgrade" method:"post" tags:"插件管理" summary:"更新模块"`
|
||||
sysin.AddonsUpgradeInp
|
||||
}
|
||||
type UpgradeRes struct {
|
||||
}
|
||||
|
||||
// UnInstallReq 卸载模块
|
||||
type UnInstallReq struct {
|
||||
g.Meta `path:"/addons/uninstall" method:"post" tags:"插件管理" summary:"卸载模块"`
|
||||
sysin.AddonsUnInstallInp
|
||||
}
|
||||
type UnInstallRes struct {
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
// Package attachment
|
||||
// @Link https://github.com/bufanyun/hotgo
|
||||
// @Copyright Copyright (c) 2022 HotGo CLI
|
||||
// @Copyright Copyright (c) 2023 HotGo CLI
|
||||
// @Author Ms <133814250@qq.com>
|
||||
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
|
||||
//
|
@ -1,6 +1,6 @@
|
||||
// Package blacklist
|
||||
// @Link https://github.com/bufanyun/hotgo
|
||||
// @Copyright Copyright (c) 2022 HotGo CLI
|
||||
// @Copyright Copyright (c) 2023 HotGo CLI
|
||||
// @Author Ms <133814250@qq.com>
|
||||
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
|
||||
//
|
@ -1,6 +1,6 @@
|
||||
// Package common
|
||||
// @Link https://github.com/bufanyun/hotgo
|
||||
// @Copyright Copyright (c) 2022 HotGo CLI
|
||||
// @Copyright Copyright (c) 2023 HotGo CLI
|
||||
// @Author Ms <133814250@qq.com>
|
||||
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
|
||||
//
|
@ -1,6 +1,6 @@
|
||||
// Package common
|
||||
// @Link https://github.com/bufanyun/hotgo
|
||||
// @Copyright Copyright (c) 2022 HotGo CLI
|
||||
// @Copyright Copyright (c) 2023 HotGo CLI
|
||||
// @Author Ms <133814250@qq.com>
|
||||
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
|
||||
//
|
@ -1,6 +1,6 @@
|
||||
// Package common
|
||||
// @Link https://github.com/bufanyun/hotgo
|
||||
// @Copyright Copyright (c) 2022 HotGo CLI
|
||||
// @Copyright Copyright (c) 2023 HotGo CLI
|
||||
// @Author Ms <133814250@qq.com>
|
||||
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
|
||||
//
|
||||
@ -47,6 +47,7 @@ type SiteConfigReq struct {
|
||||
type SiteConfigRes struct {
|
||||
Version string `json:"version" dc:"系统版本"`
|
||||
WsAddr string `json:"wsAddr" dc:"客户端websocket地址"`
|
||||
Domain string `json:"domain" dc:"对外域名"`
|
||||
}
|
||||
|
||||
// SitePingReq ping
|
@ -1,6 +1,6 @@
|
||||
// Package common
|
||||
// @Link https://github.com/bufanyun/hotgo
|
||||
// @Copyright Copyright (c) 2022 HotGo CLI
|
||||
// @Copyright Copyright (c) 2023 HotGo CLI
|
||||
// @Author Ms <133814250@qq.com>
|
||||
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
|
||||
//
|
@ -1,6 +1,6 @@
|
||||
// Package common
|
||||
// @Link https://github.com/bufanyun/hotgo
|
||||
// @Copyright Copyright (c) 2022 HotGo CLI
|
||||
// @Copyright Copyright (c) 2023 HotGo CLI
|
||||
// @Author Ms <133814250@qq.com>
|
||||
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
|
||||
//
|
@ -1,9 +1,8 @@
|
||||
// Package config
|
||||
// @Link https://github.com/bufanyun/hotgo
|
||||
// @Copyright Copyright (c) 2022 HotGo CLI
|
||||
// @Copyright Copyright (c) 2023 HotGo CLI
|
||||
// @Author Ms <133814250@qq.com>
|
||||
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
|
||||
//
|
||||
package config
|
||||
|
||||
import (
|
@ -1,6 +1,6 @@
|
||||
// Package cron
|
||||
// @Link https://github.com/bufanyun/hotgo
|
||||
// @Copyright Copyright (c) 2022 HotGo CLI
|
||||
// @Copyright Copyright (c) 2023 HotGo CLI
|
||||
// @Author Ms <133814250@qq.com>
|
||||
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
|
||||
//
|
@ -1,6 +1,6 @@
|
||||
// Package cron
|
||||
// @Link https://github.com/bufanyun/hotgo
|
||||
// @Copyright Copyright (c) 2022 HotGo CLI
|
||||
// @Copyright Copyright (c) 2023 HotGo CLI
|
||||
// @Author Ms <133814250@qq.com>
|
||||
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
|
||||
//
|
@ -3,8 +3,8 @@
|
||||
// @Copyright Copyright (c) 2023 HotGo CLI
|
||||
// @Author Ms <133814250@qq.com>
|
||||
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
|
||||
// @AutoGenerate Version 2.1.2
|
||||
// @AutoGenerate Date 2023-02-08 17:47:32
|
||||
// @AutoGenerate Version 2.1.4
|
||||
// @AutoGenerate Date 2023-02-20 16:41:58
|
||||
//
|
||||
package curddemo
|
||||
|
@ -1,6 +1,6 @@
|
||||
// Package dept
|
||||
// @Link https://github.com/bufanyun/hotgo
|
||||
// @Copyright Copyright (c) 2022 HotGo CLI
|
||||
// @Copyright Copyright (c) 2023 HotGo CLI
|
||||
// @Author Ms <133814250@qq.com>
|
||||
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
|
||||
//
|
@ -1,6 +1,6 @@
|
||||
// Package dict
|
||||
// @Link https://github.com/bufanyun/hotgo
|
||||
// @Copyright Copyright (c) 2022 HotGo CLI
|
||||
// @Copyright Copyright (c) 2023 HotGo CLI
|
||||
// @Author Ms <133814250@qq.com>
|
||||
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
|
||||
//
|
@ -1,6 +1,6 @@
|
||||
// Package dict
|
||||
// @Link https://github.com/bufanyun/hotgo
|
||||
// @Copyright Copyright (c) 2022 HotGo CLI
|
||||
// @Copyright Copyright (c) 2023 HotGo CLI
|
||||
// @Author Ms <133814250@qq.com>
|
||||
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
|
||||
//
|
@ -1,3 +1,9 @@
|
||||
// Package emslog
|
||||
// @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 emslog
|
||||
|
||||
import (
|
@ -1,6 +1,6 @@
|
||||
// Package hggen
|
||||
// Package gencodes
|
||||
// @Link https://github.com/bufanyun/hotgo
|
||||
// @Copyright Copyright (c) 2022 HotGo CLI
|
||||
// @Copyright Copyright (c) 2023 HotGo CLI
|
||||
// @Author Ms <133814250@qq.com>
|
||||
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
|
||||
//
|
@ -1,6 +1,6 @@
|
||||
// Package log
|
||||
// @Link https://github.com/bufanyun/hotgo
|
||||
// @Copyright Copyright (c) 2022 HotGo CLI
|
||||
// @Copyright Copyright (c) 2023 HotGo CLI
|
||||
// @Author Ms <133814250@qq.com>
|
||||
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
|
||||
//
|
@ -1,6 +1,6 @@
|
||||
// Package member
|
||||
// @Link https://github.com/bufanyun/hotgo
|
||||
// @Copyright Copyright (c) 2022 HotGo CLI
|
||||
// @Copyright Copyright (c) 2023 HotGo CLI
|
||||
// @Author Ms <133814250@qq.com>
|
||||
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
|
||||
//
|
@ -1,6 +1,6 @@
|
||||
// Package menu
|
||||
// @Link https://github.com/bufanyun/hotgo
|
||||
// @Copyright Copyright (c) 2022 HotGo CLI
|
||||
// @Copyright Copyright (c) 2023 HotGo CLI
|
||||
// @Author Ms <133814250@qq.com>
|
||||
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
|
||||
//
|
@ -1,6 +1,6 @@
|
||||
// Package monitor
|
||||
// @Link https://github.com/bufanyun/hotgo
|
||||
// @Copyright Copyright (c) 2022 HotGo CLI
|
||||
// @Copyright Copyright (c) 2023 HotGo CLI
|
||||
// @Author Ms <133814250@qq.com>
|
||||
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
|
||||
//
|
@ -1,6 +1,6 @@
|
||||
// Package notice
|
||||
// @Link https://github.com/bufanyun/hotgo
|
||||
// @Copyright Copyright (c) 2022 HotGo CLI
|
||||
// @Copyright Copyright (c) 2023 HotGo CLI
|
||||
// @Author Ms <133814250@qq.com>
|
||||
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
|
||||
//
|
@ -1,6 +1,6 @@
|
||||
// Package post
|
||||
// @Link https://github.com/bufanyun/hotgo
|
||||
// @Copyright Copyright (c) 2022 HotGo CLI
|
||||
// @Copyright Copyright (c) 2023 HotGo CLI
|
||||
// @Author Ms <133814250@qq.com>
|
||||
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
|
||||
//
|
@ -1,6 +1,6 @@
|
||||
// Package provinces
|
||||
// @Link https://github.com/bufanyun/hotgo
|
||||
// @Copyright Copyright (c) 2022 HotGo CLI
|
||||
// @Copyright Copyright (c) 2023 HotGo CLI
|
||||
// @Author Ms <133814250@qq.com>
|
||||
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
|
||||
//
|
@ -1,6 +1,6 @@
|
||||
// Package role
|
||||
// @Link https://github.com/bufanyun/hotgo
|
||||
// @Copyright Copyright (c) 2022 HotGo CLI
|
||||
// @Copyright Copyright (c) 2023 HotGo CLI
|
||||
// @Author Ms <133814250@qq.com>
|
||||
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
|
||||
//
|
@ -1,6 +1,6 @@
|
||||
// Package user
|
||||
// @Link https://github.com/bufanyun/hotgo
|
||||
// @Copyright Copyright (c) 2022 HotGo CLI
|
||||
// @Copyright Copyright (c) 2023 HotGo CLI
|
||||
// @Author Ms <133814250@qq.com>
|
||||
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
|
||||
//
|
@ -1,6 +1,6 @@
|
||||
// Package member
|
||||
// @Link https://github.com/bufanyun/hotgo
|
||||
// @Copyright Copyright (c) 2022 HotGo CLI
|
||||
// @Copyright Copyright (c) 2023 HotGo CLI
|
||||
// @Author Ms <133814250@qq.com>
|
||||
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
|
||||
//
|
||||
|
@ -1,6 +1,6 @@
|
||||
// Package user
|
||||
// @Link https://github.com/bufanyun/hotgo
|
||||
// @Copyright Copyright (c) 2022 HotGo CLI
|
||||
// @Copyright Copyright (c) 2023 HotGo CLI
|
||||
// @Author Ms <133814250@qq.com>
|
||||
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
|
||||
//
|
||||
|
@ -1,77 +0,0 @@
|
||||
// Package test
|
||||
// @Link https://github.com/bufanyun/hotgo
|
||||
// @Copyright Copyright (c) 2022 HotGo CLI
|
||||
// @Author Ms <133814250@qq.com>
|
||||
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
|
||||
//
|
||||
package test
|
||||
|
||||
import (
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
"hotgo/internal/model/input/adminin"
|
||||
"hotgo/internal/model/input/form"
|
||||
)
|
||||
|
||||
// ListReq 查询列表
|
||||
type ListReq struct {
|
||||
g.Meta `path:"/test/list" method:"get" tags:"测试" summary:"获取测试列表"`
|
||||
adminin.TestListInp
|
||||
}
|
||||
|
||||
type ListRes struct {
|
||||
form.PageRes
|
||||
List []*adminin.TestListModel `json:"list" dc:"数据列表"`
|
||||
}
|
||||
|
||||
// ExportReq 导出列表
|
||||
type ExportReq struct {
|
||||
g.Meta `path:"/test/export" method:"get" tags:"测试" summary:"导出测试列表"`
|
||||
adminin.TestListInp
|
||||
}
|
||||
|
||||
type ExportRes struct{}
|
||||
|
||||
// ViewReq 获取信息
|
||||
type ViewReq struct {
|
||||
g.Meta `path:"/test/view" method:"get" tags:"测试" summary:"获取指定信息"`
|
||||
adminin.TestViewInp
|
||||
}
|
||||
type ViewRes struct {
|
||||
*adminin.TestViewModel
|
||||
}
|
||||
|
||||
// EditReq 修改/新增
|
||||
type EditReq struct {
|
||||
g.Meta `path:"/test/edit" method:"post" tags:"测试" summary:"修改/新增测试"`
|
||||
adminin.TestEditInp
|
||||
}
|
||||
type EditRes struct{}
|
||||
|
||||
// DeleteReq 删除
|
||||
type DeleteReq struct {
|
||||
g.Meta `path:"/test/delete" method:"post" tags:"测试" summary:"删除测试"`
|
||||
adminin.TestDeleteInp
|
||||
}
|
||||
type DeleteRes struct{}
|
||||
|
||||
// MaxSortReq 最大排序
|
||||
type MaxSortReq struct {
|
||||
g.Meta `path:"/test/maxSort" method:"get" tags:"测试" summary:"测试最大排序"`
|
||||
}
|
||||
type MaxSortRes struct {
|
||||
*adminin.TestMaxSortModel
|
||||
}
|
||||
|
||||
// StatusReq 更新状态
|
||||
type StatusReq struct {
|
||||
g.Meta `path:"/test/status" method:"post" tags:"测试" summary:"更新测试状态"`
|
||||
adminin.TestStatusInp
|
||||
}
|
||||
type StatusRes struct{}
|
||||
|
||||
// SwitchReq 更新开关状态
|
||||
type SwitchReq struct {
|
||||
g.Meta `path:"/test/switch" method:"post" tags:"测试" summary:"更新测试状态"`
|
||||
adminin.TestSwitchInp
|
||||
}
|
||||
type SwitchRes struct{}
|
@ -1,6 +1,6 @@
|
||||
// Package base
|
||||
// @Link https://github.com/bufanyun/hotgo
|
||||
// @Copyright Copyright (c) 2022 HotGo CLI
|
||||
// @Copyright Copyright (c) 2023 HotGo CLI
|
||||
// @Author Ms <133814250@qq.com>
|
||||
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
|
||||
//
|
||||
|
15
server/api/websocket/base/send.go
Normal file
15
server/api/websocket/base/send.go
Normal file
@ -0,0 +1,15 @@
|
||||
package base
|
||||
|
||||
import (
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
"hotgo/internal/model/input/websocketin"
|
||||
)
|
||||
|
||||
// SendToTagReq 发送标签消息
|
||||
type SendToTagReq struct {
|
||||
g.Meta `path:"/send/toTag" method:"post" tags:"WebSocket" summary:"发送标签消息"`
|
||||
websocketin.SendToTagInput
|
||||
}
|
||||
|
||||
type SendToTagRes struct {
|
||||
}
|
102
server/go.mod
102
server/go.mod
@ -1,9 +1,8 @@
|
||||
module hotgo
|
||||
|
||||
go 1.15
|
||||
go 1.18
|
||||
|
||||
require (
|
||||
github.com/BurntSushi/toml v1.2.1 // indirect
|
||||
github.com/Shopify/sarama v1.34.1
|
||||
github.com/alibabacloud-go/darabonba-openapi/v2 v2.0.2
|
||||
github.com/alibabacloud-go/dysmsapi-20170525/v3 v3.0.5
|
||||
@ -13,37 +12,98 @@ require (
|
||||
github.com/axgle/mahonia v0.0.0-20180208002826-3358181d7394
|
||||
github.com/bufanyun/pool v0.2.1
|
||||
github.com/casbin/casbin/v2 v2.55.0
|
||||
github.com/cespare/xxhash/v2 v2.2.0 // indirect
|
||||
github.com/clbanning/mxj/v2 v2.5.7 // indirect
|
||||
github.com/dgrijalva/jwt-go v3.2.0+incompatible
|
||||
github.com/fatih/color v1.14.1 // indirect
|
||||
github.com/forgoer/openssl v1.4.0
|
||||
github.com/fsnotify/fsnotify v1.6.0 // indirect
|
||||
github.com/go-resty/resty/v2 v2.7.0
|
||||
github.com/go-sql-driver/mysql v1.7.0 // indirect
|
||||
github.com/gogf/gf/contrib/drivers/mysql/v2 v2.3.1
|
||||
github.com/gogf/gf/contrib/nosql/redis/v2 v2.3.1
|
||||
github.com/gogf/gf/v2 v2.3.1
|
||||
github.com/golang/mock v1.6.0 // indirect
|
||||
github.com/gogf/gf/contrib/drivers/mysql/v2 v2.3.2
|
||||
github.com/gogf/gf/contrib/nosql/redis/v2 v2.3.2
|
||||
github.com/gogf/gf/v2 v2.3.2
|
||||
github.com/gomodule/redigo v1.8.8
|
||||
github.com/google/btree v1.1.2 // indirect
|
||||
github.com/gorilla/websocket v1.5.0
|
||||
github.com/kayon/iploc v0.0.0-20200312105652-bda3e968a794
|
||||
github.com/magiconair/properties v1.8.7 // indirect
|
||||
github.com/mattn/go-runewidth v0.0.14 // indirect
|
||||
github.com/mojocn/base64Captcha v1.3.5
|
||||
github.com/olekukonko/tablewriter v0.0.5
|
||||
github.com/rivo/uniseg v0.4.3 // indirect
|
||||
github.com/shirou/gopsutil v3.21.11+incompatible
|
||||
github.com/shopspring/decimal v1.3.1
|
||||
github.com/tklauser/go-sysconf v0.3.10 // indirect
|
||||
github.com/ufilesdk-dev/ufile-gosdk v1.0.3
|
||||
github.com/xuri/excelize/v2 v2.6.0
|
||||
github.com/yusufpapurcu/wmi v1.2.2 // indirect
|
||||
go.opentelemetry.io/otel/sdk v1.11.2 // indirect
|
||||
go.uber.org/atomic v1.7.0 // indirect
|
||||
golang.org/x/crypto v0.0.0-20220411220226-7b82a4e95df4 // indirect
|
||||
golang.org/x/net v0.5.0 // indirect
|
||||
golang.org/x/tools v0.1.12
|
||||
gopkg.in/yaml.v3 v3.0.1
|
||||
)
|
||||
|
||||
require (
|
||||
github.com/BurntSushi/toml v1.2.1 // indirect
|
||||
github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible // indirect
|
||||
github.com/alibabacloud-go/alibabacloud-gateway-spi v0.0.4 // indirect
|
||||
github.com/alibabacloud-go/debug v0.0.0-20190504072949-9472017b5c68 // indirect
|
||||
github.com/alibabacloud-go/endpoint-util v1.1.0 // indirect
|
||||
github.com/alibabacloud-go/openapi-util v0.1.0 // indirect
|
||||
github.com/alibabacloud-go/tea-utils v1.3.1 // indirect
|
||||
github.com/alibabacloud-go/tea-xml v1.1.2 // indirect
|
||||
github.com/aliyun/credentials-go v1.1.2 // indirect
|
||||
github.com/cespare/xxhash/v2 v2.2.0 // indirect
|
||||
github.com/clbanning/mxj/v2 v2.5.7 // indirect
|
||||
github.com/davecgh/go-spew v1.1.1 // indirect
|
||||
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
|
||||
github.com/eapache/go-resiliency v1.2.0 // indirect
|
||||
github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21 // indirect
|
||||
github.com/eapache/queue v1.1.0 // indirect
|
||||
github.com/emirpasic/gods v1.12.0 // indirect
|
||||
github.com/fatih/color v1.14.1 // indirect
|
||||
github.com/fsnotify/fsnotify v1.6.0 // indirect
|
||||
github.com/go-logr/logr v1.2.3 // indirect
|
||||
github.com/go-logr/stdr v1.2.2 // indirect
|
||||
github.com/go-ole/go-ole v1.2.6 // indirect
|
||||
github.com/go-redis/redis/v8 v8.11.5 // indirect
|
||||
github.com/go-sql-driver/mysql v1.7.0 // indirect
|
||||
github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 // indirect
|
||||
github.com/golang/mock v1.6.0 // indirect
|
||||
github.com/golang/snappy v0.0.4 // indirect
|
||||
github.com/google/btree v1.1.2 // indirect
|
||||
github.com/grokify/html-strip-tags-go v0.0.1 // indirect
|
||||
github.com/hashicorp/errwrap v1.0.0 // indirect
|
||||
github.com/hashicorp/go-multierror v1.1.1 // indirect
|
||||
github.com/hashicorp/go-uuid v1.0.2 // indirect
|
||||
github.com/jcmturner/aescts/v2 v2.0.0 // indirect
|
||||
github.com/jcmturner/dnsutils/v2 v2.0.0 // indirect
|
||||
github.com/jcmturner/gofork v1.0.0 // indirect
|
||||
github.com/jcmturner/gokrb5/v8 v8.4.2 // indirect
|
||||
github.com/jcmturner/rpc/v2 v2.0.3 // indirect
|
||||
github.com/json-iterator/go v1.1.12 // indirect
|
||||
github.com/klauspost/compress v1.15.6 // indirect
|
||||
github.com/magiconair/properties v1.8.7 // indirect
|
||||
github.com/mattn/go-colorable v0.1.13 // indirect
|
||||
github.com/mattn/go-isatty v0.0.17 // indirect
|
||||
github.com/mattn/go-runewidth v0.0.14 // indirect
|
||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
|
||||
github.com/modern-go/reflect2 v1.0.2 // indirect
|
||||
github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 // indirect
|
||||
github.com/pierrec/lz4/v4 v4.1.14 // indirect
|
||||
github.com/pkg/errors v0.9.1 // indirect
|
||||
github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect
|
||||
github.com/richardlehane/mscfb v1.0.4 // indirect
|
||||
github.com/richardlehane/msoleps v1.0.1 // indirect
|
||||
github.com/rivo/uniseg v0.4.3 // indirect
|
||||
github.com/sirupsen/logrus v1.8.1 // indirect
|
||||
github.com/tidwall/gjson v1.2.1 // indirect
|
||||
github.com/tidwall/match v1.0.1 // indirect
|
||||
github.com/tidwall/pretty v0.0.0-20190325153808-1166b9ac2b65 // indirect
|
||||
github.com/tjfoc/gmsm v1.3.2 // indirect
|
||||
github.com/tklauser/go-sysconf v0.3.10 // indirect
|
||||
github.com/tklauser/numcpus v0.4.0 // indirect
|
||||
github.com/xuri/efp v0.0.0-20220407160117-ad0f7a785be8 // indirect
|
||||
github.com/xuri/nfp v0.0.0-20220409054826-5e722a1d9e22 // indirect
|
||||
github.com/yusufpapurcu/wmi v1.2.2 // indirect
|
||||
go.opentelemetry.io/otel v1.13.0 // indirect
|
||||
go.opentelemetry.io/otel/sdk v1.13.0 // indirect
|
||||
go.opentelemetry.io/otel/trace v1.13.0 // indirect
|
||||
go.uber.org/atomic v1.7.0 // indirect
|
||||
golang.org/x/crypto v0.0.0-20220411220226-7b82a4e95df4 // indirect
|
||||
golang.org/x/image v0.0.0-20211028202545-6944b10bf410 // indirect
|
||||
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4 // indirect
|
||||
golang.org/x/net v0.7.0 // indirect
|
||||
golang.org/x/sys v0.5.0 // indirect
|
||||
golang.org/x/text v0.7.0 // indirect
|
||||
gopkg.in/ini.v1 v1.56.0 // indirect
|
||||
stathat.com/c/consistent v1.0.0 // indirect
|
||||
)
|
||||
|
@ -161,13 +161,13 @@ github.com/go-sql-driver/mysql v1.7.0 h1:ueSltNNllEqE3qcWBTD0iQd3IpL/6U+mJxLkazJ
|
||||
github.com/go-sql-driver/mysql v1.7.0/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.3.1 h1:uSZtDmlTFS51A98KPgZElPigSGDi7PPDN6mxeIXtsLo=
|
||||
github.com/gogf/gf/contrib/drivers/mysql/v2 v2.3.1/go.mod h1:z+/0qiOwMroAnj5ESuobTv0l5P83rf+XR3r6Fj8WJyk=
|
||||
github.com/gogf/gf/contrib/nosql/redis/v2 v2.3.1 h1:0pt3KCUtVtBPC6m/6natIeBKBYAQUcfSqy5IR58ogLo=
|
||||
github.com/gogf/gf/contrib/nosql/redis/v2 v2.3.1/go.mod h1:V9o2BF9ovJnaZhHImHAanqUgjX4kI51lgU45u5rPqvw=
|
||||
github.com/gogf/gf/contrib/drivers/mysql/v2 v2.3.2 h1:BZww6QOFgiN/YvovUtN64sgnq59TIg8vtkG8AL6eSl0=
|
||||
github.com/gogf/gf/contrib/drivers/mysql/v2 v2.3.2/go.mod h1:z+/0qiOwMroAnj5ESuobTv0l5P83rf+XR3r6Fj8WJyk=
|
||||
github.com/gogf/gf/contrib/nosql/redis/v2 v2.3.2 h1:AsYganxtge0nz7eYDYdvGH6E2pRe5IuK45/OLHIFrj8=
|
||||
github.com/gogf/gf/contrib/nosql/redis/v2 v2.3.2/go.mod h1:V9o2BF9ovJnaZhHImHAanqUgjX4kI51lgU45u5rPqvw=
|
||||
github.com/gogf/gf/v2 v2.0.0/go.mod h1:apktt6TleWtCIwpz63vBqUnw8MX8gWKoZyxgDpXFtgM=
|
||||
github.com/gogf/gf/v2 v2.3.1 h1:uptCJK47N6KSRwTBnFAqBWYnYa/OXBkZ0OlhO9CK7bQ=
|
||||
github.com/gogf/gf/v2 v2.3.1/go.mod h1:tsbmtwcAl2chcYoq/fP9W2FZf06aw4i89X34nbSHo9Y=
|
||||
github.com/gogf/gf/v2 v2.3.2 h1:nlJ0zuDWqFb93/faZmr7V+GADx/lzz5Unz/9x6OJ2u8=
|
||||
github.com/gogf/gf/v2 v2.3.2/go.mod h1:tsbmtwcAl2chcYoq/fP9W2FZf06aw4i89X34nbSHo9Y=
|
||||
github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=
|
||||
github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 h1:DACJavvAHhabrF08vX0COfcOBJRhZ8lUbR+ZWIs0Y5g=
|
||||
github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0/go.mod h1:E/TSTwGwJL78qG/PmXZO1EjYhfJinVAhrmmHX6Z8B9k=
|
||||
@ -199,7 +199,6 @@ github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QD
|
||||
github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
|
||||
github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
|
||||
github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
|
||||
github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw=
|
||||
github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=
|
||||
github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM=
|
||||
github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
|
||||
@ -221,7 +220,6 @@ github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/
|
||||
github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE=
|
||||
github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=
|
||||
github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
|
||||
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
|
||||
github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs=
|
||||
github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0=
|
||||
@ -240,9 +238,7 @@ github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORR
|
||||
github.com/gopherjs/gopherjs v0.0.0-20200217142428-fce0ec30dd00 h1:l5lAOZEym3oK3SQ2HBHWsJUfbNBiTXJDeW2QDxw9AQ0=
|
||||
github.com/gopherjs/gopherjs v0.0.0-20200217142428-fce0ec30dd00/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
|
||||
github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So=
|
||||
github.com/gorilla/securecookie v1.1.1 h1:miw7JPhV+b/lAHSXz4qd/nN9jRiAFV5FwjeKyCS8BvQ=
|
||||
github.com/gorilla/securecookie v1.1.1/go.mod h1:ra0sb63/xPlUeL+yeDciTfxMRAA+MP+HVt/4epWDjd4=
|
||||
github.com/gorilla/sessions v1.2.1 h1:DHd3rPN5lE3Ts3D8rKkQ8x/0kqfeNmBAaiSi+o7FsgI=
|
||||
github.com/gorilla/sessions v1.2.1/go.mod h1:dk2InVEVJ0sfLlnXv9EAgkf6ecYs/i80K/zI+bUmuGM=
|
||||
github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
|
||||
github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc=
|
||||
@ -340,7 +336,6 @@ github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108
|
||||
github.com/onsi/ginkgo v1.16.4/go.mod h1:dX+/inL/fNMqNlz0e9LfyB9TswhZpCVdJM/Z6Vvnwo0=
|
||||
github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE=
|
||||
github.com/onsi/ginkgo v1.16.5/go.mod h1:+E8gABHa3K6zRBolWtd+ROzc/U5bkGt0FwiG042wbpU=
|
||||
github.com/onsi/ginkgo/v2 v2.0.0 h1:CcuG/HvWNkkaqCUpJifQY8z7qEMBJya6aLPx6ftGyjQ=
|
||||
github.com/onsi/ginkgo/v2 v2.0.0/go.mod h1:vw5CSIxN1JObi/U8gcbwft7ZxR2dgaR70JSE3/PpL4c=
|
||||
github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY=
|
||||
github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo=
|
||||
@ -407,8 +402,6 @@ github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9
|
||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE=
|
||||
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
|
||||
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
|
||||
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
||||
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
||||
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
|
||||
@ -416,9 +409,7 @@ github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5
|
||||
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
|
||||
github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk=
|
||||
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
|
||||
github.com/tidwall/gjson v1.2.1 h1:j0efZLrZUvNerEf6xqoi0NjWMK5YlLrR7Guo/dxY174=
|
||||
github.com/tidwall/gjson v1.2.1/go.mod h1:c/nTNbUr0E0OrXEhq1pwa8iEgc2DOt4ZZqAt1HtCkPA=
|
||||
github.com/tidwall/match v1.0.1 h1:PnKP62LPNxHKTwvHHZZzdOAOCtsJTjo6dZLCwpKm5xc=
|
||||
@ -450,7 +441,6 @@ 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=
|
||||
@ -460,16 +450,16 @@ go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
|
||||
go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
|
||||
go.opentelemetry.io/otel v1.0.0/go.mod h1:AjRVh9A5/5DE7S+mZtTR6t8vpKKryam+0lREnfmS4cg=
|
||||
go.opentelemetry.io/otel v1.7.0/go.mod h1:5BdUoMIz5WEs0vt0CUEMtSSaTSHBBVwrhnz7+nrD5xk=
|
||||
go.opentelemetry.io/otel v1.11.2 h1:YBZcQlsVekzFsFbjygXMOXSs6pialIZxcjfO/mBDmR0=
|
||||
go.opentelemetry.io/otel v1.11.2/go.mod h1:7p4EUV+AqgdlNV9gL97IgUZiVR3yrFXYo53f9BM3tRI=
|
||||
go.opentelemetry.io/otel v1.13.0 h1:1ZAKnNQKwBBxFtww/GwxNUyTf0AxkZzrukO8MeXqe4Y=
|
||||
go.opentelemetry.io/otel v1.13.0/go.mod h1:FH3RtdZCzRkJYFTCsAKDy9l/XYjMdNv6QrkFFB8DvVg=
|
||||
go.opentelemetry.io/otel/sdk v1.0.0/go.mod h1:PCrDHlSy5x1kjezSdL37PhbFUMjrsLRshJ2zCzeXwbM=
|
||||
go.opentelemetry.io/otel/sdk v1.7.0/go.mod h1:uTEOTwaqIVuTGiJN7ii13Ibp75wJmYUDe374q6cZwUU=
|
||||
go.opentelemetry.io/otel/sdk v1.11.2 h1:GF4JoaEx7iihdMFu30sOyRx52HDHOkl9xQ8SMqNXUiU=
|
||||
go.opentelemetry.io/otel/sdk v1.11.2/go.mod h1:wZ1WxImwpq+lVRo4vsmSOxdd+xwoUJ6rqyLc3SyX9aU=
|
||||
go.opentelemetry.io/otel/sdk v1.13.0 h1:BHib5g8MvdqS65yo2vV1s6Le42Hm6rrw08qU6yz5JaM=
|
||||
go.opentelemetry.io/otel/sdk v1.13.0/go.mod h1:YLKPx5+6Vx/o1TCUYYs+bpymtkmazOMT6zoRrC7AQ7I=
|
||||
go.opentelemetry.io/otel/trace v1.0.0/go.mod h1:PXTWqayeFUlJV1YDNhsJYB184+IvAH814St6o6ajzIs=
|
||||
go.opentelemetry.io/otel/trace v1.7.0/go.mod h1:fzLSB9nqR2eXzxPXb2JW9IKE+ScyXA48yyE4TNvoHqU=
|
||||
go.opentelemetry.io/otel/trace v1.11.2 h1:Xf7hWSF2Glv0DE3MH7fBHvtpSBsjcBUe5MYAmZM/+y0=
|
||||
go.opentelemetry.io/otel/trace v1.11.2/go.mod h1:4N+yC7QEz7TTsG9BSRLNAa63eg5E06ObSbKPmxQ/pKA=
|
||||
go.opentelemetry.io/otel/trace v1.13.0 h1:CBgRZ6ntv+Amuj1jDsMhZtlAPT6gbyIRdaIzFhfBSdY=
|
||||
go.opentelemetry.io/otel/trace v1.13.0/go.mod h1:muCvmmO9KKpvuXSf3KKAXXB2ygNYHQ+ZfI5X08d3tds=
|
||||
go.uber.org/atomic v1.5.1/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ=
|
||||
go.uber.org/atomic v1.7.0 h1:ADUqmZGgLDDfbSL9ZmPxKTybcoEYHgpYfELNoN+7hsw=
|
||||
go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc=
|
||||
@ -482,7 +472,6 @@ 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-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
|
||||
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-20220411220226-7b82a4e95df4 h1:kUhD7nTDoI3fVd9G4ORWrbV5NY0liEs/Jg2pv5f+bBA=
|
||||
@ -554,7 +543,6 @@ golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81R
|
||||
golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
|
||||
golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
|
||||
golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
|
||||
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
|
||||
golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM=
|
||||
golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT/9KSuxbyM7479/AVlXFRxuMCk=
|
||||
golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
||||
@ -563,9 +551,8 @@ golang.org/x/net v0.0.0-20211029224645-99673261e6eb/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.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
|
||||
golang.org/x/net v0.5.0 h1:GyT4nK/YDHSqa1c4753ouYCDajOYKTja9Xb/OHtgvSw=
|
||||
golang.org/x/net v0.5.0/go.mod h1:DivGGAXEgPSlEBzxGzZI+ZLohi+xUj054jfeKui00ws=
|
||||
golang.org/x/net v0.7.0 h1:rJrUqqhjsgNp7KqAIc25s9pZnjU7TUcSY7HcVZjdn1g=
|
||||
golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
|
||||
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=
|
||||
@ -583,7 +570,6 @@ 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/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
@ -639,17 +625,12 @@ golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBc
|
||||
golang.org/x/sys v0.0.0-20220114195835-da31bd327af9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20220128215802-99c3d69c2c27/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-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.0.0-20220919091848-fb04ddd9f9c8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.4.0 h1:Zr2JFtRQNX3BCZ8YtxRE9hNJYC8J6I1MVbMg6owUp18=
|
||||
golang.org/x/sys v0.4.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU=
|
||||
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
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/term v0.4.0/go.mod h1:9P2UbLfCdcvo3p/nzKvsmas4TnlujnuoV9hGgYzW1lQ=
|
||||
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
@ -658,8 +639,8 @@ 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.6.0 h1:3XmdazWV+ubf7QgHSTWeykHOci5oeekaGJBLkrkaw4k=
|
||||
golang.org/x/text v0.6.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
|
||||
golang.org/x/text v0.7.0 h1:4BRB4x83lYWy72KwLD/qYDuTu7q9PjSagHvijDw7cLo=
|
||||
golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
|
||||
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/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
||||
@ -789,7 +770,6 @@ google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpAD
|
||||
google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4=
|
||||
google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c=
|
||||
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
|
||||
google.golang.org/protobuf v1.26.0 h1:bxAC2xTBsZGibn2RTntX0oH50xLsqy1OxA9tTL3p/lk=
|
||||
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
|
||||
gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
|
@ -3,14 +3,14 @@
|
||||
gfcli:
|
||||
build:
|
||||
name: "hotgo"
|
||||
arch: "amd64"
|
||||
system: "linux"
|
||||
# arch: "all" #amd64
|
||||
# system: "all" #linux
|
||||
mod: "none"
|
||||
cgo: 0
|
||||
packSrc: "resource"
|
||||
packDst: "internal/packed/packed.go"
|
||||
version: ""
|
||||
output: "./bin"
|
||||
output: "./temp/hotgo"
|
||||
extra: ""
|
||||
|
||||
# gf生成代码,如果你想调整hotgo中代码生成的相关dao、service代码,同样也受用于此配置
|
||||
@ -20,12 +20,13 @@ gfcli:
|
||||
group: "default" # 分组。使用hotgo代码生成功能时必须填
|
||||
# path: "./app"
|
||||
# tables: "" #指定当前数据库中需要执行代码生成的数据表。如果为空,表示数据库的所有表都会生成。
|
||||
# tablesEx: "" #指定当前数据库中需要排除代码生成的数据表。
|
||||
tablesEx: "hg_sys_addons_install" #指定当前数据库中需要排除代码生成的数据表。
|
||||
removePrefix: "hg_"
|
||||
descriptionTag: true
|
||||
noModelComment: true
|
||||
jsonCase: "CamelLower"
|
||||
gJsonSupport: true
|
||||
clear: true
|
||||
|
||||
# service: # 生成业务配置
|
||||
# srcFolder: "internal/logic"
|
||||
|
@ -1,6 +1,6 @@
|
||||
// Package cmd
|
||||
// @Link https://github.com/bufanyun/hotgo
|
||||
// @Copyright Copyright (c) 2022 HotGo CLI
|
||||
// @Copyright Copyright (c) 2023 HotGo CLI
|
||||
// @Author Ms <133814250@qq.com>
|
||||
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
|
||||
//
|
||||
@ -41,7 +41,7 @@ var (
|
||||
---------------------------------------------------------------------------------
|
||||
更多
|
||||
github地址:https://github.com/bufanyun/hotgo
|
||||
文档地址:文档正在书写中,请耐心等一等。
|
||||
文档地址:https://github.com/bufanyun/hotgo/tree/v2.0/docs
|
||||
HotGo框架交流1群:190966648
|
||||
`,
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
// Package cmd
|
||||
// @Link https://github.com/bufanyun/hotgo
|
||||
// @Copyright Copyright (c) 2022 HotGo CLI
|
||||
// @Copyright Copyright (c) 2023 HotGo CLI
|
||||
// @Author Ms <133814250@qq.com>
|
||||
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
|
||||
//
|
||||
|
@ -1,9 +1,8 @@
|
||||
// Package cmd
|
||||
// @Link https://github.com/bufanyun/hotgo
|
||||
// @Copyright Copyright (c) 2022 HotGo CLI
|
||||
// @Copyright Copyright (c) 2023 HotGo CLI
|
||||
// @Author Ms <133814250@qq.com>
|
||||
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
|
||||
//
|
||||
package cmd
|
||||
|
||||
import (
|
||||
@ -11,6 +10,7 @@ import (
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
"github.com/gogf/gf/v2/net/ghttp"
|
||||
"github.com/gogf/gf/v2/os/gcmd"
|
||||
"hotgo/internal/library/addons"
|
||||
"hotgo/internal/library/casbin"
|
||||
"hotgo/internal/router"
|
||||
"hotgo/internal/service"
|
||||
@ -36,8 +36,7 @@ var (
|
||||
})
|
||||
|
||||
// 请求结束事件回调
|
||||
s.BindHookHandler("/*any", ghttp.HookAfterOutput, service.Hook().AccessLog)
|
||||
s.BindHookHandler("/*any", ghttp.HookAfterOutput, service.Hook().LastActive)
|
||||
s.BindHookHandler("/*any", ghttp.HookAfterOutput, service.Hook().AfterOutput)
|
||||
|
||||
s.Group("/", func(group *ghttp.RouterGroup) {
|
||||
|
||||
@ -61,6 +60,9 @@ var (
|
||||
|
||||
// 注册前台页面路由
|
||||
router.Home(ctx, group)
|
||||
|
||||
// 注册插件路由
|
||||
addons.RegisterModulesRouter(ctx, group)
|
||||
})
|
||||
|
||||
// 启动定时任务
|
||||
|
@ -1,6 +1,6 @@
|
||||
// Package cmd
|
||||
// @Link https://github.com/bufanyun/hotgo
|
||||
// @Copyright Copyright (c) 2022 HotGo CLI
|
||||
// @Copyright Copyright (c) 2023 HotGo CLI
|
||||
// @Author Ms <133814250@qq.com>
|
||||
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
|
||||
//
|
||||
|
@ -1,6 +1,6 @@
|
||||
// Package cmd
|
||||
// @Link https://github.com/bufanyun/hotgo
|
||||
// @Copyright Copyright (c) 2022 HotGo CLI
|
||||
// @Copyright Copyright (c) 2023 HotGo CLI
|
||||
// @Author Ms <133814250@qq.com>
|
||||
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
|
||||
//
|
||||
|
51
server/internal/consts/addons.go
Normal file
51
server/internal/consts/addons.go
Normal file
@ -0,0 +1,51 @@
|
||||
package consts
|
||||
|
||||
const (
|
||||
AddonsTag = "addons_" // 插件标签前缀
|
||||
AddonsDir = "addons" // 插件路径
|
||||
)
|
||||
|
||||
const (
|
||||
AddonsGroupPlug = 1 // 功能扩展
|
||||
AddonsGroupBusiness = 2 // 主要业务
|
||||
AddonsGroupThirdParty = 3 // 第三方插件
|
||||
AddonsGroupMiniApp = 4 // 小程序
|
||||
AddonsGroupCustomer = 5 // 客户关系
|
||||
AddonsGroupActivity = 6 // 营销及活动
|
||||
AddonsGroupServices = 7 // 常用服务及工具
|
||||
AddonsGroupBiz = 8 // 行业解决方案
|
||||
)
|
||||
|
||||
var AddonsGroupNameMap = map[int]string{
|
||||
AddonsGroupPlug: "功能扩展",
|
||||
AddonsGroupBusiness: "主要业务",
|
||||
AddonsGroupThirdParty: "第三方插件",
|
||||
AddonsGroupMiniApp: "小程序",
|
||||
AddonsGroupCustomer: "客户关系",
|
||||
AddonsGroupActivity: "营销及活动",
|
||||
AddonsGroupServices: "常用服务及工具",
|
||||
AddonsGroupBiz: "行业解决方案",
|
||||
}
|
||||
|
||||
var AddonsGroupIconMap = map[int]string{
|
||||
AddonsGroupPlug: "AppstoreAddOutlined",
|
||||
AddonsGroupBusiness: "FireOutlined",
|
||||
AddonsGroupThirdParty: "ApiOutlined",
|
||||
AddonsGroupMiniApp: "RocketOutlined",
|
||||
AddonsGroupCustomer: "UserSwitchOutlined",
|
||||
AddonsGroupActivity: "TagOutlined",
|
||||
AddonsGroupServices: "ToolOutlined",
|
||||
AddonsGroupBiz: "CheckCircleOutlined",
|
||||
}
|
||||
|
||||
const (
|
||||
AddonsInstallStatusOk = 1 // 已安装
|
||||
AddonsInstallStatusNo = 2 // 未安装
|
||||
AddonsInstallStatusUn = 3 // 已卸载
|
||||
)
|
||||
|
||||
var AddonsInstallStatusNameMap = map[int]string{
|
||||
AddonsInstallStatusOk: "已安装",
|
||||
AddonsInstallStatusNo: "未安装",
|
||||
AddonsInstallStatusUn: "已卸载",
|
||||
}
|
@ -1,14 +1,15 @@
|
||||
// Package consts
|
||||
// @Link https://github.com/bufanyun/hotgo
|
||||
// @Copyright Copyright (c) 2022 HotGo CLI
|
||||
// @Copyright Copyright (c) 2023 HotGo CLI
|
||||
// @Author Ms <133814250@qq.com>
|
||||
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
|
||||
//
|
||||
package consts
|
||||
|
||||
// 应用类型
|
||||
const (
|
||||
AppAdmin = "admin"
|
||||
AppApi = "api"
|
||||
AppHome = "home"
|
||||
AppWebSocket = "websocket"
|
||||
AppDefault = "default"
|
||||
)
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user