Compare commits
3
Commits
main
..
f6024f0964
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f6024f0964 | ||
|
|
50fcfd2d3d | ||
|
|
3eb5d78875 |
+43
-132
@@ -1,165 +1,76 @@
|
||||
# ---> Go
|
||||
# If you prefer the allow list template instead of the deny list, see community template:
|
||||
# https://github.com/github/gitignore/blob/main/community/Golang/Go.AllowList.gitignore
|
||||
#
|
||||
# Binaries for programs and plugins
|
||||
# Go binaries and test/build artifacts
|
||||
*.exe
|
||||
*.exe~
|
||||
*.dll
|
||||
*.so
|
||||
*.dylib
|
||||
|
||||
# Test binary, built with `go test -c`
|
||||
*.test
|
||||
|
||||
# Output of the go coverage tool, specifically when used with LiteIDE
|
||||
*.out
|
||||
|
||||
# Dependency directories (remove the comment below to include it)
|
||||
# vendor/
|
||||
|
||||
# Go workspace file
|
||||
go.work
|
||||
go.work.sum
|
||||
|
||||
# env file
|
||||
.env
|
||||
|
||||
# ---> Node
|
||||
# Logs
|
||||
logs
|
||||
# Node dependencies, logs, caches, and build output
|
||||
node_modules/
|
||||
jspm_packages/
|
||||
web_modules/
|
||||
logs/
|
||||
*.log
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
lerna-debug.log*
|
||||
.pnpm-debug.log*
|
||||
|
||||
# Diagnostic reports (https://nodejs.org/api/report.html)
|
||||
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
|
||||
|
||||
# Runtime data
|
||||
pids
|
||||
*.pid
|
||||
*.seed
|
||||
*.pid.lock
|
||||
|
||||
# Directory for instrumented libs generated by jscoverage/JSCover
|
||||
lib-cov
|
||||
|
||||
# Coverage directory used by tools like istanbul
|
||||
coverage
|
||||
coverage/
|
||||
*.lcov
|
||||
|
||||
# nyc test coverage
|
||||
.nyc_output
|
||||
|
||||
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
|
||||
.grunt
|
||||
|
||||
# Bower dependency directory (https://bower.io/)
|
||||
bower_components
|
||||
|
||||
# node-waf configuration
|
||||
.nyc_output/
|
||||
.grunt/
|
||||
bower_components/
|
||||
.lock-wscript
|
||||
|
||||
# Compiled binary addons (https://nodejs.org/api/addons.html)
|
||||
build/Release
|
||||
|
||||
# Dependency directories
|
||||
node_modules/
|
||||
jspm_packages/
|
||||
|
||||
# Snowpack dependency directory (https://snowpack.dev/)
|
||||
web_modules/
|
||||
|
||||
# TypeScript cache
|
||||
build/Release/
|
||||
*.tsbuildinfo
|
||||
|
||||
# Optional npm cache directory
|
||||
.npm
|
||||
|
||||
# Optional eslint cache
|
||||
.npm/
|
||||
.eslintcache
|
||||
|
||||
# Optional stylelint cache
|
||||
.stylelintcache
|
||||
|
||||
# Microbundle cache
|
||||
.rpt2_cache/
|
||||
.rts2_cache_cjs/
|
||||
.rts2_cache_es/
|
||||
.rts2_cache_umd/
|
||||
|
||||
# Optional REPL history
|
||||
.rpt2_cache_cjs/
|
||||
.rpt2_cache_es/
|
||||
.rpt2_cache_umd/
|
||||
.node_repl_history
|
||||
|
||||
# Output of 'npm pack'
|
||||
*.tgz
|
||||
|
||||
# Yarn Integrity file
|
||||
.yarn-integrity
|
||||
.cache/
|
||||
.parcel-cache/
|
||||
.next/
|
||||
out/
|
||||
.nuxt/
|
||||
dist/
|
||||
.temp/
|
||||
**/.vitepress/dist/
|
||||
**/.vitepress/cache/
|
||||
.docusaurus/
|
||||
.serverless/
|
||||
.fusebox/
|
||||
.dynamodb/
|
||||
.tern-port
|
||||
.vscode-test/
|
||||
.yarn/cache/
|
||||
.yarn/unplugged/
|
||||
.yarn/build-state.yml
|
||||
.yarn/install-state.gz
|
||||
.pnp.*
|
||||
|
||||
# dotenv environment variable files
|
||||
# Local environment files
|
||||
.env
|
||||
.env.development.local
|
||||
.env.test.local
|
||||
.env.production.local
|
||||
.env.local
|
||||
|
||||
# parcel-bundler cache (https://parceljs.org/)
|
||||
.cache
|
||||
.parcel-cache
|
||||
|
||||
# Next.js build output
|
||||
.next
|
||||
out
|
||||
|
||||
# Nuxt.js build / generate output
|
||||
.nuxt
|
||||
dist
|
||||
|
||||
# Gatsby files
|
||||
.cache/
|
||||
# Comment in the public line in if your project uses Gatsby and not Next.js
|
||||
# https://nextjs.org/blog/next-9-1#public-directory-support
|
||||
# public
|
||||
|
||||
# vuepress build output
|
||||
.vuepress/dist
|
||||
|
||||
# vuepress v2.x temp and cache directory
|
||||
.temp
|
||||
.cache
|
||||
|
||||
# vitepress build output
|
||||
**/.vitepress/dist
|
||||
|
||||
# vitepress cache directory
|
||||
**/.vitepress/cache
|
||||
|
||||
# Docusaurus cache and generated files
|
||||
.docusaurus
|
||||
|
||||
# Serverless directories
|
||||
.serverless/
|
||||
|
||||
# FuseBox cache
|
||||
.fusebox/
|
||||
|
||||
# DynamoDB Local files
|
||||
.dynamodb/
|
||||
|
||||
# TernJS port file
|
||||
.tern-port
|
||||
|
||||
# Stores VSCode versions used for testing VSCode extensions
|
||||
.vscode-test
|
||||
|
||||
# yarn v2
|
||||
.yarn/cache
|
||||
.yarn/unplugged
|
||||
.yarn/build-state.yml
|
||||
.yarn/install-state.gz
|
||||
.pnp.*
|
||||
# Local OS and editor metadata
|
||||
.DS_Store
|
||||
.idea/
|
||||
.vscode/
|
||||
|
||||
# Python bytecode
|
||||
__pycache__/
|
||||
*.py[cod]
|
||||
|
||||
@@ -0,0 +1,960 @@
|
||||
# HotGo 项目开发规范
|
||||
|
||||
**生成或修改任何代码前,必须完整阅读本文档。**
|
||||
本规范是项目唯一事实来源,所有新增代码必须严格对齐现有模块风格,不得自创新的代码模式。
|
||||
|
||||
---
|
||||
|
||||
## 技术栈
|
||||
|
||||
| 层 | 技术 |
|
||||
|----|----------------------------------------------------------------|
|
||||
| 后端语言 | Go,module 名 `hotgo` |
|
||||
| 后端框架 | GoFrame v2(gdb、ghttp、gcron、gerror、gctx、gerror、gjson、gvar) |
|
||||
| 前端框架 | Vue 3 + Vite + TypeScript |
|
||||
| UI 组件库 | **Naive UI**(优先使用,未经允许不得引入其他 UI 库) |
|
||||
| 状态管理 | Pinia |
|
||||
| HTTP 客户端 | 项目封装 `@/utils/http/axios`(`http.request`),禁止直接使用 axios |
|
||||
|
||||
---
|
||||
|
||||
## 后端目录结构
|
||||
|
||||
```
|
||||
server/
|
||||
├── addons/ # 插件模块(每个插件独立微架构,见"插件开发"章节)
|
||||
│ ├── modules/ # 隐式注册文件(每个插件一个 .go,仅含 import)
|
||||
│ └── <addonName>/ # 插件目录,与主模块结构镜像
|
||||
├── api/admin/<module>/ # 主模块 HTTP 契约:Req/Res + g.Meta 路由声明
|
||||
├── internal/
|
||||
│ ├── consts/ # 全局常量与字典选项(枚举在此定义并注册)
|
||||
│ ├── global/ # 全局公用变量(谨慎添加,尽量少用)
|
||||
│ ├── controller/admin/sys/ # 薄控制器,只做参数透传,不含业务逻辑
|
||||
│ ├── crons/ # 主模块定时任务注册与处理
|
||||
│ ├── queues/ # 主模块消息队列消费者注册与处理
|
||||
│ ├── logic/sys/ # 业务实现(sSysXxx),init() 注册到 service
|
||||
│ ├── library/ # 内部基础库(addons、dict、hgorm、cache、queue、cron 等)
|
||||
│ ├── service/ # 接口声明(ISysXxx)+ 注册函数
|
||||
│ ├── dao/ # 对外 DAO;internal/dao/internal/ 为 CLI 生成,禁止手改
|
||||
│ ├── model/
|
||||
│ │ ├── entity/ # 表结构体(CLI 生成,禁止手改)
|
||||
│ │ ├── do/ # ORM 写入结构(CLI 生成,禁止手改)
|
||||
│ │ └── input/sysin/ # 业务入参、出参、过滤结构
|
||||
│ └── router/
|
||||
│ ├── admin.go # 主路由,末尾调用 genrouter.Register()
|
||||
│ └── genrouter/ # 每个生成模块一个文件,init() 追加到 LoginRequiredRouter
|
||||
├── resource/
|
||||
│ ├── generate/default/curd/ # 主模块 CRUD 代码生成模板(参考,禁止直接修改)
|
||||
│ └── generate/default/addon/ # 插件脚手架代码生成模板(参考,禁止直接修改)
|
||||
└── utility/ # 通用工具:convert、excel、validate 等
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 后端分层约定
|
||||
|
||||
### 分层职责(禁止跨层调用)
|
||||
|
||||
```
|
||||
api(HTTP契约) → controller(参数透传) → service(接口) → logic(业务实现) → dao(数据访问)
|
||||
```
|
||||
|
||||
- **controller 层**:不写任何业务逻辑,只转调 service
|
||||
- **logic 层**:不出现 HTTP 相关代码,所有校验通过 `Filter()` 或 `g.Validator()` 完成
|
||||
- **dao 层**:`internal/dao/internal/` 由 CLI 自动生成,禁止手改
|
||||
|
||||
---
|
||||
|
||||
### 1. API 层 `api/admin/<module>/<module>.go`
|
||||
|
||||
- 每个接口一对 `XxxReq` / `XxxRes`,`g.Meta` 声明路由
|
||||
- GET 接口用 `method:"get"`,写操作用 `method:"post"`
|
||||
- 请求体嵌入 `sysin.XxxInp`,响应体嵌入对应 Model 或空 `struct{}`
|
||||
|
||||
```go
|
||||
type ListReq struct {
|
||||
g.Meta `path:"/xxxModule/list" method:"get" tags:"XXX模块" summary:"获取XXX列表"`
|
||||
sysin.XxxListInp
|
||||
}
|
||||
type ListRes struct {
|
||||
form.PageRes
|
||||
List []*sysin.XxxListModel `json:"list" dc:"数据列表"`
|
||||
}
|
||||
```
|
||||
|
||||
### 2. Controller 层 `internal/controller/admin/sys/<module>.go`
|
||||
|
||||
- 变量:`var XxxModule = cXxxModule{}`,类型:`type cXxxModule struct{}`
|
||||
- 只做参数转发和结果组装,禁止直接操作 dao 或写业务逻辑
|
||||
|
||||
```go
|
||||
func (c *cXxxModule) List(ctx context.Context, req *xxxmodule.ListReq) (res *xxxmodule.ListRes, err error) {
|
||||
list, totalCount, err := service.SysXxxModule().List(ctx, &req.XxxListInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
if list == nil {
|
||||
list = []*sysin.XxxListModel{}
|
||||
}
|
||||
res = new(xxxmodule.ListRes)
|
||||
res.List = list
|
||||
res.PageRes.Pack(req, totalCount)
|
||||
return
|
||||
}
|
||||
```
|
||||
|
||||
### 3. Service 层 `internal/service/sys.go`
|
||||
|
||||
- 在已有文件中**追加**接口声明和注册函数,禁止新建文件
|
||||
- 声明 `ISysXxxModule` 接口,提供 `SysXxxModule()` 获取函数和 `RegisterSysXxxModule()` 注册函数
|
||||
|
||||
### 4. Logic 层 `internal/logic/sys/<module>.go`
|
||||
|
||||
- 结构体:`type sSysXxxModule struct{}`
|
||||
- `init()` 里调用 `service.RegisterSysXxxModule(NewSysXxxModule())`
|
||||
- `Model()` 方法:`return handler.Model(dao.XxxTable.Ctx(ctx), option...)`
|
||||
- 列名引用必须用 `dao.XxxTable.Columns().FieldName`,禁止硬编码字符串字段名
|
||||
- `Edit` 方法以 `in.Id > 0` 区分更新/新增,更新用 `XxxUpdateFields`,新增用 `XxxInsertFields`
|
||||
- 字段校验在 `sysin` 的 `Filter(ctx)` 方法完成,logic 层不重复校验
|
||||
|
||||
### 5. Model 层 `internal/model/input/sysin/<module>.go`
|
||||
|
||||
| 类型 | 用途 |
|
||||
|------|------|
|
||||
| `XxxUpdateFields` | 更新时字段白名单 |
|
||||
| `XxxInsertFields` | 新增时字段白名单 |
|
||||
| `XxxEditInp` | 嵌入 `entity.XxxTable`,含 `Filter()` 校验方法 |
|
||||
| `XxxListInp` | 列表查询入参,嵌入 `form.PageInp` |
|
||||
| `XxxListModel` | 列表返回字段 |
|
||||
| `XxxViewInp` / `XxxViewModel` | 详情入参/出参 |
|
||||
| `XxxDeleteInp` | 删除入参(通常含 `Ids []int64`) |
|
||||
| `XxxStatusInp`、`XxxMaxSortInp` 等 | 其他操作 |
|
||||
|
||||
### 6. 路由注册 `internal/router/genrouter/<module>.go`
|
||||
|
||||
```go
|
||||
package genrouter
|
||||
|
||||
import "hotgo/internal/controller/admin/sys"
|
||||
|
||||
func init() {
|
||||
LoginRequiredRouter = append(LoginRequiredRouter, sys.XxxModule) // XXX模块
|
||||
}
|
||||
```
|
||||
|
||||
新建此文件即可,`genrouter/init.go` 通过 `init()` 链自动加载,无需修改 `admin.go`。
|
||||
|
||||
---
|
||||
|
||||
## 字典与枚举规范
|
||||
|
||||
**字典由后端统一维护**,前端通过固定接口拉取,禁止在前端硬编码枚举值。
|
||||
|
||||
### 后端:定义与注册(`internal/consts/` 下对应文件)
|
||||
|
||||
```go
|
||||
// 1. 定义常量
|
||||
const (
|
||||
XxxStatusEnabled = 1 // 启用
|
||||
XxxStatusDisable = 2 // 禁用
|
||||
)
|
||||
|
||||
// 2. 定义选项(选择合适的样式函数)
|
||||
var XxxStatusOptions = []*model.Option{
|
||||
dict.GenSuccessOption(XxxStatusEnabled, "启用"),
|
||||
dict.GenWarningOption(XxxStatusDisable, "禁用"),
|
||||
}
|
||||
|
||||
// 3. 在 init() 中注册(同文件)
|
||||
func init() {
|
||||
dict.RegisterEnums("XxxStatusOptions", "XXX状态选项", XxxStatusOptions)
|
||||
}
|
||||
```
|
||||
|
||||
**样式函数选择规则:**
|
||||
|
||||
| 函数 | 适用场景 |
|
||||
|------|---------|
|
||||
| `dict.GenSuccessOption` | 正常、启用、成功 |
|
||||
| `dict.GenWarningOption` | 待处理、禁用、警告 |
|
||||
| `dict.GenErrorOption` | 失败、封禁、危险 |
|
||||
| `dict.GenInfoOption` | 信息类、中性状态 |
|
||||
| `dict.GenPrimaryOption` | 主要操作、强调 |
|
||||
| `dict.GenDefaultOption` | 默认、无特殊含义 |
|
||||
| `dict.GenHashOption` | 不确定数量的动态枚举 |
|
||||
|
||||
### 后端:Logic 层中使用字典
|
||||
|
||||
```go
|
||||
// 获取标签文本
|
||||
label := dict.GetOptionLabel(consts.XxxStatusOptions, in.Status)
|
||||
|
||||
// 校验是否为合法值
|
||||
if !dict.HasOptionKey(consts.XxxStatusOptions, in.Status) {
|
||||
return gerror.New("状态值不合法")
|
||||
}
|
||||
```
|
||||
|
||||
### 前端:加载与使用字典
|
||||
|
||||
**加载**(在 `model.ts` 的 `loadOptions()` 中):
|
||||
|
||||
```ts
|
||||
export function loadOptions() {
|
||||
dict.loadOptions(['XxxStatusOptions', 'sys_normal_disable']);
|
||||
}
|
||||
```
|
||||
|
||||
**在 `model.ts` 的 columns 中渲染字典标签:**
|
||||
|
||||
```ts
|
||||
import { useDictStore } from '@/store/modules/dict';
|
||||
const dict = useDictStore();
|
||||
|
||||
// columns 中
|
||||
{
|
||||
title: '状态',
|
||||
key: 'status',
|
||||
render(row) {
|
||||
return dict.getLabel('XxxStatusOptions', row.status);
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
**在搜索表单 schemas 中使用字典下拉:**
|
||||
|
||||
```ts
|
||||
{
|
||||
field: 'status',
|
||||
component: 'NSelect',
|
||||
label: '状态',
|
||||
componentProps: {
|
||||
options: computed(() => dict.getOptions('XxxStatusOptions')),
|
||||
placeholder: '请选择状态',
|
||||
},
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 插件(Addon)开发规范
|
||||
|
||||
> 定位:独立、临时性、工具类型的功能推荐插件化开发,例如小游戏、广告管理、文章管理、小程序、微商城等。插件之间完全隔离,方便多项目复用。
|
||||
|
||||
### 插件目录结构
|
||||
|
||||
每个插件拥有完整的独立微架构,与主模块结构镜像,但 **包路径前缀为 `hotgo/addons/<addonName>/`**:
|
||||
|
||||
```
|
||||
server/addons/<addonName>/
|
||||
├── main.go # 插件入口:定义 module 结构体,实现 Module 接口,init() 注册
|
||||
├── global/
|
||||
│ ├── global.go # 插件级全局变量
|
||||
│ └── init.go # Init(ctx, skeleton),GetSkeleton() 方法
|
||||
├── api/
|
||||
│ ├── admin/ # 后台接口契约(同主模块 api 写法)
|
||||
│ ├── api/ # 前台 API 接口契约
|
||||
│ └── home/ # 首页接口契约(如有)
|
||||
├── controller/
|
||||
│ ├── admin/sys/ # 后台薄控制器
|
||||
│ ├── api/ # 前台控制器
|
||||
│ └── home/ # 首页控制器(如有)
|
||||
├── logic/
|
||||
│ ├── logic.go # 匿名导入各 logic 子包触发 init()
|
||||
│ └── sys/ # 业务实现(同主模块 logic 写法)
|
||||
├── service/ # 插件内接口声明与注册(独立,不与主模块 service 混用)
|
||||
├── model/
|
||||
│ └── input/sysin/ # 插件内入参/出参(调用主模块服务时继承主模块 input 结构)
|
||||
├── router/
|
||||
│ ├── admin.go # 注册后台路由,使用 addons.RouterPrefix() 获取路由前缀
|
||||
│ ├── api.go # 注册前台路由
|
||||
│ ├── home.go # 注册首页路由(如有)
|
||||
│ ├── websocket.go # 注册 WebSocket 路由(如有)
|
||||
│ └── genrouter/
|
||||
│ ├── init.go # 插件版 genrouter:Register() 使用插件前缀
|
||||
│ └── *.go # 每个生成模块一个文件,追加到插件 LoginRequiredRouter
|
||||
├── consts/ # 插件内常量与字典(同主模块 consts 写法)
|
||||
├── crons/ # 插件定时任务(可选)
|
||||
├── queues/ # 插件消息队列消费者(可选)
|
||||
└── resource/ # 插件静态资源与模板(可选)
|
||||
```
|
||||
|
||||
**对应前端目录:**
|
||||
|
||||
```
|
||||
web/src/
|
||||
├── api/addons/<addonName>/ # 插件前端 API 封装
|
||||
└── views/addons/<addonName>/ # 插件前端页面
|
||||
```
|
||||
|
||||
### 插件入口 `main.go`
|
||||
|
||||
```go
|
||||
package <addonName>
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/gogf/gf/v2/net/ghttp"
|
||||
_ "hotgo/addons/<addonName>/crons"
|
||||
"hotgo/addons/<addonName>/global"
|
||||
_ "hotgo/addons/<addonName>/logic"
|
||||
_ "hotgo/addons/<addonName>/queues"
|
||||
"hotgo/addons/<addonName>/router"
|
||||
"hotgo/internal/library/addons"
|
||||
"hotgo/internal/service"
|
||||
"sync"
|
||||
)
|
||||
|
||||
type module struct {
|
||||
skeleton *addons.Skeleton
|
||||
ctx context.Context
|
||||
sync.Mutex
|
||||
}
|
||||
|
||||
func init() { newModule() }
|
||||
|
||||
func newModule() {
|
||||
m := &module{
|
||||
skeleton: &addons.Skeleton{
|
||||
Label: "插件显示名",
|
||||
Name: "<addonName>", // 与目录名一致
|
||||
Group: 1,
|
||||
Brief: "简介",
|
||||
Description: "详细描述",
|
||||
Author: "作者",
|
||||
Version: "v1.0.0",
|
||||
},
|
||||
ctx: gctx.New(),
|
||||
}
|
||||
addons.RegisterModule(m)
|
||||
}
|
||||
|
||||
func (m *module) Start(option *addons.Option) (err error) {
|
||||
global.Init(m.ctx, m.skeleton)
|
||||
option.Server.Group("/", func(group *ghttp.RouterGroup) {
|
||||
group.Middleware(service.Middleware().Addon)
|
||||
router.Admin(m.ctx, group)
|
||||
router.Api(m.ctx, group)
|
||||
})
|
||||
return
|
||||
}
|
||||
// 其余方法:Stop、Ctx、GetSkeleton、Install、Upgrade、UnInstall(默认留空)
|
||||
```
|
||||
|
||||
### 插件路由前缀规则
|
||||
|
||||
```
|
||||
后台:/admin/<addonName>/接口路径 → 对应 controller/admin/sys/
|
||||
前台:/api/<addonName>/接口路径 → 对应 controller/api/
|
||||
首页:/home/<addonName>/接口路径 → 对应 controller/home/
|
||||
WebSocket:/socket/<addonName>/接口路径
|
||||
```
|
||||
|
||||
路由前缀通过 `addons.RouterPrefix(ctx, consts.AppAdmin, global.GetSkeleton().Name)` 自动生成,**禁止在路由文件里硬编码路径前缀**。
|
||||
|
||||
### 插件 genrouter 与主模块的区别
|
||||
|
||||
插件 `genrouter/init.go` 的 `Register()` 函数需要传入 `ctx` 和 `group`,并使用插件路由前缀:
|
||||
|
||||
```go
|
||||
// 插件 genrouter/init.go
|
||||
func Register(ctx context.Context, group *ghttp.RouterGroup) {
|
||||
prefix := addons.RouterPrefix(ctx, consts.AppAdmin, global.GetSkeleton().Name)
|
||||
group.Group(prefix, func(group *ghttp.RouterGroup) {
|
||||
group.Middleware(service.Middleware().AdminAuth)
|
||||
if len(LoginRequiredRouter) > 0 {
|
||||
group.Bind(LoginRequiredRouter...)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// 插件 genrouter/<module>.go
|
||||
func init() {
|
||||
LoginRequiredRouter = append(LoginRequiredRouter, sys.XxxModule)
|
||||
}
|
||||
```
|
||||
|
||||
参考实现:`server/addons/hgexample/router/genrouter/`
|
||||
|
||||
### 插件调用主模块服务
|
||||
|
||||
**在插件 input 层继承主模块 input 结构,解耦参数依赖**,避免 import cycle:
|
||||
|
||||
```go
|
||||
// 插件 model/input/sysin/config.go
|
||||
package sysin
|
||||
|
||||
import "hotgo/internal/model/input/sysin"
|
||||
|
||||
type UpdateConfigInp struct {
|
||||
sysin.UpdateAddonsConfigInp
|
||||
}
|
||||
```
|
||||
|
||||
```go
|
||||
// 插件 logic 中调用主模块服务
|
||||
import isc "hotgo/internal/service"
|
||||
|
||||
func (s *sSysConfig) UpdateConfigByGroup(ctx context.Context, in sysin.UpdateConfigInp) error {
|
||||
in.UpdateAddonsConfigInp.AddonName = global.GetSkeleton().Name
|
||||
return isc.SysAddonsConfig().UpdateConfigByGroup(ctx, in.UpdateAddonsConfigInp)
|
||||
}
|
||||
```
|
||||
|
||||
### 插件获取自身信息
|
||||
|
||||
```go
|
||||
// 插件内部
|
||||
global.GetSkeleton()
|
||||
|
||||
// 任意位置判断当前请求是否为插件请求
|
||||
contexts.IsAddonRequest(ctx)
|
||||
contexts.GetAddonName(ctx)
|
||||
```
|
||||
|
||||
### 插件隐式注册
|
||||
|
||||
在 `server/addons/modules/` 下新建 `<addonName>.go`,内容仅含一行匿名导入:
|
||||
|
||||
```go
|
||||
package modules
|
||||
|
||||
import _ "hotgo/addons/<addonName>"
|
||||
```
|
||||
|
||||
### 新增插件检查清单
|
||||
|
||||
**后端:**
|
||||
- [ ] `addons/<addonName>/main.go` — 插件入口,实现 Module 接口
|
||||
- [ ] `addons/<addonName>/global/` — global.go + init.go
|
||||
- [ ] `addons/modules/<addonName>.go` — 隐式注册
|
||||
- [ ] `addons/<addonName>/service/` — 插件内接口声明(独立包)
|
||||
- [ ] `addons/<addonName>/logic/logic.go` — 匿名导入触发 init()
|
||||
- [ ] `addons/<addonName>/logic/sys/<module>.go` — 业务实现
|
||||
- [ ] `addons/<addonName>/model/input/sysin/<module>.go` — 入参/出参
|
||||
- [ ] `addons/<addonName>/api/admin/<module>/<module>.go` — API 契约
|
||||
- [ ] `addons/<addonName>/controller/admin/sys/<module>.go` — 薄控制器
|
||||
- [ ] `addons/<addonName>/router/admin.go` — 路由注册
|
||||
- [ ] `addons/<addonName>/router/genrouter/init.go` — 插件 genrouter
|
||||
- [ ] `addons/<addonName>/router/genrouter/<module>.go` — 模块路由追加
|
||||
|
||||
**前端:**
|
||||
- [ ] `web/src/api/addons/<addonName>/index.ts` — API 封装
|
||||
- [ ] `web/src/views/addons/<addonName>/model.ts` — State、schemas、columns
|
||||
- [ ] `web/src/views/addons/<addonName>/index.vue` — 列表页
|
||||
- [ ] `web/src/views/addons/<addonName>/edit.vue` — 编辑页
|
||||
|
||||
参考实现:`server/addons/hgexample/`(完整插件示例)、`server/resource/generate/default/addon/`(生成模板)
|
||||
|
||||
---
|
||||
|
||||
## 标准 CRUD 接口清单
|
||||
|
||||
| 接口 | method | 说明 |
|
||||
|------|--------|------|
|
||||
| `/xxx/list` | GET | 分页列表 |
|
||||
| `/xxx/view` | GET | 详情 |
|
||||
| `/xxx/edit` | POST | 新增/编辑(id>0 为编辑) |
|
||||
| `/xxx/delete` | POST | 删除(支持批量,传 ids) |
|
||||
| `/xxx/status` | POST | 启用/禁用状态切换 |
|
||||
| `/xxx/switch` | POST | 开关字段切换 |
|
||||
| `/xxx/maxSort` | GET | 获取最大排序值 |
|
||||
| `/xxx/export` | GET | 导出列表 |
|
||||
|
||||
按实际需求裁剪,不强制全部实现。
|
||||
|
||||
---
|
||||
|
||||
## 前端目录结构
|
||||
|
||||
```
|
||||
web/src/
|
||||
├── api/<module>/index.ts # HTTP 请求封装
|
||||
├── views/<module>/
|
||||
│ ├── index.vue # 列表页
|
||||
│ ├── edit.vue # 新增/编辑弹窗
|
||||
│ └── model.ts # State 类、rules、schemas、columns、loadOptions
|
||||
├── components/ # 通用组件(BasicTable、BasicForm、BasicModal 等)
|
||||
├── store/modules/dict.ts # 字典 store(loadOptions、getLabel、getOptions)
|
||||
└── utils/
|
||||
├── http/axios.ts # HTTP 封装(http.request / jumpExport)
|
||||
└── dateUtil.ts # 日期工具(defRangeShortcuts 等)
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 前端编码约定
|
||||
|
||||
### API 文件 `api/<module>/index.ts`
|
||||
|
||||
- 使用 `http.request`,禁止直接使用 axios
|
||||
- 函数名与接口语义一致:`List`、`Edit`、`Delete`、`View`、`Status`、`Switch`、`Export`、`MaxSort`
|
||||
- 导出接口用 `jumpExport('/xxx/export', params)`
|
||||
|
||||
```ts
|
||||
import { http, jumpExport } from '@/utils/http/axios';
|
||||
|
||||
export function List(params) {
|
||||
return http.request({ url: '/xxxModule/list', method: 'get', params });
|
||||
}
|
||||
export function Edit(params) {
|
||||
return http.request({ url: '/xxxModule/edit', method: 'POST', params });
|
||||
}
|
||||
export function Export(params) {
|
||||
jumpExport('/xxxModule/export', params);
|
||||
}
|
||||
```
|
||||
|
||||
### model.ts 结构
|
||||
|
||||
- `class State`:属性与后端 entity 字段对应,提供合理默认值
|
||||
- `newState()`:工厂函数,支持深拷贝(`cloneDeep`)
|
||||
- `rules`:Naive UI 表单校验规则
|
||||
- `schemas`:搜索栏 `FormSchema[]`(`ref` 包装)
|
||||
- `columns`:表格列定义,含权限守卫的操作用 `hasPermission(['/xxx/edit'])`
|
||||
- `loadOptions()`:调用 `dict.loadOptions([...])`,预加载字典数据
|
||||
|
||||
### 组件使用规范
|
||||
|
||||
**必须优先使用 Naive UI 原生组件**,能用 Naive UI 实现的禁止自行封装替代组件:
|
||||
|
||||
| 场景 | 必须使用的组件 |
|
||||
|------|--------------|
|
||||
| 表格 | 项目封装 `BasicTable`(基于 Naive UI) |
|
||||
| 表单 | 项目封装 `BasicForm`(基于 Naive UI) |
|
||||
| 弹窗 | `n-modal` 或项目封装 `BasicModal` |
|
||||
| 按钮 | `n-button`,类型用 `primary`/`default`/`error` 等语义值 |
|
||||
| 选择器 | `n-select`(字典下拉)、`n-tree-select`(树形) |
|
||||
| 开关 | `n-switch`,配合 Switch 接口 |
|
||||
| 输入框 | `n-input` |
|
||||
| 日期选择 | `n-date-picker`,范围选择配合 `defRangeShortcuts()` |
|
||||
| 图片渲染 | `renderImage(url)` |
|
||||
| 文件渲染 | `renderFile(url)` |
|
||||
| 成员信息 | `renderPopoverMemberSumma(summa)` |
|
||||
|
||||
**禁止行为:**
|
||||
- 禁止引入 Element Plus、Ant Design Vue 等其他 UI 库
|
||||
- 禁止使用内联 style(使用 Naive UI 的 props 或 class)
|
||||
- 禁止在模板里硬编码字典值文本,必须通过 `dict.getLabel()` 渲染
|
||||
|
||||
### 权限控制
|
||||
|
||||
```ts
|
||||
import { usePermission } from '@/hooks/web/usePermission';
|
||||
const { hasPermission } = usePermission();
|
||||
|
||||
// 模板中
|
||||
v-if="hasPermission(['/xxxModule/edit'])"
|
||||
|
||||
// columns 中开关操作
|
||||
disabled: !hasPermission(['/xxxModule/switch'])
|
||||
```
|
||||
|
||||
权限标识与后端路由路径保持一致,**路由由后端菜单数据驱动,禁止在源码里硬编码路由路径**。
|
||||
|
||||
### Vue 3 代码规范
|
||||
|
||||
- 使用 Composition API(`<script setup>`)
|
||||
- 响应式数据用 `ref` / `reactive`,计算属性用 `computed`
|
||||
- 字典选项传给组件时用 `computed(() => dict.getOptions('XxxOptions'))`,保持响应式
|
||||
|
||||
---
|
||||
|
||||
## 新增 CRUD 模块检查清单
|
||||
|
||||
**后端(必须全部完成,顺序建议从下往上):**
|
||||
|
||||
- [ ] `internal/consts/<module>.go` — 常量定义、选项变量、`init()` 注册字典
|
||||
- [ ] 使用 goframe CLI 生成:`entity`、`do`、`dao/internal`、`dao`(禁止手写)
|
||||
- [ ] `internal/model/input/sysin/<module>.go` — 入参/出参/过滤模型
|
||||
- [ ] `internal/service/sys.go` — 追加接口声明与注册函数
|
||||
- [ ] `internal/logic/sys/<module>.go` — 业务实现
|
||||
- [ ] `internal/controller/admin/sys/<module>.go` — 薄控制器
|
||||
- [ ] `api/admin/<module>/<module>.go` — API 契约
|
||||
- [ ] `internal/router/genrouter/<module>.go` — 路由注册(`LoginRequiredRouter` 追加)
|
||||
|
||||
**前端(必须全部完成):**
|
||||
|
||||
- [ ] `web/src/api/<module>/index.ts` — HTTP 封装
|
||||
- [ ] `web/src/views/<module>/model.ts` — State、schemas、columns、rules、loadOptions
|
||||
- [ ] `web/src/views/<module>/index.vue` — 列表页
|
||||
- [ ] `web/src/views/<module>/edit.vue` — 编辑页
|
||||
|
||||
---
|
||||
|
||||
## 参考实现
|
||||
|
||||
**所有新模块必须严格对齐以下文件的风格,生成前请逐一阅读:**
|
||||
|
||||
**主模块 CRUD 参考:**
|
||||
|
||||
| 文件 | 说明 |
|
||||
|------|------|
|
||||
| `server/internal/consts/status.go` | 字典常量定义与注册标准写法 |
|
||||
| `server/api/admin/curddemo/curddemo.go` | API 契约标准写法 |
|
||||
| `server/internal/controller/admin/sys/curd_demo.go` | 薄控制器标准写法 |
|
||||
| `server/internal/logic/sys/curd_demo.go` | Logic 标准写法(含关联查询、导出、字段过滤) |
|
||||
| `server/internal/model/input/sysin/curd_demo.go` | 入参/出参模型标准写法 |
|
||||
| `server/internal/router/genrouter/curd_demo.go` | 主模块路由注册标准写法 |
|
||||
| `web/src/api/curdDemo/index.ts` | 前端 API 封装标准写法 |
|
||||
| `web/src/views/curdDemo/model.ts` | 前端 model 标准写法(含字典加载) |
|
||||
| `web/src/views/curdDemo/index.vue` | 列表页标准写法 |
|
||||
| `web/src/views/curdDemo/edit.vue` | 编辑页标准写法 |
|
||||
|
||||
**插件参考(以 hgexample 为标准):**
|
||||
|
||||
| 文件 | 说明 |
|
||||
|------|------|
|
||||
| `server/addons/hgexample/main.go` | 插件入口标准写法 |
|
||||
| `server/addons/hgexample/global/init.go` | 插件 global 标准写法 |
|
||||
| `server/addons/hgexample/router/admin.go` | 插件路由注册标准写法 |
|
||||
| `server/addons/hgexample/router/genrouter/init.go` | 插件 genrouter 标准写法 |
|
||||
| `server/addons/hgexample/router/genrouter/tenant_order.go` | 插件模块路由追加标准写法 |
|
||||
| `server/addons/hgexample/logic/sys/tenant_order.go` | 插件业务逻辑标准写法 |
|
||||
| `server/addons/hgexample/logic/sys/config.go` | 插件调用主模块服务标准写法 |
|
||||
|
||||
代码生成模板:
|
||||
- 主模块 CRUD:`server/resource/generate/default/curd/`
|
||||
- 插件脚手架:`server/resource/generate/default/addon/`
|
||||
|
||||
以上模板可参考逻辑,**禁止直接修改模板文件**。
|
||||
|
||||
---
|
||||
|
||||
## 错误处理规范
|
||||
|
||||
### 基本原则
|
||||
|
||||
- 业务错误直接用 `gerror.New("描述清晰的中文信息")` 返回,GoFrame 框架会统一处理响应码
|
||||
- 错误信息要面向用户,清晰说明**发生了什么**,而不是堆栈路径
|
||||
|
||||
### 错误创建方式
|
||||
|
||||
```go
|
||||
import "github.com/gogf/gf/v2/errors/gerror"
|
||||
|
||||
// 普通业务错误(最常用)
|
||||
return gerror.New("用户名已存在")
|
||||
|
||||
// 包装底层错误,追加上下文(调用第三方/dao 层出错时使用)
|
||||
if err := dao.User.Ctx(ctx).Data(data).Insert(); err != nil {
|
||||
return gerror.Wrap(err, "创建用户失败")
|
||||
}
|
||||
|
||||
// 带格式化参数
|
||||
return gerror.Newf("订单 %d 状态不合法,当前状态:%d", in.Id, order.Status)
|
||||
```
|
||||
|
||||
### 错误传递原则
|
||||
|
||||
- **logic 层**:遇到底层错误用 `gerror.Wrap` 追加上下文后返回;纯业务校验失败用 `gerror.New` 直接返回
|
||||
- **controller 层**:直接 `return` 透传 logic 的 error,**不再包装**,不打印日志(框架统一处理)
|
||||
- **禁止**在 controller 层 `fmt.Println(err)` 或 `g.Log().Error` 打印已经会被框架记录的错误
|
||||
|
||||
---
|
||||
|
||||
## 缓存使用规范
|
||||
|
||||
### 统一使用 `cache.Instance()`
|
||||
|
||||
**禁止直接调用 `g.Redis().Do()`**,项目统一通过 `cache.Instance()` 操作缓存,底层适配器(Memory / Redis / File)由配置决定,业务层无需关心。
|
||||
|
||||
```go
|
||||
import (
|
||||
"hotgo/internal/library/cache"
|
||||
"github.com/gogf/gf/v2/os/gcache"
|
||||
"time"
|
||||
)
|
||||
|
||||
// 设置缓存(带过期时间)
|
||||
err := cache.Instance().Set(ctx, "user:info:1", userInfo, 30*time.Minute)
|
||||
|
||||
// 获取缓存
|
||||
val, err := cache.Instance().Get(ctx, "user:info:1")
|
||||
if err != nil || val.IsNil() {
|
||||
// 缓存未命中,查数据库
|
||||
}
|
||||
|
||||
// 删除缓存
|
||||
_, err = cache.Instance().Remove(ctx, "user:info:1")
|
||||
|
||||
// GetOrSet:缓存不存在时自动执行函数并写入(推荐用于只读类缓存)
|
||||
val, err := cache.Instance().GetOrSet(ctx, "user:info:1", func(ctx context.Context) (interface{}, error) {
|
||||
return dao.AdminMember.Ctx(ctx).Where(...).One()
|
||||
}, 30*time.Minute)
|
||||
```
|
||||
|
||||
### 缓存 Key 命名规范
|
||||
|
||||
- 格式:`模块:实体:唯一标识`,例如:`user:info:1`、`config:site:basic`、`dict:options:XxxStatus`
|
||||
- 同一模块的 Key 统一在 `internal/consts/cache.go`(或对应模块的 consts 文件)中定义为常量,禁止散落在 logic 里硬编码
|
||||
- 插件缓存 Key 加插件名前缀:`hgexample:order:1`
|
||||
|
||||
### 缓存使用原则
|
||||
|
||||
- 更新或删除数据后,**主动清除**相关缓存,不依赖过期自动失效
|
||||
- 缓存时间:频繁更新的数据(配置、状态)用较短时间(5~30 分钟);基本不变的数据(字典、枚举)可用更长时间
|
||||
- 缓存穿透场景:查询结果为空时也写入短时缓存(如 1 分钟)防止击穿
|
||||
|
||||
---
|
||||
|
||||
## 日志规范
|
||||
|
||||
### 日志级别选择
|
||||
|
||||
| 级别 | 方法 | 适用场景 |
|
||||
|------|------|---------|
|
||||
| Info | `g.Log().Info` / `g.Log().Infof` | 正常业务流程的关键节点(登录成功、订单创建、支付回调等) |
|
||||
| Warning | `g.Log().Warning` / `g.Log().Warningf` | **遇到错误但不影响主流程**(重试、降级、外部服务异常、非致命校验失败) |
|
||||
| Panic | `g.Log().Panic` / `g.Log().Panicf` | 极其严重、必须立即终止的情况(配置缺失、核心依赖不可用) |
|
||||
|
||||
### 使用示例
|
||||
|
||||
```go
|
||||
// Info:记录正常流程关键事件
|
||||
g.Log().Infof(ctx, "用户登录成功 uid:%d ip:%s", member.Id, ip)
|
||||
|
||||
// Info:记录外部调用结果
|
||||
g.Log().Info(ctx, "支付回调处理完成", g.Map{"orderId": orderId, "status": status})
|
||||
|
||||
// Warning:外部接口失败但已降级处理
|
||||
g.Log().Warningf(ctx, "短信发送失败,已跳过 mobile:%s err:%+v", mobile, err)
|
||||
|
||||
// Warning:业务异常但不中断流程
|
||||
g.Log().Warning(ctx, "用户余额不足,跳过自动扣款", g.Map{"uid": uid, "balance": balance})
|
||||
|
||||
// Panic:启动时核心配置缺失
|
||||
g.Log().Panicf(ctx, "缓存未初始化,无法启动: %+v", err)
|
||||
```
|
||||
|
||||
### 日志上下文原则
|
||||
|
||||
- 日志**必须传入 `ctx`**(第一个参数),便于链路追踪
|
||||
- 关键日志需携带足够的业务字段(uid、orderId、requestId 等),用 `g.Map{}` 附加结构化信息
|
||||
- **禁止**用 `fmt.Println` 替代日志,禁止在 logic/controller 层裸打印调试信息
|
||||
|
||||
---
|
||||
|
||||
## 数据库建表约定
|
||||
|
||||
建表时遵循以下字段命名约定,代码生成器和 ORM hook 会自动识别并处理:
|
||||
|
||||
| 字段名 | 类型 | 说明 |
|
||||
|--------|------|------|
|
||||
| `id` | bigint(20) NOT NULL AUTO_INCREMENT | 主键,必须 |
|
||||
| `created_at` | datetime | 创建时间,**自动写入**,禁止手动赋值 |
|
||||
| `updated_at` | datetime | 更新时间,**自动维护**,禁止手动赋值 |
|
||||
| `deleted_at` | datetime | 软删除时间,存在时查询自动加 `IS NULL`,删除只更新此字段 |
|
||||
| `created_by` | bigint(20) | 创建者 ID,**自动写入** |
|
||||
| `updated_by` | bigint(20) | 更新者 ID,**自动维护** |
|
||||
| `deleted_by` | bigint(20) | 删除者 ID,**自动写入** |
|
||||
| `status` | tinyint | 状态字段,默认使用系统字典 `sys_normal_disable` |
|
||||
| `sort` | int | 排序字段,存在时编辑表单自动获取最大值+1填充 |
|
||||
| `pid` | bigint(20) | 树表上级ID(树表必须) |
|
||||
| `level` | int | 树等级(树表必须,自动维护) |
|
||||
| `tree` | varchar(512) | 关系树(树表必须,自动维护) |
|
||||
| `tenant_id` | bigint(20) | 租户ID(多租户场景按需加) |
|
||||
|
||||
**特殊字段查询方式(代码生成器默认生成):**
|
||||
- `string` 类型字段 → `LIKE` 模糊查询
|
||||
- `int/uint/int64` → `=` 精确查询
|
||||
- `created_by`/`updated_by`/`deleted_by` → 关键词查询(ID/用户名/手机号匹配),调用 `service.AdminMember().GetIdsByKeyword()`
|
||||
|
||||
**数据类型 → Go 类型映射(影响生成代码的字段类型):**
|
||||
- `tinyint/int/smallint` → `int`;加 `unsigned` → `uint`
|
||||
- `bigint` → `int64`;加 `unsigned` → `uint64`
|
||||
- `varchar/text/char` → `string`
|
||||
- `datetime/timestamp` → `*gtime.Time`
|
||||
- `json/jsonb` → `*gjson.Json`
|
||||
- `decimal/float/double` → `float64`
|
||||
|
||||
---
|
||||
|
||||
## 数据权限(权限过滤)
|
||||
|
||||
业务查询中如需过滤数据权限(仅自己/所属部门/下级等),在 ORM 链式调用中加入 handler:
|
||||
|
||||
```go
|
||||
import "hotgo/internal/library/hgorm/handler"
|
||||
|
||||
// 按登录用户的数据权限范围过滤(表需含 created_by 或 member_id 字段)
|
||||
dao.XxxTable.Ctx(ctx).Handler(handler.FilterAuth).Scan(&res)
|
||||
|
||||
// 表中无标准字段时,指定自定义字段
|
||||
dao.XxxTable.Ctx(ctx).Handler(handler.FilterAuthWithField("custom_field")).Scan(&res)
|
||||
|
||||
// 多租户数据权限过滤(表需含 tenant_id 字段)
|
||||
// 在 Model() 方法中通过 handler.Option 开启
|
||||
func (s *sSysXxx) Model(ctx context.Context, option ...*handler.Option) *gdb.Model {
|
||||
if len(option) == 0 {
|
||||
option = append(option, &handler.Option{FilterTenant: true})
|
||||
}
|
||||
return handler.Model(dao.XxxTable.Ctx(ctx), option...)
|
||||
}
|
||||
```
|
||||
|
||||
多租户增改时自动维护租户关系,在 ORM 操作后加 `.Hook(hook.SaveTenant)`:
|
||||
|
||||
```go
|
||||
import "hotgo/internal/library/hgorm/hook"
|
||||
|
||||
// 新增时自动写入 tenant_id/merchant_id/user_id
|
||||
dao.XxxTable.Ctx(ctx).Fields(sysin.XxxInsertFields{}).Hook(hook.SaveTenant).Data(in).Insert()
|
||||
|
||||
// 更新时自动维护
|
||||
s.Model(ctx).Fields(sysin.XxxUpdateFields{}).WherePri(in.Id).Data(in).Hook(hook.SaveTenant).Update()
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 定时任务(Crons)
|
||||
|
||||
定时任务通过实现接口 + `init()` 注册,在后台「系统设置 → 定时任务」中配置执行策略:
|
||||
|
||||
**主模块**:新建 `server/internal/crons/<name>.go`
|
||||
**插件**:新建 `server/addons/<addonName>/crons/<name>.go`
|
||||
|
||||
```go
|
||||
package crons
|
||||
|
||||
import (
|
||||
"context"
|
||||
"hotgo/internal/library/cron"
|
||||
)
|
||||
|
||||
func init() {
|
||||
cron.Register(MyTask)
|
||||
}
|
||||
|
||||
var MyTask = &cMyTask{name: "myTask"} // name 与后台配置的任务名称一致
|
||||
|
||||
type cMyTask struct{ name string }
|
||||
|
||||
func (c *cMyTask) GetName() string { return c.name }
|
||||
|
||||
func (c *cMyTask) Execute(ctx context.Context, parser *cron.Parser) (err error) {
|
||||
parser.Logger.Infof(ctx, "任务执行:%v", ...)
|
||||
return
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 消息队列(Queues)
|
||||
|
||||
队列采用接口 + `init()` 注册,topic 统一定义在 `internal/consts/queue.go`(或对应模块 consts 文件)。
|
||||
|
||||
**主模块**:新建 `server/internal/queues/<name>.go`
|
||||
**插件**:新建 `server/addons/<addonName>/queues/<name>.go`
|
||||
|
||||
```go
|
||||
package queues
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"hotgo/internal/consts"
|
||||
"hotgo/internal/library/queue"
|
||||
)
|
||||
|
||||
func init() {
|
||||
queue.RegisterConsumer(MyConsumer)
|
||||
}
|
||||
|
||||
var MyConsumer = &qMyConsumer{}
|
||||
|
||||
type qMyConsumer struct{}
|
||||
|
||||
func (q *qMyConsumer) GetTopic() string { return consts.QueueMyTopic }
|
||||
|
||||
func (q *qMyConsumer) Handle(ctx context.Context, mqMsg queue.MqMsg) (err error) {
|
||||
var data MyData
|
||||
if err = json.Unmarshal(mqMsg.Body, &data); err != nil {
|
||||
return
|
||||
}
|
||||
// 处理消息...
|
||||
return
|
||||
}
|
||||
```
|
||||
|
||||
**发送消息:**
|
||||
|
||||
```go
|
||||
// 即时消息
|
||||
queue.Push(consts.QueueMyTopic, data)
|
||||
|
||||
// 延迟消息(仅 redis/rocketmq 驱动支持)
|
||||
queue.SendDelayMsg(consts.QueueMyTopic, data, 10) // redis: 延迟秒数;rocketmq: 延迟级别
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 工具库使用规范
|
||||
|
||||
**后端(`server/utility/`)优先使用已有工具,禁止重复造轮子:**
|
||||
|
||||
| 包 | 用途 |
|
||||
|----|------|
|
||||
| `utility/convert` | 数据类型转换 |
|
||||
| `utility/encrypt` | 加密/解密 |
|
||||
| `utility/excel` | 电子表格导出/导入(导出接口用此包) |
|
||||
| `utility/validate` | 数据验证工具 |
|
||||
| `utility/tree` | 树形结构处理 |
|
||||
| `utility/simple` | 简捷函数集合 |
|
||||
| `utility/format` | 数据格式化 |
|
||||
|
||||
**前端(`web/src/utils/`)优先使用已有工具:**
|
||||
|
||||
| 工具 | 用途 |
|
||||
|------|------|
|
||||
| `@/utils/http/axios`(`http.request`) | HTTP 请求,**唯一入口** |
|
||||
| `@/utils/dateUtil`(`defRangeShortcuts`) | 日期范围快捷选项 |
|
||||
| `@/utils`(`renderImage`、`renderFile`、`renderPopoverMemberSumma`) | 表格渲染工具函数 |
|
||||
| `@/store/modules/dict`(`useDictStore`) | 字典数据加载与渲染 |
|
||||
| `@/hooks/web/usePermission`(`hasPermission`) | 权限判断 |
|
||||
|
||||
---
|
||||
|
||||
## 树表(Tree CRUD)特殊约定
|
||||
|
||||
树表在普通 CRUD 基础上有以下差异:
|
||||
|
||||
- 表中必须含 `pid`、`level`、`tree` 字段(参见建表约定)
|
||||
- `pid`/`level`/`tree` 字段**由系统自动维护**,禁止在编辑表单中手动设置这三个字段
|
||||
- 前端列表页使用树形表格(`BasicTable` 的 `childrenKey` 或 `treeData` 模式),而非普通分页列表
|
||||
- 参考实现:`server/internal/logic/sys/tree_demo.go`、`web/src/views/develop/curd/treeDemo/`
|
||||
|
||||
---
|
||||
|
||||
## 响应格式约定
|
||||
|
||||
所有接口统一响应格式(由框架中间件自动处理,**无需在 controller 手动包装**):
|
||||
|
||||
```json
|
||||
{ "code": 0, "message": "操作成功", "timestamp": 1234567890, "traceID": "xxx", "data": {} }
|
||||
```
|
||||
|
||||
- 成功状态码:`0`;失败状态码:`-1`(GoFrame 内置,无需手动设置)
|
||||
- `gerror.Wrap(err, "用户友好的提示")` → 客户端只看到最外层提示,开发者日志可见完整堆栈
|
||||
- 禁止在 controller 层手动 `Write`/`WriteJSON` 等直接写响应(破坏统一格式)
|
||||
|
||||
---
|
||||
|
||||
## 常见错误禁止清单
|
||||
|
||||
**后端:**
|
||||
- 禁止在 controller 层直接调用 dao
|
||||
- 禁止硬编码字段名字符串(用 `dao.Table.Columns().Field`)
|
||||
- 禁止手改 `entity/`、`do/`、`dao/internal/` 目录下的文件
|
||||
- 禁止在 logic 层重复做 `Filter()` 已完成的校验
|
||||
- 禁止在 `internal/service/sys.go` 之外新建主模块 service 文件(同文件追加)
|
||||
- 禁止插件 import 另一个插件的包(插件间完全隔离,通过主模块 service 通信)
|
||||
- 禁止在插件路由文件里硬编码路由前缀(用 `addons.RouterPrefix()` 生成)
|
||||
- 禁止在 `internal/library/` 下修改基础库(如需扩展,提 issue 或在 utility/ 添加)
|
||||
|
||||
**前端:**
|
||||
- 禁止直接使用 axios,必须用 `http.request`
|
||||
- 禁止硬编码字典值文本,必须用 `dict.getLabel()` 渲染
|
||||
- 禁止引入 Naive UI 以外的 UI 框架
|
||||
- 禁止内联 style
|
||||
- 禁止在源码里硬编码菜单路由路径
|
||||
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2021-present HotGo
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
@@ -1,2 +1,167 @@
|
||||
# olons_admin
|
||||
# HotGo-V2
|
||||
<div align="center">
|
||||
<img width="140px" src="https://gmycos.facms.cn/hotgo/logo.sig.png">
|
||||
<p>
|
||||
<h1>HotGo V2</h1>
|
||||
</p>
|
||||
<p align="center">
|
||||
<a href="https://goframe.org/pages/viewpage.action?pageId=1114119" target="_blank">
|
||||
<img src="https://img.shields.io/badge/goframe-2.10.0-green" alt="goframe">
|
||||
</a>
|
||||
<a href="https://v3.vuejs.org/" target="_blank">
|
||||
<img src="https://img.shields.io/badge/vue.js-vue3.4-green" alt="vue">
|
||||
</a>
|
||||
<a href="https://www.naiveui.com" target="_blank">
|
||||
<img src="https://img.shields.io/badge/naiveui-%3E2.44.1-blue" alt="naiveui">
|
||||
</a>
|
||||
<a href="https://www.tslang.cn/" target="_blank">
|
||||
<img src="https://img.shields.io/badge/typescript-%3E4.0.0-blue" alt="typescript">
|
||||
</a>
|
||||
<a href="https://vitejs.dev/" target="_blank">
|
||||
<img src="https://img.shields.io/badge/vite-%3E5.4.2-yellow" alt="vite">
|
||||
</a>
|
||||
<a href="https://github.com/bufanyun/hotgo/blob/v2.0/LICENSE" target="_blank">
|
||||
<img src="https://img.shields.io/badge/license-MIT-success" alt="license">
|
||||
</a>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
|
||||
## 平台简介
|
||||
* 基于 GoFrame2 + Vue3 + NaiveUI + uniapp 的企业级全栈框架,为二次开发而生。
|
||||
* 前端采用 Naive-Ui-Admin、Vue、Naive UI、uniapp。
|
||||
* 企业级 AI 赋能基础开发平台,内置 AI 开发规范,适配主流 AI 开发工具,实现人机协同开发,大幅提升开发效率。
|
||||
|
||||
## 演示地址
|
||||
- [https://hotgo.facms.cn/admin](https://hotgo.facms.cn/admin)
|
||||
> 账号:admin 密码:123456
|
||||
|
||||
### 使用文档
|
||||
|
||||
[安装文档](docs/guide-zh-CN/start-installation.md) · [本地文档](docs/guide-zh-CN/README.md) · [更新历史](docs/guide-zh-CN/start-update-log.md) · [常见问题](docs/guide-zh-CN/start-issue.md)
|
||||
|
||||
|
||||
## 特征
|
||||
* 高生产率:极强的可扩展性,应用化、模块化、插件化机制敏捷开发,几分钟即可搭建一个应用开发骨架。
|
||||
* 多应用入口:多入口分为 Admin (后台)、Home (前台页面)、Api (对外通用接口)、WebSocket (即时通讯接口),不同的业务,进入不同的应用入口。
|
||||
* 极致的插件化: 微核架构,功能隔离,高可定制性,可以渐进式开发,亦可以多人协同开发。支持一键创建插件模板、一键安装、更新、卸载插件、可以非常方便的将插件迁移到新项目中。
|
||||
* 快速生成代码:无需编写代码,只需创建表进行简单配置就能生成一个完善的 CURD、树表等常用的开发代码,其中所需表单控件也是勾选即可直接生成。
|
||||
* 认证机制:采用 JWT 的用户状态认证及 casbin 的权限认证
|
||||
* 路由模式:得益于 GoFrame 提供了规范化的路由注册方式,无需注解自动生成api文档
|
||||
* 模块化设计,面向接口开发
|
||||
|
||||
|
||||
## 内置功能
|
||||
1. 用户管理:用户是系统操作者,该功能主要完成系统用户配置。
|
||||
2. 部门管理:配置系统组织机构(公司、部门、岗位),树结构展现支持数据权限。
|
||||
3. 岗位管理:配置系统用户所属担任职务。
|
||||
4. 菜单管理:配置系统菜单,操作权限,按钮权限标识等。
|
||||
5. 角色管理:角色菜单权限分配、设置角色按机构或按上下级关系进行数据范围权限划分。
|
||||
6. 字典管理:对系统中经常使用的一些特定数据进行维护,支持枚举字典和自定义方法字典。
|
||||
7. 配置管理:对系统动态配置常用参数。
|
||||
8. 操作日志:系统正常操作日志记录和查询;系统异常信息日志记录和查询。
|
||||
9. 登录日志:系统登录日志记录查询包含登录异常。
|
||||
10. 服务日志:服务端运行所产生的警告、异常、崩溃日志的详细数据和堆栈信息。
|
||||
11. 支付网关:集成支付宝、微信支付、QQ支付等多种支付方式,只需简单配置即可使用。
|
||||
12. 资金管理:支持在线充值、订单申请/原路退款、资金提现、资金/积分变动明细等通用模块。
|
||||
13. 在线用户:当前系统中活跃用户状态监控。
|
||||
14. 定时任务:在线(添加、修改、删除)任务调度包含执行结果日志。
|
||||
15. 代码生成:支持自动化生成前后端代码。CURD关联表、树表、消息队列、定时任务一键生成等。
|
||||
16. 插件应用:支持一键生成插件模板,每个插件之间开发隔离,拥有独立多应用入口、独立配置。完美支持多人协同开发、插件插拔不会对原系统产生影响等。
|
||||
17. 服务监控:监视当前系统CPU、内存、磁盘、网络、堆栈等相关信息。
|
||||
18. 附件管理:文件图片上传,大文件分片上传、断点续传,支持本地、阿里云oss、腾讯云cos、ucloud对象存储、七牛云对象存储、minio等多种上传驱动,后台一键切换配置,并集成了文件选择器。
|
||||
19. TCP服务:基于gtcp的服务应用,支持长连接、断线重连、服务认证、路由分发、RPC消息、拦截器和数据绑定等。简化和规范了服务器开发流程。
|
||||
20. 消息队列:同时兼容 kafka、redis、rocketmq、磁盘队列,一键配置切换到场景适用的MQ。
|
||||
21. 通知公告:采用WebSocket实时推送在线用户最新通知、公告、私信消息。
|
||||
22. 地区编码:整合国内通用省市区编码,运用于项目于一身,支持动态省市区选项。
|
||||
23. 常用工具:集成常用的工具包和命令行工具,可以快速开发自定义命令行,多种启动入口。
|
||||
|
||||
|
||||
> HotGo开源以来得到了大家的很多支持,本项目初衷只为互相学习交流,没有任何盈利性目的!欢迎为HotGo贡献代码或提供建议!
|
||||
|
||||
|
||||
## 演示图
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td><img src="./docs/guide-zh-CN/images/demo/1.png"/></td>
|
||||
<td><img src="./docs/guide-zh-CN/images/demo/2.png"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><img src="./docs/guide-zh-CN/images/demo/3.png"/></td>
|
||||
<td><img src="./docs/guide-zh-CN/images/demo/4.png"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><img src="./docs/guide-zh-CN/images/demo/5.png"/></td>
|
||||
<td><img src="./docs/guide-zh-CN/images/demo/6.png"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><img src="./docs/guide-zh-CN/images/demo/7.png"/></td>
|
||||
<td><img src="./docs/guide-zh-CN/images/demo/8.png"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><img src="./docs/guide-zh-CN/images/demo/9.png"/></td>
|
||||
<td><img src="./docs/guide-zh-CN/images/demo/10.png"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><img src="./docs/guide-zh-CN/images/demo/11.png"/></td>
|
||||
<td><img src="./docs/guide-zh-CN/images/demo/12.png"/></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
|
||||
## 感谢(排名不分先后)
|
||||
> gf框架 [https://github.com/gogf/gf](https://github.com/gogf/gf)
|
||||
>
|
||||
> naive-ui [https://www.naiveui.com](https://www.naiveui.com)
|
||||
>
|
||||
> naive-ui-admin [https://github.com/jekip/naive-ui-admin](https://github.com/jekip/naive-ui-admin)
|
||||
>
|
||||
> 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群
|
||||
交流群①:190966648 <a target="_blank" href="https://qm.qq.com/cgi-bin/qm/qr?k=mJafkvme3VNyiQlCFIFNRtY8Xlr7pj9U&jump_from=webapi&authKey=jL10vIESr+vO8wpxwyd6DlChzkrbHpzN9uhAsIHgAinL/Vvd+nvuRyilf2UqUlCy"><img border="0" src="https://gmycos.facms.cn/hotgo/group.png" alt="HotGo框架交流1群" title="HotGo框架交流1群"></a>
|
||||
> <img src="https://gmycos.facms.cn/hotgo/hotgo1qun.png" width="400px"/>
|
||||
|
||||
|
||||
## 商用说明
|
||||
|
||||
> HotGo 是开源免费的,遵循 MIT 开源协议,意味着您无需支付任何费用,也无需授权,即可将它应用到您的产品中。
|
||||
|
||||
* 使用本项目必须保留所有版权信息。
|
||||
|
||||
* 本项目包含的第三方源码和二进制文件之版权信息另行标注。
|
||||
|
||||
* 版权所有Copyright © 2020-2026 by Ms (https://github.com/bufanyun/hotgo)
|
||||
|
||||
* All rights reserved。
|
||||
|
||||
|
||||
## 免责声明:
|
||||
* HotGo为开源学习项目,一切商业行为与HotGo无关。
|
||||
|
||||
* 用户不得利用HotGo从事非法行为,用户应当合法合规的使用,发现用户在使用产品时有任何的非法行为,HotGo有权配合有关机关进行调查或向政府部门举报,HotGo不承担用户因非法行为造成的任何法律责任,一切法律责任由用户自行承担,如因用户使用造成第三方损害的,用户应当依法予以赔偿。
|
||||
|
||||
* 所有与使用HotGo相关的资源直接风险均由用户承担。
|
||||
|
||||
|
||||
#### 如果对您有帮助,您可以点右上角 💘Star💘支持
|
||||
|
||||
|
||||
|
||||
## [感谢JetBrains提供的免费GoLand](https://jb.gg/OpenSource)
|
||||
[](https://jb.gg/OpenSource)
|
||||
|
||||
|
||||
## License
|
||||
[MIT © HotGo-2026](./LICENSE)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
+187
@@ -0,0 +1,187 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport"
|
||||
content="width=device-width, initial-scale=1, minimum-scale=1.0, shrink-to-fit=no, viewport-fit=cover">
|
||||
|
||||
<!-- Replace with your own title and description. -->
|
||||
<title>HotGo-V2</title>
|
||||
<meta name="description" content="基于全新GoFrame2+Vue3+NaiveUI+uniapp开发的全栖框架,为二次开发而生,适合中小型完整应用开发。">
|
||||
|
||||
<!-- Default Theme (see //docsify.js.org/#/themes) -->
|
||||
<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/docsify@4/lib/themes/vue.css">
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
|
||||
<script>
|
||||
// Docsify Configuration (see //docsify.js.org/#/configuration)
|
||||
window.$docsify = {
|
||||
name: "HotGo-V2",
|
||||
nameLink: {
|
||||
'/': '/hotgo/',
|
||||
},
|
||||
relativePath: true,
|
||||
// alias: {
|
||||
// "/.*/_navbar.md": "/_navbar.md",
|
||||
// },
|
||||
// themeColor: "#42b983",
|
||||
// logo: "//bufanyun.cn-bj.ufileos.com/hotgo/logo.sig.png",
|
||||
// coverpage: true,
|
||||
// homepage: "README.md",
|
||||
|
||||
// Sidebar Configuration
|
||||
auto2top: true,
|
||||
loadSidebar: "sidebar.md",
|
||||
// maxLevel: 2,
|
||||
// Set subMaxLevel to 0 to remove automatic display of page table of contents (TOC) in Sidebar
|
||||
// subMaxLevel: 3,
|
||||
|
||||
// Navbar Configuration
|
||||
// loadNavbar: true,
|
||||
|
||||
// Search Plugin Configuration
|
||||
search: {
|
||||
placeholder: {
|
||||
"/": "搜索",
|
||||
// "/": "Type to search"
|
||||
},
|
||||
noData: {
|
||||
"/": "找不到结果",
|
||||
// "/": "No Results"
|
||||
},
|
||||
// Headline depth, 1 - 6
|
||||
// depth: 2,
|
||||
},
|
||||
|
||||
// Flexible-alerts Plugin Configuration
|
||||
"flexible-alerts": {
|
||||
important: {
|
||||
label: "Important",
|
||||
|
||||
// localization
|
||||
label: {
|
||||
// "/zh-cn": "重要",
|
||||
"/": "Important"
|
||||
},
|
||||
|
||||
// Assuming that we use Font Awesome
|
||||
icon: "far fa-message",
|
||||
className: "important"
|
||||
},
|
||||
warning: {
|
||||
label: "Warning",
|
||||
|
||||
// localization
|
||||
label: {
|
||||
// "/zh-cn": "警告",
|
||||
"/": "Warning"
|
||||
},
|
||||
|
||||
// Assuming that we use Font Awesome
|
||||
icon: "fas fa-triangle-exclamation",
|
||||
className: "warning"
|
||||
},
|
||||
caution: {
|
||||
label: "Caution",
|
||||
|
||||
// localization
|
||||
label: {
|
||||
// "/zh-cn": "注意",
|
||||
"/": "Caution"
|
||||
},
|
||||
|
||||
// Assuming that we use Font Awesome
|
||||
icon: "fas fa-circle-exclamation",
|
||||
className: "attention"
|
||||
},
|
||||
},
|
||||
|
||||
// Hide-code Plugin Configuration
|
||||
hideCode: {
|
||||
// scroll: false, // Enable scrolling
|
||||
height: 300 // Max height
|
||||
},
|
||||
|
||||
// Versioned Plugin Configuration
|
||||
// versions: [
|
||||
// { folder: "/", label: "v2", default: true },
|
||||
// ],
|
||||
// versionSelectorLabel: "Version",
|
||||
|
||||
// Progress Plugin Configuration
|
||||
progress: {
|
||||
position: "top",
|
||||
// color: "var(--theme-color,#42b983)",
|
||||
height: "3px",
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<!-- Required -->
|
||||
<script src="//cdn.jsdelivr.net/npm/docsify@4/lib/docsify.min.js"></script>
|
||||
|
||||
<!-- Recommended -->
|
||||
<script src="//cdn.jsdelivr.net/npm/docsify@4/lib/plugins/zoom-image.min.js"></script>
|
||||
<script src="//cdn.jsdelivr.net/npm/docsify@4/lib/plugins/search.js"></script>
|
||||
<script src="//cdn.jsdelivr.net/npm/docsify-copy-code/dist/docsify-copy-code.min.js"></script>
|
||||
<script src="//cdn.jsdelivr.net/npm/docsify-pagination/dist/docsify-pagination.min.js"></script>
|
||||
<script src="//cdn.jsdelivr.net/npm/docsify-hide-code/dist/docsify-hide-code.min.js"></script>
|
||||
<script src="//cdn.jsdelivr.net/npm/docsify-progress@latest/dist/progress.min.js"></script>
|
||||
<script src="//cdn.jsdelivr.net/npm/docsify-example-panels"></script>
|
||||
|
||||
<!-- Prism code highlight -->
|
||||
<script src="//cdn.jsdelivr.net/npm/prismjs@1/components/prism-bash.min.js"></script>
|
||||
<script src="//cdn.jsdelivr.net/npm/prismjs@1/components/prism-matlab.min.js"></script>
|
||||
<script src="//cdn.jsdelivr.net/npm/prismjs@1.29.0/components/prism-go.min.js"></script>
|
||||
<script src="//cdn.jsdelivr.net/npm/prismjs@1.29.0/components/prism-yaml.min.js"></script>
|
||||
<script src="//cdn.jsdelivr.net/npm/prismjs@1.29.0/components/prism-vue.min.js"></script>
|
||||
<script src="//cdn.jsdelivr.net/npm/prismjs@1.29.0/components/prism-json.min.js"></script>
|
||||
<script src="//cdn.jsdelivr.net/npm/prismjs@1.29.0/components/prism-sql.min.js"></script>
|
||||
|
||||
<!--mermaid插件-->
|
||||
<script type="module">
|
||||
import mermaid from "https://cdn.jsdelivr.net/npm/mermaid@10/dist/mermaid.esm.min.mjs";
|
||||
mermaid.initialize({ startOnLoad: true });
|
||||
window.mermaid = mermaid;
|
||||
</script>
|
||||
<script src="//unpkg.com/docsify-mermaid@2.0.1/dist/docsify-mermaid.js"></script>
|
||||
|
||||
<!-- docsify-dark-switcher -->
|
||||
<script src="//cdn.jsdelivr.net/gh/LIGMATV/docsify-dark-switcher@latest/docsify-dark-switcher.js"></script>
|
||||
<style>
|
||||
:root {
|
||||
--dark-base-background: #222;
|
||||
--dark-base-color: #bbc0c4;
|
||||
--dark-theme-color: var(--theme-color, #42b983);
|
||||
--dark-code-color: var(--dark-color);
|
||||
--dark-heading-color: var(--dark-theme-color);
|
||||
--dark-cover-background: #000000a8;
|
||||
--dark-code-background: #303030;
|
||||
--dark-tip-background: #2c0000;
|
||||
--dark-warn-background: #005842;
|
||||
--dark-icon-size: 25px;
|
||||
--dark-icon-transition: .1s ease-in-out .1s;
|
||||
--dark-moon-color: #000000;
|
||||
--dark-sun-color: #ffffff;
|
||||
}
|
||||
</style>
|
||||
|
||||
<!-- docsify-plugin-flexible-alerts -->
|
||||
<script src="//cdn.jsdelivr.net/npm/docsify-plugin-flexible-alerts/dist/docsify-plugin-flexible-alerts.min.js"></script>
|
||||
<script src="//cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free/js/all.min.js"></script>
|
||||
<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free/css/fontawesome.min.css">
|
||||
|
||||
<!-- docsify-versioned-plugin -->
|
||||
<!-- <script src="//cdn.jsdelivr.net/npm/docsify-versioned-plugin@0.0.1/index.js"></script>
|
||||
<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/docsify-versioned-plugin@0.0.1/styles.css"> -->
|
||||
|
||||
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@@ -0,0 +1 @@
|
||||
* linguist-language=GO
|
||||
@@ -0,0 +1,39 @@
|
||||
.buildpath
|
||||
.hgignore.swp
|
||||
.project
|
||||
.orig
|
||||
.swp
|
||||
.idea/
|
||||
.settings/
|
||||
.vscode/
|
||||
vendor/
|
||||
composer.lock
|
||||
pkg/
|
||||
cbuild
|
||||
**/.DS_Store
|
||||
/test/
|
||||
main
|
||||
output/
|
||||
manifest/config/config.yaml
|
||||
manifest/output/
|
||||
resource/log/
|
||||
resource/public/admin/
|
||||
resource/public/attachment/
|
||||
storage/cache/
|
||||
storage/diskqueue/
|
||||
storage/cert/ssl/server.crt
|
||||
storage/cert/ssl/server.key
|
||||
storage/cert/pay/alipay/
|
||||
storage/cert/pay/wxpay/
|
||||
temp/
|
||||
logs/
|
||||
main.exe
|
||||
main.exe~
|
||||
*.exe
|
||||
*.log
|
||||
*.zip
|
||||
.idea
|
||||
!hotgo/
|
||||
*.lock
|
||||
/bin/package.sh
|
||||
internal/packed/packed.go
|
||||
@@ -0,0 +1,287 @@
|
||||
## This file contains all available configuration options
|
||||
## with their default values.
|
||||
|
||||
# See https://github.com/golangci/golangci-lint#config-file
|
||||
# See https://golangci-lint.run/usage/configuration/
|
||||
|
||||
# Options for analysis running.
|
||||
run:
|
||||
# Exit code when at least one issue was found.
|
||||
# Default: 1
|
||||
issues-exit-code: 2
|
||||
|
||||
# Include test files or not.
|
||||
# Default: true
|
||||
tests: false
|
||||
go: "1.20"
|
||||
|
||||
# Which dirs to skip: issues from them won't be reported.
|
||||
# Can use regexp here: `generated.*`, regexp is applied on full path.
|
||||
# Default value is empty list,
|
||||
# but default dirs are skipped independently of this option's value (see skip-dirs-use-default).
|
||||
# "/" will be replaced by current OS file path separator to properly work on Windows.
|
||||
# skip-dirs:
|
||||
# - internal/library/hggen/internal
|
||||
|
||||
# Which files to skip: they will be analyzed, but issues from them won't be reported.
|
||||
# Default value is empty list,
|
||||
# but there is no need to include all autogenerated files,
|
||||
# we confidently recognize autogenerated files.
|
||||
# If it's not please let us know.
|
||||
# "/" will be replaced by current OS file path separator to properly work on Windows.
|
||||
# skip-files: []
|
||||
|
||||
|
||||
# Main linters configurations.
|
||||
# See https://golangci-lint.run/usage/linters
|
||||
linters:
|
||||
# Disable all default enabled linters.
|
||||
disable-all: true
|
||||
# Custom enable linters we want to use.
|
||||
enable:
|
||||
- errcheck # Errcheck is a program for checking for unchecked errors in go programs.
|
||||
- errchkjson # Checks types passed to the json encoding functions. Reports unsupported types and optionally reports occasions, where the check for the returned error can be omitted.
|
||||
- funlen # Tool for detection of long functions
|
||||
- goconst # Finds repeated strings that could be replaced by a constant
|
||||
- gocritic # Provides diagnostics that check for bugs, performance and style issues.
|
||||
# - gofmt # Gofmt checks whether code was gofmt-ed. By default this tool runs with -s option to check for code simplification
|
||||
- gosimple # Linter for Go source code that specializes in simplifying code
|
||||
- govet # Vet examines Go source code and reports suspicious constructs, such as Printf calls whose arguments do not align with the format string
|
||||
- misspell # Finds commonly misspelled English words in comments
|
||||
- nolintlint # Reports ill-formed or insufficient nolint directives
|
||||
- revive # Fast, configurable, extensible, flexible, and beautiful linter for Go. Drop-in replacement of golint.
|
||||
- staticcheck # It's a set of rules from staticcheck. It's not the same thing as the staticcheck binary.
|
||||
- typecheck # Like the front-end of a Go compiler, parses and type-checks Go code
|
||||
- usestdlibvars # A linter that detect the possibility to use variables/constants from the Go standard library.
|
||||
- whitespace # Tool for detection of leading and trailing whitespace
|
||||
|
||||
|
||||
issues:
|
||||
exclude-rules:
|
||||
# helpers in tests often (rightfully) pass a *testing.T as their first argument
|
||||
- path: _test\.go
|
||||
text: "context.Context should be the first parameter of a function"
|
||||
linters:
|
||||
- revive
|
||||
# Yes, they are, but it's okay in a test
|
||||
- path: _test\.go
|
||||
text: "exported func.*returns unexported type.*which can be annoying to use"
|
||||
linters:
|
||||
- revive
|
||||
# https://github.com/go-critic/go-critic/issues/926
|
||||
- linters:
|
||||
- gocritic
|
||||
text: "unnecessaryDefer:"
|
||||
exclude-dirs:
|
||||
- internal/library/hggen/internal
|
||||
exclude-files: []
|
||||
|
||||
|
||||
# https://golangci-lint.run/usage/linters
|
||||
linters-settings:
|
||||
# https://golangci-lint.run/usage/linters/#misspell
|
||||
misspell:
|
||||
locale: US
|
||||
ignore-words:
|
||||
- cancelled
|
||||
|
||||
# https://golangci-lint.run/usage/linters/#revive
|
||||
# https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md
|
||||
revive:
|
||||
ignore-generated-header: true
|
||||
severity: error
|
||||
rules:
|
||||
- name: atomic
|
||||
- name: line-length-limit
|
||||
severity: error
|
||||
arguments: [ 1024 ]
|
||||
- name: unhandled-error
|
||||
severity: warning
|
||||
disabled: true
|
||||
arguments: []
|
||||
- name: var-naming
|
||||
severity: warning
|
||||
disabled: true
|
||||
arguments:
|
||||
# AllowList
|
||||
- [ "ID","URL","IP","HTTP","JSON","API","UID","Id","Api","Uid","Http","Json","Ip","Url" ]
|
||||
# DenyList
|
||||
- [ "VM" ]
|
||||
- name: string-format
|
||||
severity: warning
|
||||
disabled: false
|
||||
arguments:
|
||||
- - 'core.WriteError[1].Message'
|
||||
- '/^([^A-Z]|$)/'
|
||||
- must not start with a capital letter
|
||||
- - 'fmt.Errorf[0]'
|
||||
- '/(^|[^\.!?])$/'
|
||||
- must not end in punctuation
|
||||
- - panic
|
||||
- '/^[^\n]*$/'
|
||||
- must not contain line breaks
|
||||
- name: function-result-limit
|
||||
severity: warning
|
||||
disabled: false
|
||||
arguments: [ 4 ]
|
||||
|
||||
# https://golangci-lint.run/usage/linters/#funlen
|
||||
funlen:
|
||||
# Checks the number of lines in a function.
|
||||
# If lower than 0, disable the check.
|
||||
# Default: 60
|
||||
lines: 330
|
||||
# Checks the number of statements in a function.
|
||||
# If lower than 0, disable the check.
|
||||
# Default: 40
|
||||
statements: -1
|
||||
|
||||
# https://golangci-lint.run/usage/linters/#goconst
|
||||
goconst:
|
||||
# Minimal length of string constant.
|
||||
# Default: 3
|
||||
min-len: 4
|
||||
# Minimum occurrences of constant string count to trigger issue.
|
||||
# Default: 3
|
||||
# For subsequent optimization, the value is reduced.
|
||||
min-occurrences: 30
|
||||
# Ignore test files.
|
||||
# Default: false
|
||||
ignore-tests: true
|
||||
# Look for existing constants matching the values.
|
||||
# Default: true
|
||||
match-constant: false
|
||||
# Search also for duplicated numbers.
|
||||
# Default: false
|
||||
numbers: true
|
||||
# Minimum value, only works with goconst.numbers
|
||||
# Default: 3
|
||||
min: 5
|
||||
# Maximum value, only works with goconst.numbers
|
||||
# Default: 3
|
||||
max: 20
|
||||
# Ignore when constant is not used as function argument.
|
||||
# Default: true
|
||||
ignore-calls: false
|
||||
|
||||
# https://golangci-lint.run/usage/linters/#gocritic
|
||||
gocritic:
|
||||
disabled-checks:
|
||||
- ifElseChain
|
||||
- assignOp
|
||||
- appendAssign
|
||||
- singleCaseSwitch
|
||||
- regexpMust
|
||||
- typeSwitchVar
|
||||
- elseif
|
||||
|
||||
# https://golangci-lint.run/usage/linters/#gosimple
|
||||
gosimple:
|
||||
# Select the Go version to target.
|
||||
# Default: 1.13
|
||||
# Deprecated: use the global `run.go` instead.
|
||||
# go: "1.15"
|
||||
# Sxxxx checks in https://staticcheck.io/docs/configuration/options/#checks
|
||||
# Default: ["*"]
|
||||
checks: [
|
||||
"all", "-S1000", "-S1001", "-S1002", "-S1008", "-S1009", "-S1016", "-S1023", "-S1025", "-S1029", "-S1034", "-S1040"
|
||||
]
|
||||
|
||||
# https://golangci-lint.run/usage/linters/#govet
|
||||
govet:
|
||||
# Report about shadowed variables.
|
||||
# Default: false
|
||||
# check-shadowing: true
|
||||
# Settings per analyzer.
|
||||
settings:
|
||||
# Analyzer name, run `go tool vet help` to see all analyzers.
|
||||
printf:
|
||||
# Comma-separated list of print function names to check (in addition to default, see `go tool vet help printf`).
|
||||
# Default: []
|
||||
funcs:
|
||||
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Infof
|
||||
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Warnf
|
||||
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Errorf
|
||||
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Fatalf
|
||||
# shadow:
|
||||
# Whether to be strict about shadowing; can be noisy.
|
||||
# Default: false
|
||||
# strict: false
|
||||
unusedresult:
|
||||
# Comma-separated list of functions whose results must be used
|
||||
# (in addition to defaults context.WithCancel,context.WithDeadline,context.WithTimeout,context.WithValue,
|
||||
# errors.New,fmt.Errorf,fmt.Sprint,fmt.Sprintf,sort.Reverse)
|
||||
# Default []
|
||||
funcs:
|
||||
- pkg.MyFunc
|
||||
- context.WithCancel
|
||||
# Comma-separated list of names of methods of type func() string whose results must be used
|
||||
# (in addition to default Error,String)
|
||||
# Default []
|
||||
stringmethods:
|
||||
- MyMethod
|
||||
# Enable all analyzers.
|
||||
# Default: false
|
||||
enable-all: true
|
||||
# Disable analyzers by name.
|
||||
# Run `go tool vet help` to see all analyzers.
|
||||
# Default: []
|
||||
disable:
|
||||
- asmdecl
|
||||
- assign
|
||||
- atomic
|
||||
- atomicalign
|
||||
- bools
|
||||
- buildtag
|
||||
- cgocall
|
||||
- composites
|
||||
- copylocks
|
||||
- deepequalerrors
|
||||
- errorsas
|
||||
- fieldalignment
|
||||
- findcall
|
||||
- framepointer
|
||||
- httpresponse
|
||||
- ifaceassert
|
||||
- loopclosure
|
||||
- lostcancel
|
||||
- nilfunc
|
||||
- nilness
|
||||
- reflectvaluecompare
|
||||
- shift
|
||||
- shadow
|
||||
- sigchanyzer
|
||||
- sortslice
|
||||
- stdmethods
|
||||
- stringintconv
|
||||
- structtag
|
||||
- testinggoroutine
|
||||
- tests
|
||||
- unmarshal
|
||||
- unreachable
|
||||
- unsafeptr
|
||||
- unusedwrite
|
||||
|
||||
# https://golangci-lint.run/usage/linters/#staticcheck
|
||||
staticcheck:
|
||||
# Select the Go version to target.
|
||||
# Default: "1.13"
|
||||
# Deprecated: use the global `run.go` instead.
|
||||
# go: "1.15"
|
||||
# SAxxxx checks in https://staticcheck.io/docs/configuration/options/#checks
|
||||
# Default: ["*"]
|
||||
checks: [ "all","-SA1019","-SA4015","-SA1029","-SA1016","-SA9003","-SA4006","-SA6003" ]
|
||||
|
||||
# https://golangci-lint.run/usage/linters/#gofmt
|
||||
gofmt:
|
||||
# Simplify code: gofmt with `-s` option.
|
||||
# Default: true
|
||||
simplify: true
|
||||
# Apply the rewrite rules to the source before reformatting.
|
||||
# https://pkg.go.dev/cmd/gofmt
|
||||
# Default: []
|
||||
rewrite-rules: [ ]
|
||||
# - pattern: 'interface{}'
|
||||
# replacement: 'any'
|
||||
# - pattern: 'a[b:len(a)]'
|
||||
# replacement: 'a[b:]'
|
||||
+113
@@ -0,0 +1,113 @@
|
||||
ROOT_DIR = $(shell pwd)
|
||||
NAMESPACE = "default"
|
||||
DEPLOY_NAME = "template-single"
|
||||
DOCKER_NAME = "template-single"
|
||||
ADMIN_RESOURCE_PATH = "/resource/public/admin/"
|
||||
|
||||
# 一键编译。编译web前端,并将编译后的包移动到服务端对应静态资源路径下,最后编译服务端
|
||||
.PHONY: build
|
||||
build:
|
||||
@rm -rf ./$(ADMIN_RESOURCE_PATH)
|
||||
@mkdir ./$(ADMIN_RESOURCE_PATH)
|
||||
@cd ../web && pnpm run build && \cp -rf ./dist/* ../server$(ADMIN_RESOURCE_PATH)
|
||||
@cd ../server
|
||||
@echo "y" | gf build
|
||||
|
||||
# 通过热编译启动所有服务
|
||||
.PHONY: all
|
||||
all:
|
||||
gf run main.go --args "all"
|
||||
|
||||
.PHONY: http
|
||||
http:
|
||||
gf run main.go --args "http"
|
||||
|
||||
.PHONY: queue
|
||||
queue:
|
||||
gf run main.go --args "queue"
|
||||
|
||||
.PHONY: cron
|
||||
cron:
|
||||
gf run main.go --args "cron"
|
||||
|
||||
.PHONY: auth
|
||||
auth:
|
||||
gf run main.go --args "auth"
|
||||
|
||||
# 启动web服务
|
||||
.PHONY: web
|
||||
web:
|
||||
@cd ../web && pnpm run dev
|
||||
|
||||
# 刷新casbin权限
|
||||
.PHONY: refresh
|
||||
refresh:
|
||||
@go run main.go tools -m=casbin -a1=refresh
|
||||
|
||||
# 清理casbin权限
|
||||
.PHONY: clear
|
||||
clear:
|
||||
@go run main.go tools -m=casbin -a1=clear
|
||||
|
||||
# 运行代码质量分析工具
|
||||
# https://github.com/ywanbing/golangci
|
||||
.PHONY: lint
|
||||
lint:
|
||||
golangci-lint run
|
||||
|
||||
.PHONY: killmain
|
||||
killmain:
|
||||
@kill -9 $(ps -ef|grep main|grep -v grep|awk '{print $2}')
|
||||
|
||||
# Install/Update to the latest CLI tool.
|
||||
.PHONY: cli
|
||||
cli:
|
||||
@set -e; \
|
||||
wget -O gf https://github.com/gogf/gf/releases/latest/download/gf_$(shell go env GOOS)_$(shell go env GOARCH) && \
|
||||
chmod +x gf && \
|
||||
./gf install -y && \
|
||||
rm ./gf
|
||||
|
||||
# Check and install CLI tool.
|
||||
.PHONY: cli.install
|
||||
cli.install:
|
||||
@set -e; \
|
||||
gf -v > /dev/null 2>&1 || if [[ "$?" -ne "0" ]]; then \
|
||||
echo "GoFame CLI is not installed, start proceeding auto installation..."; \
|
||||
make cli; \
|
||||
fi;
|
||||
|
||||
# Generate Go files for DAO/DO/Entity.
|
||||
.PHONY: dao
|
||||
dao: cli.install
|
||||
@gf gen dao
|
||||
|
||||
# Generate Go files for Service.
|
||||
.PHONY: service
|
||||
service: cli.install
|
||||
@gf gen service
|
||||
|
||||
# Build image, deploy image and yaml to current kubectl environment and make port forward to local machine.
|
||||
.PHONY: start
|
||||
start:
|
||||
@set -e; \
|
||||
make image; \
|
||||
make deploy; \
|
||||
make port;
|
||||
|
||||
# Build docker image and commit to the repository.
|
||||
# example: make image tag=v0.0.1
|
||||
.PHONY: image
|
||||
image:
|
||||
@echo "y" | gf docker main.go -p -tn hotgo:$(tag)
|
||||
|
||||
# Deploy image and yaml to current kubectl environment.
|
||||
.PHONY: deploy
|
||||
deploy:
|
||||
$(eval _TAG = $(if ${TAG}, ${TAG}, develop))
|
||||
@set -e; \
|
||||
mkdir -p $(ROOT_DIR)/temp/kustomize;\
|
||||
cd $(ROOT_DIR)/manifest/deploy/kustomize/overlays/${_TAG};\
|
||||
kustomize build > $(ROOT_DIR)/temp/kustomize.yaml;\
|
||||
kubectl apply -f $(ROOT_DIR)/temp/kustomize.yaml; \
|
||||
kubectl patch -n $(NAMESPACE) deployment/$(DEPLOY_NAME) -p "{\"spec\":{\"template\":{\"metadata\":{\"labels\":{\"date\":\"$(shell date +%s)\"}}}}}";
|
||||
@@ -0,0 +1 @@
|
||||
## HotGo 管理后台服务端
|
||||
@@ -0,0 +1,6 @@
|
||||
// Package addons
|
||||
// @Link https://github.com/bufanyun/hotgo
|
||||
// @Copyright Copyright (c) 2023 HotGo CLI
|
||||
// @Author Ms <133814250@qq.com>
|
||||
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
|
||||
package addons
|
||||
@@ -0,0 +1,39 @@
|
||||
## 功能案例
|
||||
|
||||
### 简介
|
||||
|
||||
系统的一些功能案例
|
||||
|
||||
|
||||
### 使用说明
|
||||
|
||||
系统自带的功能使用示例及其说明,包含一些简单的交互
|
||||
|
||||
|
||||
### 安装
|
||||
|
||||
1、安装 HotGo (2.11.4及以上)
|
||||
|
||||
项目介绍:https://github.com/bufanyun/hotgo
|
||||
|
||||
2、将当前插件项目拷贝进 HotGo 根目录的 server/addons 目录下
|
||||
|
||||
3、在 HotGo 根目录的 server/addons/modules 目录下创建go文件:hgexample.go,内容如下:
|
||||
```go
|
||||
package modules
|
||||
|
||||
import _ "hotgo/addons/hgexample"
|
||||
```
|
||||
|
||||
4、HotGo 后台进入 开发工具->插件管理->找到 功能案例 (hgexample) 进行安装
|
||||
|
||||
5、重启服务即可生效
|
||||
|
||||
|
||||
### 常用命令行
|
||||
|
||||
```shell
|
||||
# 接口维护-gen service
|
||||
gf gen service -s=addons/hgexample/logic -d=addons/hgexample/service
|
||||
|
||||
```
|
||||
@@ -0,0 +1,26 @@
|
||||
// Package comp
|
||||
// @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 comp
|
||||
|
||||
import (
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
"github.com/gogf/gf/v2/net/ghttp"
|
||||
)
|
||||
|
||||
// ImportExcelReq 导入Excel
|
||||
type ImportExcelReq struct {
|
||||
g.Meta `path:"/comp/importExcel" method:"post" tags:"功能案例" summary:"导入Excel"`
|
||||
File *ghttp.UploadFile `json:"file" type:"file" dc:"分片文件"`
|
||||
}
|
||||
|
||||
type ImportExcelSheet struct {
|
||||
Sheet string `json:"sheet"`
|
||||
Rows [][]string `json:"rows"`
|
||||
}
|
||||
|
||||
type ImportExcelRes struct {
|
||||
Sheets []*ImportExcelSheet `json:"sheets"`
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
// Package config
|
||||
// @Link https://github.com/bufanyun/hotgo
|
||||
// @Copyright Copyright (c) 2023 HotGo CLI
|
||||
// @Author Ms <133814250@qq.com>
|
||||
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
|
||||
package config
|
||||
|
||||
import (
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
"hotgo/addons/hgexample/model/input/sysin"
|
||||
)
|
||||
|
||||
// GetReq 获取指定分组的配置
|
||||
type GetReq struct {
|
||||
g.Meta `path:"/config/get" method:"get" tags:"配置" summary:"获取指定分组的配置"`
|
||||
sysin.GetConfigInp
|
||||
}
|
||||
|
||||
type GetRes struct {
|
||||
*sysin.GetConfigModel
|
||||
}
|
||||
|
||||
// UpdateReq 获取指定分组的配置
|
||||
type UpdateReq struct {
|
||||
g.Meta `path:"/config/update" method:"post" tags:"配置" summary:"获取指定分组的配置"`
|
||||
sysin.UpdateConfigInp
|
||||
}
|
||||
|
||||
type UpdateRes struct {
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
// Package index
|
||||
// @Link https://github.com/bufanyun/hotgo
|
||||
// @Copyright Copyright (c) 2023 HotGo CLI
|
||||
// @Author Ms <133814250@qq.com>
|
||||
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
|
||||
package index
|
||||
|
||||
import (
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
"hotgo/addons/hgexample/model/input/sysin"
|
||||
)
|
||||
|
||||
// TestReq 测试
|
||||
type TestReq struct {
|
||||
g.Meta `path:"/index/test" method:"get" tags:"功能案例" summary:"测试"`
|
||||
sysin.IndexTestInp
|
||||
}
|
||||
|
||||
type TestRes struct {
|
||||
*sysin.IndexTestModel
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
// Package table
|
||||
// @Link https://github.com/bufanyun/hotgo
|
||||
// @Copyright Copyright (c) 2023 HotGo CLI
|
||||
// @Author Ms <133814250@qq.com>
|
||||
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
|
||||
package table
|
||||
|
||||
import (
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
"hotgo/addons/hgexample/model/input/sysin"
|
||||
"hotgo/internal/model/input/form"
|
||||
)
|
||||
|
||||
// ListReq 查询列表
|
||||
type ListReq struct {
|
||||
g.Meta `path:"/table/list" method:"get" tags:"表格例子" summary:"获取表格列表"`
|
||||
sysin.TableListInp
|
||||
}
|
||||
|
||||
type ListRes struct {
|
||||
form.PageRes
|
||||
List []*sysin.TableListModel `json:"list" dc:"数据列表"`
|
||||
}
|
||||
|
||||
// ExportReq 导出列表
|
||||
type ExportReq struct {
|
||||
g.Meta `path:"/table/export" method:"get" tags:"表格例子" summary:"导出表格列表"`
|
||||
sysin.TableListInp
|
||||
}
|
||||
|
||||
type ExportRes struct{}
|
||||
|
||||
// ViewReq 获取信息
|
||||
type ViewReq struct {
|
||||
g.Meta `path:"/table/view" method:"get" tags:"表格例子" summary:"获取指定信息"`
|
||||
sysin.TableViewInp
|
||||
}
|
||||
|
||||
type ViewRes struct {
|
||||
*sysin.TableViewModel
|
||||
}
|
||||
|
||||
// EditReq 修改/新增
|
||||
type EditReq struct {
|
||||
g.Meta `path:"/table/edit" method:"post" tags:"表格例子" summary:"修改/新增表格"`
|
||||
sysin.TableEditInp
|
||||
}
|
||||
|
||||
type EditRes struct{}
|
||||
|
||||
// DeleteReq 删除
|
||||
type DeleteReq struct {
|
||||
g.Meta `path:"/table/delete" method:"post" tags:"表格例子" summary:"删除表格"`
|
||||
sysin.TableDeleteInp
|
||||
}
|
||||
|
||||
type DeleteRes struct{}
|
||||
|
||||
// MaxSortReq 最大排序
|
||||
type MaxSortReq struct {
|
||||
g.Meta `path:"/table/maxSort" method:"get" tags:"表格例子" summary:"表格最大排序"`
|
||||
sysin.TableMaxSortInp
|
||||
}
|
||||
|
||||
type MaxSortRes struct {
|
||||
*sysin.TableMaxSortModel
|
||||
}
|
||||
|
||||
// StatusReq 更新状态
|
||||
type StatusReq struct {
|
||||
g.Meta `path:"/table/status" method:"post" tags:"表格例子" summary:"更新表格状态"`
|
||||
sysin.TableStatusInp
|
||||
}
|
||||
|
||||
type StatusRes struct{}
|
||||
|
||||
// SwitchReq 更新开关状态
|
||||
type SwitchReq struct {
|
||||
g.Meta `path:"/table/switch" method:"post" tags:"表格例子" summary:"更新表格状态"`
|
||||
sysin.TableSwitchInp
|
||||
}
|
||||
|
||||
type SwitchRes struct{}
|
||||
@@ -0,0 +1,59 @@
|
||||
// Package tenantorder
|
||||
// @Link https://github.com/bufanyun/hotgo
|
||||
// @Copyright Copyright (c) 2024 HotGo CLI
|
||||
// @Author Ms <133814250@qq.com>
|
||||
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
|
||||
// @AutoGenerate Version 2.13.1
|
||||
package tenantorder
|
||||
|
||||
import (
|
||||
"hotgo/addons/hgexample/model/input/sysin"
|
||||
"hotgo/internal/model/input/form"
|
||||
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
)
|
||||
|
||||
// ListReq 查询多租户功能演示列表
|
||||
type ListReq struct {
|
||||
g.Meta `path:"/tenantOrder/list" method:"get" tags:"多租户功能演示" summary:"获取多租户功能演示列表"`
|
||||
sysin.TenantOrderListInp
|
||||
}
|
||||
|
||||
type ListRes struct {
|
||||
form.PageRes
|
||||
List []*sysin.TenantOrderListModel `json:"list" dc:"数据列表"`
|
||||
}
|
||||
|
||||
// ExportReq 导出多租户功能演示列表
|
||||
type ExportReq struct {
|
||||
g.Meta `path:"/tenantOrder/export" method:"get" tags:"多租户功能演示" summary:"导出多租户功能演示列表"`
|
||||
sysin.TenantOrderListInp
|
||||
}
|
||||
|
||||
type ExportRes struct{}
|
||||
|
||||
// ViewReq 获取多租户功能演示指定信息
|
||||
type ViewReq struct {
|
||||
g.Meta `path:"/tenantOrder/view" method:"get" tags:"多租户功能演示" summary:"获取多租户功能演示指定信息"`
|
||||
sysin.TenantOrderViewInp
|
||||
}
|
||||
|
||||
type ViewRes struct {
|
||||
*sysin.TenantOrderViewModel
|
||||
}
|
||||
|
||||
// EditReq 修改/新增多租户功能演示
|
||||
type EditReq struct {
|
||||
g.Meta `path:"/tenantOrder/edit" method:"post" tags:"多租户功能演示" summary:"修改/新增多租户功能演示"`
|
||||
sysin.TenantOrderEditInp
|
||||
}
|
||||
|
||||
type EditRes struct{}
|
||||
|
||||
// DeleteReq 删除多租户功能演示
|
||||
type DeleteReq struct {
|
||||
g.Meta `path:"/tenantOrder/delete" method:"post" tags:"多租户功能演示" summary:"删除多租户功能演示"`
|
||||
sysin.TenantOrderDeleteInp
|
||||
}
|
||||
|
||||
type DeleteRes struct{}
|
||||
@@ -0,0 +1,92 @@
|
||||
// Package treetable
|
||||
// @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 treetable
|
||||
|
||||
import (
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
"hotgo/addons/hgexample/model/input/sysin"
|
||||
"hotgo/internal/model/input/form"
|
||||
)
|
||||
|
||||
// ListReq 查询列表
|
||||
type ListReq struct {
|
||||
g.Meta `path:"/treeTable/list" method:"get" tags:"树形表格例子" summary:"获取表格列表"`
|
||||
sysin.TreeTableListInp
|
||||
}
|
||||
|
||||
type ListRes struct {
|
||||
form.PageRes
|
||||
List []*sysin.TreeTableListModel `json:"list" dc:"数据列表"`
|
||||
}
|
||||
|
||||
// ExportReq 导出列表
|
||||
type ExportReq struct {
|
||||
g.Meta `path:"/treeTable/export" method:"get" tags:"树形表格例子" summary:"导出表格列表"`
|
||||
sysin.TableListInp
|
||||
}
|
||||
|
||||
type ExportRes struct{}
|
||||
|
||||
// ViewReq 获取信息
|
||||
type ViewReq struct {
|
||||
g.Meta `path:"/treeTable/view" method:"get" tags:"树形表格例子" summary:"获取指定信息"`
|
||||
sysin.TableViewInp
|
||||
}
|
||||
|
||||
type ViewRes struct {
|
||||
*sysin.TableViewModel
|
||||
}
|
||||
|
||||
// EditReq 修改/新增
|
||||
type EditReq struct {
|
||||
g.Meta `path:"/treeTable/edit" method:"post" tags:"树形表格例子" summary:"修改/新增表格"`
|
||||
sysin.TableEditInp
|
||||
}
|
||||
|
||||
type EditRes struct{}
|
||||
|
||||
// DeleteReq 删除
|
||||
type DeleteReq struct {
|
||||
g.Meta `path:"/treeTable/delete" method:"post" tags:"树形表格例子" summary:"删除表格"`
|
||||
sysin.TableDeleteInp
|
||||
}
|
||||
|
||||
type DeleteRes struct{}
|
||||
|
||||
// MaxSortReq 最大排序
|
||||
type MaxSortReq struct {
|
||||
g.Meta `path:"/treeTable/maxSort" method:"get" tags:"树形表格例子" summary:"表格最大排序"`
|
||||
sysin.TableMaxSortInp
|
||||
}
|
||||
|
||||
type MaxSortRes struct {
|
||||
*sysin.TableMaxSortModel
|
||||
}
|
||||
|
||||
// StatusReq 更新状态
|
||||
type StatusReq struct {
|
||||
g.Meta `path:"/treeTable/status" method:"post" tags:"树形表格例子" summary:"更新表格状态"`
|
||||
sysin.TableStatusInp
|
||||
}
|
||||
|
||||
type StatusRes struct{}
|
||||
|
||||
// SwitchReq 更新开关状态
|
||||
type SwitchReq struct {
|
||||
g.Meta `path:"/treeTable/switch" method:"post" tags:"树形表格例子" summary:"更新表格状态"`
|
||||
sysin.TableSwitchInp
|
||||
}
|
||||
|
||||
type SwitchRes struct{}
|
||||
|
||||
// SelectReq 树形选项
|
||||
type SelectReq struct {
|
||||
g.Meta `path:"/treeTable/select" method:"get" tags:"树形表格例子" summary:"树形选项"`
|
||||
}
|
||||
|
||||
type SelectRes struct {
|
||||
List []*sysin.TableTree `json:"list" dc:"数据列表"`
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
// Package index
|
||||
// @Link https://github.com/bufanyun/hotgo
|
||||
// @Copyright Copyright (c) 2023 HotGo CLI
|
||||
// @Author Ms <133814250@qq.com>
|
||||
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
|
||||
package index
|
||||
|
||||
import (
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
"hotgo/addons/hgexample/model/input/sysin"
|
||||
)
|
||||
|
||||
// TestReq 测试
|
||||
type TestReq struct {
|
||||
g.Meta `path:"/index/test" method:"get" tags:"功能案例" summary:"测试"`
|
||||
sysin.IndexTestInp
|
||||
}
|
||||
|
||||
type TestRes struct {
|
||||
*sysin.IndexTestModel
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
// Package index
|
||||
// @Link https://github.com/bufanyun/hotgo
|
||||
// @Copyright Copyright (c) 2023 HotGo CLI
|
||||
// @Author Ms <133814250@qq.com>
|
||||
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
|
||||
package index
|
||||
|
||||
import (
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
"hotgo/addons/hgexample/model/input/sysin"
|
||||
)
|
||||
|
||||
// TestReq 测试
|
||||
type TestReq struct {
|
||||
g.Meta `path:"/index/test" method:"get" tags:"功能案例" summary:"测试首页"`
|
||||
sysin.IndexTestInp
|
||||
}
|
||||
|
||||
type TestRes struct {
|
||||
g.Meta `mime:"text/html" type:"string" example:"<html/>"`
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
// Package index
|
||||
// @Link https://github.com/bufanyun/hotgo
|
||||
// @Copyright Copyright (c) 2023 HotGo CLI
|
||||
// @Author Ms <133814250@qq.com>
|
||||
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
|
||||
package index
|
||||
|
||||
import (
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
"hotgo/addons/hgexample/model/input/sysin"
|
||||
)
|
||||
|
||||
// TestReq 测试
|
||||
type TestReq struct {
|
||||
g.Meta `path:"/index/test" method:"get" tags:"功能案例" summary:"测试"`
|
||||
sysin.IndexTestInp
|
||||
}
|
||||
|
||||
type TestRes struct {
|
||||
*sysin.IndexTestModel
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
// Package sys
|
||||
// @Link https://github.com/bufanyun/hotgo
|
||||
// @Copyright Copyright (c) 2023 HotGo CLI
|
||||
// @Author Ms <133814250@qq.com>
|
||||
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
|
||||
package sys
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/xuri/excelize/v2"
|
||||
"hotgo/addons/hgexample/api/admin/comp"
|
||||
)
|
||||
|
||||
var (
|
||||
Comp = cComp{}
|
||||
)
|
||||
|
||||
type cComp struct{}
|
||||
|
||||
// ImportExcel 导入Excel
|
||||
func (c *cComp) ImportExcel(ctx context.Context, req *comp.ImportExcelReq) (res *comp.ImportExcelRes, err error) {
|
||||
file, err := req.File.Open()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
defer file.Close()
|
||||
|
||||
excel, err := excelize.OpenReader(file)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
defer excel.Close()
|
||||
|
||||
res = new(comp.ImportExcelRes)
|
||||
sheetList := excel.GetSheetList()
|
||||
for _, sheet := range sheetList {
|
||||
item := new(comp.ImportExcelSheet)
|
||||
item.Sheet = sheet
|
||||
item.Rows, err = excel.GetRows(sheet)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
res.Sheets = append(res.Sheets, item)
|
||||
}
|
||||
return
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
// Package sys
|
||||
// @Link https://github.com/bufanyun/hotgo
|
||||
// @Copyright Copyright (c) 2023 HotGo CLI
|
||||
// @Author Ms <133814250@qq.com>
|
||||
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
|
||||
package sys
|
||||
|
||||
import (
|
||||
"context"
|
||||
"hotgo/addons/hgexample/api/admin/config"
|
||||
"hotgo/addons/hgexample/service"
|
||||
)
|
||||
|
||||
var (
|
||||
Config = cConfig{}
|
||||
)
|
||||
|
||||
type cConfig struct{}
|
||||
|
||||
// GetConfig 获取指定分组的配置
|
||||
func (c *cConfig) GetConfig(ctx context.Context, req *config.GetReq) (res *config.GetRes, err error) {
|
||||
data, err := service.SysConfig().GetConfigByGroup(ctx, &req.GetConfigInp)
|
||||
|
||||
res = new(config.GetRes)
|
||||
res.GetConfigModel = data
|
||||
return
|
||||
}
|
||||
|
||||
// UpdateConfig 更新指定分组的配置
|
||||
func (c *cConfig) UpdateConfig(ctx context.Context, req *config.UpdateReq) (res *config.UpdateRes, err error) {
|
||||
err = service.SysConfig().UpdateConfigByGroup(ctx, &req.UpdateConfigInp)
|
||||
return
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
// Package sys
|
||||
// @Link https://github.com/bufanyun/hotgo
|
||||
// @Copyright Copyright (c) 2023 HotGo CLI
|
||||
// @Author Ms <133814250@qq.com>
|
||||
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
|
||||
package sys
|
||||
|
||||
import (
|
||||
"context"
|
||||
"hotgo/addons/hgexample/api/admin/index"
|
||||
"hotgo/addons/hgexample/service"
|
||||
)
|
||||
|
||||
var (
|
||||
Index = cIndex{}
|
||||
)
|
||||
|
||||
type cIndex struct{}
|
||||
|
||||
// Test 测试
|
||||
func (c *cIndex) Test(ctx context.Context, req *index.TestReq) (res *index.TestRes, err error) {
|
||||
data, err := service.SysIndex().Test(ctx, &req.IndexTestInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(index.TestRes)
|
||||
res.IndexTestModel = data
|
||||
return
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
// Package sys
|
||||
// @Link https://github.com/bufanyun/hotgo
|
||||
// @Copyright Copyright (c) 2023 HotGo CLI
|
||||
// @Author Ms <133814250@qq.com>
|
||||
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
|
||||
package sys
|
||||
|
||||
import (
|
||||
"context"
|
||||
"hotgo/addons/hgexample/api/admin/table"
|
||||
"hotgo/addons/hgexample/service"
|
||||
)
|
||||
|
||||
var (
|
||||
Table = cTable{}
|
||||
)
|
||||
|
||||
type cTable struct{}
|
||||
|
||||
// List 查看列表
|
||||
func (c *cTable) List(ctx context.Context, req *table.ListReq) (res *table.ListRes, err error) {
|
||||
list, totalCount, err := service.SysTable().List(ctx, &req.TableListInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(table.ListRes)
|
||||
res.List = list
|
||||
res.PageRes.Pack(req, totalCount)
|
||||
return
|
||||
}
|
||||
|
||||
// Export 导出列表
|
||||
func (c *cTable) Export(ctx context.Context, req *table.ExportReq) (res *table.ExportRes, err error) {
|
||||
err = service.SysTable().Export(ctx, &req.TableListInp)
|
||||
return
|
||||
}
|
||||
|
||||
// Edit 更新
|
||||
func (c *cTable) Edit(ctx context.Context, req *table.EditReq) (res *table.EditRes, err error) {
|
||||
err = service.SysTable().Edit(ctx, &req.TableEditInp)
|
||||
return
|
||||
}
|
||||
|
||||
// MaxSort 最大排序
|
||||
func (c *cTable) MaxSort(ctx context.Context, req *table.MaxSortReq) (res *table.MaxSortRes, err error) {
|
||||
data, err := service.SysTable().MaxSort(ctx, &req.TableMaxSortInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(table.MaxSortRes)
|
||||
res.TableMaxSortModel = data
|
||||
return
|
||||
}
|
||||
|
||||
// View 获取指定信息
|
||||
func (c *cTable) View(ctx context.Context, req *table.ViewReq) (res *table.ViewRes, err error) {
|
||||
data, err := service.SysTable().View(ctx, &req.TableViewInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(table.ViewRes)
|
||||
res.TableViewModel = data
|
||||
return
|
||||
}
|
||||
|
||||
// Delete 删除
|
||||
func (c *cTable) Delete(ctx context.Context, req *table.DeleteReq) (res *table.DeleteRes, err error) {
|
||||
err = service.SysTable().Delete(ctx, &req.TableDeleteInp)
|
||||
return
|
||||
}
|
||||
|
||||
// Status 更新状态
|
||||
func (c *cTable) Status(ctx context.Context, req *table.StatusReq) (res *table.StatusRes, err error) {
|
||||
err = service.SysTable().Status(ctx, &req.TableStatusInp)
|
||||
return
|
||||
}
|
||||
|
||||
// Switch 更新开关状态
|
||||
func (c *cTable) Switch(ctx context.Context, req *table.SwitchReq) (res *table.SwitchRes, err error) {
|
||||
err = service.SysTable().Switch(ctx, &req.TableSwitchInp)
|
||||
return
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
// Package sys
|
||||
// @Link https://github.com/bufanyun/hotgo
|
||||
// @Copyright Copyright (c) 2024 HotGo CLI
|
||||
// @Author Ms <133814250@qq.com>
|
||||
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
|
||||
// @AutoGenerate Version 2.13.1
|
||||
package sys
|
||||
|
||||
import (
|
||||
"context"
|
||||
"hotgo/addons/hgexample/api/admin/tenantorder"
|
||||
"hotgo/addons/hgexample/model/input/sysin"
|
||||
"hotgo/addons/hgexample/service"
|
||||
)
|
||||
|
||||
var (
|
||||
TenantOrder = cTenantOrder{}
|
||||
)
|
||||
|
||||
type cTenantOrder struct{}
|
||||
|
||||
// List 查看多租户功能演示列表
|
||||
func (c *cTenantOrder) List(ctx context.Context, req *tenantorder.ListReq) (res *tenantorder.ListRes, err error) {
|
||||
list, totalCount, err := service.SysTenantOrder().List(ctx, &req.TenantOrderListInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if list == nil {
|
||||
list = []*sysin.TenantOrderListModel{}
|
||||
}
|
||||
|
||||
res = new(tenantorder.ListRes)
|
||||
res.List = list
|
||||
res.PageRes.Pack(req, totalCount)
|
||||
return
|
||||
}
|
||||
|
||||
// Export 导出多租户功能演示列表
|
||||
func (c *cTenantOrder) Export(ctx context.Context, req *tenantorder.ExportReq) (res *tenantorder.ExportRes, err error) {
|
||||
err = service.SysTenantOrder().Export(ctx, &req.TenantOrderListInp)
|
||||
return
|
||||
}
|
||||
|
||||
// Edit 更新多租户功能演示
|
||||
func (c *cTenantOrder) Edit(ctx context.Context, req *tenantorder.EditReq) (res *tenantorder.EditRes, err error) {
|
||||
err = service.SysTenantOrder().Edit(ctx, &req.TenantOrderEditInp)
|
||||
return
|
||||
}
|
||||
|
||||
// View 获取指定多租户功能演示信息
|
||||
func (c *cTenantOrder) View(ctx context.Context, req *tenantorder.ViewReq) (res *tenantorder.ViewRes, err error) {
|
||||
data, err := service.SysTenantOrder().View(ctx, &req.TenantOrderViewInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(tenantorder.ViewRes)
|
||||
res.TenantOrderViewModel = data
|
||||
return
|
||||
}
|
||||
|
||||
// Delete 删除多租户功能演示
|
||||
func (c *cTenantOrder) Delete(ctx context.Context, req *tenantorder.DeleteReq) (res *tenantorder.DeleteRes, err error) {
|
||||
err = service.SysTenantOrder().Delete(ctx, &req.TenantOrderDeleteInp)
|
||||
return
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
// Package sys
|
||||
// @Link https://github.com/bufanyun/hotgo
|
||||
// @Copyright Copyright (c) 2023 HotGo CLI
|
||||
// @Author Ms <133814250@qq.com>
|
||||
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
|
||||
package sys
|
||||
|
||||
import (
|
||||
"context"
|
||||
"hotgo/addons/hgexample/api/admin/treetable"
|
||||
"hotgo/addons/hgexample/service"
|
||||
)
|
||||
|
||||
var (
|
||||
TreeTable = cTreeTable{}
|
||||
)
|
||||
|
||||
type cTreeTable struct{}
|
||||
|
||||
// List 查看列表
|
||||
func (c *cTreeTable) List(ctx context.Context, req *treetable.ListReq) (res *treetable.ListRes, err error) {
|
||||
list, totalCount, err := service.SysTreeTable().List(ctx, &req.TreeTableListInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(treetable.ListRes)
|
||||
res.List = list
|
||||
res.PageRes.Pack(req, totalCount)
|
||||
return
|
||||
}
|
||||
|
||||
// Export 导出列表
|
||||
func (c *cTreeTable) Export(ctx context.Context, req *treetable.ExportReq) (res *treetable.ExportRes, err error) {
|
||||
err = service.SysTable().Export(ctx, &req.TableListInp)
|
||||
return
|
||||
}
|
||||
|
||||
// Edit 更新
|
||||
func (c *cTreeTable) Edit(ctx context.Context, req *treetable.EditReq) (res *treetable.EditRes, err error) {
|
||||
err = service.SysTreeTable().Edit(ctx, &req.TableEditInp)
|
||||
return
|
||||
}
|
||||
|
||||
// MaxSort 最大排序
|
||||
func (c *cTreeTable) MaxSort(ctx context.Context, req *treetable.MaxSortReq) (res *treetable.MaxSortRes, err error) {
|
||||
data, err := service.SysTable().MaxSort(ctx, &req.TableMaxSortInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(treetable.MaxSortRes)
|
||||
res.TableMaxSortModel = data
|
||||
return
|
||||
}
|
||||
|
||||
// View 获取指定信息
|
||||
func (c *cTreeTable) View(ctx context.Context, req *treetable.ViewReq) (res *treetable.ViewRes, err error) {
|
||||
data, err := service.SysTable().View(ctx, &req.TableViewInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(treetable.ViewRes)
|
||||
res.TableViewModel = data
|
||||
return
|
||||
}
|
||||
|
||||
// Delete 删除
|
||||
func (c *cTreeTable) Delete(ctx context.Context, req *treetable.DeleteReq) (res *treetable.DeleteRes, err error) {
|
||||
err = service.SysTreeTable().Delete(ctx, &req.TableDeleteInp)
|
||||
return
|
||||
}
|
||||
|
||||
// Status 更新状态
|
||||
func (c *cTreeTable) Status(ctx context.Context, req *treetable.StatusReq) (res *treetable.StatusRes, err error) {
|
||||
err = service.SysTable().Status(ctx, &req.TableStatusInp)
|
||||
return
|
||||
}
|
||||
|
||||
// Switch 更新开关状态
|
||||
func (c *cTreeTable) Switch(ctx context.Context, req *treetable.SwitchReq) (res *treetable.SwitchRes, err error) {
|
||||
err = service.SysTable().Switch(ctx, &req.TableSwitchInp)
|
||||
return
|
||||
}
|
||||
|
||||
// Select 树形选项
|
||||
func (c *cTreeTable) Select(ctx context.Context, _ *treetable.SelectReq) (res *treetable.SelectRes, err error) {
|
||||
res = new(treetable.SelectRes)
|
||||
res.List, err = service.SysTreeTable().Select(ctx)
|
||||
return
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
// Package api
|
||||
// @Link https://github.com/bufanyun/hotgo
|
||||
// @Copyright Copyright (c) 2023 HotGo CLI
|
||||
// @Author Ms <133814250@qq.com>
|
||||
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
|
||||
package api
|
||||
|
||||
import (
|
||||
"context"
|
||||
"hotgo/addons/hgexample/api/api/index"
|
||||
"hotgo/addons/hgexample/service"
|
||||
)
|
||||
|
||||
var (
|
||||
Index = cIndex{}
|
||||
)
|
||||
|
||||
type cIndex struct{}
|
||||
|
||||
// Test 测试
|
||||
func (c *cIndex) Test(ctx context.Context, req *index.TestReq) (res *index.TestRes, err error) {
|
||||
data, err := service.SysIndex().Test(ctx, &req.IndexTestInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(index.TestRes)
|
||||
res.IndexTestModel = data
|
||||
return
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
// Package home
|
||||
// @Link https://github.com/bufanyun/hotgo
|
||||
// @Copyright Copyright (c) 2023 HotGo CLI
|
||||
// @Author Ms <133814250@qq.com>
|
||||
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
|
||||
package home
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
"hotgo/addons/hgexample/api/home/index"
|
||||
"hotgo/addons/hgexample/service"
|
||||
"hotgo/internal/model"
|
||||
isc "hotgo/internal/service"
|
||||
)
|
||||
|
||||
// Index 基础
|
||||
var Index = cIndex{}
|
||||
|
||||
type cIndex struct{}
|
||||
|
||||
func (a *cIndex) Index(ctx context.Context, req *index.TestReq) (res *index.TestRes, err error) {
|
||||
data, err := service.SysIndex().Test(ctx, &req.IndexTestInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
isc.View().RenderTpl(ctx, "home/index.html", model.View{Data: g.Map{
|
||||
"name": data.Name,
|
||||
"module": data.Module,
|
||||
"time": data.Time,
|
||||
}})
|
||||
return
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
// Package handler
|
||||
// @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 handler
|
||||
|
||||
import (
|
||||
"github.com/gogf/gf/v2/encoding/gjson"
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
"hotgo/internal/websocket"
|
||||
)
|
||||
|
||||
var (
|
||||
Index = cIndex{}
|
||||
)
|
||||
|
||||
type cIndex struct{}
|
||||
|
||||
// TestMessage 测试消息
|
||||
func (c *cIndex) TestMessage(client *websocket.Client, req *websocket.WRequest) {
|
||||
g.Log().Infof(client.Context(), "收到客户端测试消息:%v", gjson.New(req).String())
|
||||
// 将收到的消息原样发送给客户端
|
||||
websocket.SendSuccess(client, req.Event, req.Data)
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
// Package websocket
|
||||
// @Link https://github.com/bufanyun/hotgo
|
||||
// @Copyright Copyright (c) 2023 HotGo CLI
|
||||
// @Author Ms <133814250@qq.com>
|
||||
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
|
||||
package websocket
|
||||
|
||||
import (
|
||||
"context"
|
||||
"hotgo/addons/hgexample/api/websocket/index"
|
||||
"hotgo/addons/hgexample/service"
|
||||
)
|
||||
|
||||
var (
|
||||
Index = cIndex{}
|
||||
)
|
||||
|
||||
type cIndex struct{}
|
||||
|
||||
// Test 测试
|
||||
func (c *cIndex) Test(ctx context.Context, req *index.TestReq) (res *index.TestRes, err error) {
|
||||
data, err := service.SysIndex().Test(ctx, &req.IndexTestInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(index.TestRes)
|
||||
res.IndexTestModel = data
|
||||
return
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
// 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
|
||||
|
||||
// 定时任务.
|
||||
// 插件中的定时任务可以统一在这里注册和处理
|
||||
@@ -0,0 +1,12 @@
|
||||
// Package global
|
||||
// @Link https://github.com/bufanyun/hotgo
|
||||
// @Copyright Copyright (c) 2023 HotGo CLI
|
||||
// @Author Ms <133814250@qq.com>
|
||||
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
|
||||
package global
|
||||
|
||||
import "hotgo/internal/library/addons"
|
||||
|
||||
var (
|
||||
skeleton *addons.Skeleton // 插件架子
|
||||
)
|
||||
@@ -0,0 +1,22 @@
|
||||
// Package global
|
||||
// @Link https://github.com/bufanyun/hotgo
|
||||
// @Copyright Copyright (c) 2023 HotGo CLI
|
||||
// @Author Ms <133814250@qq.com>
|
||||
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
|
||||
package global
|
||||
|
||||
import (
|
||||
"context"
|
||||
"hotgo/internal/library/addons"
|
||||
)
|
||||
|
||||
func Init(ctx context.Context, sk *addons.Skeleton) {
|
||||
skeleton = sk
|
||||
}
|
||||
|
||||
func GetSkeleton() *addons.Skeleton {
|
||||
if skeleton == nil {
|
||||
panic("addon skeleton not initialized.")
|
||||
}
|
||||
return skeleton
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
// ==========================================================================
|
||||
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
|
||||
// ==========================================================================
|
||||
|
||||
package logic
|
||||
|
||||
import (
|
||||
_ "hotgo/addons/hgexample/logic/sys"
|
||||
)
|
||||
@@ -0,0 +1,59 @@
|
||||
// Package sys
|
||||
// @Link https://github.com/bufanyun/hotgo
|
||||
// @Copyright Copyright (c) 2023 HotGo CLI
|
||||
// @Author Ms <133814250@qq.com>
|
||||
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
|
||||
package sys
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/gogf/gf/v2/util/gconv"
|
||||
"hotgo/addons/hgexample/global"
|
||||
"hotgo/addons/hgexample/model"
|
||||
"hotgo/addons/hgexample/model/input/sysin"
|
||||
"hotgo/addons/hgexample/service"
|
||||
isc "hotgo/internal/service"
|
||||
)
|
||||
|
||||
type sSysConfig struct{}
|
||||
|
||||
func NewSysConfig() *sSysConfig {
|
||||
return &sSysConfig{}
|
||||
}
|
||||
|
||||
func init() {
|
||||
service.RegisterSysConfig(NewSysConfig())
|
||||
}
|
||||
|
||||
// GetBasic 获取基础配置
|
||||
func (s *sSysConfig) GetBasic(ctx context.Context) (conf *model.BasicConfig, err error) {
|
||||
var in sysin.GetConfigInp
|
||||
in.GetAddonsConfigInp.AddonName = global.GetSkeleton().Name
|
||||
in.GetAddonsConfigInp.Group = "basic"
|
||||
models, err := isc.SysAddonsConfig().GetConfigByGroup(ctx, &in.GetAddonsConfigInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
err = gconv.Struct(models.List, &conf)
|
||||
return
|
||||
}
|
||||
|
||||
// GetConfigByGroup 获取指定分组配置
|
||||
func (s *sSysConfig) GetConfigByGroup(ctx context.Context, in *sysin.GetConfigInp) (res *sysin.GetConfigModel, err error) {
|
||||
in.GetAddonsConfigInp.AddonName = global.GetSkeleton().Name
|
||||
models, err := isc.SysAddonsConfig().GetConfigByGroup(ctx, &in.GetAddonsConfigInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(sysin.GetConfigModel)
|
||||
res.List = models.List
|
||||
return
|
||||
}
|
||||
|
||||
// UpdateConfigByGroup 更新指定分组的配置
|
||||
func (s *sSysConfig) UpdateConfigByGroup(ctx context.Context, in *sysin.UpdateConfigInp) error {
|
||||
in.UpdateAddonsConfigInp.AddonName = global.GetSkeleton().Name
|
||||
return isc.SysAddonsConfig().UpdateConfigByGroup(ctx, &in.UpdateAddonsConfigInp)
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
// Package sys
|
||||
// @Link https://github.com/bufanyun/hotgo
|
||||
// @Copyright Copyright (c) 2023 HotGo CLI
|
||||
// @Author Ms <133814250@qq.com>
|
||||
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
|
||||
package sys
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"github.com/gogf/gf/v2/os/gtime"
|
||||
"hotgo/addons/hgexample/global"
|
||||
"hotgo/addons/hgexample/model/input/sysin"
|
||||
"hotgo/addons/hgexample/service"
|
||||
"hotgo/internal/library/contexts"
|
||||
)
|
||||
|
||||
type sSysIndex struct{}
|
||||
|
||||
func NewSysIndex() *sSysIndex {
|
||||
return &sSysIndex{}
|
||||
}
|
||||
|
||||
func init() {
|
||||
service.RegisterSysIndex(NewSysIndex())
|
||||
}
|
||||
|
||||
// Test 测试
|
||||
func (s *sSysIndex) Test(ctx context.Context, in *sysin.IndexTestInp) (res *sysin.IndexTestModel, err error) {
|
||||
res = new(sysin.IndexTestModel)
|
||||
res.Name = in.Name
|
||||
res.Module = fmt.Sprintf("当前插件模块是:%s,当前应用模块是:%s", global.GetSkeleton().Name, contexts.Get(ctx).Module)
|
||||
res.Time = gtime.Now()
|
||||
return
|
||||
}
|
||||
@@ -0,0 +1,233 @@
|
||||
// Package sys
|
||||
// @Link https://github.com/bufanyun/hotgo
|
||||
// @Copyright Copyright (c) 2023 HotGo CLI
|
||||
// @Author Ms <133814250@qq.com>
|
||||
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
|
||||
package sys
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"github.com/gogf/gf/v2/database/gdb"
|
||||
"github.com/gogf/gf/v2/errors/gerror"
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
"github.com/gogf/gf/v2/os/gctx"
|
||||
"github.com/gogf/gf/v2/util/gconv"
|
||||
"hotgo/addons/hgexample/model/input/sysin"
|
||||
"hotgo/addons/hgexample/service"
|
||||
"hotgo/internal/dao"
|
||||
"hotgo/internal/library/contexts"
|
||||
"hotgo/internal/library/hgorm"
|
||||
"hotgo/internal/library/hgorm/handler"
|
||||
"hotgo/internal/model/input/form"
|
||||
"hotgo/utility/convert"
|
||||
"hotgo/utility/excel"
|
||||
"hotgo/utility/validate"
|
||||
)
|
||||
|
||||
type sSysTable struct{}
|
||||
|
||||
func NewSysTable() *sSysTable {
|
||||
return &sSysTable{}
|
||||
}
|
||||
|
||||
func init() {
|
||||
service.RegisterSysTable(NewSysTable())
|
||||
}
|
||||
|
||||
// Model Orm模型
|
||||
func (s *sSysTable) Model(ctx context.Context, option ...*handler.Option) *gdb.Model {
|
||||
return handler.Model(dao.AddonHgexampleTable.Ctx(ctx), option...)
|
||||
}
|
||||
|
||||
// List 获取列表
|
||||
func (s *sSysTable) List(ctx context.Context, in *sysin.TableListInp) (list []*sysin.TableListModel, totalCount int, err error) {
|
||||
mod := s.Model(ctx)
|
||||
cols := dao.AddonHgexampleTable.Columns()
|
||||
|
||||
if in.Title != "" {
|
||||
mod = mod.WhereLike(cols.Title, "%"+in.Title+"%")
|
||||
}
|
||||
|
||||
if in.Content != "" {
|
||||
mod = mod.WhereLike(cols.Content, "%"+in.Content+"%")
|
||||
}
|
||||
|
||||
if in.Status > 0 {
|
||||
mod = mod.Where(cols.Status, in.Status)
|
||||
}
|
||||
|
||||
if in.Switch > 0 {
|
||||
mod = mod.Where(cols.Switch, in.Switch)
|
||||
}
|
||||
|
||||
if len(in.Price) > 0 {
|
||||
if in.Price[0] > 0 && in.Price[1] > 0 {
|
||||
mod = mod.WhereBetween(cols.Price, in.Price[0], in.Price[1])
|
||||
} else if in.Price[0] > 0 && in.Price[1] == 0 {
|
||||
mod = mod.WhereGTE(cols.Price, in.Price[0])
|
||||
} else if in.Price[0] == 0 && in.Price[1] > 0 {
|
||||
mod = mod.WhereLTE(cols.Price, in.Price[1])
|
||||
}
|
||||
}
|
||||
|
||||
if in.ActivityAt != nil {
|
||||
mod = mod.Where(cols.ActivityAt, in.ActivityAt)
|
||||
}
|
||||
|
||||
if len(in.CreatedAt) == 2 {
|
||||
mod = mod.WhereBetween(cols.CreatedAt, in.CreatedAt[0], in.CreatedAt[1])
|
||||
}
|
||||
|
||||
if !in.Flag.IsNil() {
|
||||
mod = mod.Where(fmt.Sprintf(`JSON_CONTAINS(%s,'%v')`, cols.Flag, in.Flag))
|
||||
}
|
||||
|
||||
if !in.Hobby.IsNil() {
|
||||
mod = mod.Where(fmt.Sprintf(`JSON_CONTAINS(%s,'%v')`, cols.Hobby, in.Hobby))
|
||||
}
|
||||
|
||||
totalCount, err = mod.Clone().Count()
|
||||
if err != nil {
|
||||
err = gerror.Wrap(err, "获取表格数据行失败,请稍后重试!")
|
||||
return
|
||||
}
|
||||
|
||||
if totalCount == 0 {
|
||||
return
|
||||
}
|
||||
|
||||
// .OrderAsc(cols.Sort).OrderDesc(cols.Id)
|
||||
if err = mod.Fields(sysin.TableListModel{}).Page(in.Page, in.PerPage).Handler(handler.Sorter(in)).Scan(&list); err != nil {
|
||||
err = gerror.Wrap(err, "获取表格列表失败,请稍后重试!")
|
||||
return
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// Export 导出
|
||||
func (s *sSysTable) Export(ctx context.Context, in *sysin.TableListInp) (err error) {
|
||||
list, totalCount, err := s.List(ctx, in)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
// 字段的排序是依据tags的字段顺序,如果你不想使用默认的排序方式,可以直接定义 tags = []string{"字段名称", "字段名称2", ...}
|
||||
tags, err := convert.GetEntityDescTags(sysin.TableExportModel{})
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
var (
|
||||
fileName = "表格例子导出-" + gctx.CtxId(ctx)
|
||||
sheetName = fmt.Sprintf("索引条件共%v行,共%v页,当前导出是第%v页,本页共%v行", totalCount, form.CalPageCount(totalCount, in.PerPage), in.Page, len(list))
|
||||
exports []sysin.TableExportModel
|
||||
)
|
||||
|
||||
if err = gconv.Scan(list, &exports); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if err = excel.ExportByStructs(ctx, tags, exports, fileName, sheetName); err != nil {
|
||||
return
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// Edit 修改/新增
|
||||
func (s *sSysTable) Edit(ctx context.Context, in *sysin.TableEditInp) (err error) {
|
||||
cols := dao.AddonHgexampleTable.Columns()
|
||||
if err = hgorm.IsUnique(ctx, &dao.AddonHgexampleTable, g.Map{cols.Qq: in.Qq}, "QQ号码已存在,请换一个", in.Id); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
// 修改
|
||||
if in.Id > 0 {
|
||||
in.UpdatedBy = contexts.GetUserId(ctx)
|
||||
if _, err = s.Model(ctx).WherePri(in.Id).Data(in).Update(); err != nil {
|
||||
err = gerror.Wrap(err, "修改表格失败,请稍后重试!")
|
||||
return
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// 新增
|
||||
in.CreatedBy = contexts.GetUserId(ctx)
|
||||
if _, err = s.Model(ctx, &handler.Option{FilterAuth: false}).Data(in).OmitEmptyData().Insert(); err != nil {
|
||||
err = gerror.Wrap(err, "新增表格失败,请稍后重试!")
|
||||
return
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// Delete 删除
|
||||
func (s *sSysTable) Delete(ctx context.Context, in *sysin.TableDeleteInp) (err error) {
|
||||
if _, err = s.Model(ctx).WherePri(in.Id).Delete(); err != nil {
|
||||
err = gerror.Wrap(err, "删除表格失败,请稍后重试!")
|
||||
return
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// Status 更新状态
|
||||
func (s *sSysTable) Status(ctx context.Context, in *sysin.TableStatusInp) (err error) {
|
||||
update := g.Map{
|
||||
dao.AddonHgexampleTable.Columns().Status: in.Status,
|
||||
dao.AddonHgexampleTable.Columns().UpdatedBy: contexts.GetUserId(ctx),
|
||||
}
|
||||
|
||||
if _, err = s.Model(ctx).WherePri(in.Id).Data(update).Update(); err != nil {
|
||||
err = gerror.Wrap(err, "更新表格状态失败,请稍后重试!")
|
||||
return
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// Switch 更新开关状态
|
||||
func (s *sSysTable) Switch(ctx context.Context, in *sysin.TableSwitchInp) (err error) {
|
||||
var fields = []string{
|
||||
dao.AddonHgexampleTable.Columns().Switch,
|
||||
// ...
|
||||
}
|
||||
|
||||
if !validate.InSlice(fields, in.Key) {
|
||||
err = gerror.New("开关键名不在白名单")
|
||||
return
|
||||
}
|
||||
|
||||
update := g.Map{
|
||||
in.Key: in.Value,
|
||||
dao.AddonHgexampleTable.Columns().UpdatedBy: contexts.GetUserId(ctx),
|
||||
}
|
||||
|
||||
if _, err = s.Model(ctx).Where(dao.AddonHgexampleTable.Columns().Id, in.Id).Data(update).Update(); err != nil {
|
||||
err = gerror.Wrap(err, "更新表格开关失败,请稍后重试!")
|
||||
return
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// MaxSort 最大排序
|
||||
func (s *sSysTable) MaxSort(ctx context.Context, in *sysin.TableMaxSortInp) (res *sysin.TableMaxSortModel, err error) {
|
||||
dx := dao.AddonHgexampleTable
|
||||
if err = dx.Ctx(ctx).Fields(dx.Columns().Sort).OrderDesc(dx.Columns().Sort).Scan(&res); err != nil {
|
||||
err = gerror.Wrap(err, "获取表格最大排序,请稍后重试!")
|
||||
return
|
||||
}
|
||||
|
||||
if res == nil {
|
||||
res = new(sysin.TableMaxSortModel)
|
||||
}
|
||||
|
||||
res.Sort = form.DefaultMaxSort(res.Sort)
|
||||
return
|
||||
}
|
||||
|
||||
// View 获取指定信息
|
||||
func (s *sSysTable) View(ctx context.Context, in *sysin.TableViewInp) (res *sysin.TableViewModel, err error) {
|
||||
if err = s.Model(ctx).WherePri(in.Id).Scan(&res); err != nil {
|
||||
err = gerror.Wrap(err, "获取生成演示信息,请稍后重试!")
|
||||
return
|
||||
}
|
||||
return
|
||||
}
|
||||
@@ -0,0 +1,174 @@
|
||||
// Package sys
|
||||
// @Link https://github.com/bufanyun/hotgo
|
||||
// @Copyright Copyright (c) 2024 HotGo CLI
|
||||
// @Author Ms <133814250@qq.com>
|
||||
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
|
||||
// @AutoGenerate Version 2.13.1
|
||||
package sys
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"hotgo/addons/hgexample/model/input/sysin"
|
||||
"hotgo/addons/hgexample/service"
|
||||
"hotgo/internal/dao"
|
||||
"hotgo/internal/library/hgorm/handler"
|
||||
"hotgo/internal/library/hgorm/hook"
|
||||
"hotgo/internal/model/input/form"
|
||||
"hotgo/utility/convert"
|
||||
"hotgo/utility/excel"
|
||||
|
||||
"github.com/gogf/gf/v2/database/gdb"
|
||||
"github.com/gogf/gf/v2/errors/gerror"
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
"github.com/gogf/gf/v2/os/gctx"
|
||||
"github.com/gogf/gf/v2/util/gconv"
|
||||
)
|
||||
|
||||
type sSysTenantOrder struct{}
|
||||
|
||||
func NewSysTenantOrder() *sSysTenantOrder {
|
||||
return &sSysTenantOrder{}
|
||||
}
|
||||
|
||||
func init() {
|
||||
service.RegisterSysTenantOrder(NewSysTenantOrder())
|
||||
}
|
||||
|
||||
// Model 多租户功能演示ORM模型
|
||||
func (s *sSysTenantOrder) Model(ctx context.Context, option ...*handler.Option) *gdb.Model {
|
||||
if len(option) == 0 {
|
||||
// 过滤多租户数据权限
|
||||
option = append(option, &handler.Option{
|
||||
FilterTenant: true,
|
||||
//FilterAuth: true, // 如果还需要维护created_by、member_id等部门数据权限范围可放开注释
|
||||
})
|
||||
}
|
||||
return handler.Model(dao.AddonHgexampleTenantOrder.Ctx(ctx), option...)
|
||||
}
|
||||
|
||||
// List 获取多租户功能演示列表
|
||||
func (s *sSysTenantOrder) List(ctx context.Context, in *sysin.TenantOrderListInp) (list []*sysin.TenantOrderListModel, totalCount int, err error) {
|
||||
mod := s.Model(ctx)
|
||||
|
||||
// 字段过滤
|
||||
mod = mod.Fields(sysin.TenantOrderListModel{})
|
||||
|
||||
// 查询主键
|
||||
if in.Id > 0 {
|
||||
mod = mod.Where(dao.AddonHgexampleTenantOrder.Columns().Id, in.Id)
|
||||
}
|
||||
|
||||
// 查询租户ID
|
||||
if in.TenantId > 0 {
|
||||
mod = mod.Where(dao.AddonHgexampleTenantOrder.Columns().TenantId, in.TenantId)
|
||||
}
|
||||
|
||||
// 查询商户ID
|
||||
if in.MerchantId > 0 {
|
||||
mod = mod.Where(dao.AddonHgexampleTenantOrder.Columns().MerchantId, in.MerchantId)
|
||||
}
|
||||
|
||||
// 查询用户ID
|
||||
if in.UserId > 0 {
|
||||
mod = mod.Where(dao.AddonHgexampleTenantOrder.Columns().UserId, in.UserId)
|
||||
}
|
||||
|
||||
// 查询关联订单号
|
||||
if in.OrderSn != "" {
|
||||
mod = mod.Where(dao.AddonHgexampleTenantOrder.Columns().OrderSn, in.OrderSn)
|
||||
}
|
||||
|
||||
// 查询支付状态
|
||||
if in.Status > 0 {
|
||||
mod = mod.Where(dao.AddonHgexampleTenantOrder.Columns().Status, in.Status)
|
||||
}
|
||||
|
||||
// 查询创建时间
|
||||
if len(in.CreatedAt) == 2 {
|
||||
mod = mod.WhereBetween(dao.AddonHgexampleTenantOrder.Columns().CreatedAt, in.CreatedAt[0], in.CreatedAt[1])
|
||||
}
|
||||
|
||||
// 分页
|
||||
mod = mod.Page(in.Page, in.PerPage)
|
||||
|
||||
// 排序
|
||||
mod = mod.OrderDesc(dao.AddonHgexampleTenantOrder.Columns().Id)
|
||||
|
||||
// 查询数据
|
||||
if err = mod.ScanAndCount(&list, &totalCount, false); err != nil {
|
||||
err = gerror.Wrap(err, "获取多租户功能演示列表失败,请稍后重试!")
|
||||
return
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// Export 导出多租户功能演示
|
||||
func (s *sSysTenantOrder) Export(ctx context.Context, in *sysin.TenantOrderListInp) (err error) {
|
||||
list, totalCount, err := s.List(ctx, in)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
// 字段的排序是依据tags的字段顺序,如果你不想使用默认的排序方式,可以直接定义 tags = []string{"字段名称", "字段名称2", ...}
|
||||
tags, err := convert.GetEntityDescTags(sysin.TenantOrderExportModel{})
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
var (
|
||||
fileName = "导出多租户功能演示-" + gctx.CtxId(ctx)
|
||||
sheetName = fmt.Sprintf("索引条件共%v行,共%v页,当前导出是第%v页,本页共%v行", totalCount, form.CalPageCount(totalCount, in.PerPage), in.Page, len(list))
|
||||
exports []sysin.TenantOrderExportModel
|
||||
)
|
||||
|
||||
if err = gconv.Scan(list, &exports); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
err = excel.ExportByStructs(ctx, tags, exports, fileName, sheetName)
|
||||
return
|
||||
}
|
||||
|
||||
// Edit 修改/新增多租户功能演示
|
||||
func (s *sSysTenantOrder) Edit(ctx context.Context, in *sysin.TenantOrderEditInp) (err error) {
|
||||
return g.DB().Transaction(ctx, func(ctx context.Context, tx gdb.TX) (err error) {
|
||||
// 修改
|
||||
if in.Id > 0 {
|
||||
if _, err = s.Model(ctx).
|
||||
Fields(sysin.TenantOrderUpdateFields{}).
|
||||
WherePri(in.Id).Data(in).
|
||||
Hook(hook.SaveTenant). // 自动维护租户关系更新
|
||||
Update(); err != nil {
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// 新增
|
||||
if _, err = dao.AddonHgexampleTenantOrder.Ctx(ctx).
|
||||
Fields(sysin.TenantOrderInsertFields{}).
|
||||
Hook(hook.SaveTenant). // 自动维护租户关系更新
|
||||
Data(in).
|
||||
Insert(); err != nil {
|
||||
}
|
||||
return
|
||||
})
|
||||
}
|
||||
|
||||
// Delete 删除多租户功能演示
|
||||
func (s *sSysTenantOrder) Delete(ctx context.Context, in *sysin.TenantOrderDeleteInp) (err error) {
|
||||
if _, err = s.Model(ctx).WherePri(in.Id).Delete(); err != nil {
|
||||
err = gerror.Wrap(err, "删除多租户功能演示失败,请稍后重试!")
|
||||
return
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// View 获取多租户功能演示指定信息
|
||||
func (s *sSysTenantOrder) View(ctx context.Context, in *sysin.TenantOrderViewInp) (res *sysin.TenantOrderViewModel, err error) {
|
||||
if err = s.Model(ctx).WherePri(in.Id).Scan(&res); err != nil {
|
||||
err = gerror.Wrap(err, "获取多租户功能演示信息,请稍后重试!")
|
||||
return
|
||||
}
|
||||
return
|
||||
}
|
||||
@@ -0,0 +1,186 @@
|
||||
// Package sys
|
||||
// @Link https://github.com/bufanyun/hotgo
|
||||
// @Copyright Copyright (c) 2023 HotGo CLI
|
||||
// @Author Ms <133814250@qq.com>
|
||||
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
|
||||
package sys
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"github.com/gogf/gf/v2/database/gdb"
|
||||
"github.com/gogf/gf/v2/errors/gerror"
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
"hotgo/addons/hgexample/model/input/sysin"
|
||||
"hotgo/addons/hgexample/service"
|
||||
"hotgo/internal/consts"
|
||||
"hotgo/internal/dao"
|
||||
"hotgo/internal/library/contexts"
|
||||
"hotgo/internal/library/hgorm"
|
||||
"hotgo/internal/library/hgorm/handler"
|
||||
"hotgo/internal/model/entity"
|
||||
)
|
||||
|
||||
type sSysTreeTable struct{}
|
||||
|
||||
func NewSysTreeTable() *sSysTreeTable {
|
||||
return &sSysTreeTable{}
|
||||
}
|
||||
|
||||
func init() {
|
||||
service.RegisterSysTreeTable(NewSysTreeTable())
|
||||
}
|
||||
|
||||
// Model Orm模型
|
||||
func (s *sSysTreeTable) Model(ctx context.Context, option ...*handler.Option) *gdb.Model {
|
||||
return handler.Model(dao.AddonHgexampleTable.Ctx(ctx), option...)
|
||||
}
|
||||
|
||||
// List 获取列表
|
||||
func (s *sSysTreeTable) List(ctx context.Context, in *sysin.TreeTableListInp) (list []*sysin.TreeTableListModel, totalCount int, err error) {
|
||||
mod := s.Model(ctx)
|
||||
cols := dao.AddonHgexampleTable.Columns()
|
||||
|
||||
if in.Title != "" {
|
||||
mod = mod.WhereLike(cols.Title, "%"+in.Title+"%")
|
||||
}
|
||||
|
||||
if in.Content != "" {
|
||||
mod = mod.WhereLike(cols.Content, "%"+in.Content+"%")
|
||||
}
|
||||
|
||||
if in.Status > 0 {
|
||||
mod = mod.Where(cols.Status, in.Status)
|
||||
}
|
||||
|
||||
if in.Switch > 0 {
|
||||
mod = mod.Where(cols.Switch, in.Switch)
|
||||
}
|
||||
|
||||
if in.Pid > 0 {
|
||||
mod = mod.Where(cols.Pid, in.Pid)
|
||||
}
|
||||
|
||||
if len(in.Price) > 0 {
|
||||
if in.Price[0] > 0 && in.Price[1] > 0 {
|
||||
mod = mod.WhereBetween(cols.Price, in.Price[0], in.Price[1])
|
||||
} else if in.Price[0] > 0 && in.Price[1] == 0 {
|
||||
mod = mod.WhereGTE(cols.Price, in.Price[0])
|
||||
} else if in.Price[0] == 0 && in.Price[1] > 0 {
|
||||
mod = mod.WhereLTE(cols.Price, in.Price[1])
|
||||
}
|
||||
}
|
||||
|
||||
if in.ActivityAt != nil {
|
||||
mod = mod.Where(cols.ActivityAt, in.ActivityAt)
|
||||
}
|
||||
|
||||
if len(in.CreatedAt) == 2 {
|
||||
mod = mod.WhereBetween(cols.CreatedAt, in.CreatedAt[0], in.CreatedAt[1])
|
||||
}
|
||||
|
||||
if !in.Flag.IsNil() {
|
||||
mod = mod.Where(fmt.Sprintf(`JSON_CONTAINS(%s,'%v')`, cols.Flag, in.Flag))
|
||||
}
|
||||
|
||||
if !in.Hobby.IsNil() {
|
||||
mod = mod.Where(fmt.Sprintf(`JSON_CONTAINS(%s,'%v')`, cols.Hobby, in.Hobby))
|
||||
}
|
||||
|
||||
totalCount, err = mod.Clone().Count()
|
||||
if err != nil {
|
||||
err = gerror.Wrap(err, "获取表格数据行失败,请稍后重试!")
|
||||
return
|
||||
}
|
||||
|
||||
if totalCount == 0 {
|
||||
return
|
||||
}
|
||||
|
||||
if err = mod.Fields(sysin.TableListModel{}).Page(in.Page, in.PerPage).Handler(handler.Sorter(in)).Scan(&list); err != nil {
|
||||
err = gerror.Wrap(err, "获取表格列表失败,请稍后重试!")
|
||||
return
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// Edit 修改/新增
|
||||
func (s *sSysTreeTable) Edit(ctx context.Context, in *sysin.TableEditInp) (err error) {
|
||||
cols := dao.AddonHgexampleTable.Columns()
|
||||
if err = hgorm.IsUnique(ctx, &dao.AddonHgexampleTable, g.Map{cols.Qq: in.Qq}, "QQ号码已存在,请换一个", in.Id); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
return g.DB().Transaction(ctx, func(ctx context.Context, tx gdb.TX) (err error) {
|
||||
in.Pid, in.Level, in.Tree, err = hgorm.AutoUpdateTree(ctx, &dao.AddonHgexampleTable, in.Id, in.Pid)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if in.Id > 0 {
|
||||
in.UpdatedBy = contexts.GetUserId(ctx)
|
||||
if _, err = s.Model(ctx).WherePri(in.Id).Data(in).Update(); err != nil {
|
||||
err = gerror.Wrap(err, "修改表格失败,请稍后重试!")
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
in.CreatedBy = contexts.GetUserId(ctx)
|
||||
if _, err = s.Model(ctx, &handler.Option{FilterAuth: false}).Data(in).OmitEmptyData().Insert(); err != nil {
|
||||
err = gerror.Wrap(err, "新增表格失败,请稍后重试!")
|
||||
return err
|
||||
}
|
||||
}
|
||||
return
|
||||
})
|
||||
}
|
||||
|
||||
// Delete 删除
|
||||
func (s *sSysTreeTable) Delete(ctx context.Context, in *sysin.TableDeleteInp) (err error) {
|
||||
count, err := dao.AdminMenu.Ctx(ctx).Where("pid", in.Id).Count()
|
||||
if err != nil {
|
||||
err = gerror.Wrap(err, consts.ErrorORM)
|
||||
return err
|
||||
}
|
||||
if count > 0 {
|
||||
return gerror.New("请先删除该表格下的所有下级!")
|
||||
}
|
||||
|
||||
if _, err = s.Model(ctx).WherePri(in.Id).Delete(); err != nil {
|
||||
err = gerror.Wrap(err, "删除表格失败,请稍后重试!")
|
||||
return
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// Select 关系树选项列表
|
||||
func (s *sSysTreeTable) Select(ctx context.Context) (list []*sysin.TableTree, err error) {
|
||||
var models []*entity.AddonHgexampleTable
|
||||
if err = dao.AddonHgexampleTable.Ctx(ctx).Order("pid asc,id asc,sort asc").Scan(&models); err != nil {
|
||||
err = gerror.Wrap(err, "获取关系树选项列表失败!")
|
||||
return
|
||||
}
|
||||
|
||||
list = s.treeList(0, models)
|
||||
return
|
||||
}
|
||||
|
||||
// treeList 树状列表
|
||||
func (s *sSysTreeTable) treeList(pid int64, nodes []*entity.AddonHgexampleTable) (list []*sysin.TableTree) {
|
||||
list = make([]*sysin.TableTree, 0)
|
||||
for _, v := range nodes {
|
||||
if v.Pid == pid {
|
||||
item := new(sysin.TableTree)
|
||||
item.AddonHgexampleTable = *v
|
||||
item.Label = v.Title
|
||||
item.Value = v.Id
|
||||
item.Key = v.Id
|
||||
|
||||
child := s.treeList(v.Id, nodes)
|
||||
if len(child) > 0 {
|
||||
item.Children = child
|
||||
}
|
||||
list = append(list, item)
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
@@ -0,0 +1,97 @@
|
||||
// Package hgexample
|
||||
// @Link https://github.com/bufanyun/hotgo
|
||||
// @Copyright Copyright (c) 2023 HotGo CLI
|
||||
// @Author Ms <133814250@qq.com>
|
||||
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
|
||||
package hgexample
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/gogf/gf/v2/net/ghttp"
|
||||
"github.com/gogf/gf/v2/os/gctx"
|
||||
_ "hotgo/addons/hgexample/crons"
|
||||
"hotgo/addons/hgexample/global"
|
||||
_ "hotgo/addons/hgexample/logic"
|
||||
_ "hotgo/addons/hgexample/queues"
|
||||
"hotgo/addons/hgexample/router"
|
||||
"hotgo/internal/library/addons"
|
||||
"hotgo/internal/service"
|
||||
"sync"
|
||||
)
|
||||
|
||||
type module struct {
|
||||
skeleton *addons.Skeleton
|
||||
ctx context.Context
|
||||
sync.Mutex
|
||||
}
|
||||
|
||||
func init() {
|
||||
newModule()
|
||||
}
|
||||
|
||||
func newModule() {
|
||||
m := &module{
|
||||
skeleton: &addons.Skeleton{
|
||||
Label: "功能案例",
|
||||
Name: "hgexample",
|
||||
Group: 1,
|
||||
Logo: "",
|
||||
Brief: "系统的一些功能案例",
|
||||
Description: "系统自带的功能使用示例及其说明,包含一些简单的交互",
|
||||
Author: "孟帅",
|
||||
Version: "v1.0.0", // 当该版本号高于已安装的版本号时,会提示可以更新
|
||||
},
|
||||
ctx: gctx.New(),
|
||||
}
|
||||
|
||||
addons.RegisterModule(m)
|
||||
}
|
||||
|
||||
// Start 启动模块
|
||||
func (m *module) Start(option *addons.Option) (err error) {
|
||||
// 初始化模块
|
||||
global.Init(m.ctx, m.skeleton)
|
||||
|
||||
// 注册插件路由
|
||||
option.Server.Group("/", func(group *ghttp.RouterGroup) {
|
||||
group.Middleware(service.Middleware().Addon)
|
||||
router.Admin(m.ctx, group)
|
||||
router.Api(m.ctx, group)
|
||||
router.Home(m.ctx, group)
|
||||
router.WebSocket(m.ctx, group)
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
// Stop 停止模块
|
||||
func (m *module) Stop() (err error) {
|
||||
return
|
||||
}
|
||||
|
||||
// Ctx 上下文
|
||||
func (m *module) Ctx() context.Context {
|
||||
return m.ctx
|
||||
}
|
||||
|
||||
// GetSkeleton 获取模块
|
||||
func (m *module) GetSkeleton() *addons.Skeleton {
|
||||
return m.skeleton
|
||||
}
|
||||
|
||||
// Install 安装模块
|
||||
func (m *module) Install(ctx context.Context) (err error) {
|
||||
// ...
|
||||
return
|
||||
}
|
||||
|
||||
// Upgrade 更新模块
|
||||
func (m *module) Upgrade(ctx context.Context) (err error) {
|
||||
// ...
|
||||
return
|
||||
}
|
||||
|
||||
// UnInstall 卸载模块
|
||||
func (m *module) UnInstall(ctx context.Context) (err error) {
|
||||
// ...
|
||||
return
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
// Package model
|
||||
// @Link https://github.com/bufanyun/hotgo
|
||||
// @Copyright Copyright (c) 2023 HotGo CLI
|
||||
// @Author Ms <133814250@qq.com>
|
||||
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
|
||||
package model
|
||||
|
||||
// BasicConfig 基础配置
|
||||
type BasicConfig struct {
|
||||
Test string `json:"basicTest"`
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
// Package sysin
|
||||
// @Link https://github.com/bufanyun/hotgo
|
||||
// @Copyright Copyright (c) 2023 HotGo CLI
|
||||
// @Author Ms <133814250@qq.com>
|
||||
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
|
||||
package sysin
|
||||
|
||||
import (
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
"hotgo/internal/model/input/sysin"
|
||||
)
|
||||
|
||||
// UpdateConfigInp 更新指定配置
|
||||
type UpdateConfigInp struct {
|
||||
sysin.UpdateAddonsConfigInp
|
||||
}
|
||||
|
||||
type GetConfigInp struct {
|
||||
sysin.GetAddonsConfigInp
|
||||
}
|
||||
|
||||
type GetConfigModel struct {
|
||||
List g.Map `json:"list"`
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
// Package sysin
|
||||
// @Link https://github.com/bufanyun/hotgo
|
||||
// @Copyright Copyright (c) 2023 HotGo CLI
|
||||
// @Author Ms <133814250@qq.com>
|
||||
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
|
||||
//
|
||||
package sysin
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/gogf/gf/v2/os/gtime"
|
||||
)
|
||||
|
||||
// IndexTestInp 测试
|
||||
type IndexTestInp struct {
|
||||
Name string `json:"name" d:"HotGo" dc:"名称"`
|
||||
}
|
||||
|
||||
func (in *IndexTestInp) Filter(ctx context.Context) (err error) {
|
||||
return
|
||||
}
|
||||
|
||||
type IndexTestModel struct {
|
||||
Name string `json:"name" dc:"名称"`
|
||||
Module string `json:"module" dc:"当前插件模块"`
|
||||
Time *gtime.Time `json:"time" dc:"当前时间"`
|
||||
}
|
||||
@@ -0,0 +1,180 @@
|
||||
// Package sysin
|
||||
// @Link https://github.com/bufanyun/hotgo
|
||||
// @Copyright Copyright (c) 2023 HotGo CLI
|
||||
// @Author Ms <133814250@qq.com>
|
||||
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
|
||||
package sysin
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"github.com/gogf/gf/v2/encoding/gjson"
|
||||
"github.com/gogf/gf/v2/errors/gerror"
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
"github.com/gogf/gf/v2/os/gtime"
|
||||
"hotgo/internal/consts"
|
||||
"hotgo/internal/model/entity"
|
||||
"hotgo/internal/model/input/form"
|
||||
"hotgo/utility/validate"
|
||||
)
|
||||
|
||||
// TableEditInp 修改/新增
|
||||
type TableEditInp struct {
|
||||
entity.AddonHgexampleTable
|
||||
}
|
||||
|
||||
type TableEditModel struct{}
|
||||
|
||||
func (in *TableEditInp) Filter(ctx context.Context) (err error) {
|
||||
if in.Map.IsNil() {
|
||||
in.Map = gjson.New(consts.NilJsonToString)
|
||||
}
|
||||
if in.Flag.IsNil() {
|
||||
in.Flag = gjson.New(consts.NilJsonToString)
|
||||
}
|
||||
if in.Images.IsNil() {
|
||||
in.Images = gjson.New(consts.NilJsonToString)
|
||||
}
|
||||
if in.Attachfiles.IsNil() {
|
||||
in.Attachfiles = gjson.New(consts.NilJsonToString)
|
||||
}
|
||||
if in.Hobby.IsNil() {
|
||||
in.Hobby = gjson.New(consts.NilJsonToString)
|
||||
}
|
||||
|
||||
if in.Title == "" {
|
||||
return errors.New("标题不能为空")
|
||||
}
|
||||
|
||||
if in.Email != "" && !validate.IsEmail(in.Email) {
|
||||
return errors.New("邮箱格式不正确")
|
||||
}
|
||||
|
||||
if err := g.Validator().Rules("float|between:0,5").Messages("请输入一个浮点数|推荐星只能是0~5星").Data(in.Star).Run(ctx); err != nil {
|
||||
return err.Current()
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// TableDeleteInp 删除类型
|
||||
type TableDeleteInp struct {
|
||||
Id interface{} `json:"id" v:"required#表格ID不能为空" dc:"表格ID"`
|
||||
}
|
||||
|
||||
type TableDeleteModel struct{}
|
||||
|
||||
// TableViewInp 获取信息
|
||||
type TableViewInp struct {
|
||||
Id int64 `json:"id" v:"required#表格ID不能为空" dc:"表格ID"`
|
||||
}
|
||||
|
||||
type TableViewModel struct {
|
||||
entity.AddonHgexampleTable
|
||||
}
|
||||
|
||||
// TableListInp 获取列表
|
||||
type TableListInp struct {
|
||||
form.PageReq
|
||||
form.Sorters
|
||||
Id int64 `json:"id" description:""`
|
||||
Flag *gjson.Json `json:"flag" description:"标签"`
|
||||
Title string `json:"title" description:"标题"`
|
||||
Content string `json:"content" description:"内容"`
|
||||
Price []float64 `json:"price" description:"价格"`
|
||||
ActivityAt *gtime.Time `json:"activityAt" description:"活动时间"`
|
||||
Switch int `json:"switch" description:"开关"`
|
||||
Hobby *gjson.Json `json:"hobby" description:"爱好"`
|
||||
Status int `json:"status" description:"状态"`
|
||||
CreatedAt []*gtime.Time `json:"createdAt" description:"创建时间"`
|
||||
}
|
||||
|
||||
type TableListModel struct {
|
||||
entity.AddonHgexampleTable
|
||||
TableCategoryName string `json:"TableCategoryName" description:"分类名称"`
|
||||
TableCategoryDescription string `json:"TableCategoryDescription" description:"分类描述"`
|
||||
TableCategoryRemark string `json:"TableCategoryRemark" description:"分类备注"`
|
||||
SysProvincesTitle string `json:"sysProvincesTitle" description:""`
|
||||
}
|
||||
|
||||
func (in *TableListInp) Filter(ctx context.Context) (err error) {
|
||||
if !in.Flag.IsNil() {
|
||||
in.Flag = gjson.New(in.Flag.Var().Ints())
|
||||
}
|
||||
if !in.Hobby.IsNil() {
|
||||
in.Hobby = gjson.New(in.Hobby.Var().Ints())
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
type TableExportModel struct {
|
||||
Id int64 `json:"id" description:""`
|
||||
CategoryId int64 `json:"categoryId" description:"分类ID"`
|
||||
Flag *gjson.Json `json:"flag" description:"标签"`
|
||||
Title string `json:"title" description:"标题"`
|
||||
Star float64 `json:"star" description:"推荐星"`
|
||||
Price float64 `json:"price" description:"价格"`
|
||||
Views int64 `json:"views" description:"浏览次数"`
|
||||
ActivityAt *gtime.Time `json:"activityAt" description:"活动时间"`
|
||||
StartAt *gtime.Time `json:"startAt" description:"开启时间"`
|
||||
EndAt *gtime.Time `json:"endAt" description:"结束时间"`
|
||||
Switch int `json:"switch" description:"开关"`
|
||||
Sort int `json:"sort" description:"排序"`
|
||||
Avatar string `json:"avatar" description:"头像"`
|
||||
Sex int `json:"sex" description:"性别"`
|
||||
Qq string `json:"qq" description:"qq"`
|
||||
Email string `json:"email" description:"邮箱"`
|
||||
Mobile string `json:"mobile" description:"手机号码"`
|
||||
Hobby *gjson.Json `json:"hobby" description:"爱好"`
|
||||
Channel int `json:"channel" description:"渠道"`
|
||||
Pid int64 `json:"pid" description:"上级ID"`
|
||||
Level int `json:"level" description:"树等级"`
|
||||
Tree string `json:"tree" description:"关系树"`
|
||||
Remark string `json:"remark" description:"备注"`
|
||||
Status int `json:"status" description:"状态"`
|
||||
CreatedBy int64 `json:"createdBy" description:"创建者"`
|
||||
UpdatedBy int64 `json:"updatedBy" description:"更新者"`
|
||||
CreatedAt *gtime.Time `json:"createdAt" description:"创建时间"`
|
||||
UpdatedAt *gtime.Time `json:"updatedAt" description:"修改时间"`
|
||||
DeletedAt *gtime.Time `json:"deletedAt" description:"删除时间"`
|
||||
}
|
||||
|
||||
// TableMaxSortInp 最大排序
|
||||
type TableMaxSortInp struct{}
|
||||
|
||||
type TableMaxSortModel struct {
|
||||
Sort int `json:"sort" description:"排序"`
|
||||
}
|
||||
|
||||
// TableStatusInp 更新状态
|
||||
type TableStatusInp struct {
|
||||
Id int64 `json:"id" v:"required#表格ID不能为空" dc:"表格ID"`
|
||||
Status int `json:"status" dc:"状态"`
|
||||
}
|
||||
|
||||
func (in *TableStatusInp) Filter(ctx context.Context) (err error) {
|
||||
if in.Id <= 0 {
|
||||
err = gerror.New("ID不能为空")
|
||||
return
|
||||
}
|
||||
|
||||
if in.Status <= 0 {
|
||||
err = gerror.New("状态不能为空")
|
||||
return
|
||||
}
|
||||
|
||||
if !validate.InSlice(consts.StatusSlice, in.Status) {
|
||||
err = gerror.New("状态不正确")
|
||||
return
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
type TableStatusModel struct{}
|
||||
|
||||
// TableSwitchInp 更新开关状态
|
||||
type TableSwitchInp struct {
|
||||
form.SwitchReq
|
||||
Id int64 `json:"id" v:"required#表格ID不能为空" dc:"表格ID"`
|
||||
}
|
||||
|
||||
type TableSwitchModel struct{}
|
||||
@@ -0,0 +1,123 @@
|
||||
// Package sysin
|
||||
// @Link https://github.com/bufanyun/hotgo
|
||||
// @Copyright Copyright (c) 2024 HotGo CLI
|
||||
// @Author Ms <133814250@qq.com>
|
||||
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
|
||||
// @AutoGenerate Version 2.13.1
|
||||
package sysin
|
||||
|
||||
import (
|
||||
"context"
|
||||
"hotgo/internal/model/entity"
|
||||
"hotgo/internal/model/input/form"
|
||||
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
"github.com/gogf/gf/v2/os/gtime"
|
||||
)
|
||||
|
||||
// TenantOrderUpdateFields 修改多租户功能演示字段过滤
|
||||
type TenantOrderUpdateFields struct {
|
||||
TenantId int64 `json:"tenantId" dc:"租户ID"`
|
||||
MerchantId int64 `json:"merchantId" dc:"商户ID"`
|
||||
UserId int64 `json:"userId" dc:"用户ID"`
|
||||
ProductName string `json:"productName" dc:"购买产品"`
|
||||
OrderSn string `json:"orderSn" dc:"关联订单号"`
|
||||
Money float64 `json:"money" dc:"充值金额"`
|
||||
Remark string `json:"remark" dc:"备注"`
|
||||
Status int `json:"status" dc:"支付状态"`
|
||||
}
|
||||
|
||||
// TenantOrderInsertFields 新增多租户功能演示字段过滤
|
||||
type TenantOrderInsertFields struct {
|
||||
TenantId int64 `json:"tenantId" dc:"租户ID"`
|
||||
MerchantId int64 `json:"merchantId" dc:"商户ID"`
|
||||
UserId int64 `json:"userId" dc:"用户ID"`
|
||||
ProductName string `json:"productName" dc:"购买产品"`
|
||||
OrderSn string `json:"orderSn" dc:"关联订单号"`
|
||||
Money float64 `json:"money" dc:"充值金额"`
|
||||
Remark string `json:"remark" dc:"备注"`
|
||||
Status int `json:"status" dc:"支付状态"`
|
||||
}
|
||||
|
||||
// TenantOrderEditInp 修改/新增多租户功能演示
|
||||
type TenantOrderEditInp struct {
|
||||
entity.AddonHgexampleTenantOrder
|
||||
}
|
||||
|
||||
func (in *TenantOrderEditInp) Filter(ctx context.Context) (err error) {
|
||||
// 验证充值金额
|
||||
if err := g.Validator().Rules("required").Data(in.Money).Messages("充值金额不能为空").Run(ctx); err != nil {
|
||||
return err.Current()
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
type TenantOrderEditModel struct{}
|
||||
|
||||
// TenantOrderDeleteInp 删除多租户功能演示
|
||||
type TenantOrderDeleteInp struct {
|
||||
Id interface{} `json:"id" v:"required#主键不能为空" dc:"主键"`
|
||||
}
|
||||
|
||||
func (in *TenantOrderDeleteInp) Filter(ctx context.Context) (err error) {
|
||||
return
|
||||
}
|
||||
|
||||
type TenantOrderDeleteModel struct{}
|
||||
|
||||
// TenantOrderViewInp 获取指定多租户功能演示信息
|
||||
type TenantOrderViewInp struct {
|
||||
Id int64 `json:"id" v:"required#主键不能为空" dc:"主键"`
|
||||
}
|
||||
|
||||
func (in *TenantOrderViewInp) Filter(ctx context.Context) (err error) {
|
||||
return
|
||||
}
|
||||
|
||||
type TenantOrderViewModel struct {
|
||||
entity.AddonHgexampleTenantOrder
|
||||
}
|
||||
|
||||
// TenantOrderListInp 获取多租户功能演示列表
|
||||
type TenantOrderListInp struct {
|
||||
form.PageReq
|
||||
Id int64 `json:"id" dc:"主键"`
|
||||
TenantId int64 `json:"tenantId" dc:"租户ID"`
|
||||
MerchantId int64 `json:"merchantId" dc:"商户ID"`
|
||||
UserId int64 `json:"userId" dc:"用户ID"`
|
||||
OrderSn string `json:"orderSn" dc:"关联订单号"`
|
||||
Status int `json:"status" dc:"支付状态"`
|
||||
CreatedAt []*gtime.Time `json:"createdAt" dc:"创建时间"`
|
||||
}
|
||||
|
||||
func (in *TenantOrderListInp) Filter(ctx context.Context) (err error) {
|
||||
return
|
||||
}
|
||||
|
||||
type TenantOrderListModel struct {
|
||||
Id int64 `json:"id" dc:"主键"`
|
||||
TenantId int64 `json:"tenantId" dc:"租户ID"`
|
||||
MerchantId int64 `json:"merchantId" dc:"商户ID"`
|
||||
UserId int64 `json:"userId" dc:"用户ID"`
|
||||
ProductName string `json:"productName" dc:"购买产品"`
|
||||
OrderSn string `json:"orderSn" dc:"关联订单号"`
|
||||
Money float64 `json:"money" dc:"充值金额"`
|
||||
Remark string `json:"remark" dc:"备注"`
|
||||
Status int `json:"status" dc:"支付状态"`
|
||||
CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"`
|
||||
}
|
||||
|
||||
// TenantOrderExportModel 导出多租户功能演示
|
||||
type TenantOrderExportModel struct {
|
||||
Id int64 `json:"id" dc:"主键"`
|
||||
TenantId int64 `json:"tenantId" dc:"租户ID"`
|
||||
MerchantId int64 `json:"merchantId" dc:"商户ID"`
|
||||
UserId int64 `json:"userId" dc:"用户ID"`
|
||||
ProductName string `json:"productName" dc:"购买产品"`
|
||||
OrderSn string `json:"orderSn" dc:"关联订单号"`
|
||||
Money float64 `json:"money" dc:"充值金额"`
|
||||
Remark string `json:"remark" dc:"备注"`
|
||||
Status int `json:"status" dc:"支付状态"`
|
||||
CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"`
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
// Package sysin
|
||||
// @Link https://github.com/bufanyun/hotgo
|
||||
// @Copyright Copyright (c) 2023 HotGo CLI
|
||||
// @Author Ms <133814250@qq.com>
|
||||
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
|
||||
package sysin
|
||||
|
||||
import (
|
||||
"github.com/gogf/gf/v2/encoding/gjson"
|
||||
"github.com/gogf/gf/v2/os/gtime"
|
||||
"hotgo/internal/model/entity"
|
||||
"hotgo/internal/model/input/form"
|
||||
)
|
||||
|
||||
// TreeTableListInp 获取列表
|
||||
type TreeTableListInp struct {
|
||||
form.PageReq
|
||||
form.Sorters
|
||||
Id int64 `json:"id" description:""`
|
||||
Flag *gjson.Json `json:"flag" description:"标签"`
|
||||
Title string `json:"title" description:"标题"`
|
||||
Content string `json:"content" description:"内容"`
|
||||
Price []float64 `json:"price" description:"价格"`
|
||||
ActivityAt *gtime.Time `json:"activityAt" description:"活动时间"`
|
||||
Switch int `json:"switch" description:"开关"`
|
||||
Hobby *gjson.Json `json:"hobby" description:"爱好"`
|
||||
Status int `json:"status" description:"状态"`
|
||||
CreatedAt []*gtime.Time `json:"createdAt" description:"创建时间"`
|
||||
Pid int64 `json:"pid" description:"上级ID"`
|
||||
}
|
||||
|
||||
type TreeTableListModel struct {
|
||||
entity.AddonHgexampleTable
|
||||
TableCategoryName string `json:"TableCategoryName" description:"分类名称"`
|
||||
TableCategoryDescription string `json:"TableCategoryDescription" description:"分类描述"`
|
||||
TableCategoryRemark string `json:"TableCategoryRemark" description:"分类备注"`
|
||||
SysProvincesTitle string `json:"sysProvincesTitle" description:""`
|
||||
}
|
||||
|
||||
// TableTree 树
|
||||
type TableTree struct {
|
||||
entity.AddonHgexampleTable
|
||||
Key int64 `json:"key" dc:"key"`
|
||||
Label string `json:"label" dc:"标签"`
|
||||
Value int64 `json:"value" dc:"键值"`
|
||||
Children []*TableTree `json:"children"`
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
// Package queues
|
||||
// @Link https://github.com/bufanyun/hotgo
|
||||
// @Copyright Copyright (c) 2023 HotGo CLI
|
||||
// @Author Ms <133814250@qq.com>
|
||||
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
|
||||
package queues
|
||||
|
||||
// 消息队列.
|
||||
// 插件中的消息队列消费者可以统一在这里注册和处理
|
||||
@@ -0,0 +1,36 @@
|
||||
// Package router
|
||||
// @Link https://github.com/bufanyun/hotgo
|
||||
// @Copyright Copyright (c) 2023 HotGo CLI
|
||||
// @Author Ms <133814250@qq.com>
|
||||
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
|
||||
package router
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/gogf/gf/v2/net/ghttp"
|
||||
"hotgo/addons/hgexample/controller/admin/sys"
|
||||
"hotgo/addons/hgexample/global"
|
||||
"hotgo/addons/hgexample/router/genrouter"
|
||||
"hotgo/internal/consts"
|
||||
"hotgo/internal/library/addons"
|
||||
"hotgo/internal/service"
|
||||
)
|
||||
|
||||
func Admin(ctx context.Context, group *ghttp.RouterGroup) {
|
||||
prefix := addons.RouterPrefix(ctx, consts.AppAdmin, global.GetSkeleton().Name)
|
||||
group.Group(prefix, func(group *ghttp.RouterGroup) {
|
||||
group.Bind(
|
||||
sys.Index,
|
||||
)
|
||||
group.Middleware(service.Middleware().AdminAuth)
|
||||
group.Bind(
|
||||
sys.Comp,
|
||||
sys.Config,
|
||||
sys.Table,
|
||||
sys.TreeTable,
|
||||
)
|
||||
})
|
||||
|
||||
// 注册生成路由
|
||||
genrouter.Register(ctx, group)
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
// Package router
|
||||
// @Link https://github.com/bufanyun/hotgo
|
||||
// @Copyright Copyright (c) 2023 HotGo CLI
|
||||
// @Author Ms <133814250@qq.com>
|
||||
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
|
||||
package router
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/gogf/gf/v2/net/ghttp"
|
||||
"hotgo/addons/hgexample/controller/api"
|
||||
"hotgo/addons/hgexample/global"
|
||||
"hotgo/internal/consts"
|
||||
"hotgo/internal/library/addons"
|
||||
"hotgo/internal/service"
|
||||
)
|
||||
|
||||
// Api 前台路由
|
||||
func Api(ctx context.Context, group *ghttp.RouterGroup) {
|
||||
prefix := addons.RouterPrefix(ctx, consts.AppApi, global.GetSkeleton().Name)
|
||||
group.Group(prefix, func(group *ghttp.RouterGroup) {
|
||||
group.Bind(
|
||||
// 无需验证的路由
|
||||
api.Index,
|
||||
)
|
||||
group.Middleware(service.Middleware().ApiAuth)
|
||||
group.Bind(
|
||||
// 需要验证的路由
|
||||
// ...
|
||||
)
|
||||
})
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
// Package genrouter
|
||||
// @Link https://github.com/bufanyun/hotgo
|
||||
// @Copyright Copyright (c) 2023 HotGo CLI
|
||||
// @Author Ms <133814250@qq.com>
|
||||
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
|
||||
package genrouter
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/gogf/gf/v2/net/ghttp"
|
||||
"hotgo/addons/hgexample/global"
|
||||
"hotgo/internal/consts"
|
||||
"hotgo/internal/library/addons"
|
||||
"hotgo/internal/service"
|
||||
)
|
||||
|
||||
var (
|
||||
NoLoginRouter []interface{} // 无需登录
|
||||
LoginRequiredRouter []interface{} // 需要登录
|
||||
)
|
||||
|
||||
// Register 注册通过代码生成的后台路由
|
||||
func Register(ctx context.Context, group *ghttp.RouterGroup) {
|
||||
prefix := addons.RouterPrefix(ctx, consts.AppAdmin, global.GetSkeleton().Name)
|
||||
group.Group(prefix, func(group *ghttp.RouterGroup) {
|
||||
if len(NoLoginRouter) > 0 {
|
||||
group.Bind(NoLoginRouter...)
|
||||
}
|
||||
group.Middleware(service.Middleware().AdminAuth)
|
||||
if len(LoginRequiredRouter) > 0 {
|
||||
group.Bind(LoginRequiredRouter...)
|
||||
}
|
||||
})
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
// Package genrouter
|
||||
// @Link https://github.com/bufanyun/hotgo
|
||||
// @Copyright Copyright (c) 2024 HotGo CLI
|
||||
// @Author Ms <133814250@qq.com>
|
||||
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
|
||||
// @AutoGenerate Version 2.13.1
|
||||
package genrouter
|
||||
|
||||
import "hotgo/addons/hgexample/controller/admin/sys"
|
||||
|
||||
func init() {
|
||||
LoginRequiredRouter = append(LoginRequiredRouter, sys.TenantOrder) // 多租户功能演示
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
// Package router
|
||||
// @Link https://github.com/bufanyun/hotgo
|
||||
// @Copyright Copyright (c) 2023 HotGo CLI
|
||||
// @Author Ms <133814250@qq.com>
|
||||
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
|
||||
package router
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/gogf/gf/v2/net/ghttp"
|
||||
"hotgo/addons/hgexample/controller/home"
|
||||
"hotgo/addons/hgexample/global"
|
||||
"hotgo/internal/consts"
|
||||
"hotgo/internal/library/addons"
|
||||
)
|
||||
|
||||
// Home 前台页面路由
|
||||
func Home(ctx context.Context, group *ghttp.RouterGroup) {
|
||||
prefix := addons.RouterPrefix(ctx, consts.AppHome, global.GetSkeleton().Name)
|
||||
group.Group(prefix, func(group *ghttp.RouterGroup) {
|
||||
group.Bind(
|
||||
home.Index,
|
||||
)
|
||||
})
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
// Package router
|
||||
// @Link https://github.com/bufanyun/hotgo
|
||||
// @Copyright Copyright (c) 2023 HotGo CLI
|
||||
// @Author Ms <133814250@qq.com>
|
||||
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
|
||||
package router
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/gogf/gf/v2/net/ghttp"
|
||||
"hotgo/addons/hgexample/controller/websocket"
|
||||
"hotgo/addons/hgexample/controller/websocket/handler"
|
||||
"hotgo/addons/hgexample/global"
|
||||
"hotgo/internal/consts"
|
||||
"hotgo/internal/library/addons"
|
||||
"hotgo/internal/service"
|
||||
ws "hotgo/internal/websocket"
|
||||
)
|
||||
|
||||
// WebSocket ws路由配置
|
||||
func WebSocket(ctx context.Context, group *ghttp.RouterGroup) {
|
||||
prefix := addons.RouterPrefix(ctx, consts.AppWebSocket, global.GetSkeleton().Name)
|
||||
group.Group(prefix, func(group *ghttp.RouterGroup) {
|
||||
group.Bind(
|
||||
// 无需验证的路由
|
||||
websocket.Index,
|
||||
)
|
||||
// ws连接中间件
|
||||
group.Middleware(service.Middleware().WebSocketAuth)
|
||||
group.Bind(
|
||||
// 需要验证的路由
|
||||
// ..
|
||||
)
|
||||
})
|
||||
|
||||
// 注册消息路由
|
||||
ws.RegisterMsg(ws.EventHandlers{
|
||||
"admin/addons/hgexample/testMessage": handler.Index.TestMessage, // 测试消息
|
||||
})
|
||||
}
|
||||
@@ -0,0 +1,139 @@
|
||||
// ================================================================================
|
||||
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
|
||||
// You can delete these comments if you wish manually maintain this interface file.
|
||||
// ================================================================================
|
||||
|
||||
package service
|
||||
|
||||
import (
|
||||
"context"
|
||||
"hotgo/addons/hgexample/model"
|
||||
"hotgo/addons/hgexample/model/input/sysin"
|
||||
"hotgo/internal/library/hgorm/handler"
|
||||
|
||||
"github.com/gogf/gf/v2/database/gdb"
|
||||
)
|
||||
|
||||
type (
|
||||
ISysConfig interface {
|
||||
// GetBasic 获取基础配置
|
||||
GetBasic(ctx context.Context) (conf *model.BasicConfig, err error)
|
||||
// GetConfigByGroup 获取指定分组配置
|
||||
GetConfigByGroup(ctx context.Context, in *sysin.GetConfigInp) (res *sysin.GetConfigModel, err error)
|
||||
// UpdateConfigByGroup 更新指定分组的配置
|
||||
UpdateConfigByGroup(ctx context.Context, in *sysin.UpdateConfigInp) error
|
||||
}
|
||||
ISysIndex interface {
|
||||
// Test 测试
|
||||
Test(ctx context.Context, in *sysin.IndexTestInp) (res *sysin.IndexTestModel, err error)
|
||||
}
|
||||
ISysTable interface {
|
||||
// Model Orm模型
|
||||
Model(ctx context.Context, option ...*handler.Option) *gdb.Model
|
||||
// List 获取列表
|
||||
List(ctx context.Context, in *sysin.TableListInp) (list []*sysin.TableListModel, totalCount int, err error)
|
||||
// Export 导出
|
||||
Export(ctx context.Context, in *sysin.TableListInp) (err error)
|
||||
// Edit 修改/新增
|
||||
Edit(ctx context.Context, in *sysin.TableEditInp) (err error)
|
||||
// Delete 删除
|
||||
Delete(ctx context.Context, in *sysin.TableDeleteInp) (err error)
|
||||
// Status 更新状态
|
||||
Status(ctx context.Context, in *sysin.TableStatusInp) (err error)
|
||||
// Switch 更新开关状态
|
||||
Switch(ctx context.Context, in *sysin.TableSwitchInp) (err error)
|
||||
// MaxSort 最大排序
|
||||
MaxSort(ctx context.Context, in *sysin.TableMaxSortInp) (res *sysin.TableMaxSortModel, err error)
|
||||
// View 获取指定信息
|
||||
View(ctx context.Context, in *sysin.TableViewInp) (res *sysin.TableViewModel, err error)
|
||||
}
|
||||
ISysTenantOrder interface {
|
||||
// Model 多租户功能演示ORM模型
|
||||
Model(ctx context.Context, option ...*handler.Option) *gdb.Model
|
||||
// List 获取多租户功能演示列表
|
||||
List(ctx context.Context, in *sysin.TenantOrderListInp) (list []*sysin.TenantOrderListModel, totalCount int, err error)
|
||||
// Export 导出多租户功能演示
|
||||
Export(ctx context.Context, in *sysin.TenantOrderListInp) (err error)
|
||||
// Edit 修改/新增多租户功能演示
|
||||
Edit(ctx context.Context, in *sysin.TenantOrderEditInp) (err error)
|
||||
// Delete 删除多租户功能演示
|
||||
Delete(ctx context.Context, in *sysin.TenantOrderDeleteInp) (err error)
|
||||
// View 获取多租户功能演示指定信息
|
||||
View(ctx context.Context, in *sysin.TenantOrderViewInp) (res *sysin.TenantOrderViewModel, err error)
|
||||
}
|
||||
ISysTreeTable interface {
|
||||
// Model Orm模型
|
||||
Model(ctx context.Context, option ...*handler.Option) *gdb.Model
|
||||
// List 获取列表
|
||||
List(ctx context.Context, in *sysin.TreeTableListInp) (list []*sysin.TreeTableListModel, totalCount int, err error)
|
||||
// Edit 修改/新增
|
||||
Edit(ctx context.Context, in *sysin.TableEditInp) (err error)
|
||||
// Delete 删除
|
||||
Delete(ctx context.Context, in *sysin.TableDeleteInp) (err error)
|
||||
// Select 关系树选项列表
|
||||
Select(ctx context.Context) (list []*sysin.TableTree, err error)
|
||||
}
|
||||
)
|
||||
|
||||
var (
|
||||
localSysConfig ISysConfig
|
||||
localSysIndex ISysIndex
|
||||
localSysTable ISysTable
|
||||
localSysTenantOrder ISysTenantOrder
|
||||
localSysTreeTable ISysTreeTable
|
||||
)
|
||||
|
||||
func SysConfig() ISysConfig {
|
||||
if localSysConfig == nil {
|
||||
panic("implement not found for interface ISysConfig, forgot register?")
|
||||
}
|
||||
return localSysConfig
|
||||
}
|
||||
|
||||
func RegisterSysConfig(i ISysConfig) {
|
||||
localSysConfig = i
|
||||
}
|
||||
|
||||
func SysIndex() ISysIndex {
|
||||
if localSysIndex == nil {
|
||||
panic("implement not found for interface ISysIndex, forgot register?")
|
||||
}
|
||||
return localSysIndex
|
||||
}
|
||||
|
||||
func RegisterSysIndex(i ISysIndex) {
|
||||
localSysIndex = i
|
||||
}
|
||||
|
||||
func SysTable() ISysTable {
|
||||
if localSysTable == nil {
|
||||
panic("implement not found for interface ISysTable, forgot register?")
|
||||
}
|
||||
return localSysTable
|
||||
}
|
||||
|
||||
func RegisterSysTable(i ISysTable) {
|
||||
localSysTable = i
|
||||
}
|
||||
|
||||
func SysTenantOrder() ISysTenantOrder {
|
||||
if localSysTenantOrder == nil {
|
||||
panic("implement not found for interface ISysTenantOrder, forgot register?")
|
||||
}
|
||||
return localSysTenantOrder
|
||||
}
|
||||
|
||||
func RegisterSysTenantOrder(i ISysTenantOrder) {
|
||||
localSysTenantOrder = i
|
||||
}
|
||||
|
||||
func SysTreeTable() ISysTreeTable {
|
||||
if localSysTreeTable == nil {
|
||||
panic("implement not found for interface ISysTreeTable, forgot register?")
|
||||
}
|
||||
return localSysTreeTable
|
||||
}
|
||||
|
||||
func RegisterSysTreeTable(i ISysTreeTable) {
|
||||
localSysTreeTable = i
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
// Package modules
|
||||
// @Link https://github.com/bufanyun/hotgo
|
||||
// @Copyright Copyright (c) 2023 HotGo CLI
|
||||
// @Author Ms <133814250@qq.com>
|
||||
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
|
||||
package modules
|
||||
|
||||
import _ "hotgo/addons/hgexample"
|
||||
@@ -0,0 +1,59 @@
|
||||
// Package addons
|
||||
// @Link https://github.com/bufanyun/hotgo
|
||||
// @Copyright Copyright (c) 2023 HotGo CLI
|
||||
// @Author Ms <133814250@qq.com>
|
||||
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
|
||||
package addons
|
||||
|
||||
import (
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
"hotgo/internal/model/input/form"
|
||||
"hotgo/internal/model/input/sysin"
|
||||
)
|
||||
|
||||
// ListReq 查询列表
|
||||
type ListReq struct {
|
||||
g.Meta `path:"/addons/list" method:"get" tags:"插件管理" summary:"获取插件列表"`
|
||||
sysin.AddonsListInp
|
||||
}
|
||||
|
||||
type ListRes struct {
|
||||
List []*sysin.AddonsListModel `json:"list" dc:"数据列表"`
|
||||
form.PageRes
|
||||
}
|
||||
|
||||
// BuildReq 提交生成
|
||||
type BuildReq struct {
|
||||
g.Meta `path:"/addons/build" method:"post" tags:"插件管理" summary:"提交生成"`
|
||||
sysin.AddonsBuildInp
|
||||
}
|
||||
|
||||
type BuildRes struct {
|
||||
}
|
||||
|
||||
// InstallReq 安装模块
|
||||
type InstallReq struct {
|
||||
g.Meta `path:"/addons/install" method:"post" tags:"插件管理" summary:"安装模块"`
|
||||
sysin.AddonsInstallInp
|
||||
}
|
||||
|
||||
type InstallRes struct {
|
||||
}
|
||||
|
||||
// UpgradeReq 更新模块
|
||||
type UpgradeReq struct {
|
||||
g.Meta `path:"/addons/upgrade" method:"post" tags:"插件管理" summary:"更新模块"`
|
||||
sysin.AddonsUpgradeInp
|
||||
}
|
||||
|
||||
type UpgradeRes struct {
|
||||
}
|
||||
|
||||
// UnInstallReq 卸载模块
|
||||
type UnInstallReq struct {
|
||||
g.Meta `path:"/addons/uninstall" method:"post" tags:"插件管理" summary:"卸载模块"`
|
||||
sysin.AddonsUnInstallInp
|
||||
}
|
||||
|
||||
type UnInstallRes struct {
|
||||
}
|
||||
@@ -0,0 +1,149 @@
|
||||
package appmember
|
||||
|
||||
import (
|
||||
"hotgo/internal/model/input/form"
|
||||
"hotgo/internal/model/input/sysin"
|
||||
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
)
|
||||
|
||||
type ListReq struct {
|
||||
g.Meta `path:"/appMember/list" method:"get" tags:"会员管理" summary:"会员列表"`
|
||||
sysin.AppMemberListInp
|
||||
}
|
||||
type ListRes struct {
|
||||
form.PageRes
|
||||
List []*sysin.AppMemberListModel `json:"list"`
|
||||
}
|
||||
type ViewReq struct {
|
||||
g.Meta `path:"/appMember/view" method:"get" tags:"会员管理" summary:"会员详情"`
|
||||
sysin.AppMemberViewInp
|
||||
}
|
||||
type ViewRes struct{ *sysin.AppMemberViewModel }
|
||||
type EditReq struct {
|
||||
g.Meta `path:"/appMember/edit" method:"post" tags:"会员管理" summary:"新增编辑会员"`
|
||||
sysin.AppMemberEditInp
|
||||
}
|
||||
type EditRes struct{}
|
||||
type DeleteReq struct {
|
||||
g.Meta `path:"/appMember/delete" method:"post" tags:"会员管理" summary:"注销会员"`
|
||||
sysin.AppMemberDeleteInp
|
||||
}
|
||||
type DeleteRes struct{}
|
||||
type AutoDispatchReq struct {
|
||||
g.Meta `path:"/appMember/autoDispatch" method:"post" tags:"会员管理" summary:"切换派单模式"`
|
||||
sysin.AppMemberAutoDispatchInp
|
||||
}
|
||||
type AutoDispatchRes struct{}
|
||||
type CategoryReq struct {
|
||||
g.Meta `path:"/appMember/category" method:"post" tags:"会员管理" summary:"切换会员真人假人类别"`
|
||||
sysin.AppMemberCategoryInp
|
||||
}
|
||||
type CategoryRes struct{}
|
||||
|
||||
type PaymentListReq struct {
|
||||
g.Meta `path:"/appMember/paymentList" method:"get" tags:"会员管理" summary:"收款账户列表"`
|
||||
sysin.AppMemberPaymentListInp
|
||||
}
|
||||
type PaymentListRes struct {
|
||||
List []*sysin.AppMemberPaymentModel `json:"list"`
|
||||
}
|
||||
type PaymentEditReq struct {
|
||||
g.Meta `path:"/appMember/paymentEdit" method:"post" tags:"会员管理" summary:"新增编辑收款账户"`
|
||||
sysin.AppMemberPaymentEditInp
|
||||
}
|
||||
type PaymentEditRes struct{}
|
||||
type PaymentDeleteReq struct {
|
||||
g.Meta `path:"/appMember/paymentDelete" method:"post" tags:"会员管理" summary:"删除收款账户"`
|
||||
sysin.AppMemberPaymentDeleteInp
|
||||
}
|
||||
type PaymentDeleteRes struct{}
|
||||
|
||||
type AddressListReq struct {
|
||||
g.Meta `path:"/appMember/addressList" method:"get" tags:"会员管理" summary:"地址列表"`
|
||||
sysin.AppMemberAddressListInp
|
||||
}
|
||||
type AddressListRes struct {
|
||||
List []*sysin.AppMemberAddressModel `json:"list"`
|
||||
}
|
||||
type AddressEditReq struct {
|
||||
g.Meta `path:"/appMember/addressEdit" method:"post" tags:"会员管理" summary:"新增编辑地址"`
|
||||
sysin.AppMemberAddressEditInp
|
||||
}
|
||||
type AddressEditRes struct{}
|
||||
type AddressDeleteReq struct {
|
||||
g.Meta `path:"/appMember/addressDelete" method:"post" tags:"会员管理" summary:"删除地址"`
|
||||
sysin.AppMemberAddressDeleteInp
|
||||
}
|
||||
type AddressDeleteRes struct{}
|
||||
|
||||
type SensitiveReq struct {
|
||||
g.Meta `path:"/appMember/sensitive" method:"post" tags:"会员管理" summary:"授权查看敏感信息"`
|
||||
sysin.AppMemberSensitiveInp
|
||||
}
|
||||
type SensitiveRes struct{ *sysin.AppMemberSensitiveModel }
|
||||
type TeamReq struct {
|
||||
g.Meta `path:"/appMember/team" method:"get" tags:"会员管理" summary:"团队查询"`
|
||||
sysin.AppMemberTeamInp
|
||||
}
|
||||
type TeamRes struct {
|
||||
form.PageRes
|
||||
List []*sysin.AppMemberTeamModel `json:"list"`
|
||||
}
|
||||
|
||||
type StatusRequestReq struct {
|
||||
g.Meta `path:"/appMember/statusRequest" method:"post" tags:"会员管理" summary:"发起会员状态审批"`
|
||||
sysin.AppMemberStatusRequestInp
|
||||
}
|
||||
type StatusRequestRes struct{ *sysin.AppMemberApprovalModel }
|
||||
type StatusExecuteReq struct {
|
||||
g.Meta `path:"/appMember/statusExecute" method:"post" tags:"会员管理" summary:"执行已审批会员状态变更"`
|
||||
sysin.AppMemberStatusExecuteInp
|
||||
}
|
||||
type StatusExecuteRes struct{}
|
||||
|
||||
type WalletListReq struct {
|
||||
g.Meta `path:"/appMember/walletList" method:"get" tags:"会员管理" summary:"资金调账列表"`
|
||||
sysin.WalletAdjustmentListInp
|
||||
}
|
||||
type WalletListRes struct {
|
||||
form.PageRes
|
||||
List []*sysin.WalletAdjustmentListModel `json:"list"`
|
||||
}
|
||||
type LedgerListReq struct {
|
||||
g.Meta `path:"/appMember/ledgerList" method:"get" tags:"会员管理" summary:"会员账变流水"`
|
||||
sysin.WalletLedgerListInp
|
||||
}
|
||||
type LedgerListRes struct {
|
||||
form.PageRes
|
||||
List []*sysin.WalletLedgerListModel `json:"list"`
|
||||
}
|
||||
type WalletRequestReq struct {
|
||||
g.Meta `path:"/appMember/walletRequest" method:"post" tags:"会员管理" summary:"发起资金调账审批"`
|
||||
sysin.WalletAdjustmentRequestInp
|
||||
}
|
||||
type WalletRequestRes struct{ *sysin.AppMemberApprovalModel }
|
||||
type WalletExecuteReq struct {
|
||||
g.Meta `path:"/appMember/walletExecute" method:"post" tags:"会员管理" summary:"执行已审批资金调账"`
|
||||
sysin.WalletAdjustmentExecuteInp
|
||||
}
|
||||
type WalletExecuteRes struct{}
|
||||
|
||||
type NoticeListReq struct {
|
||||
g.Meta `path:"/appMember/noticeList" method:"get" tags:"会员管理" summary:"会员通知列表"`
|
||||
sysin.MemberNoticeListInp
|
||||
}
|
||||
type NoticeListRes struct {
|
||||
form.PageRes
|
||||
List []*sysin.MemberNoticeListModel `json:"list"`
|
||||
}
|
||||
type NoticeEditReq struct {
|
||||
g.Meta `path:"/appMember/noticeEdit" method:"post" tags:"会员管理" summary:"创建会员通知"`
|
||||
sysin.MemberNoticeEditInp
|
||||
}
|
||||
type NoticeEditRes struct{}
|
||||
type NoticeRevokeReq struct {
|
||||
g.Meta `path:"/appMember/noticeRevoke" method:"post" tags:"会员管理" summary:"撤回会员通知"`
|
||||
sysin.MemberNoticeRevokeInp
|
||||
}
|
||||
type NoticeRevokeRes struct{}
|
||||
@@ -0,0 +1,53 @@
|
||||
package approval
|
||||
|
||||
import (
|
||||
"hotgo/internal/model/input/form"
|
||||
"hotgo/internal/model/input/sysin"
|
||||
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
)
|
||||
|
||||
type ListReq struct {
|
||||
g.Meta `path:"/approval/list" method:"get" tags:"审批中心" summary:"获取审批列表"`
|
||||
sysin.ApprovalListInp
|
||||
}
|
||||
type ListRes struct {
|
||||
form.PageRes
|
||||
List []*sysin.ApprovalListModel `json:"list" dc:"数据列表"`
|
||||
}
|
||||
|
||||
type ViewReq struct {
|
||||
g.Meta `path:"/approval/view" method:"get" tags:"审批中心" summary:"获取审批详情"`
|
||||
sysin.ApprovalViewInp
|
||||
}
|
||||
type ViewRes struct{ *sysin.ApprovalViewModel }
|
||||
|
||||
type CreateReq struct {
|
||||
g.Meta `path:"/approval/create" method:"post" tags:"审批中心" summary:"创建审批草稿"`
|
||||
sysin.ApprovalCreateInp
|
||||
}
|
||||
type CreateRes struct{ *sysin.ApprovalCreateModel }
|
||||
|
||||
type SubmitReq struct {
|
||||
g.Meta `path:"/approval/submit" method:"post" tags:"审批中心" summary:"提交审批"`
|
||||
sysin.ApprovalSubmitInp
|
||||
}
|
||||
type SubmitRes struct{}
|
||||
|
||||
type ApproveReq struct {
|
||||
g.Meta `path:"/approval/approve" method:"post" tags:"审批中心" summary:"通过审批"`
|
||||
sysin.ApprovalDecisionInp
|
||||
}
|
||||
type ApproveRes struct{}
|
||||
|
||||
type RejectReq struct {
|
||||
g.Meta `path:"/approval/reject" method:"post" tags:"审批中心" summary:"驳回审批"`
|
||||
sysin.ApprovalDecisionInp
|
||||
}
|
||||
type RejectRes struct{}
|
||||
|
||||
type CancelReq struct {
|
||||
g.Meta `path:"/approval/cancel" method:"post" tags:"审批中心" summary:"取消审批"`
|
||||
sysin.ApprovalCancelInp
|
||||
}
|
||||
type CancelRes struct{}
|
||||
@@ -0,0 +1,49 @@
|
||||
// Package attachment
|
||||
// @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 attachment
|
||||
|
||||
import (
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
"hotgo/internal/model/input/form"
|
||||
"hotgo/internal/model/input/sysin"
|
||||
)
|
||||
|
||||
// ListReq 查询附件列表
|
||||
type ListReq struct {
|
||||
g.Meta `path:"/attachment/list" method:"get" tags:"附件" summary:"获取附件列表"`
|
||||
sysin.AttachmentListInp
|
||||
}
|
||||
|
||||
type ListRes struct {
|
||||
List []*sysin.AttachmentListModel `json:"list" dc:"数据列表"`
|
||||
form.PageRes
|
||||
}
|
||||
|
||||
// ViewReq 获取附件信息
|
||||
type ViewReq struct {
|
||||
g.Meta `path:"/attachment/view" method:"get" tags:"附件" summary:"获取指定附件信息"`
|
||||
sysin.AttachmentViewInp
|
||||
}
|
||||
|
||||
type ViewRes struct {
|
||||
*sysin.AttachmentViewModel
|
||||
}
|
||||
|
||||
// DeleteReq 删除附件
|
||||
type DeleteReq struct {
|
||||
g.Meta `path:"/attachment/delete" method:"post" tags:"附件" summary:"删除附件"`
|
||||
sysin.AttachmentDeleteInp
|
||||
}
|
||||
|
||||
type DeleteRes struct{}
|
||||
|
||||
// ClearKindReq 清空上传类型
|
||||
type ClearKindReq struct {
|
||||
g.Meta `path:"/attachment/clearKind" method:"post" tags:"附件" summary:"清空上传类型"`
|
||||
sysin.AttachmentClearKindInp
|
||||
}
|
||||
|
||||
type ClearKindRes struct{}
|
||||
@@ -0,0 +1,23 @@
|
||||
package bizaudit
|
||||
|
||||
import (
|
||||
"hotgo/internal/model/input/form"
|
||||
"hotgo/internal/model/input/sysin"
|
||||
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
)
|
||||
|
||||
type ListReq struct {
|
||||
g.Meta `path:"/bizAudit/list" method:"get" tags:"业务审计" summary:"获取业务审计列表"`
|
||||
sysin.BizAuditListInp
|
||||
}
|
||||
type ListRes struct {
|
||||
form.PageRes
|
||||
List []*sysin.BizAuditListModel `json:"list" dc:"数据列表"`
|
||||
}
|
||||
|
||||
type ViewReq struct {
|
||||
g.Meta `path:"/bizAudit/view" method:"get" tags:"业务审计" summary:"获取业务审计详情"`
|
||||
sysin.BizAuditViewInp
|
||||
}
|
||||
type ViewRes struct{ *sysin.BizAuditViewModel }
|
||||
@@ -0,0 +1,57 @@
|
||||
// Package blacklist
|
||||
// @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 blacklist
|
||||
|
||||
import (
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
"hotgo/internal/model/input/form"
|
||||
"hotgo/internal/model/input/sysin"
|
||||
)
|
||||
|
||||
// ListReq 查询列表
|
||||
type ListReq struct {
|
||||
g.Meta `path:"/blacklist/list" method:"get" tags:"黑名单" summary:"获取黑名单列表"`
|
||||
sysin.BlacklistListInp
|
||||
}
|
||||
|
||||
type ListRes struct {
|
||||
List []*sysin.BlacklistListModel `json:"list" dc:"数据列表"`
|
||||
form.PageRes
|
||||
}
|
||||
|
||||
// ViewReq 获取信息
|
||||
type ViewReq struct {
|
||||
g.Meta `path:"/blacklist/view" method:"get" tags:"黑名单" summary:"获取指定信息"`
|
||||
sysin.BlacklistViewInp
|
||||
}
|
||||
|
||||
type ViewRes struct {
|
||||
*sysin.BlacklistViewModel
|
||||
}
|
||||
|
||||
// EditReq 修改/新增
|
||||
type EditReq struct {
|
||||
g.Meta `path:"/blacklist/edit" method:"post" tags:"黑名单" summary:"修改/新增黑名单"`
|
||||
sysin.BlacklistEditInp
|
||||
}
|
||||
|
||||
type EditRes struct{}
|
||||
|
||||
// DeleteReq 删除
|
||||
type DeleteReq struct {
|
||||
g.Meta `path:"/blacklist/delete" method:"post" tags:"黑名单" summary:"删除黑名单"`
|
||||
sysin.BlacklistDeleteInp
|
||||
}
|
||||
|
||||
type DeleteRes struct{}
|
||||
|
||||
// StatusReq 更新状态
|
||||
type StatusReq struct {
|
||||
g.Meta `path:"/blacklist/status" method:"post" tags:"黑名单" summary:"更新黑名单状态"`
|
||||
sysin.BlacklistStatusInp
|
||||
}
|
||||
|
||||
type StatusRes struct{}
|
||||
@@ -0,0 +1,49 @@
|
||||
// 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 {
|
||||
g.Meta `path:"/cash/apply" method:"post" tags:"提现" summary:"申请提现"`
|
||||
Money float64 `json:"money" description:"提现金额"`
|
||||
}
|
||||
|
||||
type ApplyRes struct{}
|
||||
|
||||
// PaymentReq 提现打款处理
|
||||
type PaymentReq struct {
|
||||
g.Meta `path:"/cash/payment" method:"post" tags:"提现" summary:"提现打款处理"`
|
||||
adminin.CashPaymentInp
|
||||
}
|
||||
|
||||
type PaymentRes struct{}
|
||||
@@ -0,0 +1,52 @@
|
||||
// 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 (
|
||||
"hotgo/internal/model/input/sysin"
|
||||
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
)
|
||||
|
||||
// ConsoleStatReq 控制台统计
|
||||
type ConsoleStatReq struct {
|
||||
g.Meta `path:"/console/stat" method:"get" tags:"控制台" summary:"综合数据统计"`
|
||||
}
|
||||
|
||||
type ConsoleStatRes struct {
|
||||
Visits struct {
|
||||
DayVisits float64 `json:"dayVisits"`
|
||||
Rise float64 `json:"rise"`
|
||||
Decline float64 `json:"decline"`
|
||||
Amount float64 `json:"amount"`
|
||||
} `json:"visits"`
|
||||
Saleroom struct {
|
||||
WeekSaleroom float64 `json:"weekSaleroom"`
|
||||
Amount float64 `json:"amount"`
|
||||
Degree float64 `json:"degree"`
|
||||
} `json:"saleroom"`
|
||||
OrderLarge struct {
|
||||
WeekLarge float64 `json:"weekLarge"`
|
||||
Rise float64 `json:"rise"`
|
||||
Decline float64 `json:"decline"`
|
||||
Amount float64 `json:"amount"`
|
||||
} `json:"orderLarge"`
|
||||
Volume struct {
|
||||
WeekLarge float64 `json:"weekLarge"`
|
||||
Rise float64 `json:"rise"`
|
||||
Decline float64 `json:"decline"`
|
||||
Amount float64 `json:"amount"`
|
||||
} `json:"volume"`
|
||||
}
|
||||
|
||||
type DashboardSummaryReq struct {
|
||||
g.Meta `path:"/dashboard/summary" method:"get" tags:"控制台" summary:"业务数据看板"`
|
||||
sysin.DashboardSummaryInp
|
||||
}
|
||||
|
||||
type DashboardSummaryRes struct {
|
||||
*sysin.DashboardSummaryModel
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
// 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"
|
||||
)
|
||||
|
||||
// SendTestEmailReq 发送测试邮件
|
||||
type SendTestEmailReq struct {
|
||||
g.Meta `path:"/ems/sendTest" tags:"邮件" method:"post" summary:"发送测试邮件"`
|
||||
To string `json:"to" v:"required#接收者邮件不能为空" dc:"接收者邮件,多个用;隔开"`
|
||||
}
|
||||
|
||||
type SendTestEmailRes struct {
|
||||
}
|
||||
|
||||
// SendBindEmsReq 发送换绑邮件
|
||||
type SendBindEmsReq struct {
|
||||
g.Meta `path:"/ems/sendBind" tags:"邮件" method:"post" summary:"发送换绑邮件"`
|
||||
}
|
||||
|
||||
type SendBindEmsRes struct {
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
// 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"
|
||||
"hotgo/internal/model/input/adminin"
|
||||
)
|
||||
|
||||
// LoginLogoutReq 注销登录
|
||||
type LoginLogoutReq struct {
|
||||
g.Meta `path:"/site/logout" method:"post" tags:"后台基础" summary:"注销登录"`
|
||||
}
|
||||
|
||||
type LoginLogoutRes struct{}
|
||||
|
||||
// RegisterReq 提交账号注册
|
||||
type RegisterReq struct {
|
||||
g.Meta `path:"/site/register" method:"post" tags:"后台基础" summary:"账号注册"`
|
||||
adminin.RegisterInp
|
||||
}
|
||||
|
||||
type RegisterRes struct {
|
||||
*adminin.LoginModel
|
||||
}
|
||||
|
||||
// LoginCaptchaReq 获取登录验证码
|
||||
type LoginCaptchaReq struct {
|
||||
g.Meta `path:"/site/captcha" method:"get" tags:"后台基础" summary:"获取登录验证码"`
|
||||
}
|
||||
|
||||
type LoginCaptchaRes struct {
|
||||
Cid string `json:"cid" dc:"验证码ID"`
|
||||
Base64 string `json:"base64" dc:"验证码"`
|
||||
}
|
||||
|
||||
// AccountLoginReq 提交账号登录
|
||||
type AccountLoginReq struct {
|
||||
g.Meta `path:"/site/accountLogin" method:"post" tags:"后台基础" summary:"账号登录"`
|
||||
adminin.AccountLoginInp
|
||||
}
|
||||
|
||||
type AccountLoginRes struct {
|
||||
*adminin.LoginModel
|
||||
}
|
||||
|
||||
// MobileLoginReq 提交手机号登录
|
||||
type MobileLoginReq struct {
|
||||
g.Meta `path:"/site/mobileLogin" method:"post" tags:"后台基础" summary:"手机号登录"`
|
||||
adminin.MobileLoginInp
|
||||
}
|
||||
|
||||
type MobileLoginRes struct {
|
||||
*adminin.LoginModel
|
||||
}
|
||||
|
||||
// SiteConfigReq 获取配置
|
||||
type SiteConfigReq struct {
|
||||
g.Meta `path:"/site/config" method:"get" tags:"后台基础" summary:"获取配置"`
|
||||
}
|
||||
|
||||
type SiteConfigRes struct {
|
||||
Version string `json:"version" dc:"系统版本"`
|
||||
WsAddr string `json:"wsAddr" dc:"客户端websocket地址"`
|
||||
Domain string `json:"domain" dc:"对外域名"`
|
||||
Mode string `json:"mode" dc:"运行模式"`
|
||||
}
|
||||
|
||||
// SiteLoginConfigReq 获取登录配置
|
||||
type SiteLoginConfigReq struct {
|
||||
g.Meta `path:"/site/loginConfig" method:"get" tags:"后台基础" summary:"获取登录配置"`
|
||||
}
|
||||
|
||||
type SiteLoginConfigRes struct {
|
||||
*model.LoginConfig
|
||||
I18nSwitch bool `json:"i18nSwitch" dc:"国际化开关"`
|
||||
DefaultLanguage string `json:"defaultLanguage" dc:"默认语言设置"`
|
||||
ProjectName string `json:"projectName" dc:"项目名称"`
|
||||
}
|
||||
|
||||
// SitePingReq ping
|
||||
type SitePingReq struct {
|
||||
g.Meta `path:"/site/ping" method:"get" tags:"后台基础" summary:"ping"`
|
||||
}
|
||||
|
||||
type SitePingRes struct{}
|
||||
@@ -0,0 +1,37 @@
|
||||
// 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/sysin"
|
||||
)
|
||||
|
||||
// SendTestSmsReq 发送测试短信
|
||||
type SendTestSmsReq struct {
|
||||
g.Meta `path:"/sms/sendTest" tags:"短信" method:"post" summary:"发送测试短信"`
|
||||
sysin.SendCodeInp
|
||||
}
|
||||
|
||||
type SendTestSmsRes struct {
|
||||
}
|
||||
|
||||
// SendBindSmsReq 发送换绑短信
|
||||
type SendBindSmsReq struct {
|
||||
g.Meta `path:"/sms/sendBind" tags:"短信" method:"post" summary:"发送换绑短信"`
|
||||
}
|
||||
|
||||
type SendBindSmsRes struct {
|
||||
}
|
||||
|
||||
// SendSmsReq 发送短信
|
||||
type SendSmsReq struct {
|
||||
g.Meta `path:"/sms/send" tags:"短信" method:"post" summary:"发送短信"`
|
||||
sysin.SendCodeInp
|
||||
}
|
||||
|
||||
type SendSmsRes struct {
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
// 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/sysin"
|
||||
)
|
||||
|
||||
// UploadFileReq 上传文件
|
||||
type UploadFileReq struct {
|
||||
g.Meta `path:"/upload/file" tags:"附件" method:"post" summary:"上传附件"`
|
||||
}
|
||||
|
||||
type UploadFileRes *sysin.AttachmentListModel
|
||||
|
||||
// CheckMultipartReq 检查文件分片
|
||||
type CheckMultipartReq struct {
|
||||
g.Meta `path:"/upload/checkMultipart" tags:"附件" method:"post" summary:"检查文件分片"`
|
||||
sysin.CheckMultipartInp
|
||||
}
|
||||
|
||||
type CheckMultipartRes struct {
|
||||
*sysin.CheckMultipartModel
|
||||
}
|
||||
|
||||
// UploadPartReq 分片上传
|
||||
type UploadPartReq struct {
|
||||
g.Meta `path:"/upload/uploadPart" tags:"附件" method:"post" summary:"分片上传"`
|
||||
sysin.UploadPartInp
|
||||
}
|
||||
|
||||
type UploadPartRes struct {
|
||||
*sysin.UploadPartModel
|
||||
}
|
||||
|
||||
// ImageTransferStorageReq 图片链接转存
|
||||
type ImageTransferStorageReq struct {
|
||||
g.Meta `path:"/upload/imageTransferStorage" tags:"附件" method:"post" summary:"图片链接转存"`
|
||||
sysin.ImageTransferStorageInp
|
||||
}
|
||||
|
||||
type ImageTransferStorageRes struct {
|
||||
*sysin.ImageTransferStorageModel
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
// 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
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
// Package config
|
||||
// @Link https://github.com/bufanyun/hotgo
|
||||
// @Copyright Copyright (c) 2023 HotGo CLI
|
||||
// @Author Ms <133814250@qq.com>
|
||||
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
|
||||
package config
|
||||
|
||||
import (
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
"hotgo/internal/model/input/form"
|
||||
"hotgo/internal/model/input/sysin"
|
||||
)
|
||||
|
||||
// GetReq 获取指定分组的配置
|
||||
type GetReq struct {
|
||||
g.Meta `path:"/config/get" method:"get" tags:"配置" summary:"获取指定分组的配置"`
|
||||
sysin.GetConfigInp
|
||||
}
|
||||
|
||||
type GetRes struct {
|
||||
*sysin.GetConfigModel
|
||||
}
|
||||
|
||||
// UpdateReq 获取指定分组的配置
|
||||
type UpdateReq struct {
|
||||
g.Meta `path:"/config/update" method:"post" tags:"配置" summary:"获取指定分组的配置"`
|
||||
sysin.UpdateConfigInp
|
||||
}
|
||||
|
||||
type UpdateRes struct {
|
||||
}
|
||||
|
||||
// TypeSelectReq 数据类型选项
|
||||
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
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
// 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{}
|
||||
@@ -0,0 +1,93 @@
|
||||
// Package cron
|
||||
// @Link https://github.com/bufanyun/hotgo
|
||||
// @Copyright Copyright (c) 2023 HotGo CLI
|
||||
// @Author Ms <133814250@qq.com>
|
||||
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
|
||||
package cron
|
||||
|
||||
import (
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
"hotgo/internal/model/input/form"
|
||||
"hotgo/internal/model/input/sysin"
|
||||
)
|
||||
|
||||
// ListReq 查询列表
|
||||
type ListReq struct {
|
||||
g.Meta `path:"/cron/list" method:"get" tags:"定时任务" summary:"获取定时任务列表"`
|
||||
sysin.CronListInp
|
||||
}
|
||||
|
||||
type ListRes struct {
|
||||
List []*sysin.CronListModel `json:"list" dc:"数据列表"`
|
||||
form.PageRes
|
||||
}
|
||||
|
||||
// ViewReq 获取信息
|
||||
type ViewReq struct {
|
||||
g.Meta `path:"/cron/view" method:"get" tags:"定时任务" summary:"获取指定信息"`
|
||||
sysin.CronViewInp
|
||||
}
|
||||
|
||||
type ViewRes struct {
|
||||
*sysin.CronViewModel
|
||||
}
|
||||
|
||||
// EditReq 修改/新增
|
||||
type EditReq struct {
|
||||
g.Meta `path:"/cron/edit" method:"post" tags:"定时任务" summary:"修改/新增定时任务"`
|
||||
sysin.CronEditInp
|
||||
}
|
||||
|
||||
type EditRes struct {
|
||||
*sysin.CronEditModel
|
||||
}
|
||||
|
||||
// DeleteReq 删除
|
||||
type DeleteReq struct {
|
||||
g.Meta `path:"/cron/delete" method:"post" tags:"定时任务" summary:"删除定时任务"`
|
||||
sysin.CronDeleteInp
|
||||
}
|
||||
|
||||
type DeleteRes struct {
|
||||
*sysin.CronDeleteModel
|
||||
}
|
||||
|
||||
// MaxSortReq 最大排序
|
||||
type MaxSortReq struct {
|
||||
g.Meta `path:"/cron/maxSort" method:"get" tags:"定时任务" summary:"定时任务最大排序"`
|
||||
sysin.CronMaxSortInp
|
||||
}
|
||||
|
||||
type MaxSortRes struct {
|
||||
*sysin.CronMaxSortModel
|
||||
}
|
||||
|
||||
// StatusReq 更新状态
|
||||
type StatusReq struct {
|
||||
g.Meta `path:"/cron/status" method:"post" tags:"定时任务" summary:"更新定时任务状态"`
|
||||
sysin.CronStatusInp
|
||||
}
|
||||
|
||||
type StatusRes struct {
|
||||
*sysin.CronStatusModel
|
||||
}
|
||||
|
||||
// OnlineExecReq 在线执行
|
||||
type OnlineExecReq struct {
|
||||
g.Meta `path:"/cron/onlineExec" method:"post" tags:"定时任务" summary:"在线执行"`
|
||||
sysin.OnlineExecInp
|
||||
}
|
||||
|
||||
type OnlineExecRes struct {
|
||||
*sysin.OnlineExecModel
|
||||
}
|
||||
|
||||
// DispatchLogReq 调度日志
|
||||
type DispatchLogReq struct {
|
||||
g.Meta `path:"/cron/dispatchLog" method:"post" tags:"定时任务" summary:"调度日志"`
|
||||
sysin.DispatchLogInp
|
||||
}
|
||||
|
||||
type DispatchLogRes struct {
|
||||
*sysin.DispatchLogModel
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
// Package cron
|
||||
// @Link https://github.com/bufanyun/hotgo
|
||||
// @Copyright Copyright (c) 2023 HotGo CLI
|
||||
// @Author Ms <133814250@qq.com>
|
||||
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
|
||||
package cron
|
||||
|
||||
import (
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
"hotgo/internal/model/input/form"
|
||||
"hotgo/internal/model/input/sysin"
|
||||
)
|
||||
|
||||
// GroupListReq 查询列表
|
||||
type GroupListReq struct {
|
||||
g.Meta `path:"/cronGroup/list" method:"get" tags:"定时任务分组" summary:"获取定时任务分组列表"`
|
||||
sysin.CronGroupListInp
|
||||
}
|
||||
|
||||
type GroupListRes struct {
|
||||
List []*sysin.CronGroupListModel `json:"list" dc:"数据列表"`
|
||||
form.PageRes
|
||||
}
|
||||
|
||||
// GroupViewReq 获取信息
|
||||
type GroupViewReq struct {
|
||||
g.Meta `path:"/cronGroup/view" method:"get" tags:"定时任务分组" summary:"获取指定信息"`
|
||||
sysin.CronGroupViewInp
|
||||
}
|
||||
|
||||
type GroupViewRes struct {
|
||||
*sysin.CronGroupViewModel
|
||||
}
|
||||
|
||||
// GroupEditReq 修改/新增
|
||||
type GroupEditReq struct {
|
||||
g.Meta `path:"/cronGroup/edit" method:"post" tags:"定时任务分组" summary:"修改/新增定时任务分组"`
|
||||
sysin.CronGroupEditInp
|
||||
}
|
||||
|
||||
type GroupEditRes struct {
|
||||
*sysin.CronGroupEditModel
|
||||
}
|
||||
|
||||
// GroupDeleteReq 删除
|
||||
type GroupDeleteReq struct {
|
||||
g.Meta `path:"/cronGroup/delete" method:"post" tags:"定时任务分组" summary:"删除定时任务分组"`
|
||||
sysin.CronGroupDeleteInp
|
||||
}
|
||||
|
||||
type GroupDeleteRes struct {
|
||||
*sysin.CronGroupDeleteModel
|
||||
}
|
||||
|
||||
// GroupMaxSortReq 最大排序
|
||||
type GroupMaxSortReq struct {
|
||||
g.Meta `path:"/cronGroup/maxSort" method:"get" tags:"定时任务分组" summary:"定时任务分组最大排序"`
|
||||
sysin.CronGroupMaxSortInp
|
||||
}
|
||||
|
||||
type GroupMaxSortRes struct {
|
||||
*sysin.CronGroupMaxSortModel
|
||||
}
|
||||
|
||||
// GroupStatusReq 更新状态
|
||||
type GroupStatusReq struct {
|
||||
g.Meta `path:"/cronGroup/status" method:"post" tags:"定时任务分组" summary:"更新定时任务分组状态"`
|
||||
sysin.CronGroupStatusInp
|
||||
}
|
||||
|
||||
type GroupStatusRes struct {
|
||||
*sysin.CronGroupStatusModel
|
||||
}
|
||||
|
||||
// GroupSelectReq 定时任务分组选项
|
||||
type GroupSelectReq struct {
|
||||
g.Meta `path:"/cronGroup/select" method:"get" tags:"定时任务分组" summary:"定时任务分组选项"`
|
||||
sysin.CronGroupSelectInp
|
||||
}
|
||||
|
||||
type GroupSelectRes struct {
|
||||
*sysin.CronGroupSelectModel
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
// Package curddemo
|
||||
// @Link https://github.com/bufanyun/hotgo
|
||||
// @Copyright Copyright (c) 2025 HotGo CLI
|
||||
// @Author Ms <133814250@qq.com>
|
||||
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
|
||||
// @AutoGenerate Version 2.18.6
|
||||
package curddemo
|
||||
|
||||
import (
|
||||
"hotgo/internal/model/input/form"
|
||||
"hotgo/internal/model/input/sysin"
|
||||
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
)
|
||||
|
||||
// ListReq 查询CURD列表列表
|
||||
type ListReq struct {
|
||||
g.Meta `path:"/curdDemo/list" method:"get" tags:"CURD列表" summary:"获取CURD列表列表"`
|
||||
sysin.CurdDemoListInp
|
||||
}
|
||||
|
||||
type ListRes struct {
|
||||
form.PageRes
|
||||
List []*sysin.CurdDemoListModel `json:"list" dc:"数据列表"`
|
||||
}
|
||||
|
||||
// ExportReq 导出CURD列表列表
|
||||
type ExportReq struct {
|
||||
g.Meta `path:"/curdDemo/export" method:"get" tags:"CURD列表" summary:"导出CURD列表列表"`
|
||||
sysin.CurdDemoListInp
|
||||
}
|
||||
|
||||
type ExportRes struct{}
|
||||
|
||||
// ViewReq 获取CURD列表指定信息
|
||||
type ViewReq struct {
|
||||
g.Meta `path:"/curdDemo/view" method:"get" tags:"CURD列表" summary:"获取CURD列表指定信息"`
|
||||
sysin.CurdDemoViewInp
|
||||
}
|
||||
|
||||
type ViewRes struct {
|
||||
*sysin.CurdDemoViewModel
|
||||
}
|
||||
|
||||
// EditReq 修改/新增CURD列表
|
||||
type EditReq struct {
|
||||
g.Meta `path:"/curdDemo/edit" method:"post" tags:"CURD列表" summary:"修改/新增CURD列表"`
|
||||
sysin.CurdDemoEditInp
|
||||
}
|
||||
|
||||
type EditRes struct{}
|
||||
|
||||
// DeleteReq 删除CURD列表
|
||||
type DeleteReq struct {
|
||||
g.Meta `path:"/curdDemo/delete" method:"post" tags:"CURD列表" summary:"删除CURD列表"`
|
||||
sysin.CurdDemoDeleteInp
|
||||
}
|
||||
|
||||
type DeleteRes struct{}
|
||||
|
||||
// MaxSortReq 获取CURD列表最大排序
|
||||
type MaxSortReq struct {
|
||||
g.Meta `path:"/curdDemo/maxSort" method:"get" tags:"CURD列表" summary:"获取CURD列表最大排序"`
|
||||
sysin.CurdDemoMaxSortInp
|
||||
}
|
||||
|
||||
type MaxSortRes struct {
|
||||
*sysin.CurdDemoMaxSortModel
|
||||
}
|
||||
|
||||
// StatusReq 更新CURD列表状态
|
||||
type StatusReq struct {
|
||||
g.Meta `path:"/curdDemo/status" method:"post" tags:"CURD列表" summary:"更新CURD列表状态"`
|
||||
sysin.CurdDemoStatusInp
|
||||
}
|
||||
|
||||
type StatusRes struct{}
|
||||
|
||||
// SwitchReq 更新CURD列表开关状态
|
||||
type SwitchReq struct {
|
||||
g.Meta `path:"/curdDemo/switch" method:"post" tags:"CURD列表" summary:"更新CURD列表状态"`
|
||||
sysin.CurdDemoSwitchInp
|
||||
}
|
||||
|
||||
type SwitchRes struct{}
|
||||
@@ -0,0 +1,38 @@
|
||||
package customerservice
|
||||
|
||||
import (
|
||||
"hotgo/internal/model/entity"
|
||||
"hotgo/internal/model/input/form"
|
||||
"hotgo/internal/model/input/sysin"
|
||||
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
)
|
||||
|
||||
type ListReq struct {
|
||||
g.Meta `path:"/customerService/list" method:"get" tags:"客服管理" summary:"客服列表"`
|
||||
sysin.CustomerServiceListInp
|
||||
}
|
||||
type ListRes struct {
|
||||
form.PageRes
|
||||
List []*entity.CustomerService `json:"list"`
|
||||
}
|
||||
type ViewReq struct {
|
||||
g.Meta `path:"/customerService/view" method:"get" tags:"客服管理" summary:"客服详情"`
|
||||
sysin.CustomerServiceViewInp
|
||||
}
|
||||
type ViewRes struct{ *entity.CustomerService }
|
||||
type EditReq struct {
|
||||
g.Meta `path:"/customerService/edit" method:"post" tags:"客服管理" summary:"新增编辑客服"`
|
||||
sysin.CustomerServiceEditInp
|
||||
}
|
||||
type EditRes struct{}
|
||||
type StatusReq struct {
|
||||
g.Meta `path:"/customerService/status" method:"post" tags:"客服管理" summary:"客服启停"`
|
||||
sysin.CustomerServiceStatusInp
|
||||
}
|
||||
type StatusRes struct{}
|
||||
type DeleteReq struct {
|
||||
g.Meta `path:"/customerService/delete" method:"post" tags:"客服管理" summary:"删除客服"`
|
||||
sysin.CustomerServiceDeleteInp
|
||||
}
|
||||
type DeleteRes struct{}
|
||||
@@ -0,0 +1,75 @@
|
||||
// Package dept
|
||||
// @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 dept
|
||||
|
||||
import (
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
"hotgo/internal/model/input/adminin"
|
||||
"hotgo/internal/model/input/form"
|
||||
"hotgo/utility/tree"
|
||||
)
|
||||
|
||||
// ListReq 查询列表
|
||||
type ListReq struct {
|
||||
g.Meta `path:"/dept/list" method:"get" tags:"部门" summary:"获取部门列表"`
|
||||
adminin.DeptListInp
|
||||
}
|
||||
|
||||
type ListRes *adminin.DeptListModel
|
||||
|
||||
// ViewReq 获取指定信息
|
||||
type ViewReq struct {
|
||||
g.Meta `path:"/dept/view" method:"get" tags:"部门" summary:"获取指定信息"`
|
||||
adminin.DeptViewInp
|
||||
}
|
||||
|
||||
type ViewRes struct {
|
||||
*adminin.DeptViewModel
|
||||
}
|
||||
|
||||
// EditReq 修改/新增字典数据
|
||||
type EditReq struct {
|
||||
g.Meta `path:"/dept/edit" method:"post" tags:"部门" summary:"修改/新增部门"`
|
||||
adminin.DeptEditInp
|
||||
}
|
||||
|
||||
type EditRes struct{}
|
||||
|
||||
// DeleteReq 删除字典类型
|
||||
type DeleteReq struct {
|
||||
g.Meta `path:"/dept/delete" method:"post" tags:"部门" summary:"删除部门"`
|
||||
adminin.DeptDeleteInp
|
||||
}
|
||||
|
||||
type DeleteRes struct{}
|
||||
|
||||
// MaxSortReq 最大排序
|
||||
type MaxSortReq struct {
|
||||
g.Meta `path:"/dept/maxSort" method:"get" tags:"部门" summary:"部门最大排序"`
|
||||
adminin.DeptMaxSortInp
|
||||
}
|
||||
|
||||
type MaxSortRes struct {
|
||||
*adminin.DeptMaxSortModel
|
||||
}
|
||||
|
||||
// OptionReq 获取当前登录用户可选的部门选项
|
||||
type OptionReq struct {
|
||||
g.Meta `path:"/dept/option" method:"get" tags:"部门" summary:"获取当前登录用户可选的部门选项"`
|
||||
adminin.DeptOptionInp
|
||||
}
|
||||
|
||||
type OptionRes struct {
|
||||
*adminin.DeptOptionModel
|
||||
form.PageRes
|
||||
}
|
||||
|
||||
// TreeOptionReq 获取部门关系树选项
|
||||
type TreeOptionReq struct {
|
||||
g.Meta `path:"/dept/treeOption" method:"get" tags:"部门" summary:"获取部门关系树选项"`
|
||||
}
|
||||
|
||||
type TreeOptionRes []tree.Node
|
||||
@@ -0,0 +1,53 @@
|
||||
// Package dict
|
||||
// @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 dict
|
||||
|
||||
import (
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
"hotgo/internal/model/input/form"
|
||||
"hotgo/internal/model/input/sysin"
|
||||
)
|
||||
|
||||
// DataEditReq 修改/新增字典数据
|
||||
type DataEditReq struct {
|
||||
g.Meta `path:"/dictData/edit" method:"post" tags:"字典数据" summary:"修改/新增字典数据"`
|
||||
sysin.DictDataEditInp
|
||||
}
|
||||
|
||||
type DataEditRes struct{}
|
||||
|
||||
// DataDeleteReq 删除字典数据
|
||||
type DataDeleteReq struct {
|
||||
g.Meta `path:"/dictData/delete" method:"post" tags:"字典数据" summary:"删除字典数据"`
|
||||
sysin.DictDataDeleteInp
|
||||
}
|
||||
|
||||
type DataDeleteRes struct{}
|
||||
|
||||
// DataListReq 查询列表
|
||||
type DataListReq struct {
|
||||
g.Meta `path:"/dictData/list" method:"get" tags:"字典数据" summary:"获取字典数据列表"`
|
||||
sysin.DictDataListInp
|
||||
}
|
||||
|
||||
type DataListRes struct {
|
||||
List []*sysin.DictDataListModel `json:"list" dc:"数据列表"`
|
||||
form.PageRes
|
||||
}
|
||||
|
||||
type DataSelectReq struct {
|
||||
g.Meta `path:"/dictData/option/{Type}" method:"get" tags:"字典数据" summary:"获取指定字典选项"`
|
||||
sysin.DataSelectInp
|
||||
}
|
||||
|
||||
type DataSelectRes sysin.DataSelectModel
|
||||
|
||||
type DataSelectsReq struct {
|
||||
g.Meta `path:"/dictData/options" method:"get" tags:"字典数据" summary:"获取多个字典选项"`
|
||||
Types []string `json:"types"`
|
||||
}
|
||||
|
||||
type DataSelectsRes map[string]sysin.DataSelectModel
|
||||
@@ -0,0 +1,36 @@
|
||||
// Package dict
|
||||
// @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 dict
|
||||
|
||||
import (
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
"hotgo/internal/model/input/sysin"
|
||||
)
|
||||
|
||||
// TypeTreeReq 字典类型树
|
||||
type TypeTreeReq struct {
|
||||
g.Meta `path:"/dictType/tree" tags:"字典类型" method:"get" summary:"字典类型树列表"`
|
||||
}
|
||||
|
||||
type TypeTreeRes struct {
|
||||
List []*sysin.DictTypeTree `json:"list" dc:"数据列表"`
|
||||
}
|
||||
|
||||
// TypeEditReq 修改/新增字典数据
|
||||
type TypeEditReq struct {
|
||||
g.Meta `path:"/dictType/edit" method:"post" tags:"字典类型" summary:"修改/新增字典类型"`
|
||||
sysin.DictTypeEditInp
|
||||
}
|
||||
|
||||
type TypeEditRes struct{}
|
||||
|
||||
// TypeDeleteReq 删除字典类型
|
||||
type TypeDeleteReq struct {
|
||||
g.Meta `path:"/dictType/delete" method:"post" tags:"字典类型" summary:"删除字典类型"`
|
||||
sysin.DictTypeDeleteInp
|
||||
}
|
||||
|
||||
type TypeDeleteRes struct{}
|
||||
@@ -0,0 +1,65 @@
|
||||
// Package emslog
|
||||
// @Link https://github.com/bufanyun/hotgo
|
||||
// @Copyright Copyright (c) 2023 HotGo CLI
|
||||
// @Author Ms <133814250@qq.com>
|
||||
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
|
||||
package emslog
|
||||
|
||||
import (
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
"hotgo/internal/model/input/form"
|
||||
"hotgo/internal/model/input/sysin"
|
||||
)
|
||||
|
||||
// ListReq 查询列表
|
||||
type ListReq struct {
|
||||
g.Meta `path:"/emsLog/list" method:"get" tags:"邮件记录" summary:"获取邮件记录列表"`
|
||||
sysin.EmsLogListInp
|
||||
}
|
||||
|
||||
type ListRes struct {
|
||||
List []*sysin.EmsLogListModel `json:"list" dc:"数据列表"`
|
||||
form.PageRes
|
||||
}
|
||||
|
||||
// ViewReq 获取指定信息
|
||||
type ViewReq struct {
|
||||
g.Meta `path:"/emsLog/view" method:"get" tags:"邮件记录" summary:"获取指定信息"`
|
||||
sysin.EmsLogViewInp
|
||||
}
|
||||
|
||||
type ViewRes struct {
|
||||
*sysin.EmsLogViewModel
|
||||
}
|
||||
|
||||
// EditReq 修改/新增数据
|
||||
type EditReq struct {
|
||||
g.Meta `path:"/emsLog/edit" method:"post" tags:"邮件记录" summary:"修改/新增邮件记录"`
|
||||
sysin.EmsLogEditInp
|
||||
}
|
||||
|
||||
type EditRes struct{}
|
||||
|
||||
// DeleteReq 删除
|
||||
type DeleteReq struct {
|
||||
g.Meta `path:"/emsLog/delete" method:"post" tags:"邮件记录" summary:"删除邮件记录"`
|
||||
sysin.EmsLogDeleteInp
|
||||
}
|
||||
|
||||
type DeleteRes struct{}
|
||||
|
||||
// StatusReq 更新状态
|
||||
type StatusReq struct {
|
||||
g.Meta `path:"/emsLog/status" method:"post" tags:"邮件记录" summary:"更新邮件记录状态"`
|
||||
sysin.EmsLogStatusInp
|
||||
}
|
||||
|
||||
type StatusRes struct{}
|
||||
|
||||
// SendTestReq 更新状态
|
||||
type SendTestReq struct {
|
||||
g.Meta `path:"/emsLog/sendTest" method:"post" tags:"邮件记录" summary:"发送测试邮件"`
|
||||
sysin.SendEmsInp
|
||||
}
|
||||
|
||||
type SendTestRes struct{}
|
||||
@@ -0,0 +1,118 @@
|
||||
// Package gencodes
|
||||
// @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 gencodes
|
||||
|
||||
import (
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
"hotgo/internal/model/input/form"
|
||||
"hotgo/internal/model/input/sysin"
|
||||
)
|
||||
|
||||
// ListReq 查询列表
|
||||
type ListReq struct {
|
||||
g.Meta `path:"/genCodes/list" method:"get" tags:"生成代码" summary:"获取生成代码列表"`
|
||||
sysin.GenCodesListInp
|
||||
}
|
||||
|
||||
type ListRes struct {
|
||||
List []*sysin.GenCodesListModel `json:"list" dc:"数据列表"`
|
||||
form.PageRes
|
||||
}
|
||||
|
||||
// ViewReq 获取指定信息
|
||||
type ViewReq struct {
|
||||
g.Meta `path:"/genCodes/view" method:"get" tags:"生成代码" summary:"获取指定信息"`
|
||||
sysin.GenCodesViewInp
|
||||
}
|
||||
|
||||
type ViewRes struct {
|
||||
*sysin.GenCodesViewModel
|
||||
}
|
||||
|
||||
// EditReq 修改/新增数据
|
||||
type EditReq struct {
|
||||
g.Meta `path:"/genCodes/edit" method:"post" tags:"生成代码" summary:"修改/新增生成代码"`
|
||||
sysin.GenCodesEditInp
|
||||
}
|
||||
|
||||
type EditRes struct {
|
||||
*sysin.GenCodesEditModel
|
||||
}
|
||||
|
||||
// DeleteReq 删除
|
||||
type DeleteReq struct {
|
||||
g.Meta `path:"/genCodes/delete" method:"post" tags:"生成代码" summary:"删除生成代码"`
|
||||
sysin.GenCodesDeleteInp
|
||||
}
|
||||
|
||||
type DeleteRes struct{}
|
||||
|
||||
// MaxSortReq 最大排序
|
||||
type MaxSortReq struct {
|
||||
g.Meta `path:"/genCodes/maxSort" method:"get" tags:"生成代码" summary:"生成代码最大排序"`
|
||||
sysin.GenCodesMaxSortInp
|
||||
}
|
||||
|
||||
type MaxSortRes struct {
|
||||
*sysin.GenCodesMaxSortModel
|
||||
}
|
||||
|
||||
// StatusReq 更新状态
|
||||
type StatusReq struct {
|
||||
g.Meta `path:"/genCodes/status" method:"post" tags:"生成代码" summary:"更新生成代码状态"`
|
||||
sysin.GenCodesStatusInp
|
||||
}
|
||||
|
||||
type StatusRes struct{}
|
||||
|
||||
type SelectsReq struct {
|
||||
g.Meta `path:"/genCodes/selects" method:"get" tags:"生成代码" summary:"生成入口选项"`
|
||||
sysin.GenCodesSelectsInp
|
||||
}
|
||||
|
||||
type SelectsRes struct {
|
||||
*sysin.GenCodesSelectsModel
|
||||
}
|
||||
|
||||
type TableSelectReq struct {
|
||||
g.Meta `path:"/genCodes/tableSelect" method:"get" tags:"生成代码" summary:"数据库表选项"`
|
||||
sysin.GenCodesTableSelectInp
|
||||
}
|
||||
|
||||
type TableSelectRes []*sysin.GenCodesTableSelectModel
|
||||
|
||||
type ColumnSelectReq struct {
|
||||
g.Meta `path:"/genCodes/columnSelect" method:"get" tags:"生成代码" summary:"表字段选项"`
|
||||
sysin.GenCodesColumnSelectInp
|
||||
}
|
||||
|
||||
type ColumnSelectRes []*sysin.GenCodesColumnSelectModel
|
||||
|
||||
type ColumnListReq struct {
|
||||
g.Meta `path:"/genCodes/columnList" method:"get" tags:"生成代码" summary:"表字段列表"`
|
||||
sysin.GenCodesColumnListInp
|
||||
}
|
||||
|
||||
type ColumnListRes []*sysin.GenCodesColumnListModel
|
||||
|
||||
// PreviewReq 生成预览
|
||||
type PreviewReq struct {
|
||||
g.Meta `path:"/genCodes/preview" method:"post" tags:"生成代码" summary:"生成预览"`
|
||||
sysin.GenCodesPreviewInp
|
||||
}
|
||||
|
||||
type PreviewRes struct {
|
||||
*sysin.GenCodesPreviewModel
|
||||
}
|
||||
|
||||
// BuildReq 提交生成
|
||||
type BuildReq struct {
|
||||
g.Meta `path:"/genCodes/build" method:"post" tags:"生成代码" summary:"提交生成"`
|
||||
sysin.GenCodesBuildInp
|
||||
}
|
||||
|
||||
type BuildRes struct {
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
// Package log
|
||||
// @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 log
|
||||
|
||||
import (
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
"hotgo/internal/model/input/form"
|
||||
"hotgo/internal/model/input/sysin"
|
||||
)
|
||||
|
||||
// ClearReq 清空日志
|
||||
type ClearReq struct {
|
||||
g.Meta `path:"/log/clear" method:"post" tags:"访问日志" summary:"清空日志"`
|
||||
}
|
||||
|
||||
type ClearRes struct{}
|
||||
|
||||
// ExportReq 导出
|
||||
type ExportReq struct {
|
||||
g.Meta `path:"/log/export" method:"get" tags:"访问日志" summary:"导出日志"`
|
||||
sysin.LogListInp
|
||||
}
|
||||
|
||||
type ExportRes struct{}
|
||||
|
||||
// ListReq 获取菜单列表
|
||||
type ListReq struct {
|
||||
g.Meta `path:"/log/list" method:"get" tags:"访问日志" summary:"获取日志列表"`
|
||||
sysin.LogListInp
|
||||
}
|
||||
|
||||
type ListRes struct {
|
||||
List []*sysin.LogListModel `json:"list" dc:"数据列表"`
|
||||
form.PageRes
|
||||
}
|
||||
|
||||
// DeleteReq 删除
|
||||
type DeleteReq struct {
|
||||
g.Meta `path:"/log/delete" method:"post" tags:"访问日志" summary:"删除日志"`
|
||||
sysin.LogDeleteInp
|
||||
}
|
||||
|
||||
type DeleteRes struct{}
|
||||
|
||||
// ViewReq 获取指定信息
|
||||
type ViewReq struct {
|
||||
g.Meta `path:"/log/view" method:"get" tags:"访问日志" summary:"获取指定信息"`
|
||||
sysin.LogViewInp
|
||||
}
|
||||
|
||||
type ViewRes struct {
|
||||
*sysin.LogViewModel
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
// Package loginlog
|
||||
// @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 loginlog
|
||||
|
||||
import (
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
"hotgo/internal/model/input/form"
|
||||
"hotgo/internal/model/input/sysin"
|
||||
)
|
||||
|
||||
// ListReq 查询登录日志列表
|
||||
type ListReq struct {
|
||||
g.Meta `path:"/loginLog/list" method:"get" tags:"登录日志" summary:"获取登录日志列表"`
|
||||
sysin.LoginLogListInp
|
||||
}
|
||||
|
||||
type ListRes struct {
|
||||
form.PageRes
|
||||
List []*sysin.LoginLogListModel `json:"list" dc:"数据列表"`
|
||||
}
|
||||
|
||||
// ExportReq 导出登录日志列表
|
||||
type ExportReq struct {
|
||||
g.Meta `path:"/loginLog/export" method:"get" tags:"登录日志" summary:"导出登录日志列表"`
|
||||
sysin.LoginLogListInp
|
||||
}
|
||||
|
||||
type ExportRes struct{}
|
||||
|
||||
// DeleteReq 删除登录日志
|
||||
type DeleteReq struct {
|
||||
g.Meta `path:"/loginLog/delete" method:"post" tags:"登录日志" summary:"删除登录日志"`
|
||||
sysin.LoginLogDeleteInp
|
||||
}
|
||||
|
||||
type DeleteRes struct{}
|
||||
@@ -0,0 +1,138 @@
|
||||
// Package member
|
||||
// @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 member
|
||||
|
||||
import (
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
"hotgo/internal/model/input/adminin"
|
||||
"hotgo/internal/model/input/form"
|
||||
)
|
||||
|
||||
// UpdateCashReq 更新提现信息
|
||||
type UpdateCashReq struct {
|
||||
g.Meta `path:"/member/updateCash" method:"post" tags:"用户" summary:"更新提现信息"`
|
||||
adminin.MemberUpdateCashInp
|
||||
}
|
||||
|
||||
type UpdateCashRes struct{}
|
||||
|
||||
// UpdateEmailReq 换绑邮箱
|
||||
type UpdateEmailReq struct {
|
||||
g.Meta `path:"/member/updateEmail" method:"post" tags:"用户" summary:"换绑邮箱"`
|
||||
adminin.MemberUpdateEmailInp
|
||||
}
|
||||
|
||||
type UpdateEmailRes struct{}
|
||||
|
||||
// UpdateMobileReq 换绑手机号
|
||||
type UpdateMobileReq struct {
|
||||
g.Meta `path:"/member/updateMobile" method:"post" tags:"用户" summary:"换绑手机号"`
|
||||
adminin.MemberUpdateMobileInp
|
||||
}
|
||||
|
||||
type UpdateMobileRes struct{}
|
||||
|
||||
// UpdateProfileReq 更新用户资料
|
||||
type UpdateProfileReq struct {
|
||||
g.Meta `path:"/member/updateProfile" method:"post" tags:"用户" summary:"更新用户资料"`
|
||||
adminin.MemberUpdateProfileInp
|
||||
}
|
||||
|
||||
type UpdateProfileRes struct{}
|
||||
|
||||
// UpdatePwdReq 修改登录密码
|
||||
type UpdatePwdReq struct {
|
||||
g.Meta `path:"/member/updatePwd" method:"post" tags:"用户" summary:"重置密码"`
|
||||
adminin.MemberUpdatePwdInp
|
||||
}
|
||||
|
||||
type UpdatePwdRes struct{}
|
||||
|
||||
// ResetPwdReq 重置密码
|
||||
type ResetPwdReq struct {
|
||||
g.Meta `path:"/member/resetPwd" method:"post" tags:"用户" summary:"重置密码"`
|
||||
adminin.MemberResetPwdInp
|
||||
}
|
||||
|
||||
type ResetPwdRes struct{}
|
||||
|
||||
// ListReq 查询列表
|
||||
type ListReq struct {
|
||||
g.Meta `path:"/member/list" method:"get" tags:"用户" summary:"获取用户列表"`
|
||||
adminin.MemberListInp
|
||||
}
|
||||
|
||||
type ListRes struct {
|
||||
List []*adminin.MemberListModel `json:"list" dc:"数据列表"`
|
||||
form.PageRes
|
||||
}
|
||||
|
||||
// ViewReq 获取指定信息
|
||||
type ViewReq struct {
|
||||
g.Meta `path:"/member/view" method:"get" tags:"用户" summary:"获取指定信息"`
|
||||
adminin.MemberViewInp
|
||||
}
|
||||
|
||||
type ViewRes struct {
|
||||
*adminin.MemberViewModel
|
||||
}
|
||||
|
||||
// EditReq 修改/新增
|
||||
type EditReq struct {
|
||||
g.Meta `path:"/member/edit" method:"post" tags:"用户" summary:"修改/新增用户"`
|
||||
adminin.MemberEditInp
|
||||
}
|
||||
|
||||
type EditRes struct{}
|
||||
|
||||
// DeleteReq 删除
|
||||
type DeleteReq struct {
|
||||
g.Meta `path:"/member/delete" method:"post" tags:"用户" summary:"删除用户"`
|
||||
adminin.MemberDeleteInp
|
||||
}
|
||||
|
||||
type DeleteRes struct{}
|
||||
|
||||
// StatusReq 更新用户状态
|
||||
type StatusReq struct {
|
||||
g.Meta `path:"/member/status" method:"post" tags:"用户" summary:"更新用户状态"`
|
||||
adminin.MemberStatusInp
|
||||
}
|
||||
|
||||
type StatusRes struct{}
|
||||
|
||||
// SelectReq 获取可选的后台用户选项
|
||||
type SelectReq struct {
|
||||
g.Meta `path:"/member/option" method:"get" tags:"用户" summary:"获取可选的后台用户选项"`
|
||||
adminin.MemberSelectInp
|
||||
}
|
||||
|
||||
type SelectRes []*adminin.MemberSelectModel
|
||||
|
||||
// InfoReq 获取登录用户信息
|
||||
type InfoReq struct {
|
||||
g.Meta `path:"/member/info" method:"get" tags:"用户" summary:"获取登录用户信息"`
|
||||
}
|
||||
|
||||
type InfoRes struct {
|
||||
*adminin.LoginMemberInfoModel
|
||||
}
|
||||
|
||||
// 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{}
|
||||
@@ -0,0 +1,67 @@
|
||||
package memberlevel
|
||||
|
||||
import (
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
"hotgo/internal/model/entity"
|
||||
"hotgo/internal/model/input/form"
|
||||
"hotgo/internal/model/input/sysin"
|
||||
)
|
||||
|
||||
type ListReq struct {
|
||||
g.Meta `path:"/memberLevel/list" method:"get" tags:"会员等级" summary:"会员等级列表"`
|
||||
sysin.MemberLevelListInp
|
||||
}
|
||||
type ListRes struct {
|
||||
form.PageRes
|
||||
List []*sysin.MemberLevelListModel `json:"list"`
|
||||
}
|
||||
type ViewReq struct {
|
||||
g.Meta `path:"/memberLevel/view" method:"get" tags:"会员等级" summary:"会员等级详情"`
|
||||
sysin.MemberLevelViewInp
|
||||
}
|
||||
type ViewRes struct{ *sysin.MemberLevelViewModel }
|
||||
type SaveReq struct {
|
||||
g.Meta `path:"/memberLevel/save" method:"post" tags:"会员等级" summary:"保存等级规则草稿"`
|
||||
sysin.MemberLevelSaveInp
|
||||
}
|
||||
type SaveRes struct {
|
||||
Id uint64 `json:"id"`
|
||||
VersionId uint64 `json:"versionId"`
|
||||
}
|
||||
type SubmitReq struct {
|
||||
g.Meta `path:"/memberLevel/submit" method:"post" tags:"会员等级" summary:"提交等级规则审批"`
|
||||
sysin.MemberLevelSubmitInp
|
||||
}
|
||||
type SubmitRes struct {
|
||||
*sysin.MemberLevelApprovalModel
|
||||
}
|
||||
type PublishReq struct {
|
||||
g.Meta `path:"/memberLevel/publish" method:"post" tags:"会员等级" summary:"发布已审批等级规则"`
|
||||
sysin.MemberLevelPublishInp
|
||||
}
|
||||
type PublishRes struct{}
|
||||
type RollbackReq struct {
|
||||
g.Meta `path:"/memberLevel/rollback" method:"post" tags:"会员等级" summary:"回滚等级规则为新草稿"`
|
||||
sysin.MemberLevelRollbackInp
|
||||
}
|
||||
type RollbackRes struct {
|
||||
VersionId uint64 `json:"versionId"`
|
||||
}
|
||||
type HistoryReq struct {
|
||||
g.Meta `path:"/memberLevel/history" method:"get" tags:"会员等级" summary:"等级版本历史"`
|
||||
sysin.MemberLevelHistoryInp
|
||||
}
|
||||
type HistoryRes struct {
|
||||
form.PageRes
|
||||
List []*entity.AppMemberLevelVersion `json:"list"`
|
||||
}
|
||||
type StatusReq struct {
|
||||
g.Meta `path:"/memberLevel/status" method:"post" tags:"会员等级" summary:"停用启用会员等级"`
|
||||
sysin.MemberLevelStatusInp
|
||||
}
|
||||
type StatusRes struct{}
|
||||
type DeleteReq struct {
|
||||
g.Meta `path:"/memberLevel/delete" method:"post" tags:"会员等级" summary:"删除会员等级"`
|
||||
sysin.MemberLevelDeleteInp
|
||||
}
|
||||
type DeleteRes struct{}
|
||||
@@ -0,0 +1,39 @@
|
||||
// Package menu
|
||||
// @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 menu
|
||||
|
||||
import (
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
"hotgo/internal/model/input/adminin"
|
||||
"hotgo/internal/model/input/form"
|
||||
)
|
||||
|
||||
// EditReq 修改/新增菜单
|
||||
type EditReq struct {
|
||||
g.Meta `path:"/menu/edit" method:"post" tags:"菜单" summary:"修改/新增菜单"`
|
||||
adminin.MenuEditInp
|
||||
}
|
||||
|
||||
type EditRes struct{}
|
||||
|
||||
// DeleteReq 删除菜单
|
||||
type DeleteReq struct {
|
||||
g.Meta `path:"/menu/delete" method:"post" tags:"菜单" summary:"删除菜单"`
|
||||
adminin.MenuDeleteInp
|
||||
}
|
||||
|
||||
type DeleteRes struct{}
|
||||
|
||||
// ListReq 获取菜单列表
|
||||
type ListReq struct {
|
||||
g.Meta `path:"/menu/list" method:"get" tags:"菜单" summary:"获取菜单列表"`
|
||||
adminin.MenuListInp
|
||||
}
|
||||
|
||||
type ListRes struct {
|
||||
*adminin.MenuListModel
|
||||
form.PageRes
|
||||
}
|
||||
@@ -0,0 +1,106 @@
|
||||
// Package monitor
|
||||
// @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 monitor
|
||||
|
||||
import (
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
"github.com/gogf/gf/v2/os/gtime"
|
||||
"hotgo/internal/library/network/tcp"
|
||||
"hotgo/internal/model/input/form"
|
||||
)
|
||||
|
||||
// UserOfflineReq 下线用户
|
||||
type UserOfflineReq struct {
|
||||
g.Meta `path:"/monitor/userOffline" method:"post" tags:"在线用户" summary:"下线用户"`
|
||||
Id string `json:"id" v:"required#SID不能为空" description:"SID"`
|
||||
}
|
||||
|
||||
type UserOfflineRes struct{}
|
||||
|
||||
// UserOnlineListReq 获取在线用户列表
|
||||
type UserOnlineListReq struct {
|
||||
g.Meta `path:"/monitor/userOnlineList" method:"get" tags:"在线用户" summary:"获取在线用户列表"`
|
||||
form.PageReq
|
||||
UserId int64 `json:"userId" description:"用户ID"`
|
||||
Username string `json:"username" description:"用户名"`
|
||||
IP string `json:"ip" description:"登录IP"`
|
||||
FirstTime []*gtime.Time `json:"firstTime" description:"登录时间"`
|
||||
}
|
||||
|
||||
type UserOnlineListRes struct {
|
||||
List []*UserOnlineModel `json:"list" description:"数据列表"`
|
||||
form.PageRes
|
||||
}
|
||||
|
||||
type UserOnlineModel struct {
|
||||
ID string `json:"id"` // 连接唯一标识
|
||||
IP string `json:"ip"` // 客户端IP
|
||||
Os string `json:"os"` // 客户端系统名称
|
||||
Browser string `json:"browser"` // 浏览器
|
||||
FirstTime int64 `json:"firstTime"` // 首次连接时间
|
||||
HeartbeatTime uint64 `json:"heartbeatTime"` // 用户上次心跳时间
|
||||
App string `json:"app"` // 应用名称
|
||||
UserId int64 `json:"userId"` // 用户ID
|
||||
Username string `json:"username"` // 用户名
|
||||
Avatar string `json:"avatar"` // 头像
|
||||
}
|
||||
|
||||
// NetOnlineListReq 获取在线服务列表
|
||||
type NetOnlineListReq struct {
|
||||
g.Meta `path:"/monitor/netOnlineList" method:"get" tags:"在线服务" summary:"获取在线服务列表"`
|
||||
form.PageReq
|
||||
Name string `json:"name" description:"应用名称"`
|
||||
Group string `json:"group" description:"分组"`
|
||||
AppId string `json:"appId" description:"APPID"`
|
||||
Addr string `json:"addr" description:"登录地址"`
|
||||
FirstTime []*gtime.Time `json:"firstTime" description:"登录时间"`
|
||||
}
|
||||
|
||||
type NetOnlineListRes struct {
|
||||
List []*NetOnlineModel `json:"list" description:"数据列表"`
|
||||
form.PageRes
|
||||
}
|
||||
|
||||
type NetOnlineModel struct {
|
||||
*tcp.AuthMeta
|
||||
Id int64 `json:"id" description:"连接ID"`
|
||||
IsAuth bool `json:"isAuth" description:"是否认证"`
|
||||
Addr string `json:"addr" description:"登录地址"`
|
||||
Port string `json:"port" description:"连接端口"`
|
||||
FirstTime int64 `json:"firstTime" description:"首次连接时间"`
|
||||
HeartbeatTime int64 `json:"heartbeatTime" description:"上次心跳时间"`
|
||||
LicenseId int64 `json:"licenseId" description:"许可ID"`
|
||||
LicenseName string `json:"licenseName" description:"许可名称"`
|
||||
LoginTimes int64 `json:"loginTimes" description:"许可累计登录次数"`
|
||||
Online int `json:"online" description:"许可在线数量"`
|
||||
OnlineLimit int `json:"onlineLimit" description:"许可在线数量限制"`
|
||||
Desc string `json:"desc" description:"许可说明"`
|
||||
Proto string `json:"proto" description:"网络协议"`
|
||||
}
|
||||
|
||||
// NetOptionReq 获取服务选项
|
||||
type NetOptionReq struct {
|
||||
g.Meta `path:"/monitor/netOption" method:"get" tags:"在线服务" summary:"获取服务选项"`
|
||||
}
|
||||
|
||||
type NetOptionRes struct {
|
||||
Routes []*RouteSelect `json:"routes" dc:"路由选项"`
|
||||
}
|
||||
|
||||
type RouteSelect struct {
|
||||
Value interface{} `json:"value"`
|
||||
Label string `json:"label"`
|
||||
Disabled bool `json:"disabled"`
|
||||
IsRPC bool `json:"isRPC"`
|
||||
}
|
||||
|
||||
// NetOfflineReq 下线服务
|
||||
type NetOfflineReq struct {
|
||||
g.Meta `path:"/monitor/netOffline" method:"post" tags:"在线服务" summary:"下线服务"`
|
||||
Id int64 `json:"id" v:"required#连接ID不能为空" description:"连接ID"`
|
||||
}
|
||||
|
||||
type NetOfflineRes struct{}
|
||||
@@ -0,0 +1,69 @@
|
||||
// Package normaltreedemo
|
||||
// @Link https://github.com/bufanyun/hotgo
|
||||
// @Copyright Copyright (c) 2024 HotGo CLI
|
||||
// @Author Ms <133814250@qq.com>
|
||||
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
|
||||
// @AutoGenerate Version 2.15.7
|
||||
package normaltreedemo
|
||||
|
||||
import (
|
||||
"hotgo/internal/model/input/form"
|
||||
"hotgo/internal/model/input/sysin"
|
||||
"hotgo/utility/tree"
|
||||
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
)
|
||||
|
||||
// ListReq 查询普通树表列表
|
||||
type ListReq struct {
|
||||
g.Meta `path:"/normalTreeDemo/list" method:"get" tags:"普通树表" summary:"获取普通树表列表"`
|
||||
sysin.NormalTreeDemoListInp
|
||||
}
|
||||
|
||||
type ListRes struct {
|
||||
form.PageRes
|
||||
List []*sysin.NormalTreeDemoListModel `json:"list" dc:"数据列表"`
|
||||
}
|
||||
|
||||
// ViewReq 获取普通树表指定信息
|
||||
type ViewReq struct {
|
||||
g.Meta `path:"/normalTreeDemo/view" method:"get" tags:"普通树表" summary:"获取普通树表指定信息"`
|
||||
sysin.NormalTreeDemoViewInp
|
||||
}
|
||||
|
||||
type ViewRes struct {
|
||||
*sysin.NormalTreeDemoViewModel
|
||||
}
|
||||
|
||||
// EditReq 修改/新增普通树表
|
||||
type EditReq struct {
|
||||
g.Meta `path:"/normalTreeDemo/edit" method:"post" tags:"普通树表" summary:"修改/新增普通树表"`
|
||||
sysin.NormalTreeDemoEditInp
|
||||
}
|
||||
|
||||
type EditRes struct{}
|
||||
|
||||
// DeleteReq 删除普通树表
|
||||
type DeleteReq struct {
|
||||
g.Meta `path:"/normalTreeDemo/delete" method:"post" tags:"普通树表" summary:"删除普通树表"`
|
||||
sysin.NormalTreeDemoDeleteInp
|
||||
}
|
||||
|
||||
type DeleteRes struct{}
|
||||
|
||||
// MaxSortReq 获取普通树表最大排序
|
||||
type MaxSortReq struct {
|
||||
g.Meta `path:"/normalTreeDemo/maxSort" method:"get" tags:"普通树表" summary:"获取普通树表最大排序"`
|
||||
sysin.NormalTreeDemoMaxSortInp
|
||||
}
|
||||
|
||||
type MaxSortRes struct {
|
||||
*sysin.NormalTreeDemoMaxSortModel
|
||||
}
|
||||
|
||||
// TreeOptionReq 获取普通树表关系树选项
|
||||
type TreeOptionReq struct {
|
||||
g.Meta `path:"/normalTreeDemo/treeOption" method:"get" tags:"普通树表" summary:"获取普通树表关系树选项"`
|
||||
}
|
||||
|
||||
type TreeOptionRes []tree.Node
|
||||
@@ -0,0 +1,128 @@
|
||||
// Package notice
|
||||
// @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 notice
|
||||
|
||||
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:"/notice/list" method:"get" tags:"公告" summary:"获取公告列表"`
|
||||
adminin.NoticeListInp
|
||||
}
|
||||
|
||||
type ListRes struct {
|
||||
List []*adminin.NoticeListModel `json:"list" dc:"数据列表"`
|
||||
form.PageRes
|
||||
}
|
||||
|
||||
// ViewReq 获取指定信息
|
||||
type ViewReq struct {
|
||||
g.Meta `path:"/notice/view" method:"get" tags:"公告" summary:"获取指定信息"`
|
||||
adminin.NoticeViewInp
|
||||
}
|
||||
|
||||
type ViewRes struct {
|
||||
*adminin.NoticeViewModel
|
||||
}
|
||||
|
||||
// EditReq 修改/新增字典数据
|
||||
type EditReq struct {
|
||||
g.Meta `path:"/notice/edit" method:"post" tags:"公告" summary:"修改/新增公告"`
|
||||
adminin.NoticeEditInp
|
||||
}
|
||||
|
||||
type EditRes struct{}
|
||||
|
||||
// DeleteReq 删除字典类型
|
||||
type DeleteReq struct {
|
||||
g.Meta `path:"/notice/delete" method:"post" tags:"公告" summary:"删除公告"`
|
||||
adminin.NoticeDeleteInp
|
||||
}
|
||||
|
||||
type DeleteRes struct{}
|
||||
|
||||
// MaxSortReq 最大排序
|
||||
type MaxSortReq struct {
|
||||
g.Meta `path:"/notice/maxSort" method:"get" tags:"公告" summary:"公告最大排序"`
|
||||
adminin.NoticeMaxSortInp
|
||||
}
|
||||
|
||||
type MaxSortRes struct {
|
||||
*adminin.NoticeMaxSortModel
|
||||
}
|
||||
|
||||
// StatusReq 更新公告状态
|
||||
type StatusReq struct {
|
||||
g.Meta `path:"/notice/status" method:"post" tags:"公告" summary:"更新公告状态"`
|
||||
adminin.NoticeStatusInp
|
||||
}
|
||||
|
||||
type StatusRes struct{}
|
||||
|
||||
// EditNotifyReq 修改/新增通知
|
||||
type EditNotifyReq struct {
|
||||
g.Meta `path:"/notice/editNotify" method:"post" tags:"公告" summary:"修改/新增通知"`
|
||||
adminin.NoticeEditInp
|
||||
}
|
||||
|
||||
type EditNotifyRes struct{}
|
||||
|
||||
// EditNoticeReq 修改/新增公告
|
||||
type EditNoticeReq struct {
|
||||
g.Meta `path:"/notice/editNotice" method:"post" tags:"公告" summary:"修改/新增公告"`
|
||||
adminin.NoticeEditInp
|
||||
}
|
||||
|
||||
type EditNoticeRes struct{}
|
||||
|
||||
// EditLetterReq 修改/新增公告
|
||||
type EditLetterReq struct {
|
||||
g.Meta `path:"/notice/editLetter" method:"post" tags:"公告" summary:"修改/新增私信"`
|
||||
adminin.NoticeEditInp
|
||||
}
|
||||
|
||||
type EditLetterRes struct{}
|
||||
|
||||
// PullMessagesReq 拉取我的消息
|
||||
type PullMessagesReq struct {
|
||||
g.Meta `path:"/notice/pullMessages" method:"get" tags:"公告" summary:"拉取我的消息"`
|
||||
adminin.PullMessagesInp
|
||||
}
|
||||
|
||||
type PullMessagesRes struct {
|
||||
*adminin.PullMessagesModel
|
||||
}
|
||||
|
||||
// ReadAllReq 全部已读
|
||||
type ReadAllReq struct {
|
||||
g.Meta `path:"/notice/readAll" method:"post" tags:"公告" summary:"全部已读"`
|
||||
adminin.NoticeReadAllInp
|
||||
}
|
||||
|
||||
type ReadAllRes struct {
|
||||
}
|
||||
|
||||
// UpReadReq 更新已读
|
||||
type UpReadReq struct {
|
||||
g.Meta `path:"/notice/upRead" method:"post" tags:"公告" summary:"更新已读"`
|
||||
adminin.NoticeUpReadInp
|
||||
}
|
||||
type UpReadRes struct{}
|
||||
|
||||
// MessageListReq 我的消息列表
|
||||
type MessageListReq struct {
|
||||
g.Meta `path:"/notice/messageList" method:"get" tags:"公告" summary:"我的消息列表"`
|
||||
adminin.NoticeMessageListInp
|
||||
}
|
||||
|
||||
type MessageListRes struct {
|
||||
List []*adminin.NoticeMessageListModel `json:"list" dc:"数据列表"`
|
||||
form.PageRes
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
// Package optiontreedemo
|
||||
// @Link https://github.com/bufanyun/hotgo
|
||||
// @Copyright Copyright (c) 2025 HotGo CLI
|
||||
// @Author Ms <133814250@qq.com>
|
||||
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
|
||||
// @AutoGenerate Version 2.17.8
|
||||
package optiontreedemo
|
||||
|
||||
import (
|
||||
"hotgo/internal/model/input/form"
|
||||
"hotgo/internal/model/input/sysin"
|
||||
"hotgo/utility/tree"
|
||||
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
)
|
||||
|
||||
// ListReq 查询选项树表列表
|
||||
type ListReq struct {
|
||||
g.Meta `path:"/optionTreeDemo/list" method:"get" tags:"选项树表" summary:"获取选项树表列表"`
|
||||
sysin.OptionTreeDemoListInp
|
||||
}
|
||||
|
||||
type ListRes struct {
|
||||
form.PageRes
|
||||
List []*sysin.OptionTreeDemoListModel `json:"list" dc:"数据列表"`
|
||||
}
|
||||
|
||||
// ViewReq 获取选项树表指定信息
|
||||
type ViewReq struct {
|
||||
g.Meta `path:"/optionTreeDemo/view" method:"get" tags:"选项树表" summary:"获取选项树表指定信息"`
|
||||
sysin.OptionTreeDemoViewInp
|
||||
}
|
||||
|
||||
type ViewRes struct {
|
||||
*sysin.OptionTreeDemoViewModel
|
||||
}
|
||||
|
||||
// EditReq 修改/新增选项树表
|
||||
type EditReq struct {
|
||||
g.Meta `path:"/optionTreeDemo/edit" method:"post" tags:"选项树表" summary:"修改/新增选项树表"`
|
||||
sysin.OptionTreeDemoEditInp
|
||||
}
|
||||
|
||||
type EditRes struct{}
|
||||
|
||||
// DeleteReq 删除选项树表
|
||||
type DeleteReq struct {
|
||||
g.Meta `path:"/optionTreeDemo/delete" method:"post" tags:"选项树表" summary:"删除选项树表"`
|
||||
sysin.OptionTreeDemoDeleteInp
|
||||
}
|
||||
|
||||
type DeleteRes struct{}
|
||||
|
||||
// MaxSortReq 获取选项树表最大排序
|
||||
type MaxSortReq struct {
|
||||
g.Meta `path:"/optionTreeDemo/maxSort" method:"get" tags:"选项树表" summary:"获取选项树表最大排序"`
|
||||
sysin.OptionTreeDemoMaxSortInp
|
||||
}
|
||||
|
||||
type MaxSortRes struct {
|
||||
*sysin.OptionTreeDemoMaxSortModel
|
||||
}
|
||||
|
||||
// TreeOptionReq 获取选项树表关系树选项
|
||||
type TreeOptionReq struct {
|
||||
g.Meta `path:"/optionTreeDemo/treeOption" method:"get" tags:"选项树表" summary:"获取选项树表关系树选项"`
|
||||
}
|
||||
|
||||
type TreeOptionRes []tree.Node
|
||||
@@ -0,0 +1,93 @@
|
||||
// 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 {
|
||||
}
|
||||
|
||||
// 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{}
|
||||
@@ -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{}
|
||||
@@ -0,0 +1,144 @@
|
||||
package portal
|
||||
|
||||
import (
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
"hotgo/internal/model/entity"
|
||||
"hotgo/internal/model/input/form"
|
||||
"hotgo/internal/model/input/sysin"
|
||||
)
|
||||
|
||||
type SiteConfigCurrentReq struct {
|
||||
g.Meta `path:"/siteConfig/current" method:"get" tags:"门户管理" summary:"获取当前站点配置"`
|
||||
sysin.SiteConfigCurrentInp
|
||||
}
|
||||
type SiteConfigCurrentRes struct{ *sysin.SiteConfigCurrentModel }
|
||||
type SiteConfigHistoryReq struct {
|
||||
g.Meta `path:"/siteConfig/history" method:"get" tags:"门户管理" summary:"获取站点配置版本"`
|
||||
sysin.SiteConfigHistoryInp
|
||||
}
|
||||
type SiteConfigHistoryRes struct {
|
||||
form.PageRes
|
||||
List []*sysin.SiteConfigHistoryModel `json:"list"`
|
||||
}
|
||||
type SiteConfigSaveReq struct {
|
||||
g.Meta `path:"/siteConfig/save" method:"post" tags:"门户管理" summary:"保存并立即生效站点配置"`
|
||||
sysin.SiteConfigSaveInp
|
||||
}
|
||||
type SiteConfigSaveRes struct {
|
||||
Id uint64 `json:"id"`
|
||||
}
|
||||
type SiteConfigSubmitReq struct {
|
||||
g.Meta `path:"/siteConfig/submit" method:"post" tags:"门户管理" summary:"提交站点配置审批"`
|
||||
sysin.SiteConfigSubmitInp
|
||||
}
|
||||
type SiteConfigSubmitRes struct{ *sysin.PortalApprovalModel }
|
||||
type SiteConfigPublishReq struct {
|
||||
g.Meta `path:"/siteConfig/publish" method:"post" tags:"门户管理" summary:"发布已审批站点配置"`
|
||||
sysin.SiteConfigPublishInp
|
||||
}
|
||||
type SiteConfigPublishRes struct{}
|
||||
type SiteConfigRollbackReq struct {
|
||||
g.Meta `path:"/siteConfig/rollback" method:"post" tags:"门户管理" summary:"回滚站点配置"`
|
||||
sysin.SiteConfigRollbackInp
|
||||
}
|
||||
type SiteConfigRollbackRes struct {
|
||||
Id uint64 `json:"id"`
|
||||
}
|
||||
|
||||
type ContentListReq struct {
|
||||
g.Meta `path:"/portalContent/list" method:"get" tags:"文本管理" summary:"获取文本内容列表"`
|
||||
sysin.ContentListInp
|
||||
}
|
||||
type ContentListRes struct {
|
||||
form.PageRes
|
||||
List []*sysin.ContentListModel `json:"list"`
|
||||
}
|
||||
type ContentViewReq struct {
|
||||
g.Meta `path:"/portalContent/view" method:"get" tags:"文本管理" summary:"获取文本内容详情"`
|
||||
sysin.ContentViewInp
|
||||
}
|
||||
type ContentViewRes struct{ *sysin.ContentViewModel }
|
||||
type ContentEditReq struct {
|
||||
g.Meta `path:"/portalContent/edit" method:"post" tags:"文本管理" summary:"新增或编辑文本内容"`
|
||||
sysin.ContentEditInp
|
||||
}
|
||||
type ContentEditRes struct {
|
||||
Id uint64 `json:"id"`
|
||||
}
|
||||
type ContentDeleteReq struct {
|
||||
g.Meta `path:"/portalContent/delete" method:"post" tags:"文本管理" summary:"删除或下线文本内容"`
|
||||
sysin.ContentDeleteInp
|
||||
}
|
||||
type ContentDeleteRes struct{}
|
||||
type ContentPublishReq struct {
|
||||
g.Meta `path:"/portalContent/publish" method:"post" tags:"文本管理" summary:"发布文本内容版本"`
|
||||
sysin.ContentPublishInp
|
||||
}
|
||||
type ContentPublishRes struct{}
|
||||
type ContentOfflineReq struct {
|
||||
g.Meta `path:"/portalContent/offline" method:"post" tags:"文本管理" summary:"下线文本内容"`
|
||||
sysin.ContentOfflineInp
|
||||
}
|
||||
type ContentOfflineRes struct{}
|
||||
|
||||
type BannerListReq struct {
|
||||
g.Meta `path:"/banner/list" method:"get" tags:"Banner管理" summary:"获取Banner列表"`
|
||||
sysin.BannerListInp
|
||||
}
|
||||
type BannerListRes struct {
|
||||
form.PageRes
|
||||
List []*sysin.BannerListModel `json:"list"`
|
||||
}
|
||||
type BannerViewReq struct {
|
||||
g.Meta `path:"/banner/view" method:"get" tags:"Banner管理" summary:"获取Banner详情"`
|
||||
sysin.BannerViewInp
|
||||
}
|
||||
type BannerViewRes struct{ *entity.Banner }
|
||||
type BannerEditReq struct {
|
||||
g.Meta `path:"/banner/edit" method:"post" tags:"Banner管理" summary:"新增或编辑Banner"`
|
||||
sysin.BannerEditInp
|
||||
}
|
||||
type BannerEditRes struct {
|
||||
Id uint64 `json:"id"`
|
||||
}
|
||||
type BannerDeleteReq struct {
|
||||
g.Meta `path:"/banner/delete" method:"post" tags:"Banner管理" summary:"删除或下线Banner"`
|
||||
sysin.BannerDeleteInp
|
||||
}
|
||||
type BannerDeleteRes struct{}
|
||||
type BannerStatusReq struct {
|
||||
g.Meta `path:"/banner/status" method:"post" tags:"Banner管理" summary:"更新Banner发布状态"`
|
||||
sysin.BannerStatusInp
|
||||
}
|
||||
type BannerStatusRes struct{}
|
||||
|
||||
type ManualProductListReq struct {
|
||||
g.Meta `path:"/manualProduct/list" method:"get" tags:"手工商城" summary:"获取手工商城商品"`
|
||||
sysin.ManualProductListInp
|
||||
}
|
||||
type ManualProductListRes struct {
|
||||
form.PageRes
|
||||
List []*sysin.ManualProductListModel `json:"list"`
|
||||
}
|
||||
type ManualProductViewReq struct {
|
||||
g.Meta `path:"/manualProduct/view" method:"get" tags:"手工商城" summary:"获取手工商城商品详情"`
|
||||
sysin.ManualProductViewInp
|
||||
}
|
||||
type ManualProductViewRes struct{ *sysin.ManualProductViewModel }
|
||||
type ManualProductEditReq struct {
|
||||
g.Meta `path:"/manualProduct/edit" method:"post" tags:"手工商城" summary:"新增或编辑手工商城商品"`
|
||||
sysin.ManualProductEditInp
|
||||
}
|
||||
type ManualProductEditRes struct {
|
||||
Id uint64 `json:"id"`
|
||||
}
|
||||
type ManualProductDeleteReq struct {
|
||||
g.Meta `path:"/manualProduct/delete" method:"post" tags:"手工商城" summary:"删除或下线手工商城商品"`
|
||||
sysin.ManualProductDeleteInp
|
||||
}
|
||||
type ManualProductDeleteRes struct{}
|
||||
type ManualProductStatusReq struct {
|
||||
g.Meta `path:"/manualProduct/status" method:"post" tags:"手工商城" summary:"更新手工商城商品状态"`
|
||||
sysin.ManualProductStatusInp
|
||||
}
|
||||
type ManualProductStatusRes struct{}
|
||||
@@ -0,0 +1,67 @@
|
||||
// Package post
|
||||
// @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 post
|
||||
|
||||
import (
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
"hotgo/internal/model/input/adminin"
|
||||
"hotgo/internal/model/input/form"
|
||||
)
|
||||
|
||||
// EditReq 修改/新增岗位
|
||||
type EditReq struct {
|
||||
g.Meta `path:"/post/edit" method:"post" tags:"岗位" summary:"修改/新增岗位"`
|
||||
adminin.PostEditInp
|
||||
}
|
||||
|
||||
type EditRes struct{}
|
||||
|
||||
// DeleteReq 删除岗位
|
||||
type DeleteReq struct {
|
||||
g.Meta `path:"/post/delete" method:"post" tags:"岗位" summary:"删除岗位"`
|
||||
adminin.PostDeleteInp
|
||||
}
|
||||
|
||||
type DeleteRes struct{}
|
||||
|
||||
// MaxSortReq 最大排序
|
||||
type MaxSortReq struct {
|
||||
g.Meta `path:"/post/maxSort" method:"get" tags:"岗位" summary:"岗位最大排序"`
|
||||
adminin.PostMaxSortInp
|
||||
}
|
||||
|
||||
type MaxSortRes struct {
|
||||
*adminin.PostMaxSortModel
|
||||
}
|
||||
|
||||
// ListReq 获取列表
|
||||
type ListReq struct {
|
||||
g.Meta `path:"/post/list" method:"get" tags:"岗位" summary:"获取岗位列表"`
|
||||
adminin.PostListInp
|
||||
}
|
||||
|
||||
type ListRes struct {
|
||||
List []*adminin.PostListModel `json:"list" description:"数据列表"`
|
||||
form.PageRes
|
||||
}
|
||||
|
||||
// ViewReq 获取指定信息
|
||||
type ViewReq struct {
|
||||
g.Meta `path:"/post/view" method:"get" tags:"岗位" summary:"获取指定信息"`
|
||||
adminin.PostViewInp
|
||||
}
|
||||
|
||||
type ViewRes struct {
|
||||
*adminin.PostViewModel
|
||||
}
|
||||
|
||||
// StatusReq 更新状态
|
||||
type StatusReq struct {
|
||||
g.Meta `path:"/post/status" method:"post" tags:"岗位" summary:"更新岗位状态"`
|
||||
adminin.PostStatusInp
|
||||
}
|
||||
|
||||
type StatusRes struct{}
|
||||
@@ -0,0 +1,43 @@
|
||||
package product
|
||||
|
||||
import (
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
"hotgo/internal/model/input/form"
|
||||
"hotgo/internal/model/input/sysin"
|
||||
)
|
||||
|
||||
type ListReq struct {
|
||||
g.Meta `path:"/product/list" method:"get" tags:"商品管理" summary:"获取商品列表"`
|
||||
sysin.ProductListInp
|
||||
}
|
||||
type ListRes struct {
|
||||
form.PageRes
|
||||
List []*sysin.ProductListModel `json:"list"`
|
||||
}
|
||||
type ViewReq struct {
|
||||
g.Meta `path:"/product/view" method:"get" tags:"商品管理" summary:"获取商品详情"`
|
||||
sysin.ProductViewInp
|
||||
}
|
||||
type ViewRes struct{ *sysin.ProductListModel }
|
||||
type EditReq struct {
|
||||
g.Meta `path:"/product/edit" method:"post" tags:"商品管理" summary:"新增编辑商品"`
|
||||
sysin.ProductEditInp
|
||||
}
|
||||
type EditRes struct {
|
||||
Id uint64 `json:"id"`
|
||||
}
|
||||
type StatusReq struct {
|
||||
g.Meta `path:"/product/status" method:"post" tags:"商品管理" summary:"商品上下架"`
|
||||
sysin.ProductStatusInp
|
||||
}
|
||||
type StatusRes struct{}
|
||||
type RecommendReq struct {
|
||||
g.Meta `path:"/product/recommend" method:"post" tags:"商品管理" summary:"商品推荐切换"`
|
||||
sysin.ProductRecommendInp
|
||||
}
|
||||
type RecommendRes struct{}
|
||||
type DeleteReq struct {
|
||||
g.Meta `path:"/product/delete" method:"post" tags:"商品管理" summary:"删除商品"`
|
||||
sysin.ProductDeleteInp
|
||||
}
|
||||
type DeleteRes struct{}
|
||||
@@ -0,0 +1,115 @@
|
||||
// Package provinces
|
||||
// @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 provinces
|
||||
|
||||
import (
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
"hotgo/internal/model/input/form"
|
||||
"hotgo/internal/model/input/sysin"
|
||||
)
|
||||
|
||||
// ListReq 查询列表
|
||||
type ListReq struct {
|
||||
g.Meta `path:"/provinces/list" method:"get" tags:"省市区" summary:"获取省市区列表"`
|
||||
sysin.ProvincesListInp
|
||||
}
|
||||
|
||||
type ListRes struct {
|
||||
List []*sysin.ProvincesListModel `json:"list" dc:"数据列表"`
|
||||
form.PageRes
|
||||
}
|
||||
|
||||
// ViewReq 获取信息
|
||||
type ViewReq struct {
|
||||
g.Meta `path:"/provinces/view" method:"get" tags:"省市区" summary:"获取指定信息"`
|
||||
sysin.ProvincesViewInp
|
||||
}
|
||||
|
||||
type ViewRes struct {
|
||||
*sysin.ProvincesViewModel
|
||||
}
|
||||
|
||||
// EditReq 修改/新增
|
||||
type EditReq struct {
|
||||
g.Meta `path:"/provinces/edit" method:"post" tags:"省市区" summary:"修改/新增省市区"`
|
||||
sysin.ProvincesEditInp
|
||||
}
|
||||
|
||||
type EditRes struct{}
|
||||
|
||||
// DeleteReq 删除
|
||||
type DeleteReq struct {
|
||||
g.Meta `path:"/provinces/delete" method:"post" tags:"省市区" summary:"删除省市区"`
|
||||
sysin.ProvincesDeleteInp
|
||||
}
|
||||
|
||||
type DeleteRes struct{}
|
||||
|
||||
// MaxSortReq 最大排序
|
||||
type MaxSortReq struct {
|
||||
g.Meta `path:"/provinces/maxSort" method:"get" tags:"省市区" summary:"省市区最大排序"`
|
||||
sysin.ProvincesMaxSortInp
|
||||
}
|
||||
|
||||
type MaxSortRes struct {
|
||||
*sysin.ProvincesMaxSortModel
|
||||
}
|
||||
|
||||
// StatusReq 更新状态
|
||||
type StatusReq struct {
|
||||
g.Meta `path:"/provinces/status" method:"post" tags:"省市区" summary:"更新省市区状态"`
|
||||
sysin.ProvincesStatusInp
|
||||
}
|
||||
|
||||
type StatusRes struct{}
|
||||
|
||||
// TreeReq 关系树选项列表
|
||||
type TreeReq struct {
|
||||
g.Meta `path:"/provinces/tree" tags:"省市区" method:"get" summary:"省市区关系树选项列表"`
|
||||
}
|
||||
|
||||
type TreeRes struct {
|
||||
List []*sysin.ProvincesTree `json:"list" dc:"数据列表"`
|
||||
}
|
||||
|
||||
// ChildrenListReq 获取省市区下级列表
|
||||
type ChildrenListReq struct {
|
||||
g.Meta `path:"/provinces/childrenList" method:"get" tags:"省市区" summary:"获取省市区下级列表"`
|
||||
sysin.ProvincesChildrenListInp
|
||||
}
|
||||
|
||||
type ChildrenListRes struct {
|
||||
List []*sysin.ProvincesChildrenListModel `json:"list" dc:"数据列表"`
|
||||
form.PageRes
|
||||
}
|
||||
|
||||
// UniqueIdReq 地区ID是否唯一
|
||||
type UniqueIdReq struct {
|
||||
g.Meta `path:"/provinces/uniqueId" method:"get" tags:"省市区" summary:"地区ID是否唯一"`
|
||||
sysin.ProvincesUniqueIdInp
|
||||
}
|
||||
|
||||
type UniqueIdRes struct {
|
||||
*sysin.ProvincesUniqueIdModel
|
||||
}
|
||||
|
||||
// SelectReq 省市区选项
|
||||
type SelectReq struct {
|
||||
g.Meta `path:"/provinces/select" method:"get" tags:"省市区" summary:"省市区选项"`
|
||||
sysin.ProvincesSelectInp
|
||||
}
|
||||
|
||||
type SelectRes struct {
|
||||
*sysin.ProvincesSelectModel
|
||||
}
|
||||
|
||||
// CityLabelReq 获取指定城市标签
|
||||
type CityLabelReq struct {
|
||||
g.Meta `path:"/provinces/cityLabel" method:"get" tags:"省市区" summary:"获取指定城市标签" `
|
||||
sysin.ProvincesCityLabelInp
|
||||
}
|
||||
|
||||
type CityLabelRes sysin.ProvincesCityLabelModel
|
||||
@@ -0,0 +1,37 @@
|
||||
package rechargeorder
|
||||
|
||||
import (
|
||||
"hotgo/internal/model/input/form"
|
||||
"hotgo/internal/model/input/sysin"
|
||||
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
)
|
||||
|
||||
type ListReq struct {
|
||||
g.Meta `path:"/rechargeOrder/list" method:"get" tags:"充值管理" summary:"充值订单列表"`
|
||||
sysin.RechargeOrderListInp
|
||||
}
|
||||
type ListRes struct {
|
||||
form.PageRes
|
||||
List []*sysin.RechargeOrderListModel `json:"list"`
|
||||
}
|
||||
type SummaryReq struct {
|
||||
g.Meta `path:"/rechargeOrder/summary" method:"get" tags:"充值管理" summary:"充值金额汇总"`
|
||||
sysin.RechargeOrderListInp
|
||||
}
|
||||
type SummaryRes struct{ *sysin.RechargeSummaryModel }
|
||||
type ViewReq struct {
|
||||
g.Meta `path:"/rechargeOrder/view" method:"get" tags:"充值管理" summary:"充值订单详情"`
|
||||
sysin.RechargeOrderViewInp
|
||||
}
|
||||
type ViewRes struct{ *sysin.RechargeOrderListModel }
|
||||
type ReviewReq struct {
|
||||
g.Meta `path:"/rechargeOrder/review" method:"post" tags:"充值管理" summary:"提交充值审核"`
|
||||
sysin.RechargeReviewInp
|
||||
}
|
||||
type ReviewRes struct{ *sysin.FinanceApprovalModel }
|
||||
type ExecuteReq struct {
|
||||
g.Meta `path:"/rechargeOrder/execute" method:"post" tags:"充值管理" summary:"执行已审批充值结果"`
|
||||
sysin.FinanceExecuteInp
|
||||
}
|
||||
type ExecuteRes struct{}
|
||||
@@ -0,0 +1,82 @@
|
||||
// Package role
|
||||
// @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 role
|
||||
|
||||
import (
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
"hotgo/internal/consts"
|
||||
"hotgo/internal/model/input/adminin"
|
||||
"hotgo/internal/model/input/form"
|
||||
)
|
||||
|
||||
// ListReq 查询列表
|
||||
type ListReq struct {
|
||||
g.Meta `path:"/role/list" method:"get" tags:"角色" summary:"获取角色列表"`
|
||||
adminin.RoleListInp
|
||||
}
|
||||
|
||||
type ListRes struct {
|
||||
*adminin.RoleListModel
|
||||
form.PageRes
|
||||
}
|
||||
|
||||
// DynamicReq 动态路由
|
||||
type DynamicReq struct {
|
||||
g.Meta `path:"/role/dynamic" method:"get" tags:"角色" summary:"获取动态路由" description:"获取登录用户动态路由"`
|
||||
}
|
||||
|
||||
type DynamicRes struct {
|
||||
List []*adminin.MenuRoute `json:"list" description:"数据列表"`
|
||||
}
|
||||
|
||||
type UpdatePermissionsReq struct {
|
||||
g.Meta `path:"/role/updatePermissions" method:"post" tags:"角色" summary:"编辑角色菜单权限"`
|
||||
adminin.UpdatePermissionsInp
|
||||
}
|
||||
|
||||
type UpdatePermissionsRes struct{}
|
||||
|
||||
type GetPermissionsReq struct {
|
||||
g.Meta `path:"/role/getPermissions" method:"get" tags:"角色" summary:"获取指定角色权限"`
|
||||
adminin.GetPermissionsInp
|
||||
}
|
||||
|
||||
type GetPermissionsRes struct {
|
||||
*adminin.GetPermissionsModel
|
||||
}
|
||||
|
||||
// EditReq 修改/新增角色
|
||||
type EditReq struct {
|
||||
g.Meta `path:"/role/edit" method:"post" tags:"角色" summary:"修改/新增角色"`
|
||||
adminin.RoleEditInp
|
||||
}
|
||||
|
||||
type EditRes struct{}
|
||||
|
||||
// DeleteReq 删除角色
|
||||
type DeleteReq struct {
|
||||
g.Meta `path:"/role/delete" method:"post" tags:"角色" summary:"删除角色"`
|
||||
adminin.RoleDeleteInp
|
||||
}
|
||||
|
||||
type DeleteRes struct{}
|
||||
|
||||
// DataScopeSelectReq 获取数据权限选项
|
||||
type DataScopeSelectReq struct {
|
||||
g.Meta `path:"/role/dataScope/select" method:"get" tags:"角色" summary:"获取数据权限选项"`
|
||||
}
|
||||
|
||||
type DataScopeSelectRes struct {
|
||||
List []consts.GroupScopeSelect `json:"list" dc:"数据选项"`
|
||||
}
|
||||
|
||||
// DataScopeEditReq 修改指定角色的数据权限
|
||||
type DataScopeEditReq struct {
|
||||
g.Meta `path:"/role/dataScope/edit" method:"post" tags:"角色" summary:"修改指定角色的数据权限"`
|
||||
adminin.DataScopeEditInp
|
||||
}
|
||||
|
||||
type DataScopeEditRes struct{}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user