mirror of
https://github.com/bufanyun/hotgo.git
synced 2025-01-23 02:40:23 +08:00
This commit is contained in:
parent
bbe655a4d8
commit
49a96750bf
27
README.md
27
README.md
@ -61,17 +61,19 @@
|
||||
8. 操作日志:系统正常操作日志记录和查询;系统异常信息日志记录和查询。
|
||||
9. 登录日志:系统登录日志记录查询包含登录异常。
|
||||
10. 服务日志:服务端运行所产生的警告、异常、崩溃日志的详细数据和堆栈信息。
|
||||
11. 在线用户:当前系统中活跃用户状态监控。
|
||||
12. 定时任务:在线(添加、修改、删除)任务调度包含执行结果日志。
|
||||
13. 代码生成:支持自动化生成前后端代码。CURD关联表、树表、消息队列、定时任务一键生成等。
|
||||
14. 插件应用:支持一键生成插件模板,每个插件之间开发隔离,拥有独立多应用入口、独立配置。完美支持多人协同开发、插件插拔不会对原系统产生影响等。
|
||||
15. 服务监控:监视当前系统CPU、内存、磁盘、网络、堆栈等相关信息。
|
||||
16. 附件管理:文件图片上传,支持本地、阿里云oss、腾讯云cos、ucloud对象存储、七牛云对象存储等多种上传驱动,后台一键切换配置。
|
||||
17. TCP服务:基于gtcp的应用化实例,支持长连接、断线重连、自动维护心跳、服务登录、服务授权等。主要用于网络服务进程之间的消息通讯。
|
||||
18. 消息队列:同时兼容 kafka、redis、rocketmq、磁盘队列,一键配置切换到场景适用的MQ。
|
||||
19. 通知公告:采用websocket实时推送在线用户最新通知、公告、私信消息。
|
||||
20. 地区编码:整合国内通用省市区编码,运用于项目于一身,支持动态省市区选项。
|
||||
21. 常用工具:集成常用的工具包和命令行工具,可以快速开发自定义命令行,多种启动入口。
|
||||
11. 支付网关:集成支付宝、微信支付、QQ支付等多种支付方式,只需简单配置即可使用。
|
||||
12. 资金管理:支持在线充值、订单申请/原路退款、资金提现、资金/积分变动明细等通用模块。
|
||||
13. 在线用户:当前系统中活跃用户状态监控。
|
||||
14. 定时任务:在线(添加、修改、删除)任务调度包含执行结果日志。
|
||||
15. 代码生成:支持自动化生成前后端代码。CURD关联表、树表、消息队列、定时任务一键生成等。
|
||||
16. 插件应用:支持一键生成插件模板,每个插件之间开发隔离,拥有独立多应用入口、独立配置。完美支持多人协同开发、插件插拔不会对原系统产生影响等。
|
||||
17. 服务监控:监视当前系统CPU、内存、磁盘、网络、堆栈等相关信息。
|
||||
18. 附件管理:文件图片上传,支持本地、阿里云oss、腾讯云cos、ucloud对象存储、七牛云对象存储等多种上传驱动,后台一键切换配置。
|
||||
19. TCP服务:基于gtcp的应用化实例,支持长连接、断线重连、自动维护心跳、服务登录、服务授权等。主要用于网络服务进程之间的消息通讯。
|
||||
20. 消息队列:同时兼容 kafka、redis、rocketmq、磁盘队列,一键配置切换到场景适用的MQ。
|
||||
21. 通知公告:采用websocket实时推送在线用户最新通知、公告、私信消息。
|
||||
22. 地区编码:整合国内通用省市区编码,运用于项目于一身,支持动态省市区选项。
|
||||
23. 常用工具:集成常用的工具包和命令行工具,可以快速开发自定义命令行,多种启动入口。
|
||||
|
||||
|
||||
> HotGo开源以来得到了大家的很多支持,本项目初衷只为互相学习交流,没有任何盈利性目的!欢迎为HotGo贡献代码或提供建议!
|
||||
@ -112,6 +114,9 @@
|
||||
> websocket [https://github.com/gorilla/websocket](github.com/gorilla/websocket)
|
||||
>
|
||||
> casbin [https://github.com/casbin/casbin](https://github.com/casbin/casbin)
|
||||
>
|
||||
> gopay [https://github.com/go-pay/gopay](https://github.com/go-pay/gopay)
|
||||
|
||||
|
||||
|
||||
## 交流QQ群
|
||||
|
@ -18,6 +18,7 @@
|
||||
- [控制台](sys-console.md)
|
||||
- 请求中间件和WebHook
|
||||
- [权限控制](sys-auth.md)
|
||||
- [支付网关](sys-payment.md)
|
||||
- [数据库](sys-db.md)
|
||||
- [代码生成](sys-code.md)
|
||||
- 定时任务
|
||||
|
@ -15,10 +15,10 @@
|
||||
5. 命令行运行 `yarn -v` 若控制台输出版本号则前端环境搭建成功
|
||||
|
||||
### 后端环境
|
||||
1. 下载golang安装 版本号需>=1.18
|
||||
1. 下载golang安装 版本号需>=1.19
|
||||
2. 国际: https://golang.org/dl/
|
||||
3. 国内: https://golang.google.cn/dl/
|
||||
4. 命令行运行 go 若控制台输出各类提示命令 则安装成功 输入 `go version` 确认版本大于1.18
|
||||
4. 命令行运行 go 若控制台输出各类提示命令 则安装成功 输入 `go version` 确认版本大于1.19
|
||||
5. 开发工具推荐 [Goland](https://www.jetbrains.com/go/)
|
||||
|
||||
### 使用说明
|
||||
@ -26,6 +26,6 @@
|
||||
> 需要本地具有 git node golang 环境
|
||||
|
||||
- node版本 >= 16.0.0
|
||||
- golang版本 >= v1.18
|
||||
- golang版本 >= v1.19
|
||||
- mysql 引擎需要是 innoDB
|
||||
- IDE推荐:Goland
|
||||
|
@ -8,8 +8,8 @@
|
||||
### 环境要求
|
||||
|
||||
- node版本 >= v16.0.0
|
||||
- golang版本 >= v1.18
|
||||
- goframe版本 >=v2.3.2
|
||||
- golang版本 >= v1.19
|
||||
- goframe版本 >=v2.4.1
|
||||
- mysql版本 >=5.7
|
||||
|
||||
> 必须先看[环境搭建文档](start-environment.md),如果安装遇到问题务必先查看[常见问题文档](start-issue.md)
|
||||
|
@ -3,8 +3,8 @@
|
||||
#### 说明环境情况
|
||||
|
||||
- 平台: windows/linux
|
||||
- 软件与版本:golang 1.18, Mysql 5.7 ...
|
||||
- 系统版本:hotgo 2.1.4
|
||||
- 软件与版本:golang 1.19, Mysql 5.7 ...
|
||||
- 系统版本:hotgo 2.6.2
|
||||
|
||||
#### 你做了什么?
|
||||
|
||||
|
@ -11,6 +11,23 @@
|
||||
|
||||
> 如果升级(覆盖)代码后打开会出现 sql 报错, 请检查更新的数据库格式或自行调整
|
||||
|
||||
### v2.6.7
|
||||
updated 2023.05.11
|
||||
- 增加:增加支付网关:集成支付宝、微信支付、QQ支付,可通过后台直接配置参数
|
||||
- 增加:增加资金管理模块,包含在线充值、申请提现、资金变动明细功能
|
||||
- 增加:增加redis延迟队列
|
||||
- 增加:tcp服务增加rpc协议通讯支持
|
||||
- 增加:通过微信访问后台自动获取openid,后续微信相关业务使用
|
||||
- 优化:gf版本升级到v2.4.1
|
||||
- 优化:优化CURD代码生成单表列表
|
||||
- 优化:优化菜单权限路由,解决偶尔修改权限不能实时生效的情况
|
||||
- 优化:优化后台导出功能搜索参数无效问题
|
||||
- 优化:将定时任务拆分成可独立部署的程序,通过tcp长连接方式与后台交互
|
||||
- 修复:修复相同文件多次上传页面无响应问题
|
||||
- 修复:修复新用户不更新活跃时间问题
|
||||
- 修复:修复本地缓存当缓存不存在时的异常错误问题
|
||||
- 修复:修复访问日志偶尔出现无法记录问题
|
||||
|
||||
|
||||
### v2.5.3
|
||||
updated 2023.04.10
|
||||
|
101
docs/guide-zh-CN/sys-payment.md
Normal file
101
docs/guide-zh-CN/sys-payment.md
Normal file
@ -0,0 +1,101 @@
|
||||
## 支付网关
|
||||
|
||||
目录
|
||||
|
||||
- 介绍
|
||||
- 一个简单的支付流程
|
||||
- 支付配置
|
||||
- 创建支付订单
|
||||
- 注册支付回调
|
||||
- 订单退款
|
||||
- 单笔转账(待更新)
|
||||
- 其他
|
||||
|
||||
|
||||
### 介绍
|
||||
> 在web应用开发中,支付功能可以做为不可或缺的一部分,HotGo提供了相对通用的支付网关,目前已支持支付宝、微信支付、QQ支付,包含创建支付订单、支付回调、订单退款等功能,开发者几乎只需关注订单业务处理即可。
|
||||
|
||||
#### 一个简单的支付流程
|
||||
|
||||
```mermaid
|
||||
|
||||
graph TD
|
||||
A(用户下单) --> B(创建订单<br> 创建成功后,将订单支付信息提交到支付网关处理)
|
||||
B -->|网关返回失败| H(提示错误)
|
||||
B -->|网关返回成功| G(拿到支付链接,用户侧跳转支付页面)
|
||||
G -->|支付完成| C(支付平台通知支付网关<br> 支付网关进行验签和效验支付处理状态) -->|验证通过,回调订单业务| E(订单更新状态,发放业务产品)
|
||||
G -->|支付取消| D(订单支付超时关闭)
|
||||
|
||||
|
||||
```
|
||||
|
||||
|
||||
### 支付配置
|
||||
> 请到 系统设置 -> 配置管理 -> 支付配置 -> 找到你需要的支付方式,进行配置即可
|
||||
|
||||
|
||||
|
||||
### 创建支付订单
|
||||
|
||||
```go
|
||||
package main
|
||||
|
||||
func main() {
|
||||
// 创建支付网关订单
|
||||
create, err := service.Pay().Create(ctx, payin.PayCreateInp{
|
||||
Subject: "充值100元",
|
||||
OrderSn: "唯一业务订单编号",
|
||||
OrderGroup: "admin_order", // 订单分组,用于订单分类和绑定支付成功的回调方法
|
||||
PayType: "wxpay", // 微信支付
|
||||
TradeType: "scan", // 二维码扫码
|
||||
PayAmount: "100", // 100元
|
||||
})
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
### 注册支付回调
|
||||
- 在文件`server/internal/global/pay.go` 加入你的业务订单分组回调方法,当订单支付成功验签通过后会自动进行回调,参考以下:
|
||||
|
||||
```go
|
||||
package global
|
||||
|
||||
import (
|
||||
"hotgo/internal/consts"
|
||||
"hotgo/internal/library/payment"
|
||||
"hotgo/internal/service"
|
||||
)
|
||||
|
||||
// 注册支付成功回调方法
|
||||
func payNotifyCall() {
|
||||
payment.RegisterNotifyCall(consts.OrderGroupAdminOrder, service.AdminOrder().PayNotify) // 后台充值订单
|
||||
// ...
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
### 订单退款
|
||||
|
||||
|
||||
```go
|
||||
package main
|
||||
|
||||
func main() {
|
||||
refund, err := service.PayRefund().Refund(ctx, payin.PayRefundInp{
|
||||
OrderSn: "唯一业务订单编号",
|
||||
RefundMoney: "退款金额",
|
||||
Reason: "买家申请退款原因",
|
||||
Remark: "商家同意退款备注",
|
||||
})
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
### 单笔转账(待更新)
|
||||
|
||||
|
||||
|
||||
### 其他
|
||||
- 由于各个支付平台中交易方式较多,如果目前已有的交易方式不满足你的支付场景需求,请自行参考gopay文档对文件`server/internal/library/payment/payment.go`中的`PayClient`接口实现进行扩展
|
||||
- gopay文档地址:https://github.com/go-pay/gopay
|
||||
|
@ -110,6 +110,31 @@ func test() {
|
||||
|
||||
```
|
||||
|
||||
延迟队列,目前只有redis驱动支持:
|
||||
|
||||
```go
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"hotgo/internal/consts"
|
||||
"hotgo/internal/library/queue"
|
||||
"hotgo/internal/model/entity"
|
||||
)
|
||||
|
||||
func test() {
|
||||
data := &entity.SysLog{
|
||||
//...
|
||||
}
|
||||
|
||||
// 延迟10秒
|
||||
if err := queue.SendDelayMsg(consts.QueueLogTopic, data, 10); err != nil {
|
||||
fmt.Printf("queue.Push err:%+v", err)
|
||||
}
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
### 控制台
|
||||
|
||||
控制台用于处理队列消息,即消费者。
|
||||
|
6
server/.gitignore
vendored
6
server/.gitignore
vendored
@ -21,8 +21,10 @@ resource/public/admin/
|
||||
resource/public/attachment/
|
||||
storage/cache/
|
||||
storage/diskqueue/
|
||||
storage/ssl/server.crt
|
||||
storage/ssl/server.key
|
||||
storage/cert/ssl/server.crt
|
||||
storage/cert/ssl/server.key
|
||||
storage/cert/pay/alipay/
|
||||
storage/cert/pay/wxpay/
|
||||
temp/
|
||||
main.exe
|
||||
main.exe~
|
||||
|
@ -25,6 +25,10 @@ http:
|
||||
queue:
|
||||
gf run main.go --args "queue"
|
||||
|
||||
.PHONY: cron
|
||||
cron:
|
||||
gf run main.go --args "cron"
|
||||
|
||||
.PHONY: auth
|
||||
auth:
|
||||
gf run main.go --args "auth"
|
||||
@ -34,6 +38,17 @@ auth:
|
||||
web:
|
||||
@cd ../web && yarn dev
|
||||
|
||||
|
||||
# 刷新casbin权限
|
||||
.PHONY: refresh
|
||||
refresh:
|
||||
@go run main.go tools -m=casbin -a1=refresh
|
||||
|
||||
# 清理casbin权限
|
||||
.PHONY: clear
|
||||
clear:
|
||||
@go run main.go tools -m=casbin -a1=clear
|
||||
|
||||
.PHONY: killmain
|
||||
killmain:
|
||||
@kill -9 $(ps -ef|grep main|grep -v grep|awk '{print $2}')
|
||||
|
48
server/api/admin/cash/cash.go
Normal file
48
server/api/admin/cash/cash.go
Normal file
@ -0,0 +1,48 @@
|
||||
// Package cash
|
||||
// @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 cash
|
||||
|
||||
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:"/cash/list" method:"get" tags:"提现" summary:"获取提现列表"`
|
||||
adminin.CashListInp
|
||||
}
|
||||
|
||||
type ListRes struct {
|
||||
List []*adminin.CashListModel `json:"list" dc:"数据列表"`
|
||||
form.PageRes
|
||||
}
|
||||
|
||||
// ViewReq 获取指定信息
|
||||
type ViewReq struct {
|
||||
g.Meta `path:"/cash/view" method:"get" tags:"提现" summary:"获取指定信息"`
|
||||
adminin.CashViewInp
|
||||
}
|
||||
type ViewRes struct {
|
||||
*adminin.CashViewModel
|
||||
}
|
||||
|
||||
// ApplyReq 申请提现
|
||||
type ApplyReq struct {
|
||||
Money float64 `json:"money" description:"提现金额"`
|
||||
g.Meta `path:"/cash/apply" method:"post" tags:"提现" summary:"申请提现"`
|
||||
}
|
||||
type ApplyRes struct{}
|
||||
|
||||
// PaymentReq 提现打款处理
|
||||
type PaymentReq struct {
|
||||
Id int64 `json:"id" description:"ID"`
|
||||
Status int64 `json:"status" description:"状态码"`
|
||||
Msg string `json:"msg" description:"处理结果"`
|
||||
g.Meta `path:"/cash/payment" method:"post" tags:"提现" summary:"提现打款处理"`
|
||||
}
|
||||
type PaymentRes struct{}
|
29
server/api/admin/common/wechat.go
Normal file
29
server/api/admin/common/wechat.go
Normal file
@ -0,0 +1,29 @@
|
||||
// Package common
|
||||
// @Link https://github.com/bufanyun/hotgo
|
||||
// @Copyright Copyright (c) 2023 HotGo CLI
|
||||
// @Author Ms <133814250@qq.com>
|
||||
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
|
||||
package common
|
||||
|
||||
import (
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
"hotgo/internal/model/input/commonin"
|
||||
)
|
||||
|
||||
// WechatAuthorizeReq 微信用户授权
|
||||
type WechatAuthorizeReq struct {
|
||||
g.Meta `path:"/wechat/authorize" method:"get" tags:"微信" summary:"微信用户授权"`
|
||||
commonin.WechatAuthorizeInp
|
||||
}
|
||||
type WechatAuthorizeRes struct {
|
||||
*commonin.WechatAuthorizeModel
|
||||
}
|
||||
|
||||
// WechatAuthorizeCallReq 微信用户授权回调
|
||||
type WechatAuthorizeCallReq struct {
|
||||
g.Meta `path:"/wechat/authorizeCall" method:"get" tags:"微信" summary:"微信用户授权"`
|
||||
commonin.WechatAuthorizeCallInp
|
||||
}
|
||||
type WechatAuthorizeCallRes struct {
|
||||
*commonin.WechatAuthorizeCallModel
|
||||
}
|
@ -34,3 +34,11 @@ type TypeSelectReq struct {
|
||||
g.Meta `path:"/config/typeSelect" method:"get" tags:"配置" summary:"数据类型选项"`
|
||||
}
|
||||
type TypeSelectRes []form.Select
|
||||
|
||||
// GetCashReq 获取提现配置
|
||||
type GetCashReq struct {
|
||||
g.Meta `path:"/config/getCash" method:"get" tags:"配置" summary:"获取提现配置"`
|
||||
}
|
||||
type GetCashRes struct {
|
||||
*sysin.GetConfigModel
|
||||
}
|
||||
|
42
server/api/admin/creditslog/creditslog.go
Normal file
42
server/api/admin/creditslog/creditslog.go
Normal file
@ -0,0 +1,42 @@
|
||||
// Package creditslog
|
||||
// @Link https://github.com/bufanyun/hotgo
|
||||
// @Copyright Copyright (c) 2023 HotGo CLI
|
||||
// @Author Ms <133814250@qq.com>
|
||||
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
|
||||
// @AutoGenerate Version 2.5.3
|
||||
// @AutoGenerate Date 2023-04-15 15:59:58
|
||||
package creditslog
|
||||
|
||||
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:"/creditsLog/list" method:"get" tags:"资产变动" summary:"获取资产变动列表"`
|
||||
adminin.CreditsLogListInp
|
||||
}
|
||||
|
||||
type ListRes struct {
|
||||
form.PageRes
|
||||
List []*adminin.CreditsLogListModel `json:"list" dc:"数据列表"`
|
||||
}
|
||||
|
||||
// ExportReq 导出资产变动列表
|
||||
type ExportReq struct {
|
||||
g.Meta `path:"/creditsLog/export" method:"get" tags:"资产变动" summary:"导出资产变动列表"`
|
||||
adminin.CreditsLogListInp
|
||||
}
|
||||
|
||||
type ExportRes struct{}
|
||||
|
||||
// OptionReq 获取变动状态选项
|
||||
type OptionReq struct {
|
||||
g.Meta `path:"/creditsLog/option" method:"get" summary:"资产变动" tags:"获取变动状态选项"`
|
||||
}
|
||||
type OptionRes struct {
|
||||
CreditType []g.Map `json:"creditType" dc:"变动类型 "`
|
||||
CreditGroup []g.Map `json:"creditGroup" dc:"变动组别"`
|
||||
}
|
@ -3,24 +3,18 @@
|
||||
// @Copyright Copyright (c) 2023 HotGo CLI
|
||||
// @Author Ms <133814250@qq.com>
|
||||
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
|
||||
//
|
||||
package cron
|
||||
|
||||
import (
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
"hotgo/internal/model/entity"
|
||||
"hotgo/internal/model/input/form"
|
||||
"hotgo/internal/model/input/sysin"
|
||||
)
|
||||
|
||||
// ListReq 查询列表
|
||||
type ListReq struct {
|
||||
form.PageReq
|
||||
form.RangeDateReq
|
||||
form.StatusReq
|
||||
Title string `json:"title"`
|
||||
Content string `json:"content"`
|
||||
g.Meta `path:"/cron/list" method:"get" tags:"定时任务" summary:"获取定时任务列表"`
|
||||
g.Meta `path:"/cron/list" method:"get" tags:"定时任务" summary:"获取定时任务列表"`
|
||||
sysin.CronListInp
|
||||
}
|
||||
|
||||
type ListRes struct {
|
||||
@ -30,8 +24,8 @@ type ListRes struct {
|
||||
|
||||
// ViewReq 获取信息
|
||||
type ViewReq struct {
|
||||
Id int64 `json:"id" v:"required#定时任务ID不能为空" dc:"定时任务ID"`
|
||||
g.Meta `path:"/cron/view" method:"get" tags:"定时任务" summary:"获取指定信息"`
|
||||
sysin.CronViewInp
|
||||
}
|
||||
type ViewRes struct {
|
||||
*sysin.CronViewModel
|
||||
@ -39,37 +33,45 @@ type ViewRes struct {
|
||||
|
||||
// EditReq 修改/新增
|
||||
type EditReq struct {
|
||||
entity.SysCron
|
||||
g.Meta `path:"/cron/edit" method:"post" tags:"定时任务" summary:"修改/新增定时任务"`
|
||||
sysin.CronEditInp
|
||||
}
|
||||
type EditRes struct {
|
||||
*sysin.CronEditModel
|
||||
}
|
||||
type EditRes struct{}
|
||||
|
||||
// DeleteReq 删除
|
||||
type DeleteReq struct {
|
||||
Id interface{} `json:"id" v:"required#定时任务ID不能为空" dc:"定时任务ID"`
|
||||
g.Meta `path:"/cron/delete" method:"post" tags:"定时任务" summary:"删除定时任务"`
|
||||
sysin.CronDeleteInp
|
||||
}
|
||||
type DeleteRes struct {
|
||||
*sysin.CronDeleteModel
|
||||
}
|
||||
type DeleteRes struct{}
|
||||
|
||||
// MaxSortReq 最大排序
|
||||
type MaxSortReq struct {
|
||||
Id int64 `json:"id" dc:"定时任务ID"`
|
||||
g.Meta `path:"/cron/maxSort" method:"get" tags:"定时任务" summary:"定时任务最大排序"`
|
||||
sysin.CronMaxSortInp
|
||||
}
|
||||
type MaxSortRes struct {
|
||||
Sort int `json:"sort" dc:"排序"`
|
||||
*sysin.CronMaxSortModel
|
||||
}
|
||||
|
||||
// StatusReq 更新状态
|
||||
type StatusReq struct {
|
||||
entity.SysCron
|
||||
g.Meta `path:"/cron/status" method:"post" tags:"定时任务" summary:"更新定时任务状态"`
|
||||
sysin.CronStatusInp
|
||||
}
|
||||
type StatusRes struct {
|
||||
*sysin.CronStatusModel
|
||||
}
|
||||
type StatusRes struct{}
|
||||
|
||||
// OnlineExecReq 在线执行
|
||||
type OnlineExecReq struct {
|
||||
g.Meta `path:"/cron/onlineExec" method:"post" tags:"定时任务" summary:"在线执行"`
|
||||
sysin.OnlineExecInp
|
||||
}
|
||||
type OnlineExecRes struct{}
|
||||
type OnlineExecRes struct {
|
||||
*sysin.OnlineExecModel
|
||||
}
|
||||
|
@ -3,7 +3,6 @@
|
||||
// @Copyright Copyright (c) 2023 HotGo CLI
|
||||
// @Author Ms <133814250@qq.com>
|
||||
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
|
||||
//
|
||||
package cron
|
||||
|
||||
import (
|
||||
@ -15,12 +14,8 @@ import (
|
||||
|
||||
// GroupListReq 查询列表
|
||||
type GroupListReq struct {
|
||||
form.PageReq
|
||||
form.RangeDateReq
|
||||
form.StatusReq
|
||||
Title string `json:"title"`
|
||||
Content string `json:"content"`
|
||||
g.Meta `path:"/cronGroup/list" method:"get" tags:"定时任务分组" summary:"获取定时任务分组列表"`
|
||||
g.Meta `path:"/cronGroup/list" method:"get" tags:"定时任务分组" summary:"获取定时任务分组列表"`
|
||||
sysin.CronGroupListInp
|
||||
}
|
||||
|
||||
type GroupListRes struct {
|
||||
@ -30,8 +25,8 @@ type GroupListRes struct {
|
||||
|
||||
// GroupViewReq 获取信息
|
||||
type GroupViewReq struct {
|
||||
Id int64 `json:"id" v:"required#定时任务分组ID不能为空" dc:"定时任务分组ID"`
|
||||
g.Meta `path:"/cronGroup/view" method:"get" tags:"定时任务分组" summary:"获取指定信息"`
|
||||
sysin.CronGroupViewInp
|
||||
}
|
||||
type GroupViewRes struct {
|
||||
*sysin.CronGroupViewModel
|
||||
@ -39,33 +34,40 @@ type GroupViewRes struct {
|
||||
|
||||
// GroupEditReq 修改/新增
|
||||
type GroupEditReq struct {
|
||||
entity.SysCronGroup
|
||||
g.Meta `path:"/cronGroup/edit" method:"post" tags:"定时任务分组" summary:"修改/新增定时任务分组"`
|
||||
sysin.CronGroupEditInp
|
||||
}
|
||||
type GroupEditRes struct {
|
||||
*sysin.CronGroupEditModel
|
||||
}
|
||||
type GroupEditRes struct{}
|
||||
|
||||
// GroupDeleteReq 删除
|
||||
type GroupDeleteReq struct {
|
||||
Id interface{} `json:"id" v:"required#定时任务分组ID不能为空" dc:"定时任务分组ID"`
|
||||
g.Meta `path:"/cronGroup/delete" method:"post" tags:"定时任务分组" summary:"删除定时任务分组"`
|
||||
sysin.CronGroupDeleteInp
|
||||
}
|
||||
type GroupDeleteRes struct {
|
||||
*sysin.CronGroupDeleteModel
|
||||
}
|
||||
type GroupDeleteRes struct{}
|
||||
|
||||
// GroupMaxSortReq 最大排序
|
||||
type GroupMaxSortReq struct {
|
||||
Id int64 `json:"id" dc:"定时任务分组ID"`
|
||||
g.Meta `path:"/cronGroup/maxSort" method:"get" tags:"定时任务分组" summary:"定时任务分组最大排序"`
|
||||
sysin.CronGroupMaxSortInp
|
||||
}
|
||||
type GroupMaxSortRes struct {
|
||||
Sort int `json:"sort" dc:"排序"`
|
||||
*sysin.CronGroupMaxSortModel
|
||||
}
|
||||
|
||||
// GroupStatusReq 更新状态
|
||||
type GroupStatusReq struct {
|
||||
entity.SysCronGroup
|
||||
g.Meta `path:"/cronGroup/status" method:"post" tags:"定时任务分组" summary:"更新定时任务分组状态"`
|
||||
sysin.CronGroupStatusInp
|
||||
}
|
||||
type GroupStatusRes struct {
|
||||
*sysin.CronGroupStatusModel
|
||||
}
|
||||
type GroupStatusRes struct{}
|
||||
|
||||
// GroupSelectReq 定时任务分组选项
|
||||
type GroupSelectReq struct {
|
||||
|
@ -3,9 +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.4
|
||||
// @AutoGenerate Date 2023-02-20 16:41:58
|
||||
//
|
||||
// @AutoGenerate Version 2.5.3
|
||||
// @AutoGenerate Date 2023-04-28 15:28:40
|
||||
package curddemo
|
||||
|
||||
import (
|
||||
|
@ -3,13 +3,13 @@
|
||||
// @Copyright Copyright (c) 2023 HotGo CLI
|
||||
// @Author Ms <133814250@qq.com>
|
||||
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
|
||||
//
|
||||
package dept
|
||||
|
||||
import (
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
"hotgo/internal/model/entity"
|
||||
"hotgo/internal/model/input/adminin"
|
||||
"hotgo/internal/model/input/form"
|
||||
)
|
||||
|
||||
// NameUniqueReq 名称是否唯一
|
||||
@ -71,3 +71,14 @@ type StatusReq struct {
|
||||
g.Meta `path:"/dept/status" method:"post" tags:"部门" summary:"更新部门状态"`
|
||||
}
|
||||
type StatusRes struct{}
|
||||
|
||||
// OptionReq 获取部门选项树
|
||||
type OptionReq struct {
|
||||
g.Meta `path:"/dept/option" method:"get" tags:"部门" summary:"获取部门选项树"`
|
||||
adminin.DeptOptionInp
|
||||
}
|
||||
|
||||
type OptionRes struct {
|
||||
*adminin.DeptOptionModel
|
||||
form.PageRes
|
||||
}
|
||||
|
@ -3,7 +3,6 @@
|
||||
// @Copyright Copyright (c) 2023 HotGo CLI
|
||||
// @Author Ms <133814250@qq.com>
|
||||
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
|
||||
//
|
||||
package member
|
||||
|
||||
import (
|
||||
@ -115,15 +114,6 @@ type DeleteReq struct {
|
||||
}
|
||||
type DeleteRes struct{}
|
||||
|
||||
// MaxSortReq 最大排序
|
||||
type MaxSortReq struct {
|
||||
g.Meta `path:"/member/maxSort" method:"get" tags:"用户" summary:"用户最大排序"`
|
||||
adminin.MemberMaxSortInp
|
||||
}
|
||||
type MaxSortRes struct {
|
||||
*adminin.MemberMaxSortModel
|
||||
}
|
||||
|
||||
// LoginInfoReq 获取登录用户信息
|
||||
type LoginInfoReq struct {
|
||||
g.Meta `path:"/member/info" method:"get" tags:"用户" summary:"获取登录用户信息" dc:"获取管理后台的登录用户信息"`
|
||||
@ -145,3 +135,17 @@ type SelectReq struct {
|
||||
g.Meta `path:"/member/option" method:"get" summary:"用户" tags:"获取可选的后台用户选项"`
|
||||
}
|
||||
type SelectRes []*adminin.MemberSelectModel
|
||||
|
||||
// AddBalanceReq 增加余额
|
||||
type AddBalanceReq struct {
|
||||
g.Meta `path:"/member/addBalance" method:"post" tags:"用户" summary:"增加余额"`
|
||||
adminin.MemberAddBalanceInp
|
||||
}
|
||||
type AddBalanceRes struct{}
|
||||
|
||||
// AddIntegralReq 增加积分
|
||||
type AddIntegralReq struct {
|
||||
g.Meta `path:"/member/addIntegral" method:"post" tags:"用户" summary:"增加积分"`
|
||||
adminin.MemberAddIntegralInp
|
||||
}
|
||||
type AddIntegralRes struct{}
|
||||
|
@ -3,12 +3,10 @@
|
||||
// @Copyright Copyright (c) 2023 HotGo CLI
|
||||
// @Author Ms <133814250@qq.com>
|
||||
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
|
||||
//
|
||||
package menu
|
||||
|
||||
import (
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
"hotgo/internal/model"
|
||||
"hotgo/internal/model/entity"
|
||||
"hotgo/internal/model/input/form"
|
||||
)
|
||||
@ -75,23 +73,3 @@ type ListReq struct {
|
||||
type ListRes struct {
|
||||
List []map[string]interface{} `json:"list" dc:"数据列表"`
|
||||
}
|
||||
|
||||
// SearchListReq 查询菜单列表
|
||||
type SearchListReq struct {
|
||||
g.Meta `path:"/menu/search_list" method:"get" tags:"菜单" summary:"获取菜单列表"`
|
||||
Name string `json:"name" dc:"菜单名称"`
|
||||
form.StatusReq
|
||||
}
|
||||
|
||||
type SearchListRes []*model.TreeMenu
|
||||
|
||||
// RoleListReq 查询角色菜单列表
|
||||
type RoleListReq struct {
|
||||
g.Meta `path:"/menu/role_list" method:"get" tags:"菜单" summary:"查询角色菜单列表"`
|
||||
RoleId string `json:"role_id" dc:"角色ID"`
|
||||
}
|
||||
|
||||
type RoleListRes struct {
|
||||
Menus []*model.LabelTreeMenu `json:"menus" dc:"菜单列表"`
|
||||
CheckedKeys []int64 `json:"checkedKeys" dc:"选择的菜单ID"`
|
||||
}
|
||||
|
102
server/api/admin/order/order.go
Normal file
102
server/api/admin/order/order.go
Normal file
@ -0,0 +1,102 @@
|
||||
// Package order
|
||||
// @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 order
|
||||
|
||||
import (
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
"hotgo/internal/model/input/adminin"
|
||||
"hotgo/internal/model/input/form"
|
||||
)
|
||||
|
||||
// AcceptRefundReq 受理申请退款
|
||||
type AcceptRefundReq struct {
|
||||
g.Meta `path:"/order/acceptRefund" method:"post" tags:"充值订单" summary:"受理申请退款"`
|
||||
adminin.OrderAcceptRefundInp
|
||||
}
|
||||
|
||||
type AcceptRefundRes struct {
|
||||
}
|
||||
|
||||
// ApplyRefundReq 申请退款
|
||||
type ApplyRefundReq struct {
|
||||
g.Meta `path:"/order/applyRefund" method:"post" tags:"充值订单" summary:"申请退款"`
|
||||
adminin.OrderApplyRefundInp
|
||||
}
|
||||
|
||||
type ApplyRefundRes struct {
|
||||
}
|
||||
|
||||
// OptionReq 获取订单状态选项
|
||||
type OptionReq struct {
|
||||
g.Meta `path:"/order/option" method:"get" summary:"充值订单" tags:"获取订单状态选项"`
|
||||
}
|
||||
type OptionRes struct {
|
||||
Status []g.Map `json:"status" dc:"订单状态"`
|
||||
AcceptRefundStatus []g.Map `json:"acceptRefundStatus" dc:"订单退款受理状态"`
|
||||
PayType []g.Map `json:"payType" dc:"支付方式"`
|
||||
}
|
||||
|
||||
// CreateReq 创建充值订单
|
||||
type CreateReq struct {
|
||||
g.Meta `path:"/order/create" method:"post" tags:"充值订单" summary:"创建充值订单"`
|
||||
adminin.OrderCreateInp
|
||||
}
|
||||
|
||||
type CreateRes struct {
|
||||
*adminin.OrderCreateModel
|
||||
}
|
||||
|
||||
// ListReq 查询充值订单列表
|
||||
type ListReq struct {
|
||||
g.Meta `path:"/order/list" method:"get" tags:"充值订单" summary:"获取充值订单列表"`
|
||||
adminin.OrderListInp
|
||||
}
|
||||
|
||||
type ListRes struct {
|
||||
form.PageRes
|
||||
List []*adminin.OrderListModel `json:"list" dc:"数据列表"`
|
||||
}
|
||||
|
||||
// ExportReq 导出充值订单列表
|
||||
type ExportReq struct {
|
||||
g.Meta `path:"/order/export" method:"get" tags:"充值订单" summary:"导出充值订单列表"`
|
||||
adminin.OrderListInp
|
||||
}
|
||||
|
||||
type ExportRes struct{}
|
||||
|
||||
// ViewReq 获取充值订单指定信息
|
||||
type ViewReq struct {
|
||||
g.Meta `path:"/order/view" method:"get" tags:"充值订单" summary:"获取充值订单指定信息"`
|
||||
adminin.OrderViewInp
|
||||
}
|
||||
|
||||
type ViewRes struct {
|
||||
*adminin.OrderViewModel
|
||||
}
|
||||
|
||||
// EditReq 修改/新增充值订单
|
||||
type EditReq struct {
|
||||
g.Meta `path:"/order/edit" method:"post" tags:"充值订单" summary:"修改/新增充值订单"`
|
||||
adminin.OrderEditInp
|
||||
}
|
||||
type EditRes struct{}
|
||||
|
||||
// DeleteReq 删除充值订单
|
||||
type DeleteReq struct {
|
||||
g.Meta `path:"/order/delete" method:"post" tags:"充值订单" summary:"删除充值订单"`
|
||||
adminin.OrderDeleteInp
|
||||
}
|
||||
|
||||
type DeleteRes struct{}
|
||||
|
||||
// StatusReq 更新充值订单状态
|
||||
type StatusReq struct {
|
||||
g.Meta `path:"/order/status" method:"post" tags:"充值订单" summary:"更新充值订单状态"`
|
||||
adminin.OrderStatusInp
|
||||
}
|
||||
|
||||
type StatusRes struct{}
|
33
server/api/admin/pay/refund.go
Normal file
33
server/api/admin/pay/refund.go
Normal file
@ -0,0 +1,33 @@
|
||||
// Package pay
|
||||
// @Link https://github.com/bufanyun/hotgo
|
||||
// @Copyright Copyright (c) 2023 HotGo CLI
|
||||
// @Author Ms <133814250@qq.com>
|
||||
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
|
||||
// @AutoGenerate Version 2.5.3
|
||||
// @AutoGenerate Date 2023-04-15 15:59:58
|
||||
package pay
|
||||
|
||||
import (
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
"hotgo/internal/model/input/form"
|
||||
"hotgo/internal/model/input/payin"
|
||||
)
|
||||
|
||||
// RefundListReq 查询交易退款列表
|
||||
type RefundListReq struct {
|
||||
g.Meta `path:"/payRefund/list" method:"get" tags:"交易退款" summary:"获取交易退款列表"`
|
||||
payin.PayRefundListInp
|
||||
}
|
||||
|
||||
type RefundListRes struct {
|
||||
form.PageRes
|
||||
List []*payin.PayRefundListModel `json:"list" dc:"数据列表"`
|
||||
}
|
||||
|
||||
// RefundExportReq 导出交易退款列表
|
||||
type RefundExportReq struct {
|
||||
g.Meta `path:"/payRefund/export" method:"get" tags:"交易退款" summary:"导出交易退款列表"`
|
||||
payin.PayRefundListInp
|
||||
}
|
||||
|
||||
type RefundExportRes struct{}
|
27
server/api/api/pay/notify.go
Normal file
27
server/api/api/pay/notify.go
Normal file
@ -0,0 +1,27 @@
|
||||
package pay
|
||||
|
||||
import (
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
"hotgo/internal/model/input/payin"
|
||||
)
|
||||
|
||||
// NotifyAliPayReq 支付宝回调
|
||||
type NotifyAliPayReq struct {
|
||||
g.Meta `path:"/pay/notify/alipay" method:"post" tags:"支付异步通知" summary:"支付宝回调"`
|
||||
}
|
||||
|
||||
type NotifyAliPayRes payin.PayNotifyModel
|
||||
|
||||
// NotifyWxPayReq 微信支付回调
|
||||
type NotifyWxPayReq struct {
|
||||
g.Meta `path:"/pay/notify/wxpay" method:"post" tags:"支付异步通知" summary:"微信支付回调"`
|
||||
}
|
||||
|
||||
type NotifyWxPayRes payin.PayNotifyModel
|
||||
|
||||
// NotifyQQPayReq QQ支付回调
|
||||
type NotifyQQPayReq struct {
|
||||
g.Meta `path:"/pay/notify/qqpay" method:"post" tags:"支付异步通知" summary:"QQ支付回调"`
|
||||
}
|
||||
|
||||
type NotifyQQPayRes payin.PayNotifyModel
|
@ -1,6 +1,6 @@
|
||||
module hotgo
|
||||
|
||||
go 1.18
|
||||
go 1.19
|
||||
|
||||
require (
|
||||
github.com/Shopify/sarama v1.34.1
|
||||
@ -11,16 +11,13 @@ require (
|
||||
github.com/aliyun/aliyun-oss-go-sdk v2.2.6+incompatible
|
||||
github.com/apache/rocketmq-client-go/v2 v2.1.0
|
||||
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/dgrijalva/jwt-go v3.2.0+incompatible
|
||||
github.com/forgoer/openssl v1.4.0
|
||||
github.com/fwhezfwhez/errorx v1.1.0
|
||||
github.com/go-resty/resty/v2 v2.7.0
|
||||
github.com/gogf/gf/contrib/drivers/mysql/v2 v2.3.3
|
||||
github.com/gogf/gf/contrib/nosql/redis/v2 v2.3.3
|
||||
github.com/gogf/gf/v2 v2.3.3
|
||||
github.com/gomodule/redigo v1.8.8
|
||||
github.com/go-pay/gopay v1.5.91
|
||||
github.com/gogf/gf/contrib/drivers/mysql/v2 v2.4.1
|
||||
github.com/gogf/gf/contrib/nosql/redis/v2 v2.4.1
|
||||
github.com/gogf/gf/v2 v2.4.1
|
||||
github.com/gorilla/websocket v1.5.0
|
||||
github.com/kayon/iploc v0.0.0-20200312105652-bda3e968a794
|
||||
github.com/mojocn/base64Captcha v1.3.5
|
||||
@ -28,13 +25,13 @@ require (
|
||||
github.com/qiniu/go-sdk/v7 v7.14.0
|
||||
github.com/shirou/gopsutil/v3 v3.23.3
|
||||
github.com/shopspring/decimal v1.3.1
|
||||
github.com/silenceper/wechat/v2 v2.1.4
|
||||
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.633
|
||||
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/sms v1.0.633
|
||||
github.com/tencentyun/cos-go-sdk-v5 v0.7.41
|
||||
github.com/ufilesdk-dev/ufile-gosdk v1.0.3
|
||||
github.com/xtaci/kcp-go v5.4.20+incompatible
|
||||
github.com/xuri/excelize/v2 v2.6.0
|
||||
golang.org/x/tools v0.6.0
|
||||
golang.org/x/tools v0.7.0
|
||||
gopkg.in/yaml.v3 v3.0.1
|
||||
)
|
||||
|
||||
@ -48,6 +45,7 @@ require (
|
||||
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/bradfitz/gomemcache v0.0.0-20220106215444-fb4bf637b56d // indirect
|
||||
github.com/cespare/xxhash/v2 v2.2.0 // indirect
|
||||
github.com/clbanning/mxj v1.8.4 // indirect
|
||||
github.com/clbanning/mxj/v2 v2.5.7 // indirect
|
||||
@ -58,18 +56,19 @@ require (
|
||||
github.com/eapache/queue v1.1.0 // indirect
|
||||
github.com/emirpasic/gods v1.12.0 // indirect
|
||||
github.com/fatih/color v1.15.0 // indirect
|
||||
github.com/fatih/structs v1.1.0 // indirect
|
||||
github.com/fsnotify/fsnotify v1.6.0 // indirect
|
||||
github.com/go-logr/logr v1.2.3 // indirect
|
||||
github.com/go-logr/logr v1.2.4 // 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/gofrs/uuid v4.0.0+incompatible // indirect
|
||||
github.com/go-sql-driver/mysql v1.7.1 // 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/google/go-querystring v1.0.0 // indirect
|
||||
github.com/google/uuid v1.3.0 // 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
|
||||
@ -81,12 +80,10 @@ require (
|
||||
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/klauspost/cpuid/v2 v2.1.1 // indirect
|
||||
github.com/klauspost/reedsolomon v1.11.7 // indirect
|
||||
github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 // 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-isatty v0.0.18 // indirect
|
||||
github.com/mattn/go-runewidth v0.0.14 // indirect
|
||||
github.com/mitchellh/mapstructure v1.4.3 // indirect
|
||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
|
||||
@ -101,30 +98,28 @@ require (
|
||||
github.com/richardlehane/msoleps v1.0.1 // indirect
|
||||
github.com/rivo/uniseg v0.4.4 // indirect
|
||||
github.com/shoenig/go-m1cpu v0.1.4 // indirect
|
||||
github.com/sirupsen/logrus v1.8.1 // indirect
|
||||
github.com/templexxx/cpufeat v0.0.0-20180724012125-cef66df7f161 // indirect
|
||||
github.com/templexxx/xor v0.0.0-20191217153810-f85b25db303b // 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/sirupsen/logrus v1.9.0 // indirect
|
||||
github.com/spf13/cast v1.4.1 // indirect
|
||||
github.com/tidwall/gjson v1.14.1 // indirect
|
||||
github.com/tidwall/match v1.1.1 // indirect
|
||||
github.com/tidwall/pretty v1.2.0 // indirect
|
||||
github.com/tjfoc/gmsm v1.3.2 // indirect
|
||||
github.com/tklauser/go-sysconf v0.3.11 // indirect
|
||||
github.com/tklauser/numcpus v0.6.0 // indirect
|
||||
github.com/xtaci/lossyconn v0.0.0-20200209145036-adba10fffc37 // 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.14.0 // indirect
|
||||
go.opentelemetry.io/otel/sdk v1.14.0 // indirect
|
||||
go.opentelemetry.io/otel/trace v1.14.0 // indirect
|
||||
go.opentelemetry.io/otel v1.15.1 // indirect
|
||||
go.opentelemetry.io/otel/sdk v1.15.1 // indirect
|
||||
go.opentelemetry.io/otel/trace v1.15.1 // indirect
|
||||
go.uber.org/atomic v1.7.0 // indirect
|
||||
golang.org/x/crypto v0.0.0-20220411220226-7b82a4e95df4 // indirect
|
||||
golang.org/x/crypto v0.7.0 // indirect
|
||||
golang.org/x/image v0.0.0-20211028202545-6944b10bf410 // indirect
|
||||
golang.org/x/mod v0.8.0 // indirect
|
||||
golang.org/x/net v0.8.0 // indirect
|
||||
golang.org/x/mod v0.9.0 // indirect
|
||||
golang.org/x/net v0.10.0 // indirect
|
||||
golang.org/x/sync v0.1.0 // indirect
|
||||
golang.org/x/sys v0.6.0 // indirect
|
||||
golang.org/x/text v0.8.0 // indirect
|
||||
golang.org/x/sys v0.8.0 // indirect
|
||||
golang.org/x/text v0.9.0 // indirect
|
||||
golang.org/x/time v0.0.0-20191024005414-555d28b269f0 // indirect
|
||||
gopkg.in/ini.v1 v1.56.0 // indirect
|
||||
stathat.com/c/consistent v1.0.0 // indirect
|
||||
|
123
server/go.sum
123
server/go.sum
@ -32,7 +32,6 @@ cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RX
|
||||
cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0=
|
||||
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
|
||||
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
|
||||
github.com/BurntSushi/toml v0.4.1/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ=
|
||||
github.com/BurntSushi/toml v1.1.0/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ=
|
||||
github.com/BurntSushi/toml v1.2.1 h1:9F2/+DoOYIOksmaJFPw1tGFy1eDnIJXg+UHjuD8lTak=
|
||||
github.com/BurntSushi/toml v1.2.1/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ=
|
||||
@ -87,8 +86,8 @@ github.com/axgle/mahonia v0.0.0-20180208002826-3358181d7394/go.mod h1:Q8n74mJTIg
|
||||
github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
|
||||
github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8=
|
||||
github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
|
||||
github.com/bufanyun/pool v0.2.1 h1:rW6TVJt+vS71d1uBI9sCMUjS39AWZFsUww+2XOh+338=
|
||||
github.com/bufanyun/pool v0.2.1/go.mod h1:uZsjaA/H4agFQ1E0KWj4bnzRUVGmieM54pJiIKPTrAI=
|
||||
github.com/bradfitz/gomemcache v0.0.0-20220106215444-fb4bf637b56d h1:pVrfxiGfwelyab6n21ZBkbkmbevaf+WvMIiR7sr97hw=
|
||||
github.com/bradfitz/gomemcache v0.0.0-20220106215444-fb4bf637b56d/go.mod h1:H0wQNHz2YrLsuXOZozoeDmnHXkNCRmMW0gwFWDfEZDA=
|
||||
github.com/casbin/casbin/v2 v2.55.0 h1:RyU+OacnVzjxof1U3bmxHM7oCRdx9+gNnkclrvof/zI=
|
||||
github.com/casbin/casbin/v2 v2.55.0/go.mod h1:vByNa/Fchek0KZUgG5wEsl7iFsiviAYKRtgrQfcJqHg=
|
||||
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
|
||||
@ -130,18 +129,17 @@ github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7
|
||||
github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk=
|
||||
github.com/fatih/color v1.15.0 h1:kOqh6YHBtK8aywxGerMG2Eq3H6Qgoqeo13Bk2Mv/nBs=
|
||||
github.com/fatih/color v1.15.0/go.mod h1:0h5ZqXfHYED7Bhv2ZJamyIOUej9KtShiJESRwBDUSsw=
|
||||
github.com/fatih/structs v1.1.0 h1:Q7juDM0QtcnhCpeyLGQKyg4TOIghuNXrkL32pHAUMxo=
|
||||
github.com/fatih/structs v1.1.0/go.mod h1:9NiDSp5zOcgEDl+j00MP/WkGVPOlPRLejGD8Ga6PJ7M=
|
||||
github.com/forgoer/openssl v1.4.0 h1:rPMnQ92OKuBsKnfY/GmUDunnP72Cy+zviAompWMdC9U=
|
||||
github.com/forgoer/openssl v1.4.0/go.mod h1:NMVFOzYeLVR7UiGTxsa+A21nrERTZ3Rv2JHDPcJpDyI=
|
||||
github.com/fortytw2/leaktest v1.3.0 h1:u8491cBMTQ8ft8aeV+adlcytMZylmA5nnwwkRZjI8vw=
|
||||
github.com/fortytw2/leaktest v1.3.0/go.mod h1:jDsjWgpAGjm2CA7WthBh/CdZYEPF31XHquHwclZch5g=
|
||||
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
|
||||
github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ=
|
||||
github.com/fsnotify/fsnotify v1.5.1/go.mod h1:T3375wBYaZdLLcVNkcVbzGHY7f1l/uK5T5Ai1i3InKU=
|
||||
github.com/fsnotify/fsnotify v1.5.4/go.mod h1:OVB6XrOHzAwXMpEM7uPOzcehqUV2UqJxmVXmkdnm1bU=
|
||||
github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4HY=
|
||||
github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbSClcnxKAGw=
|
||||
github.com/fwhezfwhez/errorx v1.1.0 h1:795cMWZFM+thQfKaC5Cjnp/h6naUEbsoQxOb/yvwn0c=
|
||||
github.com/fwhezfwhez/errorx v1.1.0/go.mod h1:epOraH2nrfmf4JUao5290NFuXw9t6MZnzgwoW5guABE=
|
||||
github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU=
|
||||
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
|
||||
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
|
||||
@ -152,37 +150,34 @@ github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9
|
||||
github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk=
|
||||
github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A=
|
||||
github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
|
||||
github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0=
|
||||
github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
|
||||
github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ=
|
||||
github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
|
||||
github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag=
|
||||
github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE=
|
||||
github.com/go-ole/go-ole v1.2.6 h1:/Fpf6oFPoeFik9ty7siob0G6Ke8QvQEuVcuChpwXzpY=
|
||||
github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0=
|
||||
github.com/go-pay/gopay v1.5.91 h1:CYQ+eugaoCyQFOtMhXlcOBeTk+CpNfGFxh1UaBuj4YI=
|
||||
github.com/go-pay/gopay v1.5.91/go.mod h1:9Xqqi6R3WjUCknmWcy8Y+F/lt0Zi817kA+mlIi2PDMw=
|
||||
github.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4=
|
||||
github.com/go-playground/locales v0.13.0/go.mod h1:taPMhCMXrRLJO55olJkUXHZBHCxTMfnGwq/HNwmWNS8=
|
||||
github.com/go-playground/locales v0.14.0/go.mod h1:sawfccIbzZTqEDETgFXqTho0QybSa7l++s0DH+LDiLs=
|
||||
github.com/go-playground/universal-translator v0.17.0/go.mod h1:UkSxE5sNxxRwHyU+Scu5vgOQjsIJAF8j9muTVoKLVtA=
|
||||
github.com/go-playground/universal-translator v0.18.0/go.mod h1:UvRDBj+xPUEGrFYl+lu/H90nyDXpg0fqeB/AQUGNTVA=
|
||||
github.com/go-playground/validator/v10 v10.8.0/go.mod h1:9JhgTzTaE31GZDpH/HSvHiRJrJ3iKAgqqH0Bl/Ocjdk=
|
||||
github.com/go-redis/redis/v8 v8.11.4/go.mod h1:2Z2wHZXdQpCDXEGzqMockDpNyYvi2l4Pxt6RJr792+w=
|
||||
github.com/go-redis/redis/v8 v8.11.5 h1:AcZZR7igkdvfVmQTPnu9WE37LRrO/YrBH5zWyjDC0oI=
|
||||
github.com/go-redis/redis/v8 v8.11.5/go.mod h1:gREzHqY1hg6oD9ngVRbLStwAWKhA0FEgq8Jd4h5lpwo=
|
||||
github.com/go-resty/resty/v2 v2.7.0 h1:me+K9p3uhSmXtrBZ4k9jcEAfJmuC8IivWHwaLZwPrFY=
|
||||
github.com/go-resty/resty/v2 v2.7.0/go.mod h1:9PWDzw47qPphMRFfhsyk0NnSgvluHcljSMVIq3w7q0I=
|
||||
github.com/go-sql-driver/mysql v1.6.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg=
|
||||
github.com/go-sql-driver/mysql v1.7.0 h1:ueSltNNllEqE3qcWBTD0iQd3IpL/6U+mJxLkazJ7YPc=
|
||||
github.com/go-sql-driver/mysql v1.7.0/go.mod h1:OXbVy3sEdcQ2Doequ6Z5BW6fXNQTmx+9S1MCJN5yJMI=
|
||||
github.com/go-sql-driver/mysql v1.7.1 h1:lUIinVbN1DY0xBg0eMOzmmtGoHwWBbvnWubQUrtU8EI=
|
||||
github.com/go-sql-driver/mysql v1.7.1/go.mod h1:OXbVy3sEdcQ2Doequ6Z5BW6fXNQTmx+9S1MCJN5yJMI=
|
||||
github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
|
||||
github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE=
|
||||
github.com/gofrs/uuid v4.0.0+incompatible h1:1SD/1F5pU8p29ybwgQSwpQk+mwdRrXCYuPhW6m+TnJw=
|
||||
github.com/gofrs/uuid v4.0.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM=
|
||||
github.com/gogf/gf/contrib/drivers/mysql/v2 v2.3.3 h1:McqosVS9Bm7SzmsMTwfVT0YX6i/Is2aRn/XfqW/0iSI=
|
||||
github.com/gogf/gf/contrib/drivers/mysql/v2 v2.3.3/go.mod h1:z+/0qiOwMroAnj5ESuobTv0l5P83rf+XR3r6Fj8WJyk=
|
||||
github.com/gogf/gf/contrib/nosql/redis/v2 v2.3.3 h1:t1DA5NbyOk7FrDtFtJ5nS+RuGkmhJ9dUsQQKh5G3LOE=
|
||||
github.com/gogf/gf/contrib/nosql/redis/v2 v2.3.3/go.mod h1:V9o2BF9ovJnaZhHImHAanqUgjX4kI51lgU45u5rPqvw=
|
||||
github.com/gogf/gf/v2 v2.0.0/go.mod h1:apktt6TleWtCIwpz63vBqUnw8MX8gWKoZyxgDpXFtgM=
|
||||
github.com/gogf/gf/v2 v2.3.3 h1:3iry6kybjvuryTtjypG9oUuxrQ0URMT7j0DVg7FFnaw=
|
||||
github.com/gogf/gf/v2 v2.3.3/go.mod h1:tsbmtwcAl2chcYoq/fP9W2FZf06aw4i89X34nbSHo9Y=
|
||||
github.com/gogf/gf/contrib/drivers/mysql/v2 v2.4.1 h1:ra6aO6+KUufCg9eK52oj6Q2SnCdrmkSZF9pd32EIivQ=
|
||||
github.com/gogf/gf/contrib/drivers/mysql/v2 v2.4.1/go.mod h1:xubKxCvgbPt9r4yD3ecJoP3DC3sHqcJoMyS0eX837Zg=
|
||||
github.com/gogf/gf/contrib/nosql/redis/v2 v2.4.1 h1:PzAu6efos26gXyBO+aaNZ40hlNsA2T/qLOgP2RgIFaM=
|
||||
github.com/gogf/gf/contrib/nosql/redis/v2 v2.4.1/go.mod h1:0t7pBtXdfuemskzkdxyC2y9nUG63wdldvGRCaQiJ+MM=
|
||||
github.com/gogf/gf/v2 v2.4.1 h1:snsuvDhNFiRoAuWBbKfIIng0KyMaRA87Qr03GLir5j8=
|
||||
github.com/gogf/gf/v2 v2.4.1/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=
|
||||
@ -217,8 +212,6 @@ github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaS
|
||||
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=
|
||||
github.com/gomodule/redigo v1.8.8 h1:f6cXq6RRfiyrOJEV7p3JhLDlmawGBVBBP1MggY8Mo4E=
|
||||
github.com/gomodule/redigo v1.8.8/go.mod h1:7ArFNvsTjH8GMMzB4uy1snslv2BwmginuMs06a1uzZE=
|
||||
github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
|
||||
github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
|
||||
github.com/google/btree v1.1.2 h1:xf4v41cLI2Z6FxbKm+8Bu+m8ifhj15JuZ9sa0jZCMUU=
|
||||
@ -250,8 +243,9 @@ github.com/google/pprof v0.0.0-20200430221834-fc25d7d30c6d/go.mod h1:ZgVRPoUq/hf
|
||||
github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM=
|
||||
github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=
|
||||
github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI=
|
||||
github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY=
|
||||
github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||
github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I=
|
||||
github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||
github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg=
|
||||
github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk=
|
||||
github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
|
||||
@ -260,11 +254,12 @@ github.com/gopherjs/gopherjs v0.0.0-20200217142428-fce0ec30dd00/go.mod h1:wJfORR
|
||||
github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So=
|
||||
github.com/gorilla/securecookie v1.1.1/go.mod h1:ra0sb63/xPlUeL+yeDciTfxMRAA+MP+HVt/4epWDjd4=
|
||||
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=
|
||||
github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
|
||||
github.com/grokify/html-strip-tags-go v0.0.1 h1:0fThFwLbW7P/kOiTBs03FsJSV9RM2M/Q/MOnCQxKMo0=
|
||||
github.com/grokify/html-strip-tags-go v0.0.1/go.mod h1:2Su6romC5/1VXOQMaWL2yb618ARB8iVo6/DR99A6d78=
|
||||
github.com/h2non/parth v0.0.0-20190131123155-b4df798d6542 h1:2VTzZjLZBgl62/EtslCrtky5vbi9dd7HrQPQIx6wqiw=
|
||||
github.com/h2non/parth v0.0.0-20190131123155-b4df798d6542/go.mod h1:Ow0tF8D4Kplbc8s8sSb3V2oUCygFHVp8gC3Dn6U4MNI=
|
||||
github.com/hashicorp/errwrap v1.0.0 h1:hLrqtEDnRye3+sgx6z4qVLNuviH3MR5aQ0ykNJa/UYA=
|
||||
github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
|
||||
github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo=
|
||||
@ -306,10 +301,6 @@ github.com/kayon/iploc v0.0.0-20200312105652-bda3e968a794/go.mod h1:IwrOeG3O3K9v
|
||||
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
|
||||
github.com/klauspost/compress v1.15.6 h1:6D9PcO8QWu0JyaQ2zUMmu16T1T+zjjEpP91guRsvDfY=
|
||||
github.com/klauspost/compress v1.15.6/go.mod h1:PhcZ0MbTNciWF3rruxRgKxI5NkcHHrHUDtV4Yw2GlzU=
|
||||
github.com/klauspost/cpuid/v2 v2.1.1 h1:t0wUqjowdm8ezddV5k0tLWVklVuvLJpoHeb4WBdydm0=
|
||||
github.com/klauspost/cpuid/v2 v2.1.1/go.mod h1:RVVoqg1df56z8g3pUjL/3lE5UfnlrJX8tyFgg4nqhuY=
|
||||
github.com/klauspost/reedsolomon v1.11.7 h1:9uaHU0slncktTEEg4+7Vl7q7XUNMBUOK4R9gnKhMjAU=
|
||||
github.com/klauspost/reedsolomon v1.11.7/go.mod h1:4bXRN+cVzMdml6ti7qLouuYi32KHJ5MGv0Qd8a47h6A=
|
||||
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
|
||||
github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
|
||||
github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc=
|
||||
@ -333,8 +324,8 @@ github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovk
|
||||
github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
|
||||
github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94=
|
||||
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
|
||||
github.com/mattn/go-isatty v0.0.17 h1:BTarxUcIeDqL27Mc+vyvdWYSL28zpIhv3RoTdsLMPng=
|
||||
github.com/mattn/go-isatty v0.0.17/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
|
||||
github.com/mattn/go-isatty v0.0.18 h1:DOKFKCQ7FNG2L1rbrmstDN4QVRdS89Nkh85u68Uwp98=
|
||||
github.com/mattn/go-isatty v0.0.18/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
|
||||
github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI=
|
||||
github.com/mattn/go-runewidth v0.0.14 h1:+xnbZSEeDbOIg5/mE6JF0w6n9duR1l3/WmbinWVwUuU=
|
||||
github.com/mattn/go-runewidth v0.0.14/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
|
||||
@ -356,6 +347,7 @@ github.com/mozillazg/go-httpheader v0.2.1 h1:geV7TrjbL8KXSyvghnFm+NyTux/hxwueTSr
|
||||
github.com/mozillazg/go-httpheader v0.2.1/go.mod h1:jJ8xECTlalr6ValeXYdOF8fFUISeBAdw6E61aqQma60=
|
||||
github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
|
||||
github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
|
||||
github.com/nbio/st v0.0.0-20140626010706-e9e8d9816f32/go.mod h1:9wM+0iRr9ahx58uYLpLIr5fm8diHn0JbqRycJi6w0Ms=
|
||||
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=
|
||||
github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A=
|
||||
github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE=
|
||||
@ -370,7 +362,6 @@ github.com/onsi/ginkgo v1.16.5/go.mod h1:+E8gABHa3K6zRBolWtd+ROzc/U5bkGt0FwiG042
|
||||
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=
|
||||
github.com/onsi/gomega v1.16.0/go.mod h1:HnhC7FXeEQY45zxNK3PPoIUhzk/80Xly9PcubAlGdZY=
|
||||
github.com/onsi/gomega v1.17.0/go.mod h1:HnhC7FXeEQY45zxNK3PPoIUhzk/80Xly9PcubAlGdZY=
|
||||
github.com/onsi/gomega v1.18.1 h1:M1GfJqGRrBrrGGsbxzV5dqM2U2ApXefZCQpkukxYRLE=
|
||||
github.com/onsi/gomega v1.18.1/go.mod h1:0q+aL8jAiMXy9hbwj2mr5GziHiwhAIQpFmmtT5hitRs=
|
||||
@ -430,18 +421,23 @@ github.com/shoenig/test v0.6.3/go.mod h1:byHiCGXqrVaflBLAMq/srcZIHynQPQgeyvkvXnj
|
||||
github.com/shopspring/decimal v1.3.1 h1:2Usl1nmF/WZucqkFZhnfFYxxxu8LG21F6nPQBE5gKV8=
|
||||
github.com/shopspring/decimal v1.3.1/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o=
|
||||
github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc=
|
||||
github.com/silenceper/wechat/v2 v2.1.4 h1:X+G9C/EiBET5AK0zhrflX3ESCP/yxhJUvoRoSXHm0js=
|
||||
github.com/silenceper/wechat/v2 v2.1.4/go.mod h1:F0PKqImb15THnwoqRNrZO1z3vpwyWuiHr5zzfnjdECY=
|
||||
github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
|
||||
github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q=
|
||||
github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=
|
||||
github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88=
|
||||
github.com/sirupsen/logrus v1.8.1 h1:dJKuHgqk1NNQlqoA6BTlM1Wf9DOH3NBjQyu0h9+AZZE=
|
||||
github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0=
|
||||
github.com/sirupsen/logrus v1.9.0 h1:trlNQbNUG3OdDrDil03MCb1H2o9nJ1x4/5LYw7byDE0=
|
||||
github.com/sirupsen/logrus v1.9.0/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
|
||||
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc=
|
||||
github.com/smartystreets/assertions v1.1.0 h1:MkTeG1DMwsrdH7QtLXy5W+fUxWq+vmb6cLmyJ7aRtF0=
|
||||
github.com/smartystreets/assertions v1.1.0/go.mod h1:tcbTF8ujkAEcZ8TElKY+i30BzYlVhC/LOxJk7iOWnoo=
|
||||
github.com/smartystreets/goconvey v0.0.0-20190710185942-9d28bd7c0945/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA=
|
||||
github.com/smartystreets/goconvey v1.6.4 h1:fv0U8FUIMPNf1L9lnHLvLhgicrIVChEkdzIKYqbNC9s=
|
||||
github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA=
|
||||
github.com/spf13/cast v1.4.1 h1:s0hze+J0196ZfEMTs80N7UlFt0BDuQ7Q+JDnHiMWKdA=
|
||||
github.com/spf13/cast v1.4.1/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE=
|
||||
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=
|
||||
@ -457,10 +453,6 @@ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/
|
||||
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
|
||||
github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8=
|
||||
github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
|
||||
github.com/templexxx/cpufeat v0.0.0-20180724012125-cef66df7f161 h1:89CEmDvlq/F7SJEOqkIdNDGJXrQIhuIx9D2DBXjavSU=
|
||||
github.com/templexxx/cpufeat v0.0.0-20180724012125-cef66df7f161/go.mod h1:wM7WEvslTq+iOEAMDLSzhVuOt5BRZ05WirO+b09GHQU=
|
||||
github.com/templexxx/xor v0.0.0-20191217153810-f85b25db303b h1:fj5tQ8acgNUr6O8LEplsxDhUIe2573iLkJc+PqnzZTI=
|
||||
github.com/templexxx/xor v0.0.0-20191217153810-f85b25db303b/go.mod h1:5XA7W9S6mni3h5uvOC75dA3m9CCCaS83lltmc0ukdi4=
|
||||
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.194/go.mod h1:7sCQWVkxcsR38nffDW057DRGk8mUjK1Ing/EFOK8s8Y=
|
||||
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.633 h1:Yj8s35IjbgaHp4Ic9BZLVGWdN2gXBMtwYi1JJ+qYbrc=
|
||||
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.633/go.mod h1:7sCQWVkxcsR38nffDW057DRGk8mUjK1Ing/EFOK8s8Y=
|
||||
@ -469,12 +461,15 @@ github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/sms v1.0.633 h1:rtgRqgZ
|
||||
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/sms v1.0.633/go.mod h1:9q29WcGkZ7R0uQjoY10Tzb8A18C2cNggbq2ZC2HRXZE=
|
||||
github.com/tencentyun/cos-go-sdk-v5 v0.7.41 h1:iU0Li/Np78H4SBna0ECQoF3mpgi6ImLXU+doGzPFXGc=
|
||||
github.com/tencentyun/cos-go-sdk-v5 v0.7.41/go.mod h1:4dCEtLHGh8QPxHEkgq+nFaky7yZxQuYwgSJM87icDaw=
|
||||
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=
|
||||
github.com/tidwall/gjson v1.14.1 h1:iymTbGkQBhveq21bEvAQ81I0LEBork8BFe1CUZXdyuo=
|
||||
github.com/tidwall/gjson v1.14.1/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk=
|
||||
github.com/tidwall/match v1.0.1/go.mod h1:LujAq0jyVjBy028G1WhWfIzbpQfMO8bBZ6Tyb0+pL9E=
|
||||
github.com/tidwall/pretty v0.0.0-20190325153808-1166b9ac2b65 h1:rQ229MBgvW68s1/g6f1/63TgYwYxfF4E+bi/KC19P8g=
|
||||
github.com/tidwall/match v1.1.1 h1:+Ho715JplO36QYgwN9PGYNhgZvoUSc9X2c80KVTi+GA=
|
||||
github.com/tidwall/match v1.1.1/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM=
|
||||
github.com/tidwall/pretty v0.0.0-20190325153808-1166b9ac2b65/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk=
|
||||
github.com/tidwall/pretty v1.2.0 h1:RWIZEg2iJ8/g6fDDYzMpobmaoGh5OLl4AXtGUGPcqCs=
|
||||
github.com/tidwall/pretty v1.2.0/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU=
|
||||
github.com/tjfoc/gmsm v1.3.2 h1:7JVkAn5bvUJ7HtU08iW6UiD+UTmJTIToHCfeFzkcCxM=
|
||||
github.com/tjfoc/gmsm v1.3.2/go.mod h1:HaUcFuY0auTiaHB9MHFGCPx5IaLhTUd2atbCFBQXn9w=
|
||||
github.com/tklauser/go-sysconf v0.3.11 h1:89WgdJhk5SNwJfu+GKyYveZ4IaJ7xAkecBo+KdJV0CM=
|
||||
@ -487,10 +482,6 @@ github.com/urfave/cli/v2 v2.3.0/go.mod h1:LJmUH05zAU44vOAcrfzZQKsZbVcdbOG8rtL3/X
|
||||
github.com/xdg-go/pbkdf2 v1.0.0/go.mod h1:jrpuAogTd400dnrH08LKmI/xc1MbPOebTwRqcT5RDeI=
|
||||
github.com/xdg-go/scram v1.1.1/go.mod h1:RaEWvsqvNKKvBPvcKeFjrG2cJqOkHTiyTpzz23ni57g=
|
||||
github.com/xdg-go/stringprep v1.0.3/go.mod h1:W3f5j4i+9rC0kuIEJL0ky1VpHXQU3ocBgklLGvcBnW8=
|
||||
github.com/xtaci/kcp-go v5.4.20+incompatible h1:TN1uey3Raw0sTz0Fg8GkfM0uH3YwzhnZWQ1bABv5xAg=
|
||||
github.com/xtaci/kcp-go v5.4.20+incompatible/go.mod h1:bN6vIwHQbfHaHtFpEssmWsN45a+AZwO7eyRCmEIbtvE=
|
||||
github.com/xtaci/lossyconn v0.0.0-20200209145036-adba10fffc37 h1:EWU6Pktpas0n8lLQwDsRyZfmkPeRbdgPtW609es+/9E=
|
||||
github.com/xtaci/lossyconn v0.0.0-20200209145036-adba10fffc37/go.mod h1:HpMP7DB2CyokmAh4lp0EQnnWhmycP/TvwBGzvuie+H0=
|
||||
github.com/xuri/efp v0.0.0-20220407160117-ad0f7a785be8 h1:3X7aE0iLKJ5j+tz58BpvIZkXNV7Yq4jC93Z/rbN2Fxk=
|
||||
github.com/xuri/efp v0.0.0-20220407160117-ad0f7a785be8/go.mod h1:ybY/Jr0T0GTCnYjKqmdwxyxn2BQf2RcQIIvex5QldPI=
|
||||
github.com/xuri/excelize/v2 v2.6.0 h1:m/aXAzSAqxgt74Nfd+sNzpzVKhTGl7+S9nbG4A57mF4=
|
||||
@ -511,18 +502,15 @@ go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8=
|
||||
go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
|
||||
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.14.0 h1:/79Huy8wbf5DnIPhemGB+zEPVwnN6fuQybr/SRXa6hM=
|
||||
go.opentelemetry.io/otel v1.14.0/go.mod h1:o4buv+dJzx8rohcUeRmWUZhqupFvzWis188WlggnNeU=
|
||||
go.opentelemetry.io/otel/sdk v1.0.0/go.mod h1:PCrDHlSy5x1kjezSdL37PhbFUMjrsLRshJ2zCzeXwbM=
|
||||
go.opentelemetry.io/otel v1.15.1 h1:3Iwq3lfRByPaws0f6bU3naAqOR1n5IeDWd9390kWHa8=
|
||||
go.opentelemetry.io/otel v1.15.1/go.mod h1:mHHGEHVDLal6YrKMmk9LqC4a3sF5g+fHfrttQIB1NTc=
|
||||
go.opentelemetry.io/otel/sdk v1.7.0/go.mod h1:uTEOTwaqIVuTGiJN7ii13Ibp75wJmYUDe374q6cZwUU=
|
||||
go.opentelemetry.io/otel/sdk v1.14.0 h1:PDCppFRDq8A1jL9v6KMI6dYesaq+DFcDZvjsoGvxGzY=
|
||||
go.opentelemetry.io/otel/sdk v1.14.0/go.mod h1:bwIC5TjrNG6QDCHNWvW4HLHtUQ4I+VQDsnjhvyZCALM=
|
||||
go.opentelemetry.io/otel/trace v1.0.0/go.mod h1:PXTWqayeFUlJV1YDNhsJYB184+IvAH814St6o6ajzIs=
|
||||
go.opentelemetry.io/otel/sdk v1.15.1 h1:5FKR+skgpzvhPQHIEfcwMYjCBr14LWzs3uSqKiQzETI=
|
||||
go.opentelemetry.io/otel/sdk v1.15.1/go.mod h1:8rVtxQfrbmbHKfqzpQkT5EzZMcbMBwTzNAggbEAM0KA=
|
||||
go.opentelemetry.io/otel/trace v1.7.0/go.mod h1:fzLSB9nqR2eXzxPXb2JW9IKE+ScyXA48yyE4TNvoHqU=
|
||||
go.opentelemetry.io/otel/trace v1.14.0 h1:wp2Mmvj41tDsyAJXiWDWpfNsOiIyd38fy85pyKcFq/M=
|
||||
go.opentelemetry.io/otel/trace v1.14.0/go.mod h1:8avnQLK+CG77yNLUae4ea2JDQ6iT+gozhnZjy/rw9G8=
|
||||
go.opentelemetry.io/otel/trace v1.15.1 h1:uXLo6iHJEzDfrNC0L0mNjItIp06SyaBQxu5t3xMlngY=
|
||||
go.opentelemetry.io/otel/trace v1.15.1/go.mod h1:IWdQG/5N1x7f6YUlmdLeJvH9yxtuJAfc4VW5Agv9r/8=
|
||||
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=
|
||||
@ -539,8 +527,9 @@ golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod h1:GvvjBRRGRdwPK5y
|
||||
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=
|
||||
golang.org/x/crypto v0.0.0-20220411220226-7b82a4e95df4/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
|
||||
golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
|
||||
golang.org/x/crypto v0.7.0 h1:AvwMYaRytfdeVt3u6mLaxYtErKYjxA2OXjJ1HHq6t3A=
|
||||
golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU=
|
||||
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
||||
golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
||||
golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8=
|
||||
@ -575,8 +564,8 @@ golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzB
|
||||
golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
||||
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
||||
golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
||||
golang.org/x/mod v0.8.0 h1:LUYupSeNrTNCGzR/hVBk2NHZO4hXcVaW1k4Qx7rjPx8=
|
||||
golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
|
||||
golang.org/x/mod v0.9.0 h1:KENHtAZL2y3NLMYZeHY9DW8HW8V+kQyJsY/V9JlKvCs=
|
||||
golang.org/x/mod v0.9.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
|
||||
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
@ -613,12 +602,11 @@ golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96b
|
||||
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=
|
||||
golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
||||
golang.org/x/net v0.0.0-20211029224645-99673261e6eb/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
||||
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.8.0 h1:Zrh2ngAOFYneWTAIAPethzeaQLuHwhuBkuV6ZiRnUaQ=
|
||||
golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc=
|
||||
golang.org/x/net v0.10.0 h1:X2//UzNDwYmtCLn7To6G58Wr6f5ahEAQgKNzv9Y951M=
|
||||
golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg=
|
||||
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=
|
||||
@ -694,12 +682,13 @@ golang.org/x/sys v0.0.0-20211020174200-9d6173849985/go.mod h1:oPkhp1MJrh7nUepCBc
|
||||
golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20220114195835-da31bd327af9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20220412211240-33da011f77ad/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20220704084225-05e143d24a9e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.6.0 h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ=
|
||||
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU=
|
||||
golang.org/x/sys v0.8.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/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
@ -710,8 +699,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.8.0 h1:57P1ETyNKtuIjB4SRd15iJxuhj8Gc416Y78H3qgMh68=
|
||||
golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
|
||||
golang.org/x/text v0.9.0 h1:2sjJmO8cDvYveuX97RDLsxlyUxLl+GHoLxBiRdHllBE=
|
||||
golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
|
||||
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
||||
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
||||
golang.org/x/time v0.0.0-20191024005414-555d28b269f0 h1:/5xXl8Y5W96D+TtHSlonuFqGHIWVuyCkGJLwGh9JJFs=
|
||||
@ -762,8 +751,8 @@ golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc
|
||||
golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
|
||||
golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
|
||||
golang.org/x/tools v0.1.7/go.mod h1:LGqMHiF4EqQNHR1JncWGqT5BVaXmza+X+BDGol+dOxo=
|
||||
golang.org/x/tools v0.6.0 h1:BOw41kyTf3PuCW1pVQf8+Cyg8pMlkYB1oo9iJ6D/lKM=
|
||||
golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU=
|
||||
golang.org/x/tools v0.7.0 h1:W4OVu8VVOaIO0yzWMNdepAulS7YfoS3Zabrm8DOXXU4=
|
||||
golang.org/x/tools v0.7.0/go.mod h1:4pg6aUX35JBAogB10C9AtvVL+qowtN4pT3CGSQex14s=
|
||||
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
@ -852,6 +841,8 @@ gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntN
|
||||
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
|
||||
gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=
|
||||
gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys=
|
||||
gopkg.in/h2non/gock.v1 v1.1.2 h1:jBbHXgGBK/AoPVfJh5x4r/WxIrElvbLel8TCZkkZJoY=
|
||||
gopkg.in/h2non/gock.v1 v1.1.2/go.mod h1:n7UGz/ckNChHiK05rDoiC4MYSunEC/lyaUm2WWaDva0=
|
||||
gopkg.in/ini.v1 v1.56.0 h1:DPMeDvGTM54DXbPkVIZsp19fp/I2K7zwA/itHYHKo8Y=
|
||||
gopkg.in/ini.v1 v1.56.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
|
||||
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ=
|
||||
|
@ -1,3 +1,8 @@
|
||||
// Package cmd
|
||||
// @Link https://github.com/bufanyun/hotgo
|
||||
// @Copyright Copyright (c) 2023 HotGo CLI
|
||||
// @Author Ms <133814250@qq.com>
|
||||
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
|
||||
package cmd
|
||||
|
||||
import (
|
||||
@ -13,11 +18,11 @@ var (
|
||||
Brief: "系统授权,当为第三方客户开发应用项目不想将源码和可执行文件让其随意使用时,可以通过授权的方式约束使用方。",
|
||||
Description: `目前已实现,一对一、一对多、有效期授权,具体使用可以参考现有逻辑结合实际场景进行改造`,
|
||||
Func: func(ctx context.Context, parser *gcmd.Parser) (err error) {
|
||||
service.TCPAuth().Start(ctx)
|
||||
service.AuthClient().Start(ctx)
|
||||
|
||||
// 退出信号监听
|
||||
signalListen(ctx, func(sig os.Signal) {
|
||||
service.TCPAuth().Stop(ctx)
|
||||
service.AuthClient().Stop(ctx)
|
||||
})
|
||||
|
||||
// 信号监听
|
||||
@ -26,7 +31,6 @@ var (
|
||||
case <-serverCloseSignal:
|
||||
// ...
|
||||
}
|
||||
|
||||
return
|
||||
},
|
||||
}
|
||||
|
@ -3,7 +3,6 @@
|
||||
// @Copyright Copyright (c) 2023 HotGo CLI
|
||||
// @Author Ms <133814250@qq.com>
|
||||
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
|
||||
//
|
||||
package cmd
|
||||
|
||||
import (
|
||||
@ -32,6 +31,7 @@ var (
|
||||
>> 所有服务 [go run main.go] 热编译 [gf run main.go]
|
||||
>> HTTP服务 [go run main.go http]
|
||||
>> 消息队列 [go run main.go queue]
|
||||
>> 定时任务 [go run main.go cron]
|
||||
>> 查看帮助 [go run main.go help]
|
||||
|
||||
---------------------------------------------------------------------------------
|
||||
@ -59,6 +59,12 @@ var (
|
||||
}
|
||||
})
|
||||
|
||||
simple.SafeGo(ctx, func(ctx context.Context) {
|
||||
if err := Cron.Func(ctx, parser); err != nil {
|
||||
g.Log().Fatal(ctx, "cron start fail:", err)
|
||||
}
|
||||
})
|
||||
|
||||
simple.SafeGo(ctx, func(ctx context.Context) {
|
||||
if err := Http.Func(ctx, parser); err != nil {
|
||||
g.Log().Fatal(ctx, "http server start fail:", err)
|
||||
@ -73,14 +79,14 @@ var (
|
||||
// ...
|
||||
}
|
||||
|
||||
g.Log().Info(ctx, "service successfully closed ..")
|
||||
g.Log().Debug(ctx, "service successfully closed ..")
|
||||
return
|
||||
},
|
||||
}
|
||||
)
|
||||
|
||||
func init() {
|
||||
if err := Main.AddCommand(Http, Queue, Tools, Auth, All, Help); err != nil {
|
||||
if err := Main.AddCommand(All, Http, Queue, Cron, Auth, Tools, Help); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
serverCloseSignal = make(chan struct{}, 1)
|
||||
|
42
server/internal/cmd/cron.go
Normal file
42
server/internal/cmd/cron.go
Normal file
@ -0,0 +1,42 @@
|
||||
// Package cmd
|
||||
// @Link https://github.com/bufanyun/hotgo
|
||||
// @Copyright Copyright (c) 2023 HotGo CLI
|
||||
// @Author Ms <133814250@qq.com>
|
||||
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/gogf/gf/v2/os/gcmd"
|
||||
"hotgo/internal/crons"
|
||||
"hotgo/internal/service"
|
||||
"os"
|
||||
)
|
||||
|
||||
var (
|
||||
Cron = &gcmd.Command{
|
||||
Name: "cron",
|
||||
Brief: "定时任务,用来部署一些可独立运行的定时任务,通过tcp方式和后台保持长连接通讯,动态调整任务属性。",
|
||||
Description: ``,
|
||||
Func: func(ctx context.Context, parser *gcmd.Parser) (err error) {
|
||||
// 启动定时任务
|
||||
service.SysCron().StartCron(ctx)
|
||||
|
||||
// tcp客户端
|
||||
service.CronClient().Start(ctx)
|
||||
|
||||
// 退出信号监听
|
||||
signalListen(ctx, func(sig os.Signal) {
|
||||
service.CronClient().Stop(ctx)
|
||||
crons.StopALL()
|
||||
serverCloseSignal <- struct{}{}
|
||||
})
|
||||
|
||||
select {
|
||||
case <-serverCloseSignal:
|
||||
// ...
|
||||
}
|
||||
return
|
||||
},
|
||||
}
|
||||
)
|
@ -38,7 +38,10 @@ var (
|
||||
r.Response.Writeln("403 - 网站拒绝显示此网页")
|
||||
})
|
||||
|
||||
// 请求结束事件回调
|
||||
// 初始化请求前回调
|
||||
s.BindHookHandler("/*any", ghttp.HookBeforeServe, service.Hook().BeforeServe)
|
||||
|
||||
// 请求响应结束后回调
|
||||
s.BindHookHandler("/*any", ghttp.HookAfterOutput, service.Hook().AfterOutput)
|
||||
|
||||
s.Group("/", func(group *ghttp.RouterGroup) {
|
||||
@ -68,11 +71,8 @@ var (
|
||||
addons.RegisterModulesRouter(ctx, group)
|
||||
})
|
||||
|
||||
// 启动定时任务
|
||||
service.SysCron().StartCron(ctx)
|
||||
|
||||
//// 启动TCP服务
|
||||
//service.TCPServer().Start(ctx)
|
||||
// 启动tcp服务
|
||||
service.TCPServer().Start(ctx)
|
||||
|
||||
// https
|
||||
setSSL(ctx, s)
|
||||
@ -82,7 +82,7 @@ var (
|
||||
s.Shutdown()
|
||||
crons.StopALL()
|
||||
websocket.Stop()
|
||||
//service.TCPServer().Stop(ctx)
|
||||
service.TCPServer().Stop(ctx)
|
||||
})
|
||||
|
||||
// Just run the server.
|
||||
|
@ -10,6 +10,7 @@ import (
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
"github.com/gogf/gf/v2/os/gcmd"
|
||||
"hotgo/internal/library/queue"
|
||||
"hotgo/utility/simple"
|
||||
)
|
||||
|
||||
var (
|
||||
@ -18,9 +19,21 @@ var (
|
||||
Brief: "消息队列",
|
||||
Description: ``,
|
||||
Func: func(ctx context.Context, parser *gcmd.Parser) (err error) {
|
||||
g.Log().Debug(ctx, "start queue consumer..")
|
||||
queue.StartConsumersListener(ctx)
|
||||
g.Log().Debug(ctx, "start queue consumer success..")
|
||||
simple.SafeGo(ctx, func(ctx context.Context) {
|
||||
g.Log().Debug(ctx, "start queue consumer..")
|
||||
queue.StartConsumersListener(ctx)
|
||||
g.Log().Debug(ctx, "start queue consumer success..")
|
||||
})
|
||||
|
||||
// 信号监听
|
||||
signalListen(ctx, signalHandlerForOverall)
|
||||
|
||||
select {
|
||||
case <-serverCloseSignal:
|
||||
// ...
|
||||
}
|
||||
|
||||
g.Log().Debug(ctx, "queue successfully closed ..")
|
||||
return
|
||||
},
|
||||
}
|
||||
|
@ -3,7 +3,6 @@
|
||||
// @Copyright Copyright (c) 2023 HotGo CLI
|
||||
// @Author Ms <133814250@qq.com>
|
||||
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
|
||||
//
|
||||
package cmd
|
||||
|
||||
import (
|
||||
@ -16,7 +15,7 @@ import (
|
||||
var (
|
||||
Tools = &gcmd.Command{
|
||||
Name: "tools",
|
||||
Brief: "工具",
|
||||
Brief: "常用工具",
|
||||
Description: ``,
|
||||
Func: func(ctx context.Context, parser *gcmd.Parser) (err error) {
|
||||
flags := parser.GetOptAll()
|
||||
@ -39,12 +38,12 @@ var (
|
||||
g.Log().Fatal(ctx, "casbin参数不能为空")
|
||||
return
|
||||
}
|
||||
casbin.InitEnforcer(ctx)
|
||||
if a1 == "clear" {
|
||||
if err := casbin.Clear(ctx); err != nil {
|
||||
return err
|
||||
}
|
||||
} else if a1 == "refresh" {
|
||||
casbin.InitEnforcer(ctx)
|
||||
if err := casbin.Refresh(ctx); err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -1,3 +1,8 @@
|
||||
// Package consts
|
||||
// @Link https://github.com/bufanyun/hotgo
|
||||
// @Copyright Copyright (c) 2023 HotGo CLI
|
||||
// @Author Ms <133814250@qq.com>
|
||||
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
|
||||
package consts
|
||||
|
||||
const (
|
||||
|
13
server/internal/consts/cash.go
Normal file
13
server/internal/consts/cash.go
Normal file
@ -0,0 +1,13 @@
|
||||
// Package consts
|
||||
// @Link https://github.com/bufanyun/hotgo
|
||||
// @Copyright Copyright (c) 2023 HotGo CLI
|
||||
// @Author Ms <133814250@qq.com>
|
||||
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
|
||||
package consts
|
||||
|
||||
// 提现状态
|
||||
const (
|
||||
CashStatusWait = 1 // 处理中
|
||||
CashStatusOk = 2 // 提现成功
|
||||
CashStatusFail = 3 // 提现异常
|
||||
)
|
@ -3,11 +3,11 @@
|
||||
// @Copyright Copyright (c) 2023 HotGo CLI
|
||||
// @Author Ms <133814250@qq.com>
|
||||
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
|
||||
//
|
||||
package consts
|
||||
|
||||
// ContextKey 上下文
|
||||
const (
|
||||
ContextKey = "HotGoContext" // http上下文变量名称
|
||||
ContextKeyCronArgs = "args" // 定时任务参数上下文变量名称
|
||||
ContextKey = "HotGoContext" // http上下文变量名称
|
||||
ContextKeyCronArgs = "args" // 定时任务参数上下文变量名称
|
||||
ContextTCPKey = "HotGoTCPContext" // tcp上下文变量名称
|
||||
)
|
||||
|
85
server/internal/consts/credit_log.go
Normal file
85
server/internal/consts/credit_log.go
Normal file
@ -0,0 +1,85 @@
|
||||
// Package consts
|
||||
// @Link https://github.com/bufanyun/hotgo
|
||||
// @Copyright Copyright (c) 2023 HotGo CLI
|
||||
// @Author Ms <133814250@qq.com>
|
||||
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
|
||||
package consts
|
||||
|
||||
import "github.com/gogf/gf/v2/frame/g"
|
||||
|
||||
const (
|
||||
CreditTypeBalance = "balance" // 余额
|
||||
CreditTypeIntegral = "integral" // 积分
|
||||
)
|
||||
|
||||
const (
|
||||
CreditGroupDecr = "decr" // 扣款
|
||||
CreditGroupIncr = "incr" // 加款
|
||||
CreditGroupOpDecr = "op_decr" // 操作扣款
|
||||
CreditGroupOpIncr = "op_incr" // 操作加款
|
||||
CreditGroupBalanceRecharge = "balance_recharge" // 余额充值
|
||||
CreditGroupBalanceRefund = "balance_refund" // 余额退款
|
||||
CreditGroupApplyCash = "apply_cash" // 申请提现
|
||||
)
|
||||
|
||||
// CreditTypeOptions 变动类型
|
||||
var CreditTypeOptions = []g.Map{
|
||||
{
|
||||
"key": CreditTypeBalance,
|
||||
"value": CreditTypeBalance,
|
||||
"label": "余额",
|
||||
"listClass": "success",
|
||||
},
|
||||
{
|
||||
"key": CreditTypeIntegral,
|
||||
"value": CreditTypeIntegral,
|
||||
"label": "积分",
|
||||
"listClass": "info",
|
||||
},
|
||||
}
|
||||
|
||||
// CreditGroupOptions 变动分组
|
||||
var CreditGroupOptions = []g.Map{
|
||||
{
|
||||
"key": CreditGroupDecr,
|
||||
"value": CreditGroupDecr,
|
||||
"label": "扣款",
|
||||
"listClass": "warning",
|
||||
},
|
||||
{
|
||||
"key": CreditGroupIncr,
|
||||
"value": CreditGroupIncr,
|
||||
"label": "加款",
|
||||
"listClass": "success",
|
||||
},
|
||||
{
|
||||
"key": CreditGroupOpDecr,
|
||||
"value": CreditGroupOpDecr,
|
||||
"label": "操作扣款",
|
||||
"listClass": "warning",
|
||||
},
|
||||
{
|
||||
"key": CreditGroupOpIncr,
|
||||
"value": CreditGroupOpIncr,
|
||||
"label": "操作加款",
|
||||
"listClass": "success",
|
||||
},
|
||||
{
|
||||
"key": CreditGroupBalanceRefund,
|
||||
"value": CreditGroupBalanceRefund,
|
||||
"label": "余额退款",
|
||||
"listClass": "warning",
|
||||
},
|
||||
{
|
||||
"key": CreditGroupBalanceRecharge,
|
||||
"value": CreditGroupBalanceRecharge,
|
||||
"label": "余额充值",
|
||||
"listClass": "success",
|
||||
},
|
||||
{
|
||||
"key": CreditGroupApplyCash,
|
||||
"value": CreditGroupApplyCash,
|
||||
"label": "申请提现",
|
||||
"listClass": "info",
|
||||
},
|
||||
}
|
@ -1,3 +1,8 @@
|
||||
// Package consts
|
||||
// @Link https://github.com/bufanyun/hotgo
|
||||
// @Copyright Copyright (c) 2023 HotGo CLI
|
||||
// @Author Ms <133814250@qq.com>
|
||||
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
|
||||
package consts
|
||||
|
||||
import "github.com/gogf/gf/v2/frame/g"
|
||||
|
@ -1,3 +1,8 @@
|
||||
// Package consts
|
||||
// @Link https://github.com/bufanyun/hotgo
|
||||
// @Copyright Copyright (c) 2023 HotGo CLI
|
||||
// @Author Ms <133814250@qq.com>
|
||||
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
|
||||
package consts
|
||||
|
||||
// 公告类型
|
||||
|
129
server/internal/consts/order.go
Normal file
129
server/internal/consts/order.go
Normal file
@ -0,0 +1,129 @@
|
||||
// Package consts
|
||||
// @Link https://github.com/bufanyun/hotgo
|
||||
// @Copyright Copyright (c) 2023 HotGo CLI
|
||||
// @Author Ms <133814250@qq.com>
|
||||
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
|
||||
package consts
|
||||
|
||||
import "github.com/gogf/gf/v2/frame/g"
|
||||
|
||||
// 订单分组
|
||||
// 为不同的业务订单设置不同的分组,分组可以设置不同的业务回调方法
|
||||
|
||||
const (
|
||||
OrderGroupDefault = "order" // 普通订单
|
||||
OrderGroupAdminOrder = "admin_order" // 后台充值订单
|
||||
// 还可以设置其他,方便后期扩展..
|
||||
)
|
||||
|
||||
// 订单类型
|
||||
|
||||
const (
|
||||
OrderTypeBalance = "balance" // 余额充值
|
||||
OrderTypeProduct = "product" // 购买产品
|
||||
)
|
||||
|
||||
const (
|
||||
OrderStatusALL int64 = -1 // 全部状态
|
||||
OrderStatusNotPay = 1 // 待付款
|
||||
OrderStatusPay = 2 // 已付款
|
||||
OrderStatusShipments = 3 // 已发货
|
||||
OrderStatusDone = 4 // 已完成
|
||||
OrderStatusClose = 5 // 已关闭
|
||||
OrderStatusReturnRequest = 6 // 申请退款
|
||||
OrderStatusReturning = 7 // 退款中
|
||||
OrderStatusReturned = 8 // 已退款
|
||||
OrderStatusReturnReject = 9 // 拒绝退款
|
||||
)
|
||||
|
||||
var OrderStatusSlice = []int64{
|
||||
OrderStatusALL,
|
||||
OrderStatusNotPay, OrderStatusPay, OrderStatusShipments, OrderStatusDone, OrderStatusClose,
|
||||
OrderStatusReturnRequest, OrderStatusReturning, OrderStatusReturned, OrderStatusReturnReject,
|
||||
}
|
||||
|
||||
// OrderStatusOptions 订单状态选项
|
||||
var OrderStatusOptions = []g.Map{
|
||||
{
|
||||
"key": OrderStatusALL,
|
||||
"value": OrderStatusALL,
|
||||
"label": "全部",
|
||||
"listClass": "info",
|
||||
},
|
||||
{
|
||||
"key": OrderStatusNotPay,
|
||||
"value": OrderStatusNotPay,
|
||||
"label": "待付款",
|
||||
"listClass": "info",
|
||||
},
|
||||
{
|
||||
"key": OrderStatusPay,
|
||||
"value": OrderStatusPay,
|
||||
"label": "已付款",
|
||||
"listClass": "info",
|
||||
},
|
||||
{
|
||||
"key": OrderStatusShipments,
|
||||
"value": OrderStatusShipments,
|
||||
"label": "已发货",
|
||||
"listClass": "info",
|
||||
},
|
||||
{
|
||||
"key": OrderStatusDone,
|
||||
"value": OrderStatusDone,
|
||||
"label": "已完成",
|
||||
"listClass": "success",
|
||||
},
|
||||
{
|
||||
"key": OrderStatusClose,
|
||||
"value": OrderStatusClose,
|
||||
"label": "已关闭",
|
||||
"listClass": "default",
|
||||
},
|
||||
{
|
||||
"key": OrderStatusReturnRequest,
|
||||
"value": OrderStatusReturnRequest,
|
||||
"label": "申请退款",
|
||||
"listClass": "warning",
|
||||
},
|
||||
{
|
||||
"key": OrderStatusReturning,
|
||||
"value": OrderStatusReturning,
|
||||
"label": "退款中",
|
||||
"listClass": "default",
|
||||
},
|
||||
{
|
||||
"key": OrderStatusReturned,
|
||||
"value": OrderStatusReturned,
|
||||
"label": "已退款",
|
||||
"listClass": "success",
|
||||
},
|
||||
{
|
||||
"key": OrderStatusReturnReject,
|
||||
"value": OrderStatusReturnReject,
|
||||
"label": "拒绝退款",
|
||||
"listClass": "error",
|
||||
},
|
||||
}
|
||||
|
||||
// OrderAcceptRefundOptions 订单退款受理状态
|
||||
var OrderAcceptRefundOptions = []g.Map{
|
||||
{
|
||||
"key": OrderStatusReturnRequest,
|
||||
"value": OrderStatusReturnRequest,
|
||||
"label": "申请退款",
|
||||
"listClass": "warning",
|
||||
},
|
||||
{
|
||||
"key": OrderStatusReturned,
|
||||
"value": OrderStatusReturned,
|
||||
"label": "已退款",
|
||||
"listClass": "success",
|
||||
},
|
||||
{
|
||||
"key": OrderStatusReturnReject,
|
||||
"value": OrderStatusReturnReject,
|
||||
"label": "拒绝退款",
|
||||
"listClass": "error",
|
||||
},
|
||||
}
|
97
server/internal/consts/pay.go
Normal file
97
server/internal/consts/pay.go
Normal file
@ -0,0 +1,97 @@
|
||||
// Package consts
|
||||
// @Link https://github.com/bufanyun/hotgo
|
||||
// @Copyright Copyright (c) 2023 HotGo CLI
|
||||
// @Author Ms <133814250@qq.com>
|
||||
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
|
||||
package consts
|
||||
|
||||
import "github.com/gogf/gf/v2/frame/g"
|
||||
|
||||
// 支付方式
|
||||
|
||||
const (
|
||||
PayTypeALL = "" // 全部
|
||||
PayTypeWxPay = "wxpay" // 微信支付
|
||||
PayTypeAliPay = "alipay" // 支付宝
|
||||
PayTypeQQPay = "qqpay" // QQ支付
|
||||
)
|
||||
|
||||
var (
|
||||
PayTypeSlice = []string{
|
||||
PayTypeWxPay, PayTypeAliPay, PayTypeQQPay,
|
||||
}
|
||||
|
||||
PayTypeNameMap = map[string]string{
|
||||
PayTypeALL: "全部",
|
||||
PayTypeWxPay: "微信支付",
|
||||
PayTypeAliPay: "支付宝",
|
||||
PayTypeQQPay: "QQ支付",
|
||||
}
|
||||
)
|
||||
|
||||
// 交易方式
|
||||
|
||||
const (
|
||||
// 微信
|
||||
TradeTypeWxMP = "mp" // 公众号
|
||||
TradeTypeWxMini = "mini" // 小程序
|
||||
TradeTypeWxApp = "app" // APP
|
||||
TradeTypeWxScan = "scan" // 二维码扫码
|
||||
TradeTypeWxPos = "pos" // 二维码收款
|
||||
TradeTypeWxH5 = "h5" // H5
|
||||
|
||||
// 支付宝
|
||||
TradeTypeAliWeb = "web" // 电脑网页
|
||||
TradeTypeAliApp = "app" // APP
|
||||
TradeTypeAliScan = "scan" // 二维码扫码
|
||||
TradeTypeAliWap = "wap" // 手机网页
|
||||
TradeTypeAliPos = "pos" // 二维码收款
|
||||
|
||||
// QQ
|
||||
TradeTypeQQWeb = "qqweb" // PC网页
|
||||
TradeTypeQQWap = "qqwap" // 移动端
|
||||
)
|
||||
|
||||
var (
|
||||
TradeTypeWxSlice = []string{TradeTypeWxMP, TradeTypeWxMini, TradeTypeWxApp, TradeTypeWxScan, TradeTypeWxPos, TradeTypeWxH5}
|
||||
TradeTypeAliSlice = []string{TradeTypeAliWeb, TradeTypeAliApp, TradeTypeAliScan, TradeTypeAliWap, TradeTypeAliPos}
|
||||
TradeTypeQQSlice = []string{TradeTypeQQWeb, TradeTypeQQWap}
|
||||
)
|
||||
|
||||
// 支付状态
|
||||
|
||||
const (
|
||||
PayStatusWait = 1 // 待支付
|
||||
PayStatusOk = 2 // 已支付
|
||||
)
|
||||
|
||||
// 退款状态
|
||||
|
||||
const (
|
||||
RefundStatusNo = 1 // 未退款
|
||||
RefundStatusApply = 2 // 申请退款
|
||||
RefundStatusReject = 3 // 拒绝退款
|
||||
RefundStatusAgree = 4 // 同意退款,已退款
|
||||
)
|
||||
|
||||
// PayTypeOptions 支付方式选项
|
||||
var PayTypeOptions = []g.Map{
|
||||
{
|
||||
"key": PayTypeWxPay,
|
||||
"value": PayTypeWxPay,
|
||||
"label": "微信支付",
|
||||
"listClass": "success",
|
||||
},
|
||||
{
|
||||
"key": PayTypeAliPay,
|
||||
"value": PayTypeAliPay,
|
||||
"label": "支付宝",
|
||||
"listClass": "info",
|
||||
},
|
||||
{
|
||||
"key": PayTypeQQPay,
|
||||
"value": PayTypeQQPay,
|
||||
"label": "QQ支付",
|
||||
"listClass": "default",
|
||||
},
|
||||
}
|
@ -1,3 +1,8 @@
|
||||
// Package consts
|
||||
// @Link https://github.com/bufanyun/hotgo
|
||||
// @Copyright Copyright (c) 2023 HotGo CLI
|
||||
// @Author Ms <133814250@qq.com>
|
||||
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
|
||||
package consts
|
||||
|
||||
// 短信驱动
|
||||
|
25
server/internal/consts/tcp.go
Normal file
25
server/internal/consts/tcp.go
Normal file
@ -0,0 +1,25 @@
|
||||
package consts
|
||||
|
||||
import "time"
|
||||
|
||||
const (
|
||||
TCPMsgCodeSuccess = 2000 // 成功的状态码
|
||||
)
|
||||
|
||||
// 定时任务
|
||||
const (
|
||||
TCPCronHeartbeatVerify = "tcpHeartbeatVerify"
|
||||
TCPCronHeartbeat = "tcpHeartbeat"
|
||||
TCPCronAuthVerify = "tcpAuthVerify"
|
||||
)
|
||||
|
||||
// 认证分组
|
||||
const (
|
||||
TCPClientGroupCron = "cron" // 定时任务
|
||||
TCPClientGroupQueue = "queue" // 消息队列
|
||||
TCPClientGroupAuth = "auth" // 服务授权
|
||||
)
|
||||
|
||||
const (
|
||||
TCPRpcTimeout = time.Second * 10 // rpc通讯超时时间, 默认10s
|
||||
)
|
@ -7,5 +7,5 @@ package consts
|
||||
|
||||
// VersionApp HotGo版本
|
||||
const (
|
||||
VersionApp = "2.5.3"
|
||||
VersionApp = "2.6.7"
|
||||
)
|
||||
|
13
server/internal/consts/wechat.go
Normal file
13
server/internal/consts/wechat.go
Normal file
@ -0,0 +1,13 @@
|
||||
package consts
|
||||
|
||||
// 授权类型
|
||||
const (
|
||||
WechatAuthorizeOpenId = "openId" // 设置openid
|
||||
WechatAuthorizeBindLogin = "bindLogin" // 绑定微信登录
|
||||
)
|
||||
|
||||
// 应用授权作用域
|
||||
const (
|
||||
WechatScopeBase = "snsapi_base" // 只获取openid,无需用户授权
|
||||
WechatScopeUserinfo = "snsapi_userinfo" // 获取用户信息,需要授权
|
||||
)
|
74
server/internal/controller/admin/admin/cash.go
Normal file
74
server/internal/controller/admin/admin/cash.go
Normal file
@ -0,0 +1,74 @@
|
||||
// Package admin
|
||||
// @Link https://github.com/bufanyun/hotgo
|
||||
// @Copyright Copyright (c) 2023 HotGo CLI
|
||||
// @Author Ms <133814250@qq.com>
|
||||
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
|
||||
package admin
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/gogf/gf/v2/util/gconv"
|
||||
"hotgo/api/admin/cash"
|
||||
"hotgo/internal/library/contexts"
|
||||
"hotgo/internal/model/input/adminin"
|
||||
"hotgo/internal/model/input/form"
|
||||
"hotgo/internal/service"
|
||||
)
|
||||
|
||||
var (
|
||||
Cash = cCash{}
|
||||
)
|
||||
|
||||
type cCash struct{}
|
||||
|
||||
// View 获取指定信息
|
||||
func (c *cCash) View(ctx context.Context, req *cash.ViewReq) (*cash.ViewRes, error) {
|
||||
data, err := service.AdminCash().View(ctx, adminin.CashViewInp{Id: req.Id})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var res cash.ViewRes
|
||||
res.CashViewModel = data
|
||||
return &res, nil
|
||||
}
|
||||
|
||||
// List 查看列表
|
||||
func (c *cCash) List(ctx context.Context, req *cash.ListReq) (res *cash.ListRes, err error) {
|
||||
var in adminin.CashListInp
|
||||
if err = gconv.Scan(req, &in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
list, totalCount, err := service.AdminCash().List(ctx, in)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
res = new(cash.ListRes)
|
||||
res.List = list
|
||||
res.PageCount = form.CalPageCount(totalCount, req.PerPage)
|
||||
res.Page = req.Page
|
||||
res.PerPage = req.PerPage
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// Apply 申请提现
|
||||
func (c *cCash) Apply(ctx context.Context, req *cash.ApplyReq) (res *cash.ApplyRes, err error) {
|
||||
err = service.AdminCash().Apply(ctx, adminin.CashApplyInp{
|
||||
Money: req.Money,
|
||||
MemberId: contexts.GetUserId(ctx),
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
// Payment 提现打款处理
|
||||
func (c *cCash) Payment(ctx context.Context, req *cash.PaymentReq) (res *cash.PaymentRes, err error) {
|
||||
err = service.AdminCash().Payment(ctx, adminin.CashPaymentInp{
|
||||
Id: req.Id,
|
||||
Status: req.Status,
|
||||
Msg: req.Msg,
|
||||
})
|
||||
return
|
||||
}
|
74
server/internal/controller/admin/admin/credits_log.go
Normal file
74
server/internal/controller/admin/admin/credits_log.go
Normal file
@ -0,0 +1,74 @@
|
||||
// Package admin
|
||||
// @Link https://github.com/bufanyun/hotgo
|
||||
// @Copyright Copyright (c) 2023 HotGo CLI
|
||||
// @Author Ms <133814250@qq.com>
|
||||
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
|
||||
// @AutoGenerate Version 2.5.3
|
||||
// @AutoGenerate Date 2023-04-15 15:59:58
|
||||
package admin
|
||||
|
||||
import (
|
||||
"context"
|
||||
"hotgo/api/admin/creditslog"
|
||||
"hotgo/internal/consts"
|
||||
"hotgo/internal/model/input/adminin"
|
||||
"hotgo/internal/model/input/form"
|
||||
"hotgo/internal/service"
|
||||
"hotgo/utility/validate"
|
||||
|
||||
"github.com/gogf/gf/v2/util/gconv"
|
||||
)
|
||||
|
||||
var (
|
||||
CreditsLog = cCreditsLog{}
|
||||
)
|
||||
|
||||
type cCreditsLog struct{}
|
||||
|
||||
// List 查看资产变动列表
|
||||
func (c *cCreditsLog) List(ctx context.Context, req *creditslog.ListReq) (res *creditslog.ListRes, err error) {
|
||||
var in adminin.CreditsLogListInp
|
||||
if err = gconv.Scan(req, &in); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if err = validate.PreFilter(ctx, &in); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
list, totalCount, err := service.AdminCreditsLog().List(ctx, in)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(creditslog.ListRes)
|
||||
res.List = list
|
||||
res.PageCount = form.CalPageCount(totalCount, req.PerPage)
|
||||
res.Page = req.Page
|
||||
res.PerPage = req.PerPage
|
||||
return
|
||||
}
|
||||
|
||||
// Export 导出资产变动列表
|
||||
func (c *cCreditsLog) Export(ctx context.Context, req *creditslog.ExportReq) (res *creditslog.ExportRes, err error) {
|
||||
var in adminin.CreditsLogListInp
|
||||
if err = gconv.Scan(req, &in); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if err = validate.PreFilter(ctx, &in); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
err = service.AdminCreditsLog().Export(ctx, in)
|
||||
return
|
||||
}
|
||||
|
||||
// Option 获取变动状态选项
|
||||
func (c *cCreditsLog) Option(ctx context.Context, req *creditslog.OptionReq) (res *creditslog.OptionRes, err error) {
|
||||
res = &creditslog.OptionRes{
|
||||
CreditType: consts.CreditTypeOptions,
|
||||
CreditGroup: consts.CreditGroupOptions,
|
||||
}
|
||||
return
|
||||
}
|
@ -3,7 +3,6 @@
|
||||
// @Copyright Copyright (c) 2023 HotGo CLI
|
||||
// @Author Ms <133814250@qq.com>
|
||||
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
|
||||
//
|
||||
package admin
|
||||
|
||||
import (
|
||||
@ -11,6 +10,7 @@ import (
|
||||
"github.com/gogf/gf/v2/util/gconv"
|
||||
"hotgo/api/admin/dept"
|
||||
"hotgo/internal/model/input/adminin"
|
||||
"hotgo/internal/model/input/form"
|
||||
"hotgo/internal/service"
|
||||
)
|
||||
|
||||
@ -105,3 +105,23 @@ func (c *cDept) Status(ctx context.Context, req *dept.StatusReq) (res *dept.Stat
|
||||
err = service.AdminDept().Status(ctx, in)
|
||||
return
|
||||
}
|
||||
|
||||
// Option 获取部门选项树
|
||||
func (c *cDept) Option(ctx context.Context, req *dept.OptionReq) (res *dept.OptionRes, err error) {
|
||||
var in adminin.DeptOptionInp
|
||||
if err = gconv.Scan(req, &in); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
list, totalCount, err := service.AdminDept().Option(ctx, in)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(dept.OptionRes)
|
||||
res.DeptOptionModel = list
|
||||
res.PageCount = form.CalPageCount(totalCount, req.PerPage)
|
||||
res.Page = req.Page
|
||||
res.PerPage = req.PerPage
|
||||
return
|
||||
}
|
||||
|
@ -3,7 +3,6 @@
|
||||
// @Copyright Copyright (c) 2023 HotGo CLI
|
||||
// @Author Ms <133814250@qq.com>
|
||||
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
|
||||
//
|
||||
package admin
|
||||
|
||||
import (
|
||||
@ -175,19 +174,6 @@ func (c *cMember) Edit(ctx context.Context, req *member.EditReq) (res *member.Ed
|
||||
return
|
||||
}
|
||||
|
||||
// MaxSort 最大排序
|
||||
func (c *cMember) MaxSort(ctx context.Context, req *member.MaxSortReq) (res *member.MaxSortRes, err error) {
|
||||
var in = adminin.MemberMaxSortInp{Id: req.Id}
|
||||
data, err := service.AdminMember().MaxSort(ctx, in)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(member.MaxSortRes)
|
||||
res.Sort = data.Sort
|
||||
return
|
||||
}
|
||||
|
||||
// View 获取指定信息
|
||||
func (c *cMember) View(ctx context.Context, req *member.ViewReq) (res *member.ViewRes, err error) {
|
||||
data, err := service.AdminMember().View(ctx, adminin.MemberViewInp{Id: req.Id})
|
||||
@ -253,3 +239,33 @@ func (c *cMember) Select(ctx context.Context, req *member.SelectReq) (res *membe
|
||||
res = (*member.SelectRes)(&data)
|
||||
return
|
||||
}
|
||||
|
||||
// AddBalance 增加余额
|
||||
func (c *cMember) AddBalance(ctx context.Context, req *member.AddBalanceReq) (res *member.AddBalanceRes, err error) {
|
||||
var in adminin.MemberAddBalanceInp
|
||||
if err = gconv.Scan(req, &in); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if err = validate.PreFilter(ctx, &in); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
err = service.AdminMember().AddBalance(ctx, in)
|
||||
return
|
||||
}
|
||||
|
||||
// AddIntegral 增加积分
|
||||
func (c *cMember) AddIntegral(ctx context.Context, req *member.AddIntegralReq) (res *member.AddIntegralRes, err error) {
|
||||
var in adminin.MemberAddIntegralInp
|
||||
if err = gconv.Scan(req, &in); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if err = validate.PreFilter(ctx, &in); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
err = service.AdminMember().AddIntegral(ctx, in)
|
||||
return
|
||||
}
|
||||
|
@ -3,14 +3,11 @@
|
||||
// @Copyright Copyright (c) 2023 HotGo CLI
|
||||
// @Author Ms <133814250@qq.com>
|
||||
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
|
||||
//
|
||||
package admin
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/gogf/gf/v2/util/gconv"
|
||||
"hotgo/api/admin/menu"
|
||||
"hotgo/internal/model/input/adminin"
|
||||
"hotgo/internal/service"
|
||||
)
|
||||
|
||||
@ -21,30 +18,6 @@ var (
|
||||
|
||||
type cMenu struct{}
|
||||
|
||||
// RoleList 查询角色菜单列表
|
||||
func (c *cMenu) RoleList(ctx context.Context, req *menu.RoleListReq) (res *menu.RoleListRes, err error) {
|
||||
var in adminin.MenuRoleListInp
|
||||
if err = gconv.Scan(req, &in); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
data, err := service.AdminMenu().RoleList(ctx, in)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(menu.RoleListRes)
|
||||
res.CheckedKeys = data.CheckedKeys
|
||||
res.Menus = data.Menus
|
||||
return
|
||||
}
|
||||
|
||||
// SearchList 查询菜单列表
|
||||
func (c *cMenu) SearchList(ctx context.Context, req *menu.SearchListReq) (res *menu.SearchListRes, err error) {
|
||||
res, err = service.AdminMenu().SearchList(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// MaxSort 最大排序
|
||||
func (c *cMenu) MaxSort(ctx context.Context, req *menu.MaxSortReq) (res *menu.MaxSortRes, err error) {
|
||||
res, err = service.AdminMenu().MaxSort(ctx, req)
|
||||
|
190
server/internal/controller/admin/admin/order.go
Normal file
190
server/internal/controller/admin/admin/order.go
Normal file
@ -0,0 +1,190 @@
|
||||
// Package admin
|
||||
// @Link https://github.com/bufanyun/hotgo
|
||||
// @Copyright Copyright (c) 2023 HotGo CLI
|
||||
// @Author Ms <133814250@qq.com>
|
||||
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
|
||||
package admin
|
||||
|
||||
import (
|
||||
"context"
|
||||
"hotgo/api/admin/order"
|
||||
"hotgo/internal/consts"
|
||||
"hotgo/internal/model/input/adminin"
|
||||
"hotgo/internal/model/input/form"
|
||||
"hotgo/internal/service"
|
||||
"hotgo/utility/validate"
|
||||
|
||||
"github.com/gogf/gf/v2/util/gconv"
|
||||
)
|
||||
|
||||
var (
|
||||
Order = cOrder{}
|
||||
)
|
||||
|
||||
type cOrder struct{}
|
||||
|
||||
// AcceptRefund 受理申请退款
|
||||
func (c *cOrder) AcceptRefund(ctx context.Context, req *order.AcceptRefundReq) (res *order.AcceptRefundRes, err error) {
|
||||
var in adminin.OrderAcceptRefundInp
|
||||
if err = gconv.Scan(req, &in); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if err = validate.PreFilter(ctx, &in); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
err = service.AdminOrder().AcceptRefund(ctx, in)
|
||||
return
|
||||
}
|
||||
|
||||
// ApplyRefund 申请退款
|
||||
func (c *cOrder) ApplyRefund(ctx context.Context, req *order.ApplyRefundReq) (res *order.ApplyRefundRes, err error) {
|
||||
var in adminin.OrderApplyRefundInp
|
||||
if err = gconv.Scan(req, &in); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if err = validate.PreFilter(ctx, &in); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
err = service.AdminOrder().ApplyRefund(ctx, in)
|
||||
return
|
||||
}
|
||||
|
||||
// Option 获取订单状态选项
|
||||
func (c *cOrder) Option(ctx context.Context, req *order.OptionReq) (res *order.OptionRes, err error) {
|
||||
res = &order.OptionRes{
|
||||
Status: consts.OrderStatusOptions,
|
||||
AcceptRefundStatus: consts.OrderAcceptRefundOptions,
|
||||
PayType: consts.PayTypeOptions,
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// Create 创建充值订单
|
||||
func (c *cOrder) Create(ctx context.Context, req *order.CreateReq) (res *order.CreateRes, err error) {
|
||||
var in adminin.OrderCreateInp
|
||||
if err = gconv.Scan(req, &in); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if err = validate.PreFilter(ctx, &in); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
data, err := service.AdminOrder().Create(ctx, in)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(order.CreateRes)
|
||||
res.OrderCreateModel = data
|
||||
return
|
||||
}
|
||||
|
||||
// List 查看充值订单列表
|
||||
func (c *cOrder) List(ctx context.Context, req *order.ListReq) (res *order.ListRes, err error) {
|
||||
var in adminin.OrderListInp
|
||||
if err = gconv.Scan(req, &in); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if err = validate.PreFilter(ctx, &in); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
list, totalCount, err := service.AdminOrder().List(ctx, in)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(order.ListRes)
|
||||
res.List = list
|
||||
res.PageCount = form.CalPageCount(totalCount, req.PerPage)
|
||||
res.Page = req.Page
|
||||
res.PerPage = req.PerPage
|
||||
return
|
||||
}
|
||||
|
||||
// Export 导出充值订单列表
|
||||
func (c *cOrder) Export(ctx context.Context, req *order.ExportReq) (res *order.ExportRes, err error) {
|
||||
var in adminin.OrderListInp
|
||||
if err = gconv.Scan(req, &in); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if err = validate.PreFilter(ctx, &in); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
err = service.AdminOrder().Export(ctx, in)
|
||||
return
|
||||
}
|
||||
|
||||
// Edit 更新充值订单
|
||||
func (c *cOrder) Edit(ctx context.Context, req *order.EditReq) (res *order.EditRes, err error) {
|
||||
var in adminin.OrderEditInp
|
||||
if err = gconv.Scan(req, &in); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if err = validate.PreFilter(ctx, &in); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
err = service.AdminOrder().Edit(ctx, in)
|
||||
return
|
||||
}
|
||||
|
||||
// View 获取指定充值订单信息
|
||||
func (c *cOrder) View(ctx context.Context, req *order.ViewReq) (res *order.ViewRes, err error) {
|
||||
var in adminin.OrderViewInp
|
||||
if err = gconv.Scan(req, &in); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if err = validate.PreFilter(ctx, &in); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
data, err := service.AdminOrder().View(ctx, in)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(order.ViewRes)
|
||||
res.OrderViewModel = data
|
||||
return
|
||||
}
|
||||
|
||||
// Delete 删除充值订单
|
||||
func (c *cOrder) Delete(ctx context.Context, req *order.DeleteReq) (res *order.DeleteRes, err error) {
|
||||
var in adminin.OrderDeleteInp
|
||||
if err = gconv.Scan(req, &in); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if err = validate.PreFilter(ctx, &in); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
err = service.AdminOrder().Delete(ctx, in)
|
||||
return
|
||||
}
|
||||
|
||||
// Status 更新充值订单状态
|
||||
func (c *cOrder) Status(ctx context.Context, req *order.StatusReq) (res *order.StatusRes, err error) {
|
||||
var in adminin.OrderStatusInp
|
||||
if err = gconv.Scan(req, &in); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if err = validate.PreFilter(ctx, &in); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
err = service.AdminOrder().Status(ctx, in)
|
||||
return
|
||||
}
|
@ -3,7 +3,6 @@
|
||||
// @Copyright Copyright (c) 2023 HotGo CLI
|
||||
// @Author Ms <133814250@qq.com>
|
||||
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
|
||||
//
|
||||
package admin
|
||||
|
||||
import (
|
||||
|
49
server/internal/controller/admin/common/wechat.go
Normal file
49
server/internal/controller/admin/common/wechat.go
Normal file
@ -0,0 +1,49 @@
|
||||
// Package common
|
||||
// @Link https://github.com/bufanyun/hotgo
|
||||
// @Copyright Copyright (c) 2023 HotGo CLI
|
||||
// @Author Ms <133814250@qq.com>
|
||||
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
|
||||
package common
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/gogf/gf/v2/util/gconv"
|
||||
"hotgo/api/admin/common"
|
||||
"hotgo/internal/model/input/commonin"
|
||||
"hotgo/internal/service"
|
||||
"hotgo/utility/validate"
|
||||
)
|
||||
|
||||
var (
|
||||
Wechat = cWechat{}
|
||||
)
|
||||
|
||||
type cWechat struct{}
|
||||
|
||||
func (c *cWechat) Authorize(ctx context.Context, req *common.WechatAuthorizeReq) (res *common.WechatAuthorizeRes, err error) {
|
||||
var in commonin.WechatAuthorizeInp
|
||||
if err = gconv.Scan(req, &in); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if err = validate.PreFilter(ctx, &in); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
_, err = service.CommonWechat().Authorize(ctx, in)
|
||||
return
|
||||
}
|
||||
|
||||
func (c *cWechat) AuthorizeCall(ctx context.Context, req *common.WechatAuthorizeCallReq) (res *common.WechatAuthorizeCallRes, err error) {
|
||||
var in commonin.WechatAuthorizeCallInp
|
||||
if err = gconv.Scan(req, &in); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if err = validate.PreFilter(ctx, &in); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
_, err = service.CommonWechat().AuthorizeCall(ctx, in)
|
||||
return
|
||||
}
|
64
server/internal/controller/admin/pay/refund.go
Normal file
64
server/internal/controller/admin/pay/refund.go
Normal file
@ -0,0 +1,64 @@
|
||||
// Package pay
|
||||
// @Link https://github.com/bufanyun/hotgo
|
||||
// @Copyright Copyright (c) 2023 HotGo CLI
|
||||
// @Author Ms <133814250@qq.com>
|
||||
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
|
||||
// @AutoGenerate Version 2.5.3
|
||||
// @AutoGenerate Date 2023-04-15 15:59:58
|
||||
package pay
|
||||
|
||||
import (
|
||||
"context"
|
||||
"hotgo/api/admin/pay"
|
||||
"hotgo/internal/model/input/form"
|
||||
"hotgo/internal/model/input/payin"
|
||||
"hotgo/internal/service"
|
||||
"hotgo/utility/validate"
|
||||
|
||||
"github.com/gogf/gf/v2/util/gconv"
|
||||
)
|
||||
|
||||
var (
|
||||
Refund = cRefund{}
|
||||
)
|
||||
|
||||
type cRefund struct{}
|
||||
|
||||
// List 查看交易退款列表
|
||||
func (c *cRefund) List(ctx context.Context, req *pay.RefundListReq) (res *pay.RefundListRes, err error) {
|
||||
var in payin.PayRefundListInp
|
||||
if err = gconv.Scan(req, &in); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if err = validate.PreFilter(ctx, &in); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
list, totalCount, err := service.PayRefund().List(ctx, in)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(pay.RefundListRes)
|
||||
res.List = list
|
||||
res.PageCount = form.CalPageCount(totalCount, req.PerPage)
|
||||
res.Page = req.Page
|
||||
res.PerPage = req.PerPage
|
||||
return
|
||||
}
|
||||
|
||||
// Export 导出交易退款列表
|
||||
func (c *cRefund) Export(ctx context.Context, req *pay.RefundExportReq) (res *pay.RefundExportRes, err error) {
|
||||
var in payin.PayRefundListInp
|
||||
if err = gconv.Scan(req, &in); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if err = validate.PreFilter(ctx, &in); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
err = service.PayRefund().Export(ctx, in)
|
||||
return
|
||||
}
|
@ -56,3 +56,10 @@ func (c *cConfig) TypeSelect(ctx context.Context, req *config.TypeSelectReq) (re
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// GetCash 获取指定分组的配置
|
||||
func (c *cConfig) GetCash(ctx context.Context, req *config.GetCashReq) (res *config.GetCashRes, err error) {
|
||||
res = new(config.GetCashRes)
|
||||
res.GetConfigModel, err = service.SysConfig().GetConfigByGroup(ctx, sysin.GetConfigInp{Group: "cash"})
|
||||
return
|
||||
}
|
@ -3,7 +3,6 @@
|
||||
// @Copyright Copyright (c) 2023 HotGo CLI
|
||||
// @Author Ms <133814250@qq.com>
|
||||
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
|
||||
//
|
||||
package sys
|
||||
|
||||
import (
|
||||
@ -12,6 +11,7 @@ import (
|
||||
"github.com/gogf/gf/v2/util/gconv"
|
||||
"hotgo/api/admin/cron"
|
||||
"hotgo/internal/model/input/form"
|
||||
"hotgo/internal/model/input/msgin"
|
||||
"hotgo/internal/model/input/sysin"
|
||||
"hotgo/internal/service"
|
||||
)
|
||||
@ -24,23 +24,23 @@ type cCron struct{}
|
||||
|
||||
// Delete 删除
|
||||
func (c *cCron) Delete(ctx context.Context, req *cron.DeleteReq) (res *cron.DeleteRes, err error) {
|
||||
var in sysin.CronDeleteInp
|
||||
if err = gconv.Scan(req, &in); err != nil {
|
||||
var in = new(msgin.CronDelete)
|
||||
if err = gconv.Scan(req, &in.CronDeleteInp); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
err = service.SysCron().Delete(ctx, in)
|
||||
err = service.TCPServer().CronDelete(ctx, in)
|
||||
return
|
||||
}
|
||||
|
||||
// Edit 更新
|
||||
func (c *cCron) Edit(ctx context.Context, req *cron.EditReq) (res *cron.EditRes, err error) {
|
||||
var in sysin.CronEditInp
|
||||
if err = gconv.Scan(req, &in); err != nil {
|
||||
var in = new(msgin.CronEdit)
|
||||
if err = gconv.Scan(req, &in.CronEditInp); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
err = service.SysCron().Edit(ctx, in)
|
||||
err = service.TCPServer().CronEdit(ctx, in)
|
||||
return
|
||||
}
|
||||
|
||||
@ -105,10 +105,11 @@ func (c *cCron) OnlineExec(ctx context.Context, req *cron.OnlineExecReq) (res *c
|
||||
return nil, gerror.New("定时任务ID不能为空")
|
||||
}
|
||||
|
||||
var in sysin.OnlineExecInp
|
||||
if err = gconv.Scan(req, &in); err != nil {
|
||||
var in = new(msgin.CronOnlineExec)
|
||||
if err = gconv.Scan(req, &in.OnlineExecInp); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
return res, service.SysCron().OnlineExec(ctx, in)
|
||||
err = service.TCPServer().CronOnlineExec(ctx, in)
|
||||
return
|
||||
}
|
||||
|
@ -3,9 +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.4
|
||||
// @AutoGenerate Date 2023-02-20 16:41:58
|
||||
//
|
||||
// @AutoGenerate Version 2.5.3
|
||||
// @AutoGenerate Date 2023-04-28 15:28:40
|
||||
package sys
|
||||
|
||||
import (
|
||||
|
53
server/internal/controller/api/pay/notify.go
Normal file
53
server/internal/controller/api/pay/notify.go
Normal file
@ -0,0 +1,53 @@
|
||||
// Package pay
|
||||
// @Link https://github.com/bufanyun/hotgo
|
||||
// @Copyright Copyright (c) 2023 HotGo CLI
|
||||
// @Author Ms <133814250@qq.com>
|
||||
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
|
||||
package pay
|
||||
|
||||
import (
|
||||
"context"
|
||||
"hotgo/api/api/pay"
|
||||
"hotgo/internal/consts"
|
||||
"hotgo/internal/model/input/payin"
|
||||
"hotgo/internal/service"
|
||||
)
|
||||
|
||||
var (
|
||||
Notify = cNotify{}
|
||||
)
|
||||
|
||||
type cNotify struct{}
|
||||
|
||||
// AliPay 支付宝回调
|
||||
func (c *cNotify) AliPay(ctx context.Context, req *pay.NotifyAliPayReq) (res *pay.NotifyAliPayRes, err error) {
|
||||
_, err = service.Pay().Notify(ctx, payin.PayNotifyInp{PayType: consts.PayTypeAliPay})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
res = &pay.NotifyAliPayRes{PayType: consts.PayTypeAliPay, Message: "success"}
|
||||
return
|
||||
}
|
||||
|
||||
// WxPay 微信支付回调
|
||||
func (c *cNotify) WxPay(ctx context.Context, req *pay.NotifyWxPayReq) (res *pay.NotifyWxPayRes, err error) {
|
||||
_, err = service.Pay().Notify(ctx, payin.PayNotifyInp{PayType: consts.PayTypeWxPay})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
res = &pay.NotifyWxPayRes{PayType: consts.PayTypeWxPay, Code: "SUCCESS", Message: "收单成功"}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// QQPay QQ支付回调
|
||||
func (c *cNotify) QQPay(ctx context.Context, req *pay.NotifyQQPayReq) (res *pay.NotifyQQPayRes, err error) {
|
||||
_, err = service.Pay().Notify(ctx, payin.PayNotifyInp{PayType: consts.PayTypeQQPay})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
res = &pay.NotifyQQPayRes{PayType: consts.PayTypeQQPay, Message: "SUCCESS"}
|
||||
return
|
||||
}
|
43
server/internal/crons/close_order.go
Normal file
43
server/internal/crons/close_order.go
Normal file
@ -0,0 +1,43 @@
|
||||
// Package crons
|
||||
// @Link https://github.com/bufanyun/hotgo
|
||||
// @Copyright Copyright (c) 2023 HotGo CLI
|
||||
// @Author Ms <133814250@qq.com>
|
||||
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
|
||||
package crons
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
"github.com/gogf/gf/v2/os/gtime"
|
||||
"hotgo/internal/consts"
|
||||
"hotgo/internal/dao"
|
||||
"hotgo/internal/service"
|
||||
)
|
||||
|
||||
func init() {
|
||||
cronList = append(cronList, CloseOrder)
|
||||
}
|
||||
|
||||
// CloseOrder 取消过期订单
|
||||
var CloseOrder = &cCloseOrder{name: "close_order"}
|
||||
|
||||
type cCloseOrder struct {
|
||||
name string
|
||||
}
|
||||
|
||||
func (c *cCloseOrder) GetName() string {
|
||||
return c.name
|
||||
}
|
||||
|
||||
// Execute 执行任务
|
||||
func (c *cCloseOrder) Execute(ctx context.Context) {
|
||||
_, err := service.AdminOrder().Model(ctx).
|
||||
Where(dao.AdminOrder.Columns().Status, consts.OrderStatusNotPay).
|
||||
WhereLTE(dao.AdminOrder.Columns().CreatedAt, gtime.Now().AddDate(0, 0, -1)).
|
||||
Data(g.Map{
|
||||
dao.AdminOrder.Columns().Status: consts.OrderStatusClose,
|
||||
}).Update()
|
||||
if err != nil {
|
||||
g.Log().Warning(ctx, "cron CloseOrder Execute err:%+v", err)
|
||||
}
|
||||
}
|
@ -3,7 +3,6 @@
|
||||
// @Copyright Copyright (c) 2023 HotGo CLI
|
||||
// @Author Ms <133814250@qq.com>
|
||||
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
|
||||
//
|
||||
package crons
|
||||
|
||||
import (
|
||||
@ -177,12 +176,13 @@ func Delete(sysCron *entity.SysCron) (err error) {
|
||||
if sysCron == nil {
|
||||
return
|
||||
}
|
||||
|
||||
for _, v := range gcron.Entries() {
|
||||
if v.Name == sysCron.Name {
|
||||
gcron.Remove(v.Name)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
|
27
server/internal/dao/admin_cash.go
Normal file
27
server/internal/dao/admin_cash.go
Normal file
@ -0,0 +1,27 @@
|
||||
// =================================================================================
|
||||
// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish.
|
||||
// =================================================================================
|
||||
|
||||
package dao
|
||||
|
||||
import (
|
||||
"hotgo/internal/dao/internal"
|
||||
)
|
||||
|
||||
// internalAdminCashDao is internal type for wrapping internal DAO implements.
|
||||
type internalAdminCashDao = *internal.AdminCashDao
|
||||
|
||||
// adminCashDao is the data access object for table hg_admin_cash.
|
||||
// You can define custom methods on it to extend its functionality as you wish.
|
||||
type adminCashDao struct {
|
||||
internalAdminCashDao
|
||||
}
|
||||
|
||||
var (
|
||||
// AdminCash is globally public accessible object for table hg_admin_cash operations.
|
||||
AdminCash = adminCashDao{
|
||||
internal.NewAdminCashDao(),
|
||||
}
|
||||
)
|
||||
|
||||
// Fill with you ideas below.
|
27
server/internal/dao/admin_credits_log.go
Normal file
27
server/internal/dao/admin_credits_log.go
Normal file
@ -0,0 +1,27 @@
|
||||
// =================================================================================
|
||||
// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish.
|
||||
// =================================================================================
|
||||
|
||||
package dao
|
||||
|
||||
import (
|
||||
"hotgo/internal/dao/internal"
|
||||
)
|
||||
|
||||
// internalAdminCreditsLogDao is internal type for wrapping internal DAO implements.
|
||||
type internalAdminCreditsLogDao = *internal.AdminCreditsLogDao
|
||||
|
||||
// adminCreditsLogDao is the data access object for table hg_admin_credits_log.
|
||||
// You can define custom methods on it to extend its functionality as you wish.
|
||||
type adminCreditsLogDao struct {
|
||||
internalAdminCreditsLogDao
|
||||
}
|
||||
|
||||
var (
|
||||
// AdminCreditsLog is globally public accessible object for table hg_admin_credits_log operations.
|
||||
AdminCreditsLog = adminCreditsLogDao{
|
||||
internal.NewAdminCreditsLogDao(),
|
||||
}
|
||||
)
|
||||
|
||||
// Fill with you ideas below.
|
@ -48,18 +48,3 @@ func (dao *adminDeptDao) IsUniqueName(ctx context.Context, id int64, name string
|
||||
|
||||
return false, nil
|
||||
}
|
||||
|
||||
// TopPid 获取最上级pid
|
||||
func (dao *adminDeptDao) TopPid(ctx context.Context, data *entity.AdminDept) (int64, error) {
|
||||
var pidData *entity.AdminDept
|
||||
if data.Pid == 0 {
|
||||
return data.Id, nil
|
||||
}
|
||||
err := dao.Ctx(ctx).Where("id", data.Pid).Scan(&pidData)
|
||||
if err != nil {
|
||||
err = gerror.Wrap(err, consts.ErrorORM)
|
||||
return 0, err
|
||||
}
|
||||
|
||||
return dao.TopPid(ctx, pidData)
|
||||
}
|
||||
|
@ -8,7 +8,6 @@ import (
|
||||
"context"
|
||||
"github.com/gogf/gf/v2/errors/gerror"
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
"hotgo/internal/consts"
|
||||
"hotgo/internal/dao/internal"
|
||||
"hotgo/internal/model/entity"
|
||||
)
|
||||
@ -54,22 +53,3 @@ func (dao *adminMemberPostDao) UpdatePostIds(ctx context.Context, memberId int64
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetMemberByIds 获取指定关联员的岗位ids
|
||||
func (dao *adminMemberPostDao) GetMemberByIds(ctx context.Context, memberId int64) (postIds []int64, err error) {
|
||||
var list []*entity.AdminMemberPost
|
||||
err = dao.Ctx(ctx).
|
||||
Fields("post_id").
|
||||
Where("member_id", memberId).
|
||||
Scan(&list)
|
||||
if err != nil {
|
||||
err = gerror.Wrap(err, consts.ErrorORM)
|
||||
return postIds, err
|
||||
}
|
||||
|
||||
for i := 0; i < len(list); i++ {
|
||||
postIds = append(postIds, list[i].PostId)
|
||||
}
|
||||
|
||||
return postIds, nil
|
||||
}
|
||||
|
@ -9,7 +9,6 @@ import (
|
||||
"github.com/gogf/gf/v2/errors/gerror"
|
||||
"hotgo/internal/consts"
|
||||
"hotgo/internal/dao/internal"
|
||||
"hotgo/internal/model"
|
||||
"hotgo/internal/model/entity"
|
||||
)
|
||||
|
||||
@ -70,68 +69,3 @@ func (dao *adminMenuDao) IsUniqueName(ctx context.Context, id int64, name string
|
||||
|
||||
return false, nil
|
||||
}
|
||||
|
||||
func (dao *adminMenuDao) GenLabelTreeList(ctx context.Context, pid int64) ([]*model.LabelTreeMenu, error) {
|
||||
|
||||
var (
|
||||
newLst []*model.LabelTreeMenu
|
||||
)
|
||||
if err := dao.Ctx(ctx).Where("pid", pid).Order("sort asc,id desc").Scan(&newLst); err != nil {
|
||||
err = gerror.Wrap(err, consts.ErrorORM)
|
||||
return nil, err
|
||||
}
|
||||
|
||||
for i := 0; i < len(newLst); i++ {
|
||||
newLst[i].Key = newLst[i].Id
|
||||
newLst[i].Label = newLst[i].Name
|
||||
err := dao.Ctx(ctx).Where("pid", newLst[i].Id).Order("sort asc,id desc").Scan(&newLst[i].Children)
|
||||
if err != nil {
|
||||
err = gerror.Wrap(err, consts.ErrorORM)
|
||||
return nil, err
|
||||
}
|
||||
|
||||
for i2 := 0; i2 < len(newLst[i].Children); i2++ {
|
||||
newLst[i].Children[i2].Key = newLst[i].Children[i2].Id
|
||||
newLst[i].Children[i2].Label = newLst[i].Children[i2].Name
|
||||
}
|
||||
}
|
||||
|
||||
return newLst, nil
|
||||
}
|
||||
|
||||
// GenTreeList 生成树列表
|
||||
func (dao *adminMenuDao) GenTreeList(ctx context.Context, pid int64, ids []int64) ([]*model.TreeMenu, error) {
|
||||
|
||||
var (
|
||||
newLst []*model.TreeMenu
|
||||
)
|
||||
if err := dao.Ctx(ctx).Where("id", ids).Where("pid", pid).Order("sort asc,id desc").Scan(&newLst); err != nil {
|
||||
err = gerror.Wrap(err, consts.ErrorORM)
|
||||
return nil, err
|
||||
}
|
||||
|
||||
for i := 0; i < len(newLst); i++ {
|
||||
err := dao.Ctx(ctx).Where("pid", newLst[i].Id).Order("sort asc,id desc").Scan(&newLst[i].Children)
|
||||
if err != nil {
|
||||
err = gerror.Wrap(err, consts.ErrorORM)
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
return newLst, nil
|
||||
}
|
||||
|
||||
// TopPid 获取最上级pid
|
||||
func (dao *adminMenuDao) TopPid(ctx context.Context, data *entity.AdminMenu) (int64, error) {
|
||||
var pidData *entity.AdminMenu
|
||||
if data.Pid == 0 {
|
||||
return data.Id, nil
|
||||
}
|
||||
err := dao.Ctx(ctx).Where("id", data.Pid).Scan(&pidData)
|
||||
if err != nil {
|
||||
err = gerror.Wrap(err, consts.ErrorORM)
|
||||
return 0, err
|
||||
}
|
||||
|
||||
return dao.TopPid(ctx, pidData)
|
||||
}
|
||||
|
27
server/internal/dao/admin_oauth.go
Normal file
27
server/internal/dao/admin_oauth.go
Normal file
@ -0,0 +1,27 @@
|
||||
// =================================================================================
|
||||
// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish.
|
||||
// =================================================================================
|
||||
|
||||
package dao
|
||||
|
||||
import (
|
||||
"hotgo/internal/dao/internal"
|
||||
)
|
||||
|
||||
// internalAdminOauthDao is internal type for wrapping internal DAO implements.
|
||||
type internalAdminOauthDao = *internal.AdminOauthDao
|
||||
|
||||
// adminOauthDao is the data access object for table hg_admin_oauth.
|
||||
// You can define custom methods on it to extend its functionality as you wish.
|
||||
type adminOauthDao struct {
|
||||
internalAdminOauthDao
|
||||
}
|
||||
|
||||
var (
|
||||
// AdminOauth is globally public accessible object for table hg_admin_oauth operations.
|
||||
AdminOauth = adminOauthDao{
|
||||
internal.NewAdminOauthDao(),
|
||||
}
|
||||
)
|
||||
|
||||
// Fill with you ideas below.
|
27
server/internal/dao/admin_order.go
Normal file
27
server/internal/dao/admin_order.go
Normal file
@ -0,0 +1,27 @@
|
||||
// =================================================================================
|
||||
// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish.
|
||||
// =================================================================================
|
||||
|
||||
package dao
|
||||
|
||||
import (
|
||||
"hotgo/internal/dao/internal"
|
||||
)
|
||||
|
||||
// internalAdminOrderDao is internal type for wrapping internal DAO implements.
|
||||
type internalAdminOrderDao = *internal.AdminOrderDao
|
||||
|
||||
// adminOrderDao is the data access object for table hg_admin_order.
|
||||
// You can define custom methods on it to extend its functionality as you wish.
|
||||
type adminOrderDao struct {
|
||||
internalAdminOrderDao
|
||||
}
|
||||
|
||||
var (
|
||||
// AdminOrder is globally public accessible object for table hg_admin_order operations.
|
||||
AdminOrder = adminOrderDao{
|
||||
internal.NewAdminOrderDao(),
|
||||
}
|
||||
)
|
||||
|
||||
// Fill with you ideas below.
|
91
server/internal/dao/internal/admin_cash.go
Normal file
91
server/internal/dao/internal/admin_cash.go
Normal file
@ -0,0 +1,91 @@
|
||||
// ==========================================================================
|
||||
// Code generated by GoFrame CLI tool. DO NOT EDIT.
|
||||
// ==========================================================================
|
||||
|
||||
package internal
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/gogf/gf/v2/database/gdb"
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
)
|
||||
|
||||
// AdminCashDao is the data access object for table hg_admin_cash.
|
||||
type AdminCashDao struct {
|
||||
table string // table is the underlying table name of the DAO.
|
||||
group string // group is the database configuration group name of current DAO.
|
||||
columns AdminCashColumns // columns contains all the column names of Table for convenient usage.
|
||||
}
|
||||
|
||||
// AdminCashColumns defines and stores column names for table hg_admin_cash.
|
||||
type AdminCashColumns struct {
|
||||
Id string // ID
|
||||
MemberId string // 管理员ID
|
||||
Money string // 提现金额
|
||||
Fee string // 手续费
|
||||
LastMoney string // 最终到账金额
|
||||
Ip string // 申请人IP
|
||||
Status string // 状态码
|
||||
Msg string // 处理结果
|
||||
HandleAt string // 处理时间
|
||||
CreatedAt string // 申请时间
|
||||
}
|
||||
|
||||
// adminCashColumns holds the columns for table hg_admin_cash.
|
||||
var adminCashColumns = AdminCashColumns{
|
||||
Id: "id",
|
||||
MemberId: "member_id",
|
||||
Money: "money",
|
||||
Fee: "fee",
|
||||
LastMoney: "last_money",
|
||||
Ip: "ip",
|
||||
Status: "status",
|
||||
Msg: "msg",
|
||||
HandleAt: "handle_at",
|
||||
CreatedAt: "created_at",
|
||||
}
|
||||
|
||||
// NewAdminCashDao creates and returns a new DAO object for table data access.
|
||||
func NewAdminCashDao() *AdminCashDao {
|
||||
return &AdminCashDao{
|
||||
group: "default",
|
||||
table: "hg_admin_cash",
|
||||
columns: adminCashColumns,
|
||||
}
|
||||
}
|
||||
|
||||
// DB retrieves and returns the underlying raw database management object of current DAO.
|
||||
func (dao *AdminCashDao) DB() gdb.DB {
|
||||
return g.DB(dao.group)
|
||||
}
|
||||
|
||||
// Table returns the table name of current dao.
|
||||
func (dao *AdminCashDao) Table() string {
|
||||
return dao.table
|
||||
}
|
||||
|
||||
// Columns returns all column names of current dao.
|
||||
func (dao *AdminCashDao) Columns() AdminCashColumns {
|
||||
return dao.columns
|
||||
}
|
||||
|
||||
// Group returns the configuration group name of database of current dao.
|
||||
func (dao *AdminCashDao) Group() string {
|
||||
return dao.group
|
||||
}
|
||||
|
||||
// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
|
||||
func (dao *AdminCashDao) Ctx(ctx context.Context) *gdb.Model {
|
||||
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
|
||||
}
|
||||
|
||||
// Transaction wraps the transaction logic using function f.
|
||||
// It rollbacks the transaction and returns the error from function f if it returns non-nil error.
|
||||
// It commits the transaction and returns nil if function f returns nil.
|
||||
//
|
||||
// Note that, you should not Commit or Rollback the transaction in function f
|
||||
// as it is automatically handled by this function.
|
||||
func (dao *AdminCashDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
||||
return dao.Ctx(ctx).Transaction(ctx, f)
|
||||
}
|
101
server/internal/dao/internal/admin_credits_log.go
Normal file
101
server/internal/dao/internal/admin_credits_log.go
Normal file
@ -0,0 +1,101 @@
|
||||
// ==========================================================================
|
||||
// Code generated by GoFrame CLI tool. DO NOT EDIT.
|
||||
// ==========================================================================
|
||||
|
||||
package internal
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/gogf/gf/v2/database/gdb"
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
)
|
||||
|
||||
// AdminCreditsLogDao is the data access object for table hg_admin_credits_log.
|
||||
type AdminCreditsLogDao struct {
|
||||
table string // table is the underlying table name of the DAO.
|
||||
group string // group is the database configuration group name of current DAO.
|
||||
columns AdminCreditsLogColumns // columns contains all the column names of Table for convenient usage.
|
||||
}
|
||||
|
||||
// AdminCreditsLogColumns defines and stores column names for table hg_admin_credits_log.
|
||||
type AdminCreditsLogColumns struct {
|
||||
Id string // 变动ID
|
||||
MemberId string // 管理员ID
|
||||
AppId string // 应用id
|
||||
AddonsName string // 插件名称
|
||||
CreditType string // 变动类型
|
||||
CreditGroup string // 变动组别
|
||||
BeforeNum string // 变动前
|
||||
Num string // 变动数据
|
||||
AfterNum string // 变动后
|
||||
Remark string // 备注
|
||||
Ip string // 操作人IP
|
||||
MapId string // 关联ID
|
||||
Status string // 状态
|
||||
CreatedAt string // 创建时间
|
||||
UpdatedAt string // 修改时间
|
||||
}
|
||||
|
||||
// adminCreditsLogColumns holds the columns for table hg_admin_credits_log.
|
||||
var adminCreditsLogColumns = AdminCreditsLogColumns{
|
||||
Id: "id",
|
||||
MemberId: "member_id",
|
||||
AppId: "app_id",
|
||||
AddonsName: "addons_name",
|
||||
CreditType: "credit_type",
|
||||
CreditGroup: "credit_group",
|
||||
BeforeNum: "before_num",
|
||||
Num: "num",
|
||||
AfterNum: "after_num",
|
||||
Remark: "remark",
|
||||
Ip: "ip",
|
||||
MapId: "map_id",
|
||||
Status: "status",
|
||||
CreatedAt: "created_at",
|
||||
UpdatedAt: "updated_at",
|
||||
}
|
||||
|
||||
// NewAdminCreditsLogDao creates and returns a new DAO object for table data access.
|
||||
func NewAdminCreditsLogDao() *AdminCreditsLogDao {
|
||||
return &AdminCreditsLogDao{
|
||||
group: "default",
|
||||
table: "hg_admin_credits_log",
|
||||
columns: adminCreditsLogColumns,
|
||||
}
|
||||
}
|
||||
|
||||
// DB retrieves and returns the underlying raw database management object of current DAO.
|
||||
func (dao *AdminCreditsLogDao) DB() gdb.DB {
|
||||
return g.DB(dao.group)
|
||||
}
|
||||
|
||||
// Table returns the table name of current dao.
|
||||
func (dao *AdminCreditsLogDao) Table() string {
|
||||
return dao.table
|
||||
}
|
||||
|
||||
// Columns returns all column names of current dao.
|
||||
func (dao *AdminCreditsLogDao) Columns() AdminCreditsLogColumns {
|
||||
return dao.columns
|
||||
}
|
||||
|
||||
// Group returns the configuration group name of database of current dao.
|
||||
func (dao *AdminCreditsLogDao) Group() string {
|
||||
return dao.group
|
||||
}
|
||||
|
||||
// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
|
||||
func (dao *AdminCreditsLogDao) Ctx(ctx context.Context) *gdb.Model {
|
||||
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
|
||||
}
|
||||
|
||||
// Transaction wraps the transaction logic using function f.
|
||||
// It rollbacks the transaction and returns the error from function f if it returns non-nil error.
|
||||
// It commits the transaction and returns nil if function f returns nil.
|
||||
//
|
||||
// Note that, you should not Commit or Rollback the transaction in function f
|
||||
// as it is automatically handled by this function.
|
||||
func (dao *AdminCreditsLogDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
||||
return dao.Ctx(ctx).Transaction(ctx, f)
|
||||
}
|
@ -29,6 +29,7 @@ type AdminMemberColumns struct {
|
||||
Salt string // 密码盐
|
||||
AuthKey string // 授权令牌
|
||||
PasswordResetToken string // 密码重置令牌
|
||||
Integral string // 积分
|
||||
Balance string // 余额
|
||||
Avatar string // 头像
|
||||
Sex string // 性别
|
||||
@ -60,6 +61,7 @@ var adminMemberColumns = AdminMemberColumns{
|
||||
Salt: "salt",
|
||||
AuthKey: "auth_key",
|
||||
PasswordResetToken: "password_reset_token",
|
||||
Integral: "integral",
|
||||
Balance: "balance",
|
||||
Avatar: "avatar",
|
||||
Sex: "sex",
|
||||
|
101
server/internal/dao/internal/admin_oauth.go
Normal file
101
server/internal/dao/internal/admin_oauth.go
Normal file
@ -0,0 +1,101 @@
|
||||
// ==========================================================================
|
||||
// Code generated by GoFrame CLI tool. DO NOT EDIT.
|
||||
// ==========================================================================
|
||||
|
||||
package internal
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/gogf/gf/v2/database/gdb"
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
)
|
||||
|
||||
// AdminOauthDao is the data access object for table hg_admin_oauth.
|
||||
type AdminOauthDao struct {
|
||||
table string // table is the underlying table name of the DAO.
|
||||
group string // group is the database configuration group name of current DAO.
|
||||
columns AdminOauthColumns // columns contains all the column names of Table for convenient usage.
|
||||
}
|
||||
|
||||
// AdminOauthColumns defines and stores column names for table hg_admin_oauth.
|
||||
type AdminOauthColumns struct {
|
||||
Id string // 主键
|
||||
MemberId string // 用户ID
|
||||
Unionid string // 唯一ID
|
||||
OauthClient string // 授权组别
|
||||
OauthOpenid string // 授权开放ID
|
||||
Sex string // 性别
|
||||
Nickname string // 昵称
|
||||
HeadPortrait string // 头像
|
||||
Birthday string // 生日
|
||||
Country string // 国家
|
||||
Province string // 省
|
||||
City string // 市
|
||||
Status string // 状态
|
||||
CreatedAt string // 创建时间
|
||||
UpdatedAt string // 修改时间
|
||||
}
|
||||
|
||||
// adminOauthColumns holds the columns for table hg_admin_oauth.
|
||||
var adminOauthColumns = AdminOauthColumns{
|
||||
Id: "id",
|
||||
MemberId: "member_id",
|
||||
Unionid: "unionid",
|
||||
OauthClient: "oauth_client",
|
||||
OauthOpenid: "oauth_openid",
|
||||
Sex: "sex",
|
||||
Nickname: "nickname",
|
||||
HeadPortrait: "head_portrait",
|
||||
Birthday: "birthday",
|
||||
Country: "country",
|
||||
Province: "province",
|
||||
City: "city",
|
||||
Status: "status",
|
||||
CreatedAt: "created_at",
|
||||
UpdatedAt: "updated_at",
|
||||
}
|
||||
|
||||
// NewAdminOauthDao creates and returns a new DAO object for table data access.
|
||||
func NewAdminOauthDao() *AdminOauthDao {
|
||||
return &AdminOauthDao{
|
||||
group: "default",
|
||||
table: "hg_admin_oauth",
|
||||
columns: adminOauthColumns,
|
||||
}
|
||||
}
|
||||
|
||||
// DB retrieves and returns the underlying raw database management object of current DAO.
|
||||
func (dao *AdminOauthDao) DB() gdb.DB {
|
||||
return g.DB(dao.group)
|
||||
}
|
||||
|
||||
// Table returns the table name of current dao.
|
||||
func (dao *AdminOauthDao) Table() string {
|
||||
return dao.table
|
||||
}
|
||||
|
||||
// Columns returns all column names of current dao.
|
||||
func (dao *AdminOauthDao) Columns() AdminOauthColumns {
|
||||
return dao.columns
|
||||
}
|
||||
|
||||
// Group returns the configuration group name of database of current dao.
|
||||
func (dao *AdminOauthDao) Group() string {
|
||||
return dao.group
|
||||
}
|
||||
|
||||
// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
|
||||
func (dao *AdminOauthDao) Ctx(ctx context.Context) *gdb.Model {
|
||||
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
|
||||
}
|
||||
|
||||
// Transaction wraps the transaction logic using function f.
|
||||
// It rollbacks the transaction and returns the error from function f if it returns non-nil error.
|
||||
// It commits the transaction and returns nil if function f returns nil.
|
||||
//
|
||||
// Note that, you should not Commit or Rollback the transaction in function f
|
||||
// as it is automatically handled by this function.
|
||||
func (dao *AdminOauthDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
||||
return dao.Ctx(ctx).Transaction(ctx, f)
|
||||
}
|
95
server/internal/dao/internal/admin_order.go
Normal file
95
server/internal/dao/internal/admin_order.go
Normal file
@ -0,0 +1,95 @@
|
||||
// ==========================================================================
|
||||
// Code generated by GoFrame CLI tool. DO NOT EDIT.
|
||||
// ==========================================================================
|
||||
|
||||
package internal
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/gogf/gf/v2/database/gdb"
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
)
|
||||
|
||||
// AdminOrderDao is the data access object for table hg_admin_order.
|
||||
type AdminOrderDao struct {
|
||||
table string // table is the underlying table name of the DAO.
|
||||
group string // group is the database configuration group name of current DAO.
|
||||
columns AdminOrderColumns // columns contains all the column names of Table for convenient usage.
|
||||
}
|
||||
|
||||
// AdminOrderColumns defines and stores column names for table hg_admin_order.
|
||||
type AdminOrderColumns struct {
|
||||
Id string // 主键
|
||||
MemberId string // 管理员id
|
||||
OrderType string // 订单类型
|
||||
ProductId string // 产品id
|
||||
OrderSn string // 关联订单号
|
||||
Money string // 充值金额
|
||||
Remark string // 备注
|
||||
RefundReason string // 退款原因
|
||||
RejectRefundReason string // 拒绝退款原因
|
||||
Status string // 状态
|
||||
CreatedAt string // 创建时间
|
||||
UpdatedAt string // 修改时间
|
||||
}
|
||||
|
||||
// adminOrderColumns holds the columns for table hg_admin_order.
|
||||
var adminOrderColumns = AdminOrderColumns{
|
||||
Id: "id",
|
||||
MemberId: "member_id",
|
||||
OrderType: "order_type",
|
||||
ProductId: "product_id",
|
||||
OrderSn: "order_sn",
|
||||
Money: "money",
|
||||
Remark: "remark",
|
||||
RefundReason: "refund_reason",
|
||||
RejectRefundReason: "reject_refund_reason",
|
||||
Status: "status",
|
||||
CreatedAt: "created_at",
|
||||
UpdatedAt: "updated_at",
|
||||
}
|
||||
|
||||
// NewAdminOrderDao creates and returns a new DAO object for table data access.
|
||||
func NewAdminOrderDao() *AdminOrderDao {
|
||||
return &AdminOrderDao{
|
||||
group: "default",
|
||||
table: "hg_admin_order",
|
||||
columns: adminOrderColumns,
|
||||
}
|
||||
}
|
||||
|
||||
// DB retrieves and returns the underlying raw database management object of current DAO.
|
||||
func (dao *AdminOrderDao) DB() gdb.DB {
|
||||
return g.DB(dao.group)
|
||||
}
|
||||
|
||||
// Table returns the table name of current dao.
|
||||
func (dao *AdminOrderDao) Table() string {
|
||||
return dao.table
|
||||
}
|
||||
|
||||
// Columns returns all column names of current dao.
|
||||
func (dao *AdminOrderDao) Columns() AdminOrderColumns {
|
||||
return dao.columns
|
||||
}
|
||||
|
||||
// Group returns the configuration group name of database of current dao.
|
||||
func (dao *AdminOrderDao) Group() string {
|
||||
return dao.group
|
||||
}
|
||||
|
||||
// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
|
||||
func (dao *AdminOrderDao) Ctx(ctx context.Context) *gdb.Model {
|
||||
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
|
||||
}
|
||||
|
||||
// Transaction wraps the transaction logic using function f.
|
||||
// It rollbacks the transaction and returns the error from function f if it returns non-nil error.
|
||||
// It commits the transaction and returns nil if function f returns nil.
|
||||
//
|
||||
// Note that, you should not Commit or Rollback the transaction in function f
|
||||
// as it is automatically handled by this function.
|
||||
func (dao *AdminOrderDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
||||
return dao.Ctx(ctx).Transaction(ctx, f)
|
||||
}
|
131
server/internal/dao/internal/pay_log.go
Normal file
131
server/internal/dao/internal/pay_log.go
Normal file
@ -0,0 +1,131 @@
|
||||
// ==========================================================================
|
||||
// Code generated by GoFrame CLI tool. DO NOT EDIT.
|
||||
// ==========================================================================
|
||||
|
||||
package internal
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/gogf/gf/v2/database/gdb"
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
)
|
||||
|
||||
// PayLogDao is the data access object for table hg_pay_log.
|
||||
type PayLogDao struct {
|
||||
table string // table is the underlying table name of the DAO.
|
||||
group string // group is the database configuration group name of current DAO.
|
||||
columns PayLogColumns // columns contains all the column names of Table for convenient usage.
|
||||
}
|
||||
|
||||
// PayLogColumns defines and stores column names for table hg_pay_log.
|
||||
type PayLogColumns struct {
|
||||
Id string // 主键
|
||||
MemberId string // 会员ID
|
||||
AppId string // 应用ID
|
||||
AddonsName string // 插件名称
|
||||
OrderSn string // 关联订单号
|
||||
OrderGroup string // 组别[默认统一支付类型]
|
||||
Openid string // openid
|
||||
MchId string // 商户支付账户
|
||||
Subject string // 订单标题
|
||||
Detail string // 支付商品详情
|
||||
AuthCode string // 刷卡码
|
||||
OutTradeNo string // 商户订单号
|
||||
TransactionId string // 交易号
|
||||
PayType string // 支付类型
|
||||
PayAmount string // 支付金额
|
||||
ActualAmount string // 实付金额
|
||||
PayStatus string // 支付状态
|
||||
PayAt string // 支付时间
|
||||
TradeType string // 交易类型
|
||||
RefundSn string // 退款单号
|
||||
IsRefund string // 是否退款
|
||||
Custom string // 自定义参数
|
||||
CreateIp string // 创建者IP
|
||||
PayIp string // 支付者IP
|
||||
NotifyUrl string // 支付通知回调地址
|
||||
ReturnUrl string // 买家付款成功跳转地址
|
||||
TraceIds string // 链路ID集合
|
||||
Status string // 状态
|
||||
CreatedAt string // 创建时间
|
||||
UpdatedAt string // 修改时间
|
||||
}
|
||||
|
||||
// payLogColumns holds the columns for table hg_pay_log.
|
||||
var payLogColumns = PayLogColumns{
|
||||
Id: "id",
|
||||
MemberId: "member_id",
|
||||
AppId: "app_id",
|
||||
AddonsName: "addons_name",
|
||||
OrderSn: "order_sn",
|
||||
OrderGroup: "order_group",
|
||||
Openid: "openid",
|
||||
MchId: "mch_id",
|
||||
Subject: "subject",
|
||||
Detail: "detail",
|
||||
AuthCode: "auth_code",
|
||||
OutTradeNo: "out_trade_no",
|
||||
TransactionId: "transaction_id",
|
||||
PayType: "pay_type",
|
||||
PayAmount: "pay_amount",
|
||||
ActualAmount: "actual_amount",
|
||||
PayStatus: "pay_status",
|
||||
PayAt: "pay_at",
|
||||
TradeType: "trade_type",
|
||||
RefundSn: "refund_sn",
|
||||
IsRefund: "is_refund",
|
||||
Custom: "custom",
|
||||
CreateIp: "create_ip",
|
||||
PayIp: "pay_ip",
|
||||
NotifyUrl: "notify_url",
|
||||
ReturnUrl: "return_url",
|
||||
TraceIds: "trace_ids",
|
||||
Status: "status",
|
||||
CreatedAt: "created_at",
|
||||
UpdatedAt: "updated_at",
|
||||
}
|
||||
|
||||
// NewPayLogDao creates and returns a new DAO object for table data access.
|
||||
func NewPayLogDao() *PayLogDao {
|
||||
return &PayLogDao{
|
||||
group: "default",
|
||||
table: "hg_pay_log",
|
||||
columns: payLogColumns,
|
||||
}
|
||||
}
|
||||
|
||||
// DB retrieves and returns the underlying raw database management object of current DAO.
|
||||
func (dao *PayLogDao) DB() gdb.DB {
|
||||
return g.DB(dao.group)
|
||||
}
|
||||
|
||||
// Table returns the table name of current dao.
|
||||
func (dao *PayLogDao) Table() string {
|
||||
return dao.table
|
||||
}
|
||||
|
||||
// Columns returns all column names of current dao.
|
||||
func (dao *PayLogDao) Columns() PayLogColumns {
|
||||
return dao.columns
|
||||
}
|
||||
|
||||
// Group returns the configuration group name of database of current dao.
|
||||
func (dao *PayLogDao) Group() string {
|
||||
return dao.group
|
||||
}
|
||||
|
||||
// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
|
||||
func (dao *PayLogDao) Ctx(ctx context.Context) *gdb.Model {
|
||||
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
|
||||
}
|
||||
|
||||
// Transaction wraps the transaction logic using function f.
|
||||
// It rollbacks the transaction and returns the error from function f if it returns non-nil error.
|
||||
// It commits the transaction and returns nil if function f returns nil.
|
||||
//
|
||||
// Note that, you should not Commit or Rollback the transaction in function f
|
||||
// as it is automatically handled by this function.
|
||||
func (dao *PayLogDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
||||
return dao.Ctx(ctx).Transaction(ctx, f)
|
||||
}
|
97
server/internal/dao/internal/pay_refund.go
Normal file
97
server/internal/dao/internal/pay_refund.go
Normal file
@ -0,0 +1,97 @@
|
||||
// ==========================================================================
|
||||
// Code generated by GoFrame CLI tool. DO NOT EDIT.
|
||||
// ==========================================================================
|
||||
|
||||
package internal
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/gogf/gf/v2/database/gdb"
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
)
|
||||
|
||||
// PayRefundDao is the data access object for table hg_pay_refund.
|
||||
type PayRefundDao struct {
|
||||
table string // table is the underlying table name of the DAO.
|
||||
group string // group is the database configuration group name of current DAO.
|
||||
columns PayRefundColumns // columns contains all the column names of Table for convenient usage.
|
||||
}
|
||||
|
||||
// PayRefundColumns defines and stores column names for table hg_pay_refund.
|
||||
type PayRefundColumns struct {
|
||||
Id string // 主键ID
|
||||
MemberId string // 会员ID
|
||||
AppId string // 应用ID
|
||||
OrderSn string // 业务订单号
|
||||
RefundTradeNo string // 退款交易号
|
||||
RefundMoney string // 退款金额
|
||||
RefundWay string // 退款方式
|
||||
Ip string // 申请者IP
|
||||
Reason string // 申请退款原因
|
||||
Remark string // 退款备注
|
||||
Status string // 退款状态
|
||||
CreatedAt string // 申请时间
|
||||
UpdatedAt string // 更新时间
|
||||
}
|
||||
|
||||
// payRefundColumns holds the columns for table hg_pay_refund.
|
||||
var payRefundColumns = PayRefundColumns{
|
||||
Id: "id",
|
||||
MemberId: "member_id",
|
||||
AppId: "app_id",
|
||||
OrderSn: "order_sn",
|
||||
RefundTradeNo: "refund_trade_no",
|
||||
RefundMoney: "refund_money",
|
||||
RefundWay: "refund_way",
|
||||
Ip: "ip",
|
||||
Reason: "reason",
|
||||
Remark: "remark",
|
||||
Status: "status",
|
||||
CreatedAt: "created_at",
|
||||
UpdatedAt: "updated_at",
|
||||
}
|
||||
|
||||
// NewPayRefundDao creates and returns a new DAO object for table data access.
|
||||
func NewPayRefundDao() *PayRefundDao {
|
||||
return &PayRefundDao{
|
||||
group: "default",
|
||||
table: "hg_pay_refund",
|
||||
columns: payRefundColumns,
|
||||
}
|
||||
}
|
||||
|
||||
// DB retrieves and returns the underlying raw database management object of current DAO.
|
||||
func (dao *PayRefundDao) DB() gdb.DB {
|
||||
return g.DB(dao.group)
|
||||
}
|
||||
|
||||
// Table returns the table name of current dao.
|
||||
func (dao *PayRefundDao) Table() string {
|
||||
return dao.table
|
||||
}
|
||||
|
||||
// Columns returns all column names of current dao.
|
||||
func (dao *PayRefundDao) Columns() PayRefundColumns {
|
||||
return dao.columns
|
||||
}
|
||||
|
||||
// Group returns the configuration group name of database of current dao.
|
||||
func (dao *PayRefundDao) Group() string {
|
||||
return dao.group
|
||||
}
|
||||
|
||||
// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
|
||||
func (dao *PayRefundDao) Ctx(ctx context.Context) *gdb.Model {
|
||||
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
|
||||
}
|
||||
|
||||
// Transaction wraps the transaction logic using function f.
|
||||
// It rollbacks the transaction and returns the error from function f if it returns non-nil error.
|
||||
// It commits the transaction and returns nil if function f returns nil.
|
||||
//
|
||||
// Note that, you should not Commit or Rollback the transaction in function f
|
||||
// as it is automatically handled by this function.
|
||||
func (dao *PayRefundDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
||||
return dao.Ctx(ctx).Transaction(ctx, f)
|
||||
}
|
27
server/internal/dao/pay_log.go
Normal file
27
server/internal/dao/pay_log.go
Normal file
@ -0,0 +1,27 @@
|
||||
// =================================================================================
|
||||
// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish.
|
||||
// =================================================================================
|
||||
|
||||
package dao
|
||||
|
||||
import (
|
||||
"hotgo/internal/dao/internal"
|
||||
)
|
||||
|
||||
// internalPayLogDao is internal type for wrapping internal DAO implements.
|
||||
type internalPayLogDao = *internal.PayLogDao
|
||||
|
||||
// payLogDao is the data access object for table hg_pay_log.
|
||||
// You can define custom methods on it to extend its functionality as you wish.
|
||||
type payLogDao struct {
|
||||
internalPayLogDao
|
||||
}
|
||||
|
||||
var (
|
||||
// PayLog is globally public accessible object for table hg_pay_log operations.
|
||||
PayLog = payLogDao{
|
||||
internal.NewPayLogDao(),
|
||||
}
|
||||
)
|
||||
|
||||
// Fill with you ideas below.
|
27
server/internal/dao/pay_refund.go
Normal file
27
server/internal/dao/pay_refund.go
Normal file
@ -0,0 +1,27 @@
|
||||
// =================================================================================
|
||||
// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish.
|
||||
// =================================================================================
|
||||
|
||||
package dao
|
||||
|
||||
import (
|
||||
"hotgo/internal/dao/internal"
|
||||
)
|
||||
|
||||
// internalPayRefundDao is internal type for wrapping internal DAO implements.
|
||||
type internalPayRefundDao = *internal.PayRefundDao
|
||||
|
||||
// payRefundDao is the data access object for table hg_pay_refund.
|
||||
// You can define custom methods on it to extend its functionality as you wish.
|
||||
type payRefundDao struct {
|
||||
internalPayRefundDao
|
||||
}
|
||||
|
||||
var (
|
||||
// PayRefund is globally public accessible object for table hg_pay_refund operations.
|
||||
PayRefund = payRefundDao{
|
||||
internal.NewPayRefundDao(),
|
||||
}
|
||||
)
|
||||
|
||||
// Fill with you ideas below.
|
@ -32,7 +32,6 @@ func Init(ctx context.Context) {
|
||||
g.Log().Fatal(ctx, "配置读取异常:", err, "\r\n你确定 config/config.yaml 文件存在且格式正确吗?\r\n")
|
||||
return
|
||||
}
|
||||
//g.SetDebug(debug.Bool())
|
||||
|
||||
// 默认上海时区
|
||||
if err = gtime.SetTimeZone("Asia/Shanghai"); err != nil {
|
||||
@ -55,6 +54,12 @@ func Init(ctx context.Context) {
|
||||
// 加载ip访问黑名单
|
||||
service.SysBlacklist().Load(ctx)
|
||||
|
||||
// 初始化功能库配置
|
||||
service.SysConfig().InitConfig(ctx)
|
||||
|
||||
// 注册支付成功回调方法
|
||||
payNotifyCall()
|
||||
|
||||
// 初始化生成代码配置
|
||||
hggen.InIt(ctx)
|
||||
}
|
||||
|
13
server/internal/global/pay.go
Normal file
13
server/internal/global/pay.go
Normal file
@ -0,0 +1,13 @@
|
||||
package global
|
||||
|
||||
import (
|
||||
"hotgo/internal/consts"
|
||||
"hotgo/internal/library/payment"
|
||||
"hotgo/internal/service"
|
||||
)
|
||||
|
||||
// 注册支付成功回调方法
|
||||
func payNotifyCall() {
|
||||
payment.RegisterNotifyCall(consts.OrderGroupAdminOrder, service.AdminOrder().PayNotify) // 后台充值订单
|
||||
// ...
|
||||
}
|
@ -35,7 +35,7 @@ func ScanInstall(m Module) (record *InstallRecord, err error) {
|
||||
func IsInstall(m Module) bool {
|
||||
record, err := ScanInstall(m)
|
||||
if err != nil {
|
||||
g.Log().Debug(m.Ctx(), err.Error())
|
||||
g.Log().Debugf(m.Ctx(), "addons.IsInstall err:%+v", err)
|
||||
return false
|
||||
}
|
||||
if record == nil {
|
||||
|
2
server/internal/library/cache/cache.go
vendored
2
server/internal/library/cache/cache.go
vendored
@ -51,7 +51,7 @@ func SetAdapter(ctx context.Context) {
|
||||
|
||||
if !gfile.Exists(conf.FileDir) {
|
||||
if err := gfile.Mkdir(conf.FileDir); err != nil {
|
||||
g.Log().Fatalf(ctx, "Failed to create the cache directory. Procedure, err:%+v", err)
|
||||
g.Log().Fatalf(ctx, "failed to create the cache directory. procedure, err:%+v", err)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
20
server/internal/library/cache/file/file.go
vendored
20
server/internal/library/cache/file/file.go
vendored
@ -9,9 +9,11 @@ import (
|
||||
"fmt"
|
||||
"github.com/gogf/gf/v2/container/gvar"
|
||||
"github.com/gogf/gf/v2/errors/gerror"
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
"github.com/gogf/gf/v2/os/gcache"
|
||||
"github.com/gogf/gf/v2/os/gctx"
|
||||
"github.com/gogf/gf/v2/os/gfile"
|
||||
"github.com/gogf/gf/v2/util/gconv"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"time"
|
||||
@ -181,7 +183,12 @@ func (c *AdapterFile) createName(key string) string {
|
||||
}
|
||||
|
||||
func (c *AdapterFile) read(key string) (*fileContent, error) {
|
||||
value, err := ioutil.ReadFile(c.createName(key))
|
||||
rp := gfile.RealPath(c.createName(key))
|
||||
if rp == "" {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
value, err := os.ReadFile(rp)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -236,6 +243,10 @@ func (c *AdapterFile) Fetch(key string) (interface{}, error) {
|
||||
return "", err
|
||||
}
|
||||
|
||||
if content == nil {
|
||||
return "", nil
|
||||
}
|
||||
|
||||
return content.Data, nil
|
||||
}
|
||||
|
||||
@ -286,5 +297,8 @@ func (c *AdapterFile) Save(key string, value string, lifeTime time.Duration) err
|
||||
return err
|
||||
}
|
||||
|
||||
return ioutil.WriteFile(c.createName(key), data, perm)
|
||||
err = os.WriteFile(c.createName(key), data, perm)
|
||||
|
||||
g.Log().Warningf(gctx.New(), "Save err:%+v", err)
|
||||
return err
|
||||
}
|
||||
|
@ -3,7 +3,6 @@
|
||||
// @Copyright Copyright (c) 2023 HotGo CLI
|
||||
// @Author Ms <133814250@qq.com>
|
||||
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
|
||||
//
|
||||
package casbin
|
||||
|
||||
import (
|
||||
@ -31,7 +30,7 @@ CREATE TABLE IF NOT EXISTS %s (
|
||||
v4 varchar(256) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
|
||||
v5 varchar(256) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
|
||||
PRIMARY KEY (id) USING BTREE
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = 'casbin权限表' ROW_FORMAT = Dynamic;
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '管理员_casbin权限表' ROW_FORMAT = Dynamic;
|
||||
`
|
||||
)
|
||||
|
||||
|
@ -3,7 +3,6 @@
|
||||
// @Copyright Copyright (c) 2023 HotGo CLI
|
||||
// @Author Ms <133814250@qq.com>
|
||||
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
|
||||
//
|
||||
package casbin
|
||||
|
||||
import (
|
||||
|
@ -34,7 +34,7 @@ func Get(ctx context.Context) *model.Context {
|
||||
func SetUser(ctx context.Context, user *model.Identity) {
|
||||
c := Get(ctx)
|
||||
if c == nil {
|
||||
g.Log().Warning(ctx, "contexts.SetUser, c == nil ")
|
||||
g.Log().Warning(ctx, "contexts.SetUser, c == nil ")
|
||||
return
|
||||
}
|
||||
c.User = user
|
||||
@ -44,7 +44,7 @@ func SetUser(ctx context.Context, user *model.Identity) {
|
||||
func SetResponse(ctx context.Context, response *model.Response) {
|
||||
c := Get(ctx)
|
||||
if c == nil {
|
||||
g.Log().Warning(ctx, "contexts.SetResponse, c == nil ")
|
||||
g.Log().Warning(ctx, "contexts.SetResponse, c == nil ")
|
||||
return
|
||||
}
|
||||
c.Response = response
|
||||
@ -54,22 +54,12 @@ func SetResponse(ctx context.Context, response *model.Response) {
|
||||
func SetModule(ctx context.Context, module string) {
|
||||
c := Get(ctx)
|
||||
if c == nil {
|
||||
g.Log().Warning(ctx, "contexts.SetModule, c == nil ")
|
||||
g.Log().Warning(ctx, "contexts.SetModule, c == nil ")
|
||||
return
|
||||
}
|
||||
c.Module = module
|
||||
}
|
||||
|
||||
// SetTakeUpTime 设置请求耗时
|
||||
func SetTakeUpTime(ctx context.Context, takeUpTime int64) {
|
||||
c := Get(ctx)
|
||||
if c == nil {
|
||||
g.Log().Warning(ctx, "contexts.SetTakeUpTime, c == nil ")
|
||||
return
|
||||
}
|
||||
c.TakeUpTime = takeUpTime
|
||||
}
|
||||
|
||||
// GetUser 获取用户信息
|
||||
func GetUser(ctx context.Context) *model.Identity {
|
||||
c := Get(ctx)
|
||||
@ -120,7 +110,7 @@ func GetModule(ctx context.Context) string {
|
||||
func SetAddonName(ctx context.Context, name string) {
|
||||
c := Get(ctx)
|
||||
if c == nil {
|
||||
g.Log().Warning(ctx, "contexts.SetAddonName, c == nil ")
|
||||
g.Log().Warning(ctx, "contexts.SetAddonName, c == nil ")
|
||||
return
|
||||
}
|
||||
Get(ctx).AddonName = name
|
||||
@ -143,3 +133,35 @@ func GetAddonName(ctx context.Context) string {
|
||||
}
|
||||
return Get(ctx).AddonName
|
||||
}
|
||||
|
||||
// SetData 设置额外数据
|
||||
func SetData(ctx context.Context, k string, v interface{}) {
|
||||
c := Get(ctx)
|
||||
if c == nil {
|
||||
g.Log().Warning(ctx, "contexts.SetData, c == nil ")
|
||||
return
|
||||
}
|
||||
Get(ctx).Data[k] = v
|
||||
}
|
||||
|
||||
// SetDataMap 设置额外数据
|
||||
func SetDataMap(ctx context.Context, vs g.Map) {
|
||||
c := Get(ctx)
|
||||
if c == nil {
|
||||
g.Log().Warning(ctx, "contexts.SetData, c == nil ")
|
||||
return
|
||||
}
|
||||
|
||||
for k, v := range vs {
|
||||
Get(ctx).Data[k] = v
|
||||
}
|
||||
}
|
||||
|
||||
// GetData 获取额外数据
|
||||
func GetData(ctx context.Context) g.Map {
|
||||
c := Get(ctx)
|
||||
if c == nil {
|
||||
return nil
|
||||
}
|
||||
return c.Data
|
||||
}
|
||||
|
30
server/internal/library/contexts/detached.go
Normal file
30
server/internal/library/contexts/detached.go
Normal file
@ -0,0 +1,30 @@
|
||||
package contexts
|
||||
|
||||
import (
|
||||
"context"
|
||||
"time"
|
||||
)
|
||||
|
||||
type detached struct {
|
||||
ctx context.Context
|
||||
}
|
||||
|
||||
func (detached) Deadline() (time.Time, bool) {
|
||||
return time.Time{}, false
|
||||
}
|
||||
|
||||
func (detached) Done() <-chan struct{} {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (detached) Err() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (d detached) Value(key interface{}) interface{} {
|
||||
return d.ctx.Value(key)
|
||||
}
|
||||
|
||||
func Detach(ctx context.Context) context.Context {
|
||||
return detached{ctx: ctx}
|
||||
}
|
@ -292,7 +292,7 @@ buildDone:
|
||||
return
|
||||
}
|
||||
|
||||
// getBuildInVarMapJson retrieves and returns the custom build-in variables in configuration
|
||||
// getBuildInVarStr retrieves and returns the custom build-in variables in configuration
|
||||
// file as json.
|
||||
func (c cBuild) getBuildInVarStr(ctx context.Context, in cBuildInput) string {
|
||||
buildInVarMap := in.VarMap
|
||||
|
@ -12,6 +12,7 @@ var (
|
||||
type cGen struct {
|
||||
g.Meta `name:"gen" brief:"{cGenBrief}" dc:"{cGenDc}"`
|
||||
cGenDao
|
||||
cGenEnums
|
||||
cGenPb
|
||||
cGenPbEntity
|
||||
cGenService
|
||||
|
15
server/internal/library/hggen/internal/cmd/cmd_gen_enums.go
Normal file
15
server/internal/library/hggen/internal/cmd/cmd_gen_enums.go
Normal file
@ -0,0 +1,15 @@
|
||||
// Copyright GoFrame gf Author(https://goframe.org). All Rights Reserved.
|
||||
//
|
||||
// This Source Code Form is subject to the terms of the MIT License.
|
||||
// If a copy of the MIT was not distributed with this file,
|
||||
// You can obtain one at https://github.com/gogf/gf.
|
||||
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"hotgo/internal/library/hggen/internal/cmd/genenums"
|
||||
)
|
||||
|
||||
type (
|
||||
cGenEnums = genenums.CGenEnums
|
||||
)
|
@ -3,6 +3,8 @@ package cmd
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"github.com/gogf/gf/v2/text/gstr"
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
@ -37,6 +39,10 @@ gf init my-mono-repo -m
|
||||
name for the project. It will create a folder with NAME in current directory.
|
||||
The NAME will also be the module name for the project.
|
||||
`
|
||||
// cInitGitDir the git directory
|
||||
cInitGitDir = ".git"
|
||||
// cInitGitignore the gitignore file
|
||||
cInitGitignore = ".gitignore"
|
||||
)
|
||||
|
||||
func init() {
|
||||
@ -57,17 +63,22 @@ type cInitInput struct {
|
||||
type cInitOutput struct{}
|
||||
|
||||
func (c cInit) Index(ctx context.Context, in cInitInput) (out *cInitOutput, err error) {
|
||||
var (
|
||||
overwrote = false
|
||||
)
|
||||
if !gfile.IsEmpty(in.Name) && !allyes.Check() {
|
||||
s := gcmd.Scanf(`the folder "%s" is not empty, files might be overwrote, continue? [y/n]: `, in.Name)
|
||||
if strings.EqualFold(s, "n") {
|
||||
return
|
||||
}
|
||||
overwrote = true
|
||||
}
|
||||
mlog.Print("initializing...")
|
||||
|
||||
// Create project folder and files.
|
||||
var (
|
||||
templateRepoName string
|
||||
gitignoreFile = in.Name + "/" + cInitGitignore
|
||||
)
|
||||
if in.Mono {
|
||||
templateRepoName = cInitMonoRepo
|
||||
@ -81,14 +92,35 @@ func (c cInit) Index(ctx context.Context, in cInitInput) (out *cInitOutput, err
|
||||
return
|
||||
}
|
||||
|
||||
// build ignoreFiles from the .gitignore file
|
||||
ignoreFiles := make([]string, 0, 10)
|
||||
ignoreFiles = append(ignoreFiles, cInitGitDir)
|
||||
if overwrote {
|
||||
err = gfile.ReadLines(gitignoreFile, func(line string) error {
|
||||
// Add only hidden files or directories
|
||||
// If other directories are added, it may cause the entire directory to be ignored
|
||||
// such as 'main' in the .gitignore file, but the path is 'D:\main\my-project'
|
||||
if line != "" && strings.HasPrefix(line, ".") {
|
||||
ignoreFiles = append(ignoreFiles, line)
|
||||
}
|
||||
return nil
|
||||
})
|
||||
|
||||
// if not found the .gitignore file will skip os.ErrNotExist error
|
||||
if err != nil && !os.IsNotExist(err) {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
// Replace template name to project name.
|
||||
err = gfile.ReplaceDir(
|
||||
cInitRepoPrefix+templateRepoName,
|
||||
gfile.Basename(gfile.RealPath(in.Name)),
|
||||
in.Name,
|
||||
"*",
|
||||
true,
|
||||
)
|
||||
err = gfile.ReplaceDirFunc(func(path, content string) string {
|
||||
for _, ignoreFile := range ignoreFiles {
|
||||
if strings.Contains(path, ignoreFile) {
|
||||
return content
|
||||
}
|
||||
}
|
||||
return gstr.Replace(gfile.GetContents(path), cInitRepoPrefix+templateRepoName, gfile.Basename(gfile.RealPath(in.Name)))
|
||||
}, in.Name, "*", true)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ like json/xml/yaml/toml/ini.
|
||||
cTplParseEg = `
|
||||
gf tpl parse -p ./template -v values.json -r
|
||||
gf tpl parse -p ./template -v values.json -n *.tpl -r
|
||||
gf tpl parse -p ./template -v values.json -d '${,}}' -r
|
||||
gf tpl parse -p ./template -v values.json -d '${{,}}' -r
|
||||
gf tpl parse -p ./template -v values.json -o ./template.parsed
|
||||
`
|
||||
cTplSupportValuesFilePattern = `*.json,*.xml,*.yaml,*.yml,*.toml,*.ini`
|
||||
@ -63,7 +63,7 @@ func init() {
|
||||
}
|
||||
|
||||
func (c *cTpl) Parse(ctx context.Context, in cTplParseInput) (out *cTplParseOutput, err error) {
|
||||
if in.Output == "" && in.Replace == false {
|
||||
if in.Output == "" && !in.Replace {
|
||||
return nil, gerror.New(`parameter output and replace should not be both empty`)
|
||||
}
|
||||
delimiters := gstr.SplitAndTrim(in.Delimiters, ",")
|
||||
|
@ -50,7 +50,7 @@ func generateStructDefinition(ctx context.Context, in generateStructDefinitionIn
|
||||
return buffer.String()
|
||||
}
|
||||
|
||||
// generateStructFieldForModel generates and returns the attribute definition for specified field.
|
||||
// generateStructFieldDefinition generates and returns the attribute definition for specified field.
|
||||
func generateStructFieldDefinition(
|
||||
ctx context.Context, field *gdb.TableField, in generateStructDefinitionInput,
|
||||
) []string {
|
||||
|
@ -0,0 +1,83 @@
|
||||
// Copyright GoFrame gf Author(https://goframe.org). All Rights Reserved.
|
||||
//
|
||||
// This Source Code Form is subject to the terms of the MIT License.
|
||||
// If a copy of the MIT was not distributed with this file,
|
||||
// You can obtain one at https://github.com/gogf/gf.
|
||||
|
||||
package genenums
|
||||
|
||||
import (
|
||||
"context"
|
||||
"golang.org/x/tools/go/packages"
|
||||
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
"github.com/gogf/gf/v2/os/gfile"
|
||||
"github.com/gogf/gf/v2/text/gstr"
|
||||
"github.com/gogf/gf/v2/util/gtag"
|
||||
"hotgo/internal/library/hggen/internal/consts"
|
||||
"hotgo/internal/library/hggen/internal/utility/mlog"
|
||||
)
|
||||
|
||||
type (
|
||||
CGenEnums struct{}
|
||||
CGenEnumsInput struct {
|
||||
g.Meta `name:"enums" config:"{CGenEnumsConfig}" brief:"{CGenEnumsBrief}" eg:"{CGenEnumsEg}"`
|
||||
Src string `name:"src" short:"s" dc:"source folder path to be parsed" d:"."`
|
||||
Path string `name:"path" short:"p" dc:"output go file path storing enums content" d:"internal/boot/boot_enums.go"`
|
||||
Prefix string `name:"prefix" short:"x" dc:"only exports packages that starts with specified prefix"`
|
||||
}
|
||||
CGenEnumsOutput struct{}
|
||||
)
|
||||
|
||||
const (
|
||||
CGenEnumsConfig = `gfcli.gen.enums`
|
||||
CGenEnumsBrief = `parse go files in current project and generate enums go file`
|
||||
CGenEnumsEg = `
|
||||
gf gen enums
|
||||
gf gen enums -p internal/boot/boot_enums.go
|
||||
gf gen enums -p internal/boot/boot_enums.go -s .
|
||||
gf gen enums -x github.com/gogf
|
||||
`
|
||||
)
|
||||
|
||||
func init() {
|
||||
gtag.Sets(g.MapStrStr{
|
||||
`CGenEnumsEg`: CGenEnumsEg,
|
||||
`CGenEnumsBrief`: CGenEnumsBrief,
|
||||
`CGenEnumsConfig`: CGenEnumsConfig,
|
||||
})
|
||||
}
|
||||
|
||||
func (c CGenEnums) Enums(ctx context.Context, in CGenEnumsInput) (out *CGenEnumsOutput, err error) {
|
||||
realPath := gfile.RealPath(in.Src)
|
||||
if realPath == "" {
|
||||
mlog.Fatalf(`source folder path "%s" does not exist`, in.Src)
|
||||
}
|
||||
err = gfile.Chdir(realPath)
|
||||
if err != nil {
|
||||
mlog.Fatal(err)
|
||||
}
|
||||
mlog.Printf(`scanning: %s`, realPath)
|
||||
cfg := &packages.Config{
|
||||
Dir: realPath,
|
||||
Mode: pkgLoadMode,
|
||||
Tests: false,
|
||||
}
|
||||
pkgs, err := packages.Load(cfg)
|
||||
if err != nil {
|
||||
mlog.Fatal(err)
|
||||
}
|
||||
p := NewEnumsParser(in.Prefix)
|
||||
p.ParsePackages(pkgs)
|
||||
var enumsContent = gstr.ReplaceByMap(consts.TemplateGenEnums, g.MapStrStr{
|
||||
"{PackageName}": gfile.Basename(gfile.Dir(in.Path)),
|
||||
"{EnumsJson}": "`" + p.Export() + "`",
|
||||
})
|
||||
enumsContent = gstr.Trim(enumsContent)
|
||||
if err = gfile.PutContents(in.Path, enumsContent); err != nil {
|
||||
return
|
||||
}
|
||||
mlog.Printf(`generated: %s`, in.Path)
|
||||
mlog.Print("done!")
|
||||
return
|
||||
}
|
@ -0,0 +1,140 @@
|
||||
// Copyright GoFrame gf Author(https://goframe.org). All Rights Reserved.
|
||||
//
|
||||
// This Source Code Form is subject to the terms of the MIT License.
|
||||
// If a copy of the MIT was not distributed with this file,
|
||||
// You can obtain one at https://github.com/gogf/gf.
|
||||
|
||||
package genenums
|
||||
|
||||
import (
|
||||
"go/constant"
|
||||
"go/types"
|
||||
"golang.org/x/tools/go/packages"
|
||||
|
||||
"github.com/gogf/gf/v2/encoding/gjson"
|
||||
"github.com/gogf/gf/v2/text/gstr"
|
||||
"github.com/gogf/gf/v2/util/gconv"
|
||||
)
|
||||
|
||||
const pkgLoadMode = 0xffffff
|
||||
|
||||
type EnumsParser struct {
|
||||
enums []EnumItem
|
||||
parsedPkg map[string]struct{}
|
||||
prefix string
|
||||
}
|
||||
|
||||
type EnumItem struct {
|
||||
Name string
|
||||
Value string
|
||||
Kind constant.Kind // String/Int/Bool/Float/Complex/Unknown
|
||||
Type string // Pkg.ID + TypeName
|
||||
}
|
||||
|
||||
var standardPackages = make(map[string]struct{})
|
||||
|
||||
func init() {
|
||||
stdPackages, err := packages.Load(nil, "std")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
for _, p := range stdPackages {
|
||||
standardPackages[p.ID] = struct{}{}
|
||||
}
|
||||
}
|
||||
|
||||
func NewEnumsParser(prefix string) *EnumsParser {
|
||||
return &EnumsParser{
|
||||
enums: make([]EnumItem, 0),
|
||||
parsedPkg: make(map[string]struct{}),
|
||||
prefix: prefix,
|
||||
}
|
||||
}
|
||||
|
||||
func (p *EnumsParser) ParsePackages(pkgs []*packages.Package) {
|
||||
for _, pkg := range pkgs {
|
||||
p.ParsePackage(pkg)
|
||||
}
|
||||
}
|
||||
|
||||
func (p *EnumsParser) ParsePackage(pkg *packages.Package) {
|
||||
// Ignore std packages.
|
||||
if _, ok := standardPackages[pkg.ID]; ok {
|
||||
return
|
||||
}
|
||||
// Ignore pared packages.
|
||||
if _, ok := p.parsedPkg[pkg.ID]; ok {
|
||||
return
|
||||
}
|
||||
p.parsedPkg[pkg.ID] = struct{}{}
|
||||
// Only parse specified prefix.
|
||||
if p.prefix != "" {
|
||||
if !gstr.HasPrefix(pkg.ID, p.prefix) {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
var (
|
||||
scope = pkg.Types.Scope()
|
||||
names = scope.Names()
|
||||
)
|
||||
for _, name := range names {
|
||||
con, ok := scope.Lookup(name).(*types.Const)
|
||||
if !ok {
|
||||
// Only constants can be enums.
|
||||
continue
|
||||
}
|
||||
if !con.Exported() {
|
||||
// Ignore unexported values.
|
||||
continue
|
||||
}
|
||||
|
||||
var enumType = con.Type().String()
|
||||
if !gstr.Contains(enumType, "/") {
|
||||
// Ignore std types.
|
||||
continue
|
||||
}
|
||||
var (
|
||||
enumName = con.Name()
|
||||
enumValue = con.Val().ExactString()
|
||||
enumKind = con.Val().Kind()
|
||||
)
|
||||
if con.Val().Kind() == constant.String {
|
||||
enumValue = constant.StringVal(con.Val())
|
||||
}
|
||||
p.enums = append(p.enums, EnumItem{
|
||||
Name: enumName,
|
||||
Value: enumValue,
|
||||
Type: enumType,
|
||||
Kind: enumKind,
|
||||
})
|
||||
|
||||
}
|
||||
for _, im := range pkg.Imports {
|
||||
p.ParsePackage(im)
|
||||
}
|
||||
}
|
||||
|
||||
func (p *EnumsParser) Export() string {
|
||||
var typeEnumMap = make(map[string][]interface{})
|
||||
for _, enum := range p.enums {
|
||||
if typeEnumMap[enum.Type] == nil {
|
||||
typeEnumMap[enum.Type] = make([]interface{}, 0)
|
||||
}
|
||||
var value interface{}
|
||||
switch enum.Kind {
|
||||
case constant.Int:
|
||||
value = gconv.Int64(enum.Value)
|
||||
case constant.String:
|
||||
value = enum.Value
|
||||
case constant.Float:
|
||||
value = gconv.Float64(enum.Value)
|
||||
case constant.Bool:
|
||||
value = gconv.Bool(enum.Value)
|
||||
default:
|
||||
value = enum.Value
|
||||
}
|
||||
typeEnumMap[enum.Type] = append(typeEnumMap[enum.Type], value)
|
||||
}
|
||||
return gjson.MustEncodeString(typeEnumMap)
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
// Copyright GoFrame gf Author(https://goframe.org). All Rights Reserved.
|
||||
//
|
||||
// This Source Code Form is subject to the terms of the MIT License.
|
||||
// If a copy of the MIT was not distributed with this file,
|
||||
// You can obtain one at https://github.com/gogf/gf.
|
||||
|
||||
package consts
|
||||
|
||||
const TemplateGenEnums = `
|
||||
// ================================================================================
|
||||
// Code generated by GoFrame CLI tool. DO NOT EDIT.
|
||||
// ================================================================================
|
||||
|
||||
package {PackageName}
|
||||
|
||||
import (
|
||||
"github.com/gogf/gf/v2/util/gtag"
|
||||
)
|
||||
|
||||
func init() {
|
||||
gtag.SetGlobalEnums({EnumsJson})
|
||||
}
|
||||
`
|
@ -3,7 +3,6 @@
|
||||
// @Copyright Copyright (c) 2023 HotGo CLI
|
||||
// @Author Ms <133814250@qq.com>
|
||||
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
|
||||
//
|
||||
package views
|
||||
|
||||
import (
|
||||
@ -21,7 +20,7 @@ const (
|
||||
LogicWhereNoSupport = "\t// TODO 暂不支持生成[ %s ]查询方式,请自行补充此处代码!"
|
||||
LogicListSimpleSelect = "\tfields, err := hgorm.GenSelect(ctx, sysin.%sListModel{}, dao.%s)\n\tif err != nil {\n\t\treturn\n\t}"
|
||||
LogicListJoinSelect = "\t//关联表select\n\tfields, err := hgorm.GenJoinSelect(ctx, %sin.%sListModel{}, dao.%s, []*hgorm.Join{\n%v\t})"
|
||||
LogicListJoinOnRelation = "\t// 关联表%s\n\tmod = mod.%s(hgorm.GenJoinOnRelation(\n\t\tdao.%s.Table(), dao.%s.Columns().%s, // 主表表名,关联条件\n\t\tdao.%s.Table(), \"%s\", dao.%s.Columns().%s, // 关联表表名,别名,关联条件\n\t)...)\n\n"
|
||||
LogicListJoinOnRelation = "\t// 关联表%s\n\tmod = mod.%s(hgorm.GenJoinOnRelation(\n\t\tdao.%s.Table(), dao.%s.Columns().%s, // 主表表名,关联字段\n\t\tdao.%s.Table(), \"%s\", dao.%s.Columns().%s, // 关联表表名,别名,关联字段\n\t)...)\n\n"
|
||||
LogicEditUpdate = "\t\t_, err = s.Model(ctx).\n\t\t\tFieldsEx(\n%s\t\t\t).\n\t\t\tWhere(dao.%s.Columns().%s, in.%s).Data(in).Update()\n\t\treturn "
|
||||
LogicEditInsert = "\t_, err = s.Model(ctx, &handler.Option{FilterAuth: false}).\n\t\tFieldsEx(\n%s\t\t).\n\t\tData(in).Insert()"
|
||||
LogicSwitchUpdate = "g.Map{\n\t\tin.Key: in.Value,\n%s}"
|
||||
@ -136,10 +135,11 @@ func (l *gCurd) generateLogicListJoin(ctx context.Context, in *CurdPreviewInput)
|
||||
selectBuffer.WriteString(fmt.Sprintf(LogicListJoinSelect, in.options.TemplateGroup, in.In.VarName, in.In.DaoName, joinSelectRows))
|
||||
|
||||
data["select"] = selectBuffer.String()
|
||||
data["fields"] = "fields"
|
||||
data["link"] = linkBuffer.String()
|
||||
|
||||
} else {
|
||||
data["select"] = fmt.Sprintf(LogicListSimpleSelect, in.In.VarName, in.In.DaoName)
|
||||
data["fields"] = fmt.Sprintf("%sin.%sListModel{}", in.options.TemplateGroup, in.In.VarName)
|
||||
}
|
||||
|
||||
return data
|
||||
|
@ -9,6 +9,7 @@ import (
|
||||
"bytes"
|
||||
"context"
|
||||
"fmt"
|
||||
"github.com/gogf/gf/v2/errors/gerror"
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
"hotgo/internal/model/input/sysin"
|
||||
"hotgo/utility/convert"
|
||||
@ -24,7 +25,9 @@ func (l *gCurd) webModelTplData(ctx context.Context, in *CurdPreviewInput) (data
|
||||
data["defaultState"] = l.generateWebModelDefaultState(ctx, in)
|
||||
data["rules"] = l.generateWebModelRules(ctx, in)
|
||||
data["formSchema"] = l.generateWebModelFormSchema(ctx, in)
|
||||
data["columns"] = l.generateWebModelColumns(ctx, in)
|
||||
if data["columns"], err = l.generateWebModelColumns(ctx, in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
@ -214,12 +217,14 @@ func (l *gCurd) generateWebModelFormSchemaEach(buffer *bytes.Buffer, fields []*s
|
||||
}
|
||||
}
|
||||
|
||||
func (l *gCurd) generateWebModelColumns(ctx context.Context, in *CurdPreviewInput) string {
|
||||
func (l *gCurd) generateWebModelColumns(ctx context.Context, in *CurdPreviewInput) (string, error) {
|
||||
buffer := bytes.NewBuffer(nil)
|
||||
buffer.WriteString("export const columns = [\n")
|
||||
|
||||
// 主表
|
||||
l.generateWebModelColumnsEach(buffer, in, in.masterFields)
|
||||
if err := l.generateWebModelColumnsEach(buffer, in, in.masterFields); err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
// 关联表
|
||||
if len(in.options.Join) > 0 {
|
||||
@ -227,15 +232,17 @@ func (l *gCurd) generateWebModelColumns(ctx context.Context, in *CurdPreviewInpu
|
||||
if !isEffectiveJoin(v) {
|
||||
continue
|
||||
}
|
||||
l.generateWebModelColumnsEach(buffer, in, v.Columns)
|
||||
if err := l.generateWebModelColumnsEach(buffer, in, v.Columns); err != nil {
|
||||
return "", err
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
buffer.WriteString("];\n")
|
||||
return buffer.String()
|
||||
return buffer.String(), nil
|
||||
}
|
||||
|
||||
func (l *gCurd) generateWebModelColumnsEach(buffer *bytes.Buffer, in *CurdPreviewInput, fields []*sysin.GenCodesColumnListModel) {
|
||||
func (l *gCurd) generateWebModelColumnsEach(buffer *bytes.Buffer, in *CurdPreviewInput, fields []*sysin.GenCodesColumnListModel) (err error) {
|
||||
for _, field := range fields {
|
||||
if !field.IsList {
|
||||
continue
|
||||
@ -251,9 +258,17 @@ func (l *gCurd) generateWebModelColumnsEach(buffer *bytes.Buffer, in *CurdPrevie
|
||||
component = fmt.Sprintf(" {\n title: '%s',\n key: '%s',\n render(row) {\n return formatToDate(row.%s);\n },\n },\n", field.Dc, field.TsName, field.TsName)
|
||||
|
||||
case FormModeSelect:
|
||||
if g.IsEmpty(in.options.dictMap[field.TsName]) {
|
||||
err = gerror.Newf("设置单选下拉框选项时,必须选择字典类型,字段名称:%v", field.Name)
|
||||
return
|
||||
}
|
||||
component = fmt.Sprintf(" {\n title: '%s',\n key: '%s',\n render(row) {\n if (isNullObject(row.%s)) {\n return ``;\n }\n return h(\n NTag,\n {\n style: {\n marginRight: '6px',\n },\n type: getOptionTag(options.value.%s, row.%s),\n bordered: false,\n },\n {\n default: () => getOptionLabel(options.value.%s, row.%s),\n }\n );\n },\n },\n", field.Dc, field.TsName, field.TsName, in.options.dictMap[field.TsName], field.TsName, in.options.dictMap[field.TsName], field.TsName)
|
||||
|
||||
case FormModeSelectMultiple:
|
||||
if g.IsEmpty(in.options.dictMap[field.TsName]) {
|
||||
err = gerror.Newf("设置多选下拉框选项时,必须选择字典类型,字段名称:%v", field.Name)
|
||||
return
|
||||
}
|
||||
component = fmt.Sprintf(" {\n title: '%s',\n key: '%s',\n render(row) {\n if (isNullObject(row.%s) || !isArray(row.%s)) {\n return ``;\n }\n return row.%s.map((tagKey) => {\n return h(\n NTag,\n {\n style: {\n marginRight: '6px',\n },\n type: getOptionTag(options.value.%s, tagKey),\n bordered: false,\n },\n {\n default: () => getOptionLabel(options.value.%s, tagKey),\n }\n );\n });\n },\n },\n", field.Dc, field.TsName, field.TsName, field.TsName, field.TsName, in.options.dictMap[field.TsName], in.options.dictMap[field.TsName])
|
||||
|
||||
case FormModeUploadImage:
|
||||
@ -280,4 +295,6 @@ func (l *gCurd) generateWebModelColumnsEach(buffer *bytes.Buffer, in *CurdPrevie
|
||||
|
||||
buffer.WriteString(component)
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
@ -3,7 +3,6 @@
|
||||
// @Copyright Copyright (c) 2023 HotGo CLI
|
||||
// @Author Ms <133814250@qq.com>
|
||||
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
|
||||
//
|
||||
package views
|
||||
|
||||
import (
|
||||
@ -45,7 +44,10 @@ func (l *gCurd) generateWebViewItem(ctx context.Context, in *CurdPreviewInput) s
|
||||
case FormModeTime:
|
||||
component = defaultComponent
|
||||
|
||||
case FormModeRadio, FormModeCheckbox, FormModeSelect, FormModeSelectMultiple:
|
||||
case FormModeRadio, FormModeSelect:
|
||||
component = fmt.Sprintf("<n-descriptions-item label=\"%s\">\n <n-tag\n :type=\"getOptionTag(options.%s, formValue?.%s)\"\n size=\"small\"\n class=\"min-left-space\"\n >{{ getOptionLabel(options.%s, formValue?.%s) }}</n-tag\n >\n </n-descriptions-item>", field.Dc, in.options.dictMap[field.TsName], field.TsName, in.options.dictMap[field.TsName], field.TsName)
|
||||
|
||||
case FormModeCheckbox, FormModeSelectMultiple:
|
||||
component = fmt.Sprintf("<n-descriptions-item label=\"%s\">\n <template v-for=\"(item, key) in formValue?.%s\" :key=\"key\">\n <n-tag\n :type=\"getOptionTag(options.%s, item)\"\n size=\"small\"\n class=\"min-left-space\"\n >{{ getOptionLabel(options.%s, item) }}</n-tag\n >\n </template>\n </n-descriptions-item>", field.Dc, field.TsName, in.options.dictMap[field.TsName], in.options.dictMap[field.TsName])
|
||||
|
||||
case FormModeUploadImage:
|
||||
|
@ -107,3 +107,7 @@ func GetAuthorization(r *ghttp.Request) string {
|
||||
|
||||
return gstr.Replace(authorization, "Bearer ", "")
|
||||
}
|
||||
|
||||
func GenAuthKey(token string) string {
|
||||
return gmd5.MustEncryptString(token)
|
||||
}
|
||||
|
@ -16,7 +16,7 @@ import (
|
||||
"github.com/gogf/gf/v2/util/gconv"
|
||||
"github.com/kayon/iploc"
|
||||
"hotgo/utility/validate"
|
||||
"io/ioutil"
|
||||
"io"
|
||||
"net"
|
||||
"net/http"
|
||||
"strings"
|
||||
@ -169,7 +169,7 @@ func GetPublicIP(ctx context.Context) (ip string, err error) {
|
||||
var data *WhoisRegionData
|
||||
err = g.Client().Timeout(10*time.Second).GetVar(ctx, whoisApi).Scan(&data)
|
||||
if err != nil {
|
||||
g.Log().Infof(ctx, "GetPublicIP alternatives are being tried err:%+v", err)
|
||||
g.Log().Info(ctx, "GetPublicIP fail, alternatives are being tried.")
|
||||
return GetPublicIP2()
|
||||
}
|
||||
|
||||
@ -187,7 +187,7 @@ func GetPublicIP2() (ip string, err error) {
|
||||
}
|
||||
defer response.Body.Close()
|
||||
|
||||
body, err := ioutil.ReadAll(response.Body)
|
||||
body, err := io.ReadAll(response.Body)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
@ -219,6 +219,9 @@ func GetLocalIP() (ip string, err error) {
|
||||
|
||||
// GetClientIp 获取客户端IP
|
||||
func GetClientIp(r *ghttp.Request) string {
|
||||
if r == nil {
|
||||
return ""
|
||||
}
|
||||
ip := r.Header.Get("X-Forwarded-For")
|
||||
if ip == "" {
|
||||
ip = r.GetClientIp()
|
||||
|
@ -3,7 +3,6 @@ package tcp
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"github.com/gogf/gf/v2/encoding/gjson"
|
||||
"github.com/gogf/gf/v2/errors/gerror"
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
"github.com/gogf/gf/v2/net/gtcp"
|
||||
@ -36,6 +35,7 @@ type Client struct {
|
||||
IsLogin bool // 是否已登录
|
||||
addr string
|
||||
auth *AuthMeta
|
||||
rpc *Rpc
|
||||
timeout time.Duration
|
||||
connectInterval time.Duration
|
||||
maxConnectCount uint
|
||||
@ -103,6 +103,7 @@ func NewClient(config *ClientConfig) (client *Client, err error) {
|
||||
client.timeout = config.Timeout
|
||||
}
|
||||
|
||||
client.rpc = NewRpc(client.Ctx)
|
||||
return
|
||||
}
|
||||
|
||||
@ -248,7 +249,31 @@ func (client *Client) read() {
|
||||
client.Logger.Debugf(client.Ctx, "client RecvPkg invalid message: %+v", msg)
|
||||
continue
|
||||
}
|
||||
f(msg.Data, client.conn)
|
||||
|
||||
switch msg.Router {
|
||||
case "ResponseServerLogin", "ResponseServerHeartbeat": // 服务登录、心跳无需验证签名
|
||||
ctx, cancel := initCtx(gctx.New(), &Context{})
|
||||
doHandleRouterMsg(f, ctx, cancel, msg.Data)
|
||||
default: // 通用路由消息处理
|
||||
in, err := VerifySign(msg.Data, client.auth.AppId, client.auth.SecretKey)
|
||||
if err != nil {
|
||||
client.Logger.Warningf(client.Ctx, "client read VerifySign err:%+v message: %+v", err, msg)
|
||||
continue
|
||||
}
|
||||
|
||||
ctx, cancel := initCtx(gctx.New(), &Context{
|
||||
Conn: client.conn,
|
||||
Auth: client.auth,
|
||||
TraceID: in.TraceID,
|
||||
})
|
||||
|
||||
// 响应rpc消息
|
||||
if client.rpc.HandleMsg(ctx, cancel, msg.Data) {
|
||||
return
|
||||
}
|
||||
|
||||
doHandleRouterMsg(f, ctx, cancel, msg.Data)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
@ -307,16 +332,45 @@ func (client *Client) Write(data interface{}) error {
|
||||
return gerror.New("client Write message is nil")
|
||||
}
|
||||
|
||||
// 签名
|
||||
SetSign(data, gctx.CtxId(client.Ctx), client.auth.AppId, client.auth.SecretKey)
|
||||
|
||||
msgType := reflect.TypeOf(data)
|
||||
if msgType == nil || msgType.Kind() != reflect.Ptr {
|
||||
return gerror.Newf("client json message pointer required: %+v", data)
|
||||
}
|
||||
msg := &Message{Router: msgType.Elem().Name(), Data: data}
|
||||
|
||||
client.Logger.Debugf(client.Ctx, "client Write Router:%v, data:%+v", msg.Router, gjson.New(data).String())
|
||||
|
||||
return SendPkg(client.conn, msg)
|
||||
}
|
||||
|
||||
// Send 发送消息
|
||||
func (client *Client) Send(ctx context.Context, data interface{}) error {
|
||||
MsgPkg(data, client.auth, gctx.CtxId(ctx))
|
||||
return client.Write(data)
|
||||
}
|
||||
|
||||
// Reply 回复消息
|
||||
func (client *Client) Reply(ctx context.Context, data interface{}) (err error) {
|
||||
user := GetCtx(ctx)
|
||||
if user == nil {
|
||||
err = gerror.New("获取回复用户信息失败")
|
||||
return
|
||||
}
|
||||
MsgPkg(data, client.auth, user.TraceID)
|
||||
return client.Write(data)
|
||||
}
|
||||
|
||||
// RpcRequest 发送消息并等待响应结果
|
||||
func (client *Client) RpcRequest(ctx context.Context, data interface{}) (res interface{}, err error) {
|
||||
var (
|
||||
traceID = MsgPkg(data, client.auth, gctx.CtxId(ctx))
|
||||
key = client.rpc.GetCallId(client.conn, traceID)
|
||||
)
|
||||
|
||||
if traceID == "" {
|
||||
err = gerror.New("traceID is required")
|
||||
return
|
||||
}
|
||||
|
||||
return client.rpc.Request(key, func() {
|
||||
client.Write(data)
|
||||
})
|
||||
}
|
||||
|
@ -5,6 +5,7 @@ import (
|
||||
"fmt"
|
||||
"github.com/gogf/gf/v2/os/gcron"
|
||||
"github.com/gogf/gf/v2/os/gtime"
|
||||
"hotgo/internal/consts"
|
||||
)
|
||||
|
||||
func (client *Client) getCronKey(s string) string {
|
||||
@ -19,19 +20,19 @@ func (client *Client) stopCron() {
|
||||
|
||||
func (client *Client) startCron() {
|
||||
// 心跳超时检查
|
||||
if gcron.Search(client.getCronKey(cronHeartbeatVerify)) == nil {
|
||||
if gcron.Search(client.getCronKey(consts.TCPCronHeartbeatVerify)) == nil {
|
||||
gcron.AddSingleton(client.Ctx, "@every 600s", func(ctx context.Context) {
|
||||
if client.heartbeat < gtime.Timestamp()-600 {
|
||||
client.Logger.Debugf(client.Ctx, "client heartbeat timeout, about to reconnect..")
|
||||
client.Logger.Debugf(client.Ctx, "client heartbeat timeout, about to reconnect..")
|
||||
client.Destroy()
|
||||
}
|
||||
}, client.getCronKey(cronHeartbeatVerify))
|
||||
}, client.getCronKey(consts.TCPCronHeartbeatVerify))
|
||||
}
|
||||
|
||||
// 心跳
|
||||
if gcron.Search(client.getCronKey(cronHeartbeat)) == nil {
|
||||
if gcron.Search(client.getCronKey(consts.TCPCronHeartbeat)) == nil {
|
||||
gcron.AddSingleton(client.Ctx, "@every 120s", func(ctx context.Context) {
|
||||
client.serverHeartbeat()
|
||||
}, client.getCronKey(cronHeartbeat))
|
||||
}, client.getCronKey(consts.TCPCronHeartbeat))
|
||||
}
|
||||
}
|
||||
|
@ -1,16 +1,19 @@
|
||||
package tcp
|
||||
|
||||
import (
|
||||
"github.com/gogf/gf/v2/errors/gcode"
|
||||
"context"
|
||||
"github.com/gogf/gf/v2/os/gctx"
|
||||
"github.com/gogf/gf/v2/os/gtime"
|
||||
"github.com/gogf/gf/v2/util/gconv"
|
||||
"hotgo/internal/consts"
|
||||
"hotgo/internal/model/input/msgin"
|
||||
)
|
||||
|
||||
// serverLogin 心跳
|
||||
func (client *Client) serverHeartbeat() {
|
||||
if err := client.Write(&msgin.ServerHeartbeat{}); err != nil {
|
||||
client.Logger.Debugf(client.Ctx, "client WriteMsg ServerHeartbeat err:%+v", err)
|
||||
ctx := gctx.New()
|
||||
if err := client.Send(ctx, &msgin.ServerHeartbeat{}); err != nil {
|
||||
client.Logger.Debugf(ctx, "client WriteMsg ServerHeartbeat err:%+v", err)
|
||||
return
|
||||
}
|
||||
}
|
||||
@ -22,40 +25,45 @@ func (client *Client) serverLogin() {
|
||||
Name: client.auth.Name,
|
||||
}
|
||||
|
||||
if err := client.Write(data); err != nil {
|
||||
client.Logger.Debugf(client.Ctx, "client WriteMsg ServerLogin err:%+v", err)
|
||||
ctx := gctx.New()
|
||||
if err := client.Send(ctx, data); err != nil {
|
||||
client.Logger.Debugf(ctx, "client WriteMsg ServerLogin err:%+v", err)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
func (client *Client) onResponseServerLogin(ctx context.Context, args ...interface{}) {
|
||||
var in *msgin.ResponseServerLogin
|
||||
if err := gconv.Scan(args[0], &in); err != nil {
|
||||
client.Logger.Infof(ctx, "onResponseServerLogin message Scan failed:%+v, args:%+v", err, args[0])
|
||||
return
|
||||
}
|
||||
|
||||
if in.Code != consts.TCPMsgCodeSuccess {
|
||||
client.IsLogin = false
|
||||
client.Logger.Warningf(ctx, "onResponseServerLogin quit err:%v", in.Message)
|
||||
client.Destroy()
|
||||
return
|
||||
}
|
||||
|
||||
client.IsLogin = true
|
||||
|
||||
if client.loginEvent != nil {
|
||||
client.loginEvent()
|
||||
}
|
||||
}
|
||||
|
||||
func (client *Client) onResponseServerLogin(args ...interface{}) {
|
||||
var in *msgin.ResponseServerLogin
|
||||
if err := gconv.Scan(args[0], &in); err != nil {
|
||||
client.Logger.Infof(client.Ctx, "onResponseServerLogin message Scan failed:%+v, args:%+v", err, args[0])
|
||||
return
|
||||
}
|
||||
client.Logger.Infof(client.Ctx, "onResponseServerLogin in:%+v", *in)
|
||||
|
||||
if in.Code != gcode.CodeOK.Code() {
|
||||
client.IsLogin = false
|
||||
client.Logger.Warningf(client.Ctx, "onResponseServerLogin quit err:%v", in.Message)
|
||||
client.Destroy()
|
||||
return
|
||||
}
|
||||
client.IsLogin = true
|
||||
}
|
||||
|
||||
func (client *Client) onResponseServerHeartbeat(args ...interface{}) {
|
||||
func (client *Client) onResponseServerHeartbeat(ctx context.Context, args ...interface{}) {
|
||||
var in *msgin.ResponseServerHeartbeat
|
||||
if err := gconv.Scan(args[0], &in); err != nil {
|
||||
client.Logger.Infof(client.Ctx, "onResponseServerHeartbeat message Scan failed:%+v, args:%+v", err, args)
|
||||
client.Logger.Infof(ctx, "onResponseServerHeartbeat message Scan failed:%+v, args:%+v", err, args)
|
||||
return
|
||||
}
|
||||
|
||||
if in.Code != consts.TCPMsgCodeSuccess {
|
||||
client.Logger.Warningf(ctx, "onResponseServerHeartbeat err:%v", in.Message)
|
||||
return
|
||||
}
|
||||
|
||||
client.heartbeat = gtime.Timestamp()
|
||||
client.Logger.Infof(client.Ctx, "onResponseServerHeartbeat in:%+v", *in)
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user