版本预发布

This commit is contained in:
孟帅 2023-02-08 20:29:34 +08:00
parent f11c7c5bf2
commit 2068d05c93
269 changed files with 16122 additions and 12075 deletions

21
LICENSE Normal file
View File

@ -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.

View File

@ -91,30 +91,6 @@ git clone https://github.com/bufanyun/hotgo.git && cd hotgo
- 项目数据库文件 `resource/data/db.sql` 创建数据库并导入 - 项目数据库文件 `resource/data/db.sql` 创建数据库并导入
- 修改配置 `manifest/config/config.yaml.bak` 复制改为`manifest/config/config.yaml` - 修改配置 `manifest/config/config.yaml.bak` 复制改为`manifest/config/config.yaml`
其中hotgo配置
```yaml
# hotgo配置
hotgo:
debug: true # debug开关开启后接口出现错误时会输出堆栈信息默认为true
ipMethod: "whois" # IP归属地解析方法可选cz88|whois默认为whois
wsAddr: "ws://127.0.0.1:8000/socket" # 客户端websocket连接地址如果项目在公网请填写公网IP:运行端口
isDemo: false # 是否為演示系統 false | true
ssl: # https
switch: false # 是否开启https访问需要配置sslCrtPath、sslKeyPath证书夹
crtPath: "resource/ssl/server.crt"
keyPath: "resource/ssl/server.key"
log: # 全局请求日志
switch: true # 日志开关默认为true
queue: true # 是否启用队列启用时需要配置队列信息默认为true
module: [ "admin", "api", "default" ] # 需要记录的模块
skipCode: [ ] # 不记录的状态码,如: ["0", "-1"]
admin:
superIds: [ 1,2,3 ] # 后台超管账号ID通过ID验证超管
superRoleKey: "super" # 超管角色唯一标识符,通过角色验证超管
defaultPage: 10 # 列表分页默认加载数量
defaultPageSize: 1 # 列表分页默认加载页码
maxSortIncrement: 10 # 最大排序值增量
```
后台前端: 后台前端:
- 配置服务端地址,包含在以下文件中: - 配置服务端地址,包含在以下文件中:
@ -212,7 +188,7 @@ web端
> <img src="https://bufanyun.cn-bj.ufileos.com/hotgo/hotgo1qun.png" width="400px"/> > <img src="https://bufanyun.cn-bj.ufileos.com/hotgo/hotgo1qun.png" width="400px"/>
> 感谢你使用HotGo,公司团队精力时间有限,因此我们不再提供免费的技术服务! > 感谢你使用HotGo公司团队精力时间有限,因此我们不再提供免费的技术服务!
> >
> 同时您也可以联系我们,雇佣我们团队为您干活,谢谢合作! > 同时您也可以联系我们,雇佣我们团队为您干活,谢谢合作!
@ -225,7 +201,7 @@ web端
* 本项目包含的第三方源码和二进制文件之版权信息另行标注。 * 本项目包含的第三方源码和二进制文件之版权信息另行标注。
* 版权所有Copyright © 2022-2024 by Ms (https://github.com/bufanyun/hotgo) * 版权所有Copyright © 2020-2024 by Ms (https://github.com/bufanyun/hotgo)
* All rights reserved。 * All rights reserved。
@ -245,9 +221,9 @@ web端
## [感谢JetBrains提供的免费GoLand](https://jb.gg/OpenSource) ## [感谢JetBrains提供的免费GoLand](https://jb.gg/OpenSource)
[![avatar](https://camo.githubusercontent.com/323657c6e81419b8e151e9da4c71f409e3fcc65d630535170c59fe4807dbc905/68747470733a2f2f676f6672616d652e6f72672f646f776e6c6f61642f7468756d626e61696c732f313131343131392f6a6574627261696e732e706e67)](https://jb.gg/OpenSource) [![avatar](https://camo.githubusercontent.com/323657c6e81419b8e151e9da4c71f409e3fcc65d630535170c59fe4807dbc905/68747470733a2f2f676f6672616d652e6f72672f646f776e6c6f61642f7468756d626e61696c732f313131343131392f6a6574627261696e732e706e67)](https://jb.gg/OpenSource)
## License
[MIT © HotGo-2021](./LICENSE)

View File

@ -21,6 +21,7 @@ web:
killmain: killmain:
@kill -9 $(ps -ef|grep main|grep -v grep|awk '{print $2}') @kill -9 $(ps -ef|grep main|grep -v grep|awk '{print $2}')
# Install/Update to the latest CLI tool. # Install/Update to the latest CLI tool.
.PHONY: cli .PHONY: cli
cli: cli:

View File

@ -8,9 +8,9 @@ package member
import "github.com/gogf/gf/v2/frame/g" import "github.com/gogf/gf/v2/frame/g"
// GetIdByCodeReq 通过邀请码获取会员ID // GetIdByCodeReq 通过邀请码获取用户ID
type GetIdByCodeReq struct { type GetIdByCodeReq struct {
g.Meta `path:"/member/getIdByCode" method:"post" tags:"会员" summary:"通过邀请码获取会员ID"` g.Meta `path:"/member/getIdByCode" method:"post" tags:"用户" summary:"通过邀请码获取用户ID"`
Code string `json:"code" dc:"邀请码"` Code string `json:"code" dc:"邀请码"`
} }
type GetIdByCodeRes struct{} type GetIdByCodeRes struct{}

View File

@ -54,7 +54,7 @@ type DeleteRes struct{}
// MaxSortReq 最大排序 // MaxSortReq 最大排序
type MaxSortReq struct { type MaxSortReq struct {
Id int64 `json:"id" dc:"附件ID"` Id int64 `json:"id" dc:"附件ID"`
g.Meta `path:"/attachment/max_sort" method:"get" tags:"附件" summary:"附件最大排序"` g.Meta `path:"/attachment/maxSort" method:"get" tags:"附件" summary:"附件最大排序"`
} }
type MaxSortRes struct { type MaxSortRes struct {
Sort int `json:"sort" dc:"排序"` Sort int `json:"sort" dc:"排序"`

View File

@ -54,7 +54,7 @@ type DeleteRes struct{}
// MaxSortReq 最大排序 // MaxSortReq 最大排序
type MaxSortReq struct { type MaxSortReq struct {
Id int64 `json:"id" dc:"黑名单ID"` Id int64 `json:"id" dc:"黑名单ID"`
g.Meta `path:"/blacklist/max_sort" method:"get" tags:"黑名单" summary:"黑名单最大排序"` g.Meta `path:"/blacklist/maxSort" method:"get" tags:"黑名单" summary:"黑名单最大排序"`
} }
type MaxSortRes struct { type MaxSortRes struct {
Sort int `json:"sort" dc:"排序"` Sort int `json:"sort" dc:"排序"`

View File

@ -17,3 +17,10 @@ type SendTestEmailReq struct {
} }
type SendTestEmailRes struct { type SendTestEmailRes struct {
} }
// SendBindEmsReq 发送换绑邮件
type SendBindEmsReq struct {
g.Meta `path:"/ems/sendBind" tags:"邮件" method:"post" summary:"发送换绑邮件"`
}
type SendBindEmsRes struct {
}

View File

@ -17,3 +17,10 @@ type SendTestSmsReq struct {
} }
type SendTestSmsRes struct { type SendTestSmsRes struct {
} }
// SendBindSmsReq 发送换绑短信
type SendBindSmsReq struct {
g.Meta `path:"/sms/sendBind" tags:"短信" method:"post" summary:"发送换绑短信"`
}
type SendBindSmsRes struct {
}

View File

@ -54,7 +54,7 @@ type DeleteRes struct{}
// MaxSortReq 最大排序 // MaxSortReq 最大排序
type MaxSortReq struct { type MaxSortReq struct {
Id int64 `json:"id" dc:"定时任务ID"` Id int64 `json:"id" dc:"定时任务ID"`
g.Meta `path:"/cron/max_sort" method:"get" tags:"定时任务" summary:"定时任务最大排序"` g.Meta `path:"/cron/maxSort" method:"get" tags:"定时任务" summary:"定时任务最大排序"`
} }
type MaxSortRes struct { type MaxSortRes struct {
Sort int `json:"sort" dc:"排序"` Sort int `json:"sort" dc:"排序"`

View File

@ -54,7 +54,7 @@ type GroupDeleteRes struct{}
// GroupMaxSortReq 最大排序 // GroupMaxSortReq 最大排序
type GroupMaxSortReq struct { type GroupMaxSortReq struct {
Id int64 `json:"id" dc:"定时任务分组ID"` Id int64 `json:"id" dc:"定时任务分组ID"`
g.Meta `path:"/cronGroup/max_sort" method:"get" tags:"定时任务分组" summary:"定时任务分组最大排序"` g.Meta `path:"/cronGroup/maxSort" method:"get" tags:"定时任务分组" summary:"定时任务分组最大排序"`
} }
type GroupMaxSortRes struct { type GroupMaxSortRes struct {
Sort int `json:"sort" dc:"排序"` Sort int `json:"sort" dc:"排序"`

View File

@ -3,8 +3,8 @@
// @Copyright Copyright (c) 2023 HotGo CLI // @Copyright Copyright (c) 2023 HotGo CLI
// @Author Ms <133814250@qq.com> // @Author Ms <133814250@qq.com>
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE // @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
// @AutoGenerate Version 2.1.0 // @AutoGenerate Version 2.1.2
// @AutoGenerate Date 2023-01-18 15:19:42 // @AutoGenerate Date 2023-02-08 17:47:32
// //
package curddemo package curddemo

View File

@ -37,7 +37,7 @@ type ListReq struct {
g.Meta `path:"/dept/list" method:"get" tags:"部门" summary:"获取部门列表"` g.Meta `path:"/dept/list" method:"get" tags:"部门" summary:"获取部门列表"`
} }
type ListRes []*g.Map type ListRes adminin.DeptListModel
// ViewReq 获取指定信息 // ViewReq 获取指定信息
type ViewReq struct { type ViewReq struct {
@ -65,7 +65,7 @@ type DeleteRes struct{}
// MaxSortReq 最大排序 // MaxSortReq 最大排序
type MaxSortReq struct { type MaxSortReq struct {
Id int64 `json:"id" dc:"部门ID"` Id int64 `json:"id" dc:"部门ID"`
g.Meta `path:"/dept/max_sort" method:"get" tags:"部门" summary:"部门最大排序"` g.Meta `path:"/dept/maxSort" method:"get" tags:"部门" summary:"部门最大排序"`
} }
type MaxSortRes struct { type MaxSortRes struct {
Sort int `json:"sort" dc:"排序"` Sort int `json:"sort" dc:"排序"`

View File

@ -0,0 +1,55 @@
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{}

View File

@ -15,7 +15,7 @@ import (
// ListReq 查询列表 // ListReq 查询列表
type ListReq struct { type ListReq struct {
g.Meta `path:"/genCodes/list" method:"get" tags:"生成代码" summary:"获取生成代码列表"` g.Meta `path:"/genCodes/list" method:"get" tags:"生成代码" summary:"获取生成代码列表"`
sysin.GenCodesListInp sysin.GenCodesListInp
} }
@ -52,7 +52,7 @@ type DeleteRes struct{}
// MaxSortReq 最大排序 // MaxSortReq 最大排序
type MaxSortReq struct { type MaxSortReq struct {
Id int64 `json:"id" dc:"生成代码ID"` Id int64 `json:"id" dc:"生成代码ID"`
g.Meta `path:"/genCodes/max_sort" method:"get" tags:"生成代码" summary:"生成代码最大排序"` g.Meta `path:"/genCodes/maxSort" method:"get" tags:"生成代码" summary:"生成代码最大排序"`
} }
type MaxSortRes struct { type MaxSortRes struct {
Sort int `json:"sort" dc:"排序"` Sort int `json:"sort" dc:"排序"`

View File

@ -8,94 +8,83 @@ package member
import ( import (
"github.com/gogf/gf/v2/frame/g" "github.com/gogf/gf/v2/frame/g"
"github.com/gogf/gf/v2/os/gtime"
"hotgo/internal/model/entity"
"hotgo/internal/model/input/adminin" "hotgo/internal/model/input/adminin"
"hotgo/internal/model/input/form" "hotgo/internal/model/input/form"
) )
// UpdateProfileReq 更新会员资料 // 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 { type UpdateProfileReq struct {
g.Meta `path:"/member/updateProfile" method:"post" tags:"会员" summary:"更新会员资料"` g.Meta `path:"/member/updateProfile" method:"post" tags:"用户" summary:"更新用户资料"`
Mobile int `json:"mobile" dc:"手机号"` adminin.MemberUpdateProfileInp
Email string `json:"email" dc:"邮箱"`
RealName string `json:"realName" dc:"真实姓名"`
} }
type UpdateProfileRes struct{} type UpdateProfileRes struct{}
// UpdatePwdReq 修改登录密码 // UpdatePwdReq 修改登录密码
type UpdatePwdReq struct { type UpdatePwdReq struct {
g.Meta `path:"/member/updatePwd" method:"post" tags:"会员" summary:"重置密码"` g.Meta `path:"/member/updatePwd" method:"post" tags:"用户" summary:"重置密码"`
OldPassword string `json:"oldPassword" v:"required#原密码不能为空" dc:"原密码"` adminin.MemberUpdatePwdInp
NewPassword string `json:"newPassword" v:"required|length:6,16#新密码不能为空#新密码需在6~16之间" dc:"新密码"`
} }
type UpdatePwdRes struct{} type UpdatePwdRes struct{}
// ProfileReq 获取登录用户的基本信息
type ProfileReq struct {
g.Meta `path:"/member/profile" method:"get" tags:"会员" summary:"获取登录用户的基本信息"`
}
type ProfileRes struct {
PostGroup string `json:"postGroup" dc:"岗位名称"`
RoleGroup string `json:"roleGroup" dc:"角色名称"`
User *adminin.MemberViewModel `json:"member" dc:"用户基本信息"`
SysDept *adminin.DeptViewModel `json:"sysDept" dc:"部门信息"`
SysRoles []*adminin.RoleListModel `json:"sysRoles" dc:"角色列表"`
PostIds int64 `json:"postIds" dc:"当前岗位"`
RoleIds int64 `json:"roleIds" dc:"当前角色"`
}
// ResetPwdReq 重置密码 // ResetPwdReq 重置密码
type ResetPwdReq struct { type ResetPwdReq struct {
g.Meta `path:"/member/resetPwd" method:"post" tags:"会员" summary:"重置密码"` g.Meta `path:"/member/resetPwd" method:"post" tags:"用户" summary:"重置密码"`
Password string `json:"password" v:"required#密码不能为空" dc:"密码"` adminin.MemberResetPwdInp
Id int64 `json:"id" dc:"会员ID"`
} }
type ResetPwdRes struct{} type ResetPwdRes struct{}
// EmailUniqueReq 邮箱是否唯一 // EmailUniqueReq 邮箱是否唯一
type EmailUniqueReq struct { type EmailUniqueReq struct {
g.Meta `path:"/member/emailUnique" method:"get" tags:"会员" summary:"邮箱是否唯一"` g.Meta `path:"/member/emailUnique" method:"get" tags:"用户" summary:"邮箱是否唯一"`
Email string `json:"email" v:"required#邮箱不能为空" dc:"邮箱"` adminin.MemberEmailUniqueInp
Id int64 `json:"id" dc:"会员ID"`
} }
type EmailUniqueRes struct { type EmailUniqueRes struct {
IsUnique bool `json:"is_unique" dc:"是否唯一"` *adminin.MemberEmailUniqueModel
} }
// MobileUniqueReq 手机号是否唯一 // MobileUniqueReq 手机号是否唯一
type MobileUniqueReq struct { type MobileUniqueReq struct {
g.Meta `path:"/member/mobileUnique" method:"get" tags:"会员" summary:"手机号是否唯一"` g.Meta `path:"/member/mobileUnique" method:"get" tags:"用户" summary:"手机号是否唯一"`
Mobile string `json:"mobile" v:"required#手机号不能为空" dc:"手机号"` adminin.MemberMobileUniqueInp
Id int64 `json:"id" dc:"会员ID"`
} }
type MobileUniqueRes struct { type MobileUniqueRes struct {
IsUnique bool `json:"is_unique" dc:"是否唯一"` *adminin.MemberMobileUniqueModel
} }
// NameUniqueReq 名称是否唯一 // NameUniqueReq 名称是否唯一
type NameUniqueReq struct { type NameUniqueReq struct {
g.Meta `path:"/member/nameUnique" method:"get" tags:"会员" summary:"会员名称是否唯一"` g.Meta `path:"/member/nameUnique" method:"get" tags:"用户" summary:"用户名称是否唯一"`
Username string `json:"username" v:"required#会员名称不能为空" dc:"会员名称"` adminin.MemberNameUniqueInp
Id int64 `json:"id" dc:"会员ID"`
} }
type NameUniqueRes struct { type NameUniqueRes struct {
IsUnique bool `json:"is_unique" dc:"是否唯一"` *adminin.MemberNameUniqueModel
} }
// ListReq 查询列表 // ListReq 查询列表
type ListReq struct { type ListReq struct {
g.Meta `path:"/member/list" method:"get" tags:"会员" summary:"获取会员列表"` g.Meta `path:"/member/list" method:"get" tags:"用户" summary:"获取用户列表"`
form.PageReq adminin.MemberListInp
form.RangeDateReq
form.StatusReq
DeptId int `json:"deptId" dc:"部门ID"`
Mobile int `json:"mobile" dc:"手机号"`
Username string `json:"username" dc:"用户名"`
Realname string `json:"realName" dc:"真实姓名"`
Name string `json:"name" dc:"岗位名称"`
Code string `json:"code" dc:"岗位编码"`
CreatedAt []int64 `json:"createdAt" dc:"创建时间"`
} }
type ListRes struct { type ListRes struct {
@ -105,107 +94,54 @@ type ListRes struct {
// ViewReq 获取指定信息 // ViewReq 获取指定信息
type ViewReq struct { type ViewReq struct {
g.Meta `path:"/member/view" method:"get" tags:"会员" summary:"获取指定信息"` g.Meta `path:"/member/view" method:"get" tags:"用户" summary:"获取指定信息"`
Id int64 `json:"id" dc:"会员ID"` adminin.MemberViewInp
} }
type ViewRes struct { type ViewRes struct {
*adminin.MemberViewModel *adminin.MemberViewModel
Posts []*adminin.PostListModel `json:"posts" dc:"可选岗位"`
PostIds []int64 `json:"postIds" dc:"当前岗位"`
Roles []*adminin.RoleListModel `json:"roles" dc:"可选角色"`
RoleIds []int64 `json:"roleIds" dc:"当前角色"`
DeptName string `json:"deptName" dc:"部门名称"`
} }
// EditReq 修改/新增 // EditReq 修改/新增
type EditReq struct { type EditReq struct {
g.Meta `path:"/member/edit" method:"post" tags:"会员" summary:"修改/新增会员"` g.Meta `path:"/member/edit" method:"post" tags:"用户" summary:"修改/新增用户"`
adminin.MemberEditInp adminin.MemberEditInp
} }
type EditRes struct{} type EditRes struct{}
// DeleteReq 删除 // DeleteReq 删除
type DeleteReq struct { type DeleteReq struct {
g.Meta `path:"/member/delete" method:"post" tags:"会员" summary:"删除会员"` g.Meta `path:"/member/delete" method:"post" tags:"用户" summary:"删除用户"`
Id interface{} `json:"id" v:"required#会员ID不能为空" dc:"会员ID"` adminin.MemberDeleteInp
} }
type DeleteRes struct{} type DeleteRes struct{}
// MaxSortReq 最大排序 // MaxSortReq 最大排序
type MaxSortReq struct { type MaxSortReq struct {
g.Meta `path:"/member/max_sort" method:"get" tags:"会员" summary:"会员最大排序"` g.Meta `path:"/member/maxSort" method:"get" tags:"用户" summary:"用户最大排序"`
Id int64 `json:"id" dc:"会员ID"` adminin.MemberMaxSortInp
} }
type MaxSortRes struct { type MaxSortRes struct {
Sort int `json:"sort" dc:"排序"` *adminin.MemberMaxSortModel
} }
// InfoReq 获取登录用户信息 // LoginInfoReq 获取登录用户信息
type InfoReq struct { type LoginInfoReq struct {
g.Meta `path:"/member/info" method:"get" tags:"会员" summary:"获取登录用户信息" dc:"获取管理后台的登录用户信息"` g.Meta `path:"/member/info" method:"get" tags:"用户" summary:"获取登录用户信息" dc:"获取管理后台的登录用户信息"`
} }
type InfoRes struct { type LoginInfoRes struct {
adminin.MemberLoginModel *adminin.LoginMemberInfoModel
} }
type PortalConfigContentOptions struct { // StatusReq 更新用户状态
TitleRequired bool `json:"titleRequired" titleRequired:""`
MoreUrl string `json:"moreUrl" dc:"模块地址"`
Refresh int `json:"refresh" dc:"刷新"`
}
type PortalConfigContent struct {
Id int `json:"id" dc:"内容ID"`
X int `json:"x" dc:""`
Y int `json:"y" dc:""`
W int `json:"w" dc:"宽"`
H int `json:"h" dc:"高"`
I int `json:"i" dc:""`
Key string `json:"key" dc:""`
IsShowTitle string `json:"isShowTitle" dc:""`
IsAllowDrag bool `json:"isAllowDrag" dc:""`
Name string `json:"name" dc:""`
Type string `json:"type" dc:""`
Url string `json:"url" dc:""`
Options []*PortalConfigContentOptions `json:"options" dc:""`
Moved bool `json:"moved" dc:""`
}
type PortalConfig struct {
CreateByName string `json:"createByName" dc:"创建者名称"`
CreateDeptName string `json:"createDeptName" dc:"创建部门名称"`
ImportErrInfo string `json:"importErrInfo" dc:"导出错误信息"`
Id string `json:"id" dc:"用户ID"`
SearchValue string `json:"searchValue" dc:"搜索内容"`
CreateBy string `json:"createBy" dc:"创建者名称"`
CreateDept string `json:"createDept" dc:"创建部门名称"`
CreateTime *gtime.Time `json:"createTime" dc:"创建时间"`
UpdateBy string `json:"updateBy" dc:"更新者名称"`
UpdateTime *gtime.Time `json:"updateTime" dc:"更新时间"`
UpdateIp string `json:"updateIp" dc:"更新iP"`
Remark string `json:"remark" dc:"备注"`
Version string `json:"version" dc:"版本号"`
DelFlag string `json:"delFlag" dc:"删除标签"`
HandleType string `json:"handleType" dc:""`
Params string `json:"params" dc:""`
Name string `json:"name" dc:"配置名称"`
Code string `json:"code" dc:"配置代码"`
ApplicationRange string `json:"applicationRange" dc:""`
IsDefault string `json:"isDefault" dc:"是否默认"`
ResourceId string `json:"resourceId" dc:""`
ResourceName string `json:"resourceName" dc:""`
SystemDefinedId string `json:"systemDefinedId" dc:""`
Sort string `json:"sort" dc:"排序"`
SaveType string `json:"saveType" dc:""`
Status string `json:"status" dc:"状态"`
RecordLog string `json:"recordLog" dc:""`
PortalConfigContent string `json:"content" dc:"配置内容"`
}
// StatusReq 更新岗位状态
type StatusReq struct { type StatusReq struct {
entity.AdminPost g.Meta `path:"/member/status" method:"post" tags:"用户" summary:"更新用户状态"`
g.Meta `path:"/member/status" method:"post" tags:"会员" summary:"更新会员状态"` adminin.MemberStatusInp
} }
type StatusRes struct{} type StatusRes struct{}
// SelectReq 获取可选的后台用户选项
type SelectReq struct {
g.Meta `path:"/member/option" method:"get" summary:"用户" tags:"获取可选的后台用户选项"`
}
type SelectRes []*adminin.MemberSelectModel

View File

@ -15,7 +15,7 @@ import (
// MaxSortReq 菜单最大排序 // MaxSortReq 菜单最大排序
type MaxSortReq struct { type MaxSortReq struct {
g.Meta `path:"/menu/max_sort" method:"get" tags:"菜单" summary:"菜单最大排序"` g.Meta `path:"/menu/maxSort" method:"get" tags:"菜单" summary:"菜单最大排序"`
Id int64 `json:"id" dc:"菜单ID"` Id int64 `json:"id" dc:"菜单ID"`
} }
type MaxSortRes struct { type MaxSortRes struct {

View File

@ -8,19 +8,14 @@ package notice
import ( import (
"github.com/gogf/gf/v2/frame/g" "github.com/gogf/gf/v2/frame/g"
"hotgo/internal/model/entity"
"hotgo/internal/model/input/adminin" "hotgo/internal/model/input/adminin"
"hotgo/internal/model/input/form" "hotgo/internal/model/input/form"
) )
// ListReq 查询列表 // ListReq 查询列表
type ListReq struct { type ListReq struct {
form.PageReq g.Meta `path:"/notice/list" method:"get" tags:"公告" summary:"获取公告列表"`
form.RangeDateReq adminin.NoticeListInp
form.StatusReq
Title string `json:"title"`
Content string `json:"content"`
g.Meta `path:"/notice/list" method:"get" tags:"公告" summary:"获取公告列表"`
} }
type ListRes struct { type ListRes struct {
@ -30,39 +25,105 @@ type ListRes struct {
// ViewReq 获取指定信息 // ViewReq 获取指定信息
type ViewReq struct { type ViewReq struct {
Id int64 `json:"id" v:"required#公告ID不能为空" dc:"公告ID"`
g.Meta `path:"/notice/view" method:"get" tags:"公告" summary:"获取指定信息"` g.Meta `path:"/notice/view" method:"get" tags:"公告" summary:"获取指定信息"`
adminin.NoticeViewInp
} }
type ViewRes struct { type ViewRes struct {
*adminin.NoticeViewModel *adminin.NoticeViewModel
} }
// EditReq 修改/新增字典数据 // EditReq 修改/新增字典数据
type EditReq struct { type EditReq struct {
entity.AdminNotice
g.Meta `path:"/notice/edit" method:"post" tags:"公告" summary:"修改/新增公告"` g.Meta `path:"/notice/edit" method:"post" tags:"公告" summary:"修改/新增公告"`
adminin.NoticeEditInp
} }
type EditRes struct{} type EditRes struct{}
// DeleteReq 删除字典类型 // DeleteReq 删除字典类型
type DeleteReq struct { type DeleteReq struct {
Id interface{} `json:"id" v:"required#公告ID不能为空" dc:"公告ID"`
g.Meta `path:"/notice/delete" method:"post" tags:"公告" summary:"删除公告"` g.Meta `path:"/notice/delete" method:"post" tags:"公告" summary:"删除公告"`
adminin.NoticeDeleteInp
} }
type DeleteRes struct{} type DeleteRes struct{}
// MaxSortReq 最大排序 // MaxSortReq 最大排序
type MaxSortReq struct { type MaxSortReq struct {
Id int64 `json:"id" dc:"公告ID"` g.Meta `path:"/notice/maxSort" method:"get" tags:"公告" summary:"公告最大排序"`
g.Meta `path:"/notice/max_sort" method:"get" tags:"公告" summary:"公告最大排序"` adminin.NoticeMaxSortInp
} }
type MaxSortRes struct { type MaxSortRes struct {
Sort int `json:"sort" dc:"排序"` Sort int `json:"sort" dc:"排序"`
} }
// StatusReq 更新公告状态 // StatusReq 更新公告状态
type StatusReq struct { type StatusReq struct {
entity.AdminNotice
g.Meta `path:"/notice/status" method:"post" tags:"公告" summary:"更新公告状态"` g.Meta `path:"/notice/status" method:"post" tags:"公告" summary:"更新公告状态"`
adminin.NoticeStatusInp
} }
type StatusRes struct{} 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
}

View File

@ -29,7 +29,7 @@ type DeleteRes struct{}
// MaxSortReq 最大排序 // MaxSortReq 最大排序
type MaxSortReq struct { type MaxSortReq struct {
g.Meta `path:"/post/max_sort" method:"get" tags:"岗位" summary:"岗位最大排序"` g.Meta `path:"/post/maxSort" method:"get" tags:"岗位" summary:"岗位最大排序"`
Id int64 `json:"id" description:"岗位ID"` Id int64 `json:"id" description:"岗位ID"`
} }
type MaxSortRes struct { type MaxSortRes struct {

View File

@ -93,3 +93,19 @@ type UniqueIdReq struct {
type UniqueIdRes struct { type UniqueIdRes struct {
*sysin.ProvincesUniqueIdModel *sysin.ProvincesUniqueIdModel
} }
// SelectReq 省市区选项
type SelectReq struct {
g.Meta `path:"/provinces/select" method:"get" summary:"省市区" tags:"省市区选项"`
sysin.ProvincesSelectInp
}
type SelectRes struct {
*sysin.ProvincesSelectModel
}
// CityLabelReq 获取指定城市标签
type CityLabelReq struct {
g.Meta `path:"/provinces/cityLabel" method:"get" summary:"省市区" tags:"获取指定城市标签"`
sysin.ProvincesCityLabelInp
}
type CityLabelRes sysin.ProvincesCityLabelModel

View File

@ -15,7 +15,7 @@ import (
// MemberListReq 查询列表 // MemberListReq 查询列表
type MemberListReq struct { type MemberListReq struct {
g.Meta `path:"/role/member_list" method:"get" tags:"角色" summary:"获取角色下的会员列表"` g.Meta `path:"/role/member_list" method:"get" tags:"角色" summary:"获取角色下的用户列表"`
form.PageReq form.PageReq
form.RangeDateReq form.RangeDateReq
form.StatusReq form.StatusReq

View File

@ -3,6 +3,7 @@ module hotgo
go 1.15 go 1.15
require ( require (
github.com/BurntSushi/toml v1.2.1 // indirect
github.com/Shopify/sarama v1.34.1 github.com/Shopify/sarama v1.34.1
github.com/alibabacloud-go/darabonba-openapi/v2 v2.0.2 github.com/alibabacloud-go/darabonba-openapi/v2 v2.0.2
github.com/alibabacloud-go/dysmsapi-20170525/v3 v3.0.5 github.com/alibabacloud-go/dysmsapi-20170525/v3 v3.0.5
@ -12,29 +13,37 @@ require (
github.com/axgle/mahonia v0.0.0-20180208002826-3358181d7394 github.com/axgle/mahonia v0.0.0-20180208002826-3358181d7394
github.com/bufanyun/pool v0.2.1 github.com/bufanyun/pool v0.2.1
github.com/casbin/casbin/v2 v2.55.0 github.com/casbin/casbin/v2 v2.55.0
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/clbanning/mxj/v2 v2.5.7 // indirect
github.com/dgrijalva/jwt-go v3.2.0+incompatible github.com/dgrijalva/jwt-go v3.2.0+incompatible
github.com/fatih/color v1.14.1 // indirect
github.com/forgoer/openssl v1.4.0 github.com/forgoer/openssl v1.4.0
github.com/fsnotify/fsnotify v1.6.0 // indirect
github.com/go-resty/resty/v2 v2.7.0 github.com/go-resty/resty/v2 v2.7.0
github.com/gogf/gf/contrib/drivers/mysql/v2 v2.2.0-beta2 github.com/go-sql-driver/mysql v1.7.0 // indirect
github.com/gogf/gf/contrib/nosql/redis/v2 v2.3.0 github.com/gogf/gf/contrib/drivers/mysql/v2 v2.3.1
github.com/gogf/gf/contrib/nosql/redis/v2 v2.3.1
github.com/gogf/gf/v2 v2.3.1 github.com/gogf/gf/v2 v2.3.1
github.com/golang/mock v1.6.0 // indirect github.com/golang/mock v1.6.0 // indirect
github.com/gomodule/redigo v1.8.8 github.com/gomodule/redigo v1.8.8
github.com/google/btree v1.1.2 // indirect github.com/google/btree v1.1.2 // indirect
github.com/gorilla/websocket v1.5.0 github.com/gorilla/websocket v1.5.0
github.com/kayon/iploc v0.0.0-20200312105652-bda3e968a794 github.com/kayon/iploc v0.0.0-20200312105652-bda3e968a794
github.com/mattn/go-colorable v0.1.12 // indirect github.com/magiconair/properties v1.8.7 // indirect
github.com/mattn/go-runewidth v0.0.14 // indirect
github.com/mojocn/base64Captcha v1.3.5 github.com/mojocn/base64Captcha v1.3.5
github.com/olekukonko/tablewriter v0.0.5 github.com/olekukonko/tablewriter v0.0.5
github.com/rivo/uniseg v0.4.3 // indirect
github.com/shirou/gopsutil v3.21.11+incompatible github.com/shirou/gopsutil v3.21.11+incompatible
github.com/shopspring/decimal v1.3.1 github.com/shopspring/decimal v1.3.1
github.com/tklauser/go-sysconf v0.3.10 // indirect github.com/tklauser/go-sysconf v0.3.10 // indirect
github.com/ufilesdk-dev/ufile-gosdk v1.0.3 github.com/ufilesdk-dev/ufile-gosdk v1.0.3
github.com/xuri/excelize/v2 v2.6.0 github.com/xuri/excelize/v2 v2.6.0
github.com/yusufpapurcu/wmi v1.2.2 // indirect github.com/yusufpapurcu/wmi v1.2.2 // indirect
go.opentelemetry.io/otel/sdk v1.11.2 // indirect
go.uber.org/atomic v1.7.0 // indirect go.uber.org/atomic v1.7.0 // indirect
golang.org/x/crypto v0.0.0-20220411220226-7b82a4e95df4 // indirect golang.org/x/crypto v0.0.0-20220411220226-7b82a4e95df4 // indirect
golang.org/x/tools v0.1.7 golang.org/x/net v0.5.0 // indirect
golang.org/x/xerrors v0.0.0-20220411194840-2f41105eb62f // indirect golang.org/x/tools v0.1.12
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b gopkg.in/yaml.v3 v3.0.1
) )

View File

@ -33,8 +33,9 @@ cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/BurntSushi/toml v0.4.1/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ= github.com/BurntSushi/toml v0.4.1/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ=
github.com/BurntSushi/toml v1.1.0 h1:ksErzDEI1khOiGPgpwuI7x2ebx/uXQNw7xJpn9Eq1+I=
github.com/BurntSushi/toml v1.1.0/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ= github.com/BurntSushi/toml v1.1.0/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ=
github.com/BurntSushi/toml v1.2.1 h1:9F2/+DoOYIOksmaJFPw1tGFy1eDnIJXg+UHjuD8lTak=
github.com/BurntSushi/toml v1.2.1/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ=
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible h1:1G1pk05UrOh0NlF1oeaaix1x8XzrfjIDK47TY0Zehcw= github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible h1:1G1pk05UrOh0NlF1oeaaix1x8XzrfjIDK47TY0Zehcw=
github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0= github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0=
@ -89,13 +90,15 @@ github.com/casbin/casbin/v2 v2.55.0 h1:RyU+OacnVzjxof1U3bmxHM7oCRdx9+gNnkclrvof/
github.com/casbin/casbin/v2 v2.55.0/go.mod h1:vByNa/Fchek0KZUgG5wEsl7iFsiviAYKRtgrQfcJqHg= github.com/casbin/casbin/v2 v2.55.0/go.mod h1:vByNa/Fchek0KZUgG5wEsl7iFsiviAYKRtgrQfcJqHg=
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
github.com/cespare/xxhash/v2 v2.1.2 h1:YRXhKfTDauu4ajMg1TPgFO5jnlC2HCbmLXMcTG5cbYE=
github.com/cespare/xxhash/v2 v2.1.2/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/cespare/xxhash/v2 v2.1.2/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44=
github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI=
github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI=
github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU=
github.com/clbanning/mxj/v2 v2.5.5 h1:oT81vUeEiQQ/DcHbzSytRngP6Ky9O+L+0Bw0zSJag9E=
github.com/clbanning/mxj/v2 v2.5.5/go.mod h1:hNiWqW14h+kc+MdF9C6/YoRfjEJoR3ou6tn/Qo+ve2s= github.com/clbanning/mxj/v2 v2.5.5/go.mod h1:hNiWqW14h+kc+MdF9C6/YoRfjEJoR3ou6tn/Qo+ve2s=
github.com/clbanning/mxj/v2 v2.5.7 h1:7q5lvUpaPF/WOkqgIDiwjBJaznaLCCBd78pi8ZyAnE0=
github.com/clbanning/mxj/v2 v2.5.7/go.mod h1:hNiWqW14h+kc+MdF9C6/YoRfjEJoR3ou6tn/Qo+ve2s=
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc=
github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
@ -119,8 +122,9 @@ github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymF
github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98=
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
github.com/fatih/color v1.13.0 h1:8LOYc1KYPPmyKMuN8QV2DNRWNbLo6LZ0iLs8+mlH53w=
github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk= github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk=
github.com/fatih/color v1.14.1 h1:qfhVLaG5s+nCROl1zJsZRxFeYrHLqWroPOQ8BWiNb4w=
github.com/fatih/color v1.14.1/go.mod h1:2oHN61fhTpgcxD3TSWCgKDiH1+x4OiDVVGH8WlgGZGg=
github.com/forgoer/openssl v1.4.0 h1:rPMnQ92OKuBsKnfY/GmUDunnP72Cy+zviAompWMdC9U= github.com/forgoer/openssl v1.4.0 h1:rPMnQ92OKuBsKnfY/GmUDunnP72Cy+zviAompWMdC9U=
github.com/forgoer/openssl v1.4.0/go.mod h1:NMVFOzYeLVR7UiGTxsa+A21nrERTZ3Rv2JHDPcJpDyI= github.com/forgoer/openssl v1.4.0/go.mod h1:NMVFOzYeLVR7UiGTxsa+A21nrERTZ3Rv2JHDPcJpDyI=
github.com/fortytw2/leaktest v1.3.0 h1:u8491cBMTQ8ft8aeV+adlcytMZylmA5nnwwkRZjI8vw= github.com/fortytw2/leaktest v1.3.0 h1:u8491cBMTQ8ft8aeV+adlcytMZylmA5nnwwkRZjI8vw=
@ -128,8 +132,9 @@ github.com/fortytw2/leaktest v1.3.0/go.mod h1:jDsjWgpAGjm2CA7WthBh/CdZYEPF31XHqu
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ=
github.com/fsnotify/fsnotify v1.5.1/go.mod h1:T3375wBYaZdLLcVNkcVbzGHY7f1l/uK5T5Ai1i3InKU= github.com/fsnotify/fsnotify v1.5.1/go.mod h1:T3375wBYaZdLLcVNkcVbzGHY7f1l/uK5T5Ai1i3InKU=
github.com/fsnotify/fsnotify v1.5.4 h1:jRbGcIw6P2Meqdwuo0H1p6JVLbL5DHKAKlYndzMwVZI=
github.com/fsnotify/fsnotify v1.5.4/go.mod h1:OVB6XrOHzAwXMpEM7uPOzcehqUV2UqJxmVXmkdnm1bU= github.com/fsnotify/fsnotify v1.5.4/go.mod h1:OVB6XrOHzAwXMpEM7uPOzcehqUV2UqJxmVXmkdnm1bU=
github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4HY=
github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbSClcnxKAGw=
github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU=
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
@ -151,14 +156,15 @@ github.com/go-redis/redis/v8 v8.11.5 h1:AcZZR7igkdvfVmQTPnu9WE37LRrO/YrBH5zWyjDC
github.com/go-redis/redis/v8 v8.11.5/go.mod h1:gREzHqY1hg6oD9ngVRbLStwAWKhA0FEgq8Jd4h5lpwo= github.com/go-redis/redis/v8 v8.11.5/go.mod h1:gREzHqY1hg6oD9ngVRbLStwAWKhA0FEgq8Jd4h5lpwo=
github.com/go-resty/resty/v2 v2.7.0 h1:me+K9p3uhSmXtrBZ4k9jcEAfJmuC8IivWHwaLZwPrFY= github.com/go-resty/resty/v2 v2.7.0 h1:me+K9p3uhSmXtrBZ4k9jcEAfJmuC8IivWHwaLZwPrFY=
github.com/go-resty/resty/v2 v2.7.0/go.mod h1:9PWDzw47qPphMRFfhsyk0NnSgvluHcljSMVIq3w7q0I= github.com/go-resty/resty/v2 v2.7.0/go.mod h1:9PWDzw47qPphMRFfhsyk0NnSgvluHcljSMVIq3w7q0I=
github.com/go-sql-driver/mysql v1.6.0 h1:BCTh4TKNUYmOmMUcQ3IipzF5prigylS7XXjEkfCHuOE=
github.com/go-sql-driver/mysql v1.6.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg= github.com/go-sql-driver/mysql v1.6.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg=
github.com/go-sql-driver/mysql v1.7.0 h1:ueSltNNllEqE3qcWBTD0iQd3IpL/6U+mJxLkazJ7YPc=
github.com/go-sql-driver/mysql v1.7.0/go.mod h1:OXbVy3sEdcQ2Doequ6Z5BW6fXNQTmx+9S1MCJN5yJMI=
github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE= github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE=
github.com/gogf/gf/contrib/drivers/mysql/v2 v2.2.0-beta2 h1:QgVPXrGp8wJx18HIOsNATaIiHjXsd/Rk1F1QyxfWv+g= github.com/gogf/gf/contrib/drivers/mysql/v2 v2.3.1 h1:uSZtDmlTFS51A98KPgZElPigSGDi7PPDN6mxeIXtsLo=
github.com/gogf/gf/contrib/drivers/mysql/v2 v2.2.0-beta2/go.mod h1:z+/0qiOwMroAnj5ESuobTv0l5P83rf+XR3r6Fj8WJyk= github.com/gogf/gf/contrib/drivers/mysql/v2 v2.3.1/go.mod h1:z+/0qiOwMroAnj5ESuobTv0l5P83rf+XR3r6Fj8WJyk=
github.com/gogf/gf/contrib/nosql/redis/v2 v2.3.0 h1:r2q8MLwF6yUIEm6Hhwsfo/ixaJTKluTXSjU8rSeXo3c= github.com/gogf/gf/contrib/nosql/redis/v2 v2.3.1 h1:0pt3KCUtVtBPC6m/6natIeBKBYAQUcfSqy5IR58ogLo=
github.com/gogf/gf/contrib/nosql/redis/v2 v2.3.0/go.mod h1:V9o2BF9ovJnaZhHImHAanqUgjX4kI51lgU45u5rPqvw= github.com/gogf/gf/contrib/nosql/redis/v2 v2.3.1/go.mod h1:V9o2BF9ovJnaZhHImHAanqUgjX4kI51lgU45u5rPqvw=
github.com/gogf/gf/v2 v2.0.0/go.mod h1:apktt6TleWtCIwpz63vBqUnw8MX8gWKoZyxgDpXFtgM= github.com/gogf/gf/v2 v2.0.0/go.mod h1:apktt6TleWtCIwpz63vBqUnw8MX8gWKoZyxgDpXFtgM=
github.com/gogf/gf/v2 v2.3.1 h1:uptCJK47N6KSRwTBnFAqBWYnYa/OXBkZ0OlhO9CK7bQ= github.com/gogf/gf/v2 v2.3.1 h1:uptCJK47N6KSRwTBnFAqBWYnYa/OXBkZ0OlhO9CK7bQ=
github.com/gogf/gf/v2 v2.3.1/go.mod h1:tsbmtwcAl2chcYoq/fP9W2FZf06aw4i89X34nbSHo9Y= github.com/gogf/gf/v2 v2.3.1/go.mod h1:tsbmtwcAl2chcYoq/fP9W2FZf06aw4i89X34nbSHo9Y=
@ -213,8 +219,9 @@ github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/
github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.7 h1:81/ik6ipDQS2aGcBfIN5dHDB36BwrStyeAQquSYCV4o=
github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE= github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE=
github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=
github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs=
github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0=
@ -294,16 +301,20 @@ github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
github.com/magiconair/properties v1.8.6 h1:5ibWZ6iY0NctNGWo87LalDlEZ6R41TqbbDamhfG/Qzo=
github.com/magiconair/properties v1.8.6/go.mod h1:y3VJvCyxH9uVvJTWEGAELF3aiYNyPKd5NZ3oSwXrF60= github.com/magiconair/properties v1.8.6/go.mod h1:y3VJvCyxH9uVvJTWEGAELF3aiYNyPKd5NZ3oSwXrF60=
github.com/magiconair/properties v1.8.7 h1:IeQXZAiQcpL9mgcAe1Nu6cX9LLw6ExEHKjN0VQdvPDY=
github.com/magiconair/properties v1.8.7/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0=
github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc=
github.com/mattn/go-colorable v0.1.12 h1:jF+Du6AlPIjs2BiUiQlKOX0rt3SujHxPnksPKZbaA40= github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA=
github.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4= github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg=
github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
github.com/mattn/go-isatty v0.0.14 h1:yVuAays6BHfxijgZPzw+3Zlu5yQgKGP2/hcQbHb7S9Y=
github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94=
github.com/mattn/go-runewidth v0.0.9 h1:Lm995f3rfxdpd6TSmuVCHVb/QhupuXlYr8sCI/QdE+0= github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
github.com/mattn/go-isatty v0.0.17 h1:BTarxUcIeDqL27Mc+vyvdWYSL28zpIhv3RoTdsLMPng=
github.com/mattn/go-isatty v0.0.17/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI=
github.com/mattn/go-runewidth v0.0.14 h1:+xnbZSEeDbOIg5/mE6JF0w6n9duR1l3/WmbinWVwUuU=
github.com/mattn/go-runewidth v0.0.14/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg=
@ -369,6 +380,9 @@ github.com/richardlehane/mscfb v1.0.4 h1:WULscsljNPConisD5hR0+OyZjwK46Pfyr6mPu5Z
github.com/richardlehane/mscfb v1.0.4/go.mod h1:YzVpcZg9czvAuhk9T+a3avCpcFPMUWm7gK3DypaEsUk= github.com/richardlehane/mscfb v1.0.4/go.mod h1:YzVpcZg9czvAuhk9T+a3avCpcFPMUWm7gK3DypaEsUk=
github.com/richardlehane/msoleps v1.0.1 h1:RfrALnSNXzmXLbGct/P2b4xkFz4e8Gmj/0Vj9M9xC1o= github.com/richardlehane/msoleps v1.0.1 h1:RfrALnSNXzmXLbGct/P2b4xkFz4e8Gmj/0Vj9M9xC1o=
github.com/richardlehane/msoleps v1.0.1/go.mod h1:BWev5JBpU9Ko2WAgmZEuiz4/u3ZYTKbjLycmwiWUfWg= github.com/richardlehane/msoleps v1.0.1/go.mod h1:BWev5JBpU9Ko2WAgmZEuiz4/u3ZYTKbjLycmwiWUfWg=
github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
github.com/rivo/uniseg v0.4.3 h1:utMvzDsuh3suAEnhH0RdHmoPbU648o6CvXxTx4SBMOw=
github.com/rivo/uniseg v0.4.3/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88=
github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
github.com/rogpeppe/go-internal v1.6.1 h1:/FiVV8dS/e+YqF2JvO3yXRFbBLTIuSDkuC7aBOAvL+k= github.com/rogpeppe/go-internal v1.6.1 h1:/FiVV8dS/e+YqF2JvO3yXRFbBLTIuSDkuC7aBOAvL+k=
github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc=
@ -393,14 +407,18 @@ github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE= github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE=
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY=
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk=
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
github.com/tidwall/gjson v1.2.1 h1:j0efZLrZUvNerEf6xqoi0NjWMK5YlLrR7Guo/dxY174= github.com/tidwall/gjson v1.2.1 h1:j0efZLrZUvNerEf6xqoi0NjWMK5YlLrR7Guo/dxY174=
github.com/tidwall/gjson v1.2.1/go.mod h1:c/nTNbUr0E0OrXEhq1pwa8iEgc2DOt4ZZqAt1HtCkPA= github.com/tidwall/gjson v1.2.1/go.mod h1:c/nTNbUr0E0OrXEhq1pwa8iEgc2DOt4ZZqAt1HtCkPA=
github.com/tidwall/match v1.0.1 h1:PnKP62LPNxHKTwvHHZZzdOAOCtsJTjo6dZLCwpKm5xc= github.com/tidwall/match v1.0.1 h1:PnKP62LPNxHKTwvHHZZzdOAOCtsJTjo6dZLCwpKm5xc=
@ -432,6 +450,7 @@ github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9de
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
github.com/yuin/goldmark v1.4.0/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= github.com/yuin/goldmark v1.4.0/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
github.com/yusufpapurcu/wmi v1.2.2 h1:KBNDSne4vP5mbSWnJbO+51IMOXJB67QiYCSBrubbPRg= github.com/yusufpapurcu/wmi v1.2.2 h1:KBNDSne4vP5mbSWnJbO+51IMOXJB67QiYCSBrubbPRg=
github.com/yusufpapurcu/wmi v1.2.2/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0= github.com/yusufpapurcu/wmi v1.2.2/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0=
go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU=
@ -440,14 +459,17 @@ go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
go.opentelemetry.io/otel v1.0.0/go.mod h1:AjRVh9A5/5DE7S+mZtTR6t8vpKKryam+0lREnfmS4cg= go.opentelemetry.io/otel v1.0.0/go.mod h1:AjRVh9A5/5DE7S+mZtTR6t8vpKKryam+0lREnfmS4cg=
go.opentelemetry.io/otel v1.7.0 h1:Z2lA3Tdch0iDcrhJXDIlC94XE+bxok1F9B+4Lz/lGsM=
go.opentelemetry.io/otel v1.7.0/go.mod h1:5BdUoMIz5WEs0vt0CUEMtSSaTSHBBVwrhnz7+nrD5xk= go.opentelemetry.io/otel v1.7.0/go.mod h1:5BdUoMIz5WEs0vt0CUEMtSSaTSHBBVwrhnz7+nrD5xk=
go.opentelemetry.io/otel v1.11.2 h1:YBZcQlsVekzFsFbjygXMOXSs6pialIZxcjfO/mBDmR0=
go.opentelemetry.io/otel v1.11.2/go.mod h1:7p4EUV+AqgdlNV9gL97IgUZiVR3yrFXYo53f9BM3tRI=
go.opentelemetry.io/otel/sdk v1.0.0/go.mod h1:PCrDHlSy5x1kjezSdL37PhbFUMjrsLRshJ2zCzeXwbM= go.opentelemetry.io/otel/sdk v1.0.0/go.mod h1:PCrDHlSy5x1kjezSdL37PhbFUMjrsLRshJ2zCzeXwbM=
go.opentelemetry.io/otel/sdk v1.7.0 h1:4OmStpcKVOfvDOgCt7UriAPtKolwIhxpnSNI/yK+1B0=
go.opentelemetry.io/otel/sdk v1.7.0/go.mod h1:uTEOTwaqIVuTGiJN7ii13Ibp75wJmYUDe374q6cZwUU= go.opentelemetry.io/otel/sdk v1.7.0/go.mod h1:uTEOTwaqIVuTGiJN7ii13Ibp75wJmYUDe374q6cZwUU=
go.opentelemetry.io/otel/sdk v1.11.2 h1:GF4JoaEx7iihdMFu30sOyRx52HDHOkl9xQ8SMqNXUiU=
go.opentelemetry.io/otel/sdk v1.11.2/go.mod h1:wZ1WxImwpq+lVRo4vsmSOxdd+xwoUJ6rqyLc3SyX9aU=
go.opentelemetry.io/otel/trace v1.0.0/go.mod h1:PXTWqayeFUlJV1YDNhsJYB184+IvAH814St6o6ajzIs= go.opentelemetry.io/otel/trace v1.0.0/go.mod h1:PXTWqayeFUlJV1YDNhsJYB184+IvAH814St6o6ajzIs=
go.opentelemetry.io/otel/trace v1.7.0 h1:O37Iogk1lEkMRXewVtZ1BBTVn5JEp8GrJvP92bJqC6o=
go.opentelemetry.io/otel/trace v1.7.0/go.mod h1:fzLSB9nqR2eXzxPXb2JW9IKE+ScyXA48yyE4TNvoHqU= go.opentelemetry.io/otel/trace v1.7.0/go.mod h1:fzLSB9nqR2eXzxPXb2JW9IKE+ScyXA48yyE4TNvoHqU=
go.opentelemetry.io/otel/trace v1.11.2 h1:Xf7hWSF2Glv0DE3MH7fBHvtpSBsjcBUe5MYAmZM/+y0=
go.opentelemetry.io/otel/trace v1.11.2/go.mod h1:4N+yC7QEz7TTsG9BSRLNAa63eg5E06ObSbKPmxQ/pKA=
go.uber.org/atomic v1.5.1/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= go.uber.org/atomic v1.5.1/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ=
go.uber.org/atomic v1.7.0 h1:ADUqmZGgLDDfbSL9ZmPxKTybcoEYHgpYfELNoN+7hsw= go.uber.org/atomic v1.7.0 h1:ADUqmZGgLDDfbSL9ZmPxKTybcoEYHgpYfELNoN+7hsw=
go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc=
@ -460,6 +482,7 @@ golang.org/x/crypto v0.0.0-20191219195013-becbf705a915/go.mod h1:LzIPMQfyMNhhGPh
golang.org/x/crypto v0.0.0-20200510223506-06a226fb4e37/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200510223506-06a226fb4e37/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20201112155050-0c6587e931a9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20201112155050-0c6587e931a9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.0.0-20220214200702-86341886e292/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.0.0-20220214200702-86341886e292/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
golang.org/x/crypto v0.0.0-20220408190544-5352b0902921/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.0.0-20220408190544-5352b0902921/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
golang.org/x/crypto v0.0.0-20220411220226-7b82a4e95df4 h1:kUhD7nTDoI3fVd9G4ORWrbV5NY0liEs/Jg2pv5f+bBA= golang.org/x/crypto v0.0.0-20220411220226-7b82a4e95df4 h1:kUhD7nTDoI3fVd9G4ORWrbV5NY0liEs/Jg2pv5f+bBA=
@ -497,8 +520,9 @@ golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzB
golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg=
golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.4.2 h1:Gz96sIWK3OalVv/I/qNygP42zyoKp3xptRVCWRFEBvo=
golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4 h1:6zppjxzCulZykYSLyVDYbneBfbaBIQPYMevg0bEwv2s=
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
@ -530,6 +554,7 @@ golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81R
golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM=
golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT/9KSuxbyM7479/AVlXFRxuMCk= golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT/9KSuxbyM7479/AVlXFRxuMCk=
golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
@ -537,8 +562,10 @@ golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d/go.mod h1:9nx3DQGgdP8bBQD5qx
golang.org/x/net v0.0.0-20211029224645-99673261e6eb/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20211029224645-99673261e6eb/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20220407224826-aac1ed45d8e3/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220407224826-aac1ed45d8e3/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk=
golang.org/x/net v0.0.0-20220520000938-2e3eb7b945c2 h1:NWy5+hlRbC7HK+PmcXVUmW1IMyFce7to56IUvhUFm7Y=
golang.org/x/net v0.0.0-20220520000938-2e3eb7b945c2/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220520000938-2e3eb7b945c2/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk=
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
golang.org/x/net v0.5.0 h1:GyT4nK/YDHSqa1c4753ouYCDajOYKTja9Xb/OHtgvSw=
golang.org/x/net v0.5.0/go.mod h1:DivGGAXEgPSlEBzxGzZI+ZLohi+xUj054jfeKui00ws=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
@ -556,6 +583,7 @@ golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJ
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
@ -607,14 +635,21 @@ golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40/go.mod h1:oPkhp1MJrh7nUepCBc
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220114195835-da31bd327af9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220114195835-da31bd327af9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220128215802-99c3d69c2c27/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220128215802-99c3d69c2c27/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220412211240-33da011f77ad h1:ntjMns5wyP/fN65tdBD4g8J5w8n015+iIIs9rtjXkY0=
golang.org/x/sys v0.0.0-20220412211240-33da011f77ad/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220412211240-33da011f77ad/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.4.0 h1:Zr2JFtRQNX3BCZ8YtxRE9hNJYC8J6I1MVbMg6owUp18=
golang.org/x/sys v0.4.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/term v0.4.0/go.mod h1:9P2UbLfCdcvo3p/nzKvsmas4TnlujnuoV9hGgYzW1lQ=
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
@ -622,8 +657,9 @@ golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
golang.org/x/text v0.3.8-0.20211105212822-18b340fc7af2 h1:GLw7MR8AfAG2GmGcmVgObFOHXYypgGjnGno25RDwn3Y=
golang.org/x/text v0.3.8-0.20211105212822-18b340fc7af2/go.mod h1:EFNZuWvGYxIRUEX+K8UmCFwYmZjqcrnq15ZuVldZkZ0= golang.org/x/text v0.3.8-0.20211105212822-18b340fc7af2/go.mod h1:EFNZuWvGYxIRUEX+K8UmCFwYmZjqcrnq15ZuVldZkZ0=
golang.org/x/text v0.6.0 h1:3XmdazWV+ubf7QgHSTWeykHOci5oeekaGJBLkrkaw4k=
golang.org/x/text v0.6.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
@ -672,14 +708,13 @@ golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc
golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA=
golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
golang.org/x/tools v0.1.7 h1:6j8CgantCy3yc8JGBqkDLMKWqZ0RDU2g1HVgacojGWQ=
golang.org/x/tools v0.1.7/go.mod h1:LGqMHiF4EqQNHR1JncWGqT5BVaXmza+X+BDGol+dOxo= golang.org/x/tools v0.1.7/go.mod h1:LGqMHiF4EqQNHR1JncWGqT5BVaXmza+X+BDGol+dOxo=
golang.org/x/tools v0.1.12 h1:VveCTK38A2rkS8ZqFY25HIDFscX5X9OoEhJd3quQmXU=
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20220411194840-2f41105eb62f h1:GGU+dLjvlC3qDwqYgL6UgRmHXhOOgns0bZu2Ty5mm6U=
golang.org/x/xerrors v0.0.0-20220411194840-2f41105eb62f/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE=
google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M=
google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg=
@ -779,8 +814,9 @@ gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo=
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=

View File

@ -54,14 +54,14 @@ var (
g.Log().Debug(ctx, "starting all server") g.Log().Debug(ctx, "starting all server")
simple.SafeGo(ctx, func(ctx context.Context) { simple.SafeGo(ctx, func(ctx context.Context) {
if err := Http.Func(ctx, parser); err != nil { if err := Queue.Func(ctx, parser); err != nil {
g.Log().Fatal(ctx, "http server start fail:", err) g.Log().Fatal(ctx, "queue consumer start fail:", err)
} }
}) })
simple.SafeGo(ctx, func(ctx context.Context) { simple.SafeGo(ctx, func(ctx context.Context) {
if err := Queue.Func(ctx, parser); err != nil { if err := Http.Func(ctx, parser); err != nil {
g.Log().Fatal(ctx, "queue consumer start fail:", err) g.Log().Fatal(ctx, "http server start fail:", err)
} }
}) })

View File

@ -36,7 +36,8 @@ var (
}) })
// 请求结束事件回调 // 请求结束事件回调
s.BindHookHandler("/*any", ghttp.HookAfterOutput, service.Hook().GlobalLog) s.BindHookHandler("/*any", ghttp.HookAfterOutput, service.Hook().AccessLog)
s.BindHookHandler("/*any", ghttp.HookAfterOutput, service.Hook().LastActive)
s.Group("/", func(group *ghttp.RouterGroup) { s.Group("/", func(group *ghttp.RouterGroup) {
@ -74,7 +75,7 @@ var (
// Just run the server. // Just run the server.
s.Run() s.Run()
return nil return
}, },
} }
) )
@ -83,7 +84,6 @@ func setSSL(ctx context.Context, s *ghttp.Server) {
config, err := service.SysConfig().GetLoadSSL(ctx) config, err := service.SysConfig().GetLoadSSL(ctx)
if err != nil { if err != nil {
g.Log().Fatal(ctx, "ssl配置获取失败err:%+v", err) g.Log().Fatal(ctx, "ssl配置获取失败err:%+v", err)
return
} }
if config != nil && config.Switch { if config != nil && config.Switch {
s.EnableHTTPS(config.CrtPath, config.KeyPath) s.EnableHTTPS(config.CrtPath, config.KeyPath)

View File

@ -10,5 +10,6 @@ package consts
const ( const (
DemoTips = "演示系统已隐藏" DemoTips = "演示系统已隐藏"
NilJsonToString = "{}" // 空json初始化值 NilJsonToString = "{}" // 空json初始化值
RegionSpilt = " / " // 地区分隔符
) )

View File

@ -0,0 +1,39 @@
package consts
import "github.com/gogf/gf/v2/frame/g"
// 邮件内置模板
const (
EmsTemplateText = "text" // 通用文本
EmsTemplateCode = "code" // 通用验证码
EmsTemplateLogin = "login" // 登录
EmsTemplateRegister = "register" // 注册
EmsTemplateResetPwd = "resetPwd" // 重置密码
EmsTemplateBind = "bind" // 绑定邮箱
EmsTemplateCash = "cash" // 申请提现
)
// 验证码状态
const (
EmsStatusNotUsed = 1 // 未使用
EmsStatusUsed = 2 // 已使用
)
var EmsSubjectMap = g.MapStrStr{
EmsTemplateText: "这是一封来自HotGo的邮件",
EmsTemplateCode: "验证码",
EmsTemplateLogin: "登录验证码",
EmsTemplateRegister: "注册验证码",
EmsTemplateResetPwd: "重置密码",
EmsTemplateBind: "绑定邮箱验证码",
EmsTemplateCash: "申请提现验证码",
}
// IsCodeEmsTemplate 是否是验证码类型的模板
func IsCodeEmsTemplate(template string) bool {
return template == EmsTemplateCode ||
template == EmsTemplateLogin ||
template == EmsTemplateRegister ||
template == EmsTemplateBind ||
template == EmsTemplateCash
}

View File

@ -21,6 +21,13 @@ var GenCodesTypeNameMap = map[int]string{
GenCodesTypeCron: "定时任务(未实现)", GenCodesTypeCron: "定时任务(未实现)",
} }
var GenCodesTypeConfMap = map[int]string{
GenCodesTypeCurd: "crud",
GenCodesTypeTree: "tree",
GenCodesTypeQueue: "queue",
GenCodesTypeCron: "cron",
}
// 生成代码状态 // 生成代码状态
const ( const (
GenCodesStatusOk = 1 // 生成成功 GenCodesStatusOk = 1 // 生成成功

View File

@ -0,0 +1,8 @@
package consts
// 公告类型
const (
NoticeTypeNotify = 1 // 通知
NoticeTypeNotice = 2 // 公告
NoticeTypeLetter = 3 // 私信
)

View File

@ -17,7 +17,7 @@ const (
SmsTemplateCash = "cash" // 申请提现 SmsTemplateCash = "cash" // 申请提现
) )
// 短信状态码 // 验证码状态
const ( const (
SmsStatusNotUsed = 1 // 未使用 SmsStatusNotUsed = 1 // 未使用
SmsStatusUsed = 2 // 已使用 SmsStatusUsed = 2 // 已使用

View File

@ -8,5 +8,5 @@ package consts
// VersionApp HotGo版本 // VersionApp HotGo版本
const ( const (
VersionApp = "2.1.2" VersionApp = "2.1.3"
) )

View File

@ -21,122 +21,102 @@ var (
type cDept struct{} type cDept struct{}
// NameUnique 名称是否唯一 // NameUnique 名称是否唯一
func (c *cDept) NameUnique(ctx context.Context, req *dept.NameUniqueReq) (*dept.NameUniqueRes, error) { func (c *cDept) NameUnique(ctx context.Context, req *dept.NameUniqueReq) (res *dept.NameUniqueRes, err error) {
data, err := service.AdminDept().NameUnique(ctx, adminin.DeptNameUniqueInp{Id: req.Id, Name: req.Name}) data, err := service.AdminDept().NameUnique(ctx, adminin.DeptNameUniqueInp{Id: req.Id, Name: req.Name})
if err != nil { if err != nil {
return nil, err return
} }
var res dept.NameUniqueRes res = new(dept.NameUniqueRes)
res.IsUnique = data.IsUnique res.IsUnique = data.IsUnique
return &res, nil return
} }
// Delete 删除 // Delete 删除
func (c *cDept) Delete(ctx context.Context, req *dept.DeleteReq) (res *dept.DeleteRes, err error) { func (c *cDept) Delete(ctx context.Context, req *dept.DeleteReq) (res *dept.DeleteRes, err error) {
var in adminin.DeptDeleteInp var in adminin.DeptDeleteInp
if err = gconv.Scan(req, &in); err != nil { if err = gconv.Scan(req, &in); err != nil {
return nil, err return
} }
if err = service.AdminDept().Delete(ctx, in); err != nil {
return nil, err err = service.AdminDept().Delete(ctx, in)
} return
return res, nil
} }
// Edit 更新 // Edit 更新
func (c *cDept) Edit(ctx context.Context, req *dept.EditReq) (res *dept.EditRes, err error) { func (c *cDept) Edit(ctx context.Context, req *dept.EditReq) (res *dept.EditRes, err error) {
var in adminin.DeptEditInp var in adminin.DeptEditInp
if err = gconv.Scan(req, &in); err != nil { if err = gconv.Scan(req, &in); err != nil {
return nil, err return nil, err
} }
if err = service.AdminDept().Edit(ctx, in); err != nil {
return nil, err
}
return res, nil err = service.AdminDept().Edit(ctx, in)
return
} }
// MaxSort 最大排序 // MaxSort 最大排序
func (c *cDept) MaxSort(ctx context.Context, req *dept.MaxSortReq) (*dept.MaxSortRes, error) { func (c *cDept) MaxSort(ctx context.Context, req *dept.MaxSortReq) (res *dept.MaxSortRes, err error) {
data, err := service.AdminDept().MaxSort(ctx, adminin.DeptMaxSortInp{Id: req.Id}) data, err := service.AdminDept().MaxSort(ctx, adminin.DeptMaxSortInp{Id: req.Id})
if err != nil { if err != nil {
return nil, err return
} }
var res dept.MaxSortRes res = new(dept.MaxSortRes)
res.Sort = data.Sort res.Sort = data.Sort
return &res, nil return
} }
// View 获取指定信息 // View 获取指定信息
func (c *cDept) View(ctx context.Context, req *dept.ViewReq) (*dept.ViewRes, error) { func (c *cDept) View(ctx context.Context, req *dept.ViewReq) (res *dept.ViewRes, err error) {
data, err := service.AdminDept().View(ctx, adminin.DeptViewInp{Id: req.Id}) data, err := service.AdminDept().View(ctx, adminin.DeptViewInp{Id: req.Id})
if err != nil { if err != nil {
return nil, err return
} }
var res dept.ViewRes res = new(dept.ViewRes)
res.DeptViewModel = data res.DeptViewModel = data
return &res, nil return
} }
// List 查看列表 // List 查看列表
func (c *cDept) List(ctx context.Context, req *dept.ListReq) (*dept.ListRes, error) { func (c *cDept) List(ctx context.Context, req *dept.ListReq) (res *dept.ListRes, err error) {
var in adminin.DeptListInp
var ( if err = gconv.Scan(req, &in); err != nil {
in adminin.DeptListInp return
res dept.ListRes
)
if err := gconv.Scan(req, &in); err != nil {
return nil, err
} }
data, err := service.AdminDept().List(ctx, in) data, err := service.AdminDept().List(ctx, in)
if err != nil { if err != nil {
return nil, err return
} }
_ = gconv.Structs(data, &res) res = (*dept.ListRes)(&data)
return
return &res, nil
} }
// ListTree 查看列表树 // ListTree 查看列表树
func (c *cDept) ListTree(ctx context.Context, req *dept.ListTreeReq) (*dept.ListTreeRes, error) { func (c *cDept) ListTree(ctx context.Context, req *dept.ListTreeReq) (res *dept.ListTreeRes, err error) {
var in adminin.DeptListTreeInp
var ( if err = gconv.Scan(req, &in); err != nil {
in adminin.DeptListTreeInp return
res dept.ListTreeRes
)
if err := gconv.Scan(req, &in); err != nil {
return nil, err
} }
data, err := service.AdminDept().ListTree(ctx, in) data, err := service.AdminDept().ListTree(ctx, in)
if err != nil { if err != nil {
return nil, err return
} }
_ = gconv.Structs(data, &res) res = (*dept.ListTreeRes)(&data)
return
return &res, nil
} }
// Status 更新部门状态 // Status 更新部门状态
func (c *cDept) Status(ctx context.Context, req *dept.StatusReq) (res *dept.StatusRes, err error) { func (c *cDept) Status(ctx context.Context, req *dept.StatusReq) (res *dept.StatusRes, err error) {
var in adminin.DeptStatusInp var in adminin.DeptStatusInp
if err = gconv.Scan(req, &in); err != nil { if err = gconv.Scan(req, &in); err != nil {
return nil, err return
}
if err = service.AdminDept().Status(ctx, in); err != nil {
return nil, err
} }
return res, nil err = service.AdminDept().Status(ctx, in)
return
} }

View File

@ -23,269 +23,228 @@ var (
type cMember struct{} type cMember struct{}
// UpdateProfile 修改登录密码 // UpdateCash 修改代理商提现信息
func (c *cMember) UpdateProfile(ctx context.Context, req *member.UpdateProfileReq) (res *member.UpdateProfileRes, err error) { func (c *cMember) UpdateCash(ctx context.Context, req *member.UpdateCashReq) (res *member.UpdateCashRes, err error) {
var in adminin.MemberUpdateCashInp
if err = gconv.Scan(req, &in); err != nil {
return
}
err = service.AdminMember().UpdateCash(ctx, in)
return
}
// UpdateEmail 换绑邮箱
func (c *cMember) UpdateEmail(ctx context.Context, req *member.UpdateEmailReq) (res *member.UpdateEmailRes, err error) {
var in adminin.MemberUpdateEmailInp
if err = gconv.Scan(req, &in); err != nil {
return
}
err = service.AdminMember().UpdateEmail(ctx, in)
return
}
// UpdateMobile 换绑手机号
func (c *cMember) UpdateMobile(ctx context.Context, req *member.UpdateMobileReq) (res *member.UpdateMobileRes, err error) {
var in adminin.MemberUpdateMobileInp
if err = gconv.Scan(req, &in); err != nil {
return
}
err = service.AdminMember().UpdateMobile(ctx, in)
return
}
// UpdateProfile 更新用户资料
func (c *cMember) UpdateProfile(ctx context.Context, req *member.UpdateProfileReq) (res *member.UpdateProfileRes, err error) {
var in adminin.MemberUpdateProfileInp var in adminin.MemberUpdateProfileInp
if err = gconv.Scan(req, &in); err != nil { if err = gconv.Scan(req, &in); err != nil {
return nil, err return
}
if err = service.AdminMember().UpdateProfile(ctx, in); err != nil {
return nil, err
} }
err = service.AdminMember().UpdateProfile(ctx, in)
return return
} }
// UpdatePwd 修改登录密码 // UpdatePwd 修改登录密码
func (c *cMember) UpdatePwd(ctx context.Context, req *member.UpdatePwdReq) (res *member.UpdatePwdRes, err error) { func (c *cMember) UpdatePwd(ctx context.Context, req *member.UpdatePwdReq) (res *member.UpdatePwdRes, err error) {
var memberId = contexts.Get(ctx).User.Id
memberId := contexts.Get(ctx).User.Id
if memberId <= 0 { if memberId <= 0 {
err := gerror.New("获取用户信息失败!") err = gerror.New("获取用户信息失败!")
return nil, err return nil, err
} }
if err = service.AdminMember(). var in = adminin.MemberUpdatePwdInp{
UpdatePwd(ctx, adminin.MemberUpdatePwdInp{Id: memberId, OldPassword: req.OldPassword, NewPassword: req.NewPassword}); err != nil { Id: memberId,
return nil, err OldPassword: req.OldPassword,
NewPassword: req.NewPassword,
} }
err = service.AdminMember().UpdatePwd(ctx, in)
return return
} }
// Profile 获取登录用户的基本信息
func (c *cMember) Profile(ctx context.Context, req *member.ProfileReq) (*member.ProfileRes, error) {
var res member.ProfileRes
memberId := contexts.Get(ctx).User.Id
if memberId <= 0 {
err := gerror.New("获取用户信息失败!")
return nil, err
}
// 用户基本信息
memberInfo, err := service.AdminMember().View(ctx, adminin.MemberViewInp{Id: memberId})
if err != nil {
return nil, err
}
res.User = memberInfo
// 所在部门
sysDept, err := service.AdminDept().View(ctx, adminin.DeptViewInp{Id: memberInfo.DeptId})
if err != nil {
return nil, err
}
res.SysDept = sysDept
// 角色列表
sysRoles, err := service.AdminRole().GetMemberList(ctx, memberInfo.RoleId)
if err != nil {
return nil, err
}
res.SysRoles = sysRoles
// 获取角色名称
roleGroup, err := service.AdminRole().GetName(ctx, memberInfo.RoleId)
if err != nil {
return nil, err
}
res.RoleGroup = roleGroup
// 获取第一岗位名称
postGroup, err := service.AdminPost().GetMemberByStartName(ctx, memberInfo.Id)
if err != nil {
return nil, err
}
res.PostGroup = postGroup
return &res, nil
}
// ResetPwd 重置密码 // ResetPwd 重置密码
func (c *cMember) ResetPwd(ctx context.Context, req *member.ResetPwdReq) (res *member.ResetPwdRes, err error) { func (c *cMember) ResetPwd(ctx context.Context, req *member.ResetPwdReq) (res *member.ResetPwdRes, err error) {
var in = adminin.MemberResetPwdInp{
if err = service.AdminMember(). Id: req.Id,
ResetPwd(ctx, adminin.MemberResetPwdInp{Id: req.Id, Password: req.Password}); err != nil { Password: req.Password,
return nil, err
} }
err = service.AdminMember().ResetPwd(ctx, in)
return return
} }
// EmailUnique 邮箱是否唯一 // EmailUnique 邮箱是否唯一
func (c *cMember) EmailUnique(ctx context.Context, req *member.EmailUniqueReq) (*member.EmailUniqueRes, error) { func (c *cMember) EmailUnique(ctx context.Context, req *member.EmailUniqueReq) (res *member.EmailUniqueRes, err error) {
var in = adminin.MemberEmailUniqueInp{
data, err := service.AdminMember().EmailUnique(ctx, adminin.MemberEmailUniqueInp{Id: req.Id, Email: req.Email}) Id: req.Id,
if err != nil { Email: req.Email,
return nil, err
} }
var res member.EmailUniqueRes data, err := service.AdminMember().EmailUnique(ctx, in)
if err != nil {
return
}
res = new(member.EmailUniqueRes)
res.IsUnique = data.IsUnique res.IsUnique = data.IsUnique
return &res, nil return
} }
// MobileUnique 手机号是否唯一 // MobileUnique 手机号是否唯一
func (c *cMember) MobileUnique(ctx context.Context, req *member.MobileUniqueReq) (*member.MobileUniqueRes, error) { func (c *cMember) MobileUnique(ctx context.Context, req *member.MobileUniqueReq) (res *member.MobileUniqueRes, err error) {
var in = adminin.MemberMobileUniqueInp{
data, err := service.AdminMember().MobileUnique(ctx, adminin.MemberMobileUniqueInp{Id: req.Id, Mobile: req.Mobile}) Id: req.Id,
if err != nil { Mobile: req.Mobile,
return nil, err
} }
var res member.MobileUniqueRes data, err := service.AdminMember().MobileUnique(ctx, in)
if err != nil {
return
}
res = new(member.MobileUniqueRes)
res.IsUnique = data.IsUnique res.IsUnique = data.IsUnique
return &res, nil return
} }
// NameUnique 名称是否唯一 // NameUnique 名称是否唯一
func (c *cMember) NameUnique(ctx context.Context, req *member.NameUniqueReq) (*member.NameUniqueRes, error) { func (c *cMember) NameUnique(ctx context.Context, req *member.NameUniqueReq) (res *member.NameUniqueRes, err error) {
var in = adminin.MemberNameUniqueInp{
data, err := service.AdminMember().NameUnique(ctx, adminin.MemberNameUniqueInp{Id: req.Id, Username: req.Username}) Id: req.Id,
if err != nil { Username: req.Username,
return nil, err
} }
var res member.NameUniqueRes data, err := service.AdminMember().NameUnique(ctx, in)
if err != nil {
return
}
res = new(member.NameUniqueRes)
res.IsUnique = data.IsUnique res.IsUnique = data.IsUnique
return &res, nil return
} }
// Delete 删除 // Delete 删除
func (c *cMember) Delete(ctx context.Context, req *member.DeleteReq) (res *member.DeleteRes, err error) { func (c *cMember) Delete(ctx context.Context, req *member.DeleteReq) (res *member.DeleteRes, err error) {
var in adminin.MemberDeleteInp var in adminin.MemberDeleteInp
if err = gconv.Scan(req, &in); err != nil { if err = gconv.Scan(req, &in); err != nil {
return nil, err return
} }
if err = service.AdminMember().Delete(ctx, in); err != nil {
return nil, err err = service.AdminMember().Delete(ctx, in)
} return
return res, nil
} }
// Edit 修改/新增 // Edit 修改/新增
func (c *cMember) Edit(ctx context.Context, req *member.EditReq) (res *member.EditRes, err error) { func (c *cMember) Edit(ctx context.Context, req *member.EditReq) (res *member.EditRes, err error) {
var in adminin.MemberEditInp var in adminin.MemberEditInp
if err = gconv.Scan(req, &in); err != nil { if err = gconv.Scan(req, &in); err != nil {
return nil, err return
} }
in.PostIds = req.PostIds in.PostIds = req.PostIds
if err = service.AdminMember().Edit(ctx, in); err != nil { err = service.AdminMember().Edit(ctx, in)
return nil, err return
}
return res, nil
} }
// MaxSort 最大排序 // MaxSort 最大排序
func (c *cMember) MaxSort(ctx context.Context, req *member.MaxSortReq) (*member.MaxSortRes, error) { func (c *cMember) MaxSort(ctx context.Context, req *member.MaxSortReq) (res *member.MaxSortRes, err error) {
var in = adminin.MemberMaxSortInp{Id: req.Id}
data, err := service.AdminMember().MaxSort(ctx, adminin.MemberMaxSortInp{Id: req.Id}) data, err := service.AdminMember().MaxSort(ctx, in)
if err != nil { if err != nil {
return nil, err return
} }
var res member.MaxSortRes res = new(member.MaxSortRes)
res.Sort = data.Sort res.Sort = data.Sort
return &res, nil return
} }
// View 获取指定信息 // View 获取指定信息
func (c *cMember) View(ctx context.Context, req *member.ViewReq) (*member.ViewRes, error) { func (c *cMember) View(ctx context.Context, req *member.ViewReq) (res *member.ViewRes, err error) {
data, err := service.AdminMember().View(ctx, adminin.MemberViewInp{Id: req.Id})
postsList, _, err := service.AdminPost().List(ctx, adminin.PostListInp{})
if err != nil { if err != nil {
return nil, err return
} }
//roleList, _, err := service.AdminRole().List(ctx, adminin.RoleListInp{}) res = new(member.ViewRes)
//if err != nil { res.MemberViewModel = data
// return nil, err return
//}
var res member.ViewRes
res.Posts = postsList
//res.Roles = roleList
if req.Id <= 0 {
return &res, err
}
memberInfo, err := service.AdminMember().View(ctx, adminin.MemberViewInp{Id: req.Id})
if err != nil {
return nil, err
}
res.MemberViewModel = memberInfo
res.PostIds, err = service.AdminMemberPost().GetMemberByIds(ctx, memberInfo.Id)
if err != nil {
return nil, err
}
res.RoleIds = []int64{memberInfo.RoleId}
res.DeptName, err = service.AdminDept().GetName(ctx, memberInfo.DeptId)
if err != nil {
return nil, err
}
return &res, nil
} }
// List 查看列表 // List 查看列表
func (c *cMember) List(ctx context.Context, req *member.ListReq) (*member.ListRes, error) { func (c *cMember) List(ctx context.Context, req *member.ListReq) (res *member.ListRes, err error) {
var in adminin.MemberListInp
var ( if err = gconv.Scan(req, &in); err != nil {
in adminin.MemberListInp return
res member.ListRes
)
if err := gconv.Scan(req, &in); err != nil {
return nil, err
} }
list, totalCount, err := service.AdminMember().List(ctx, in) list, totalCount, err := service.AdminMember().List(ctx, in)
if err != nil { if err != nil {
return nil, err return
} }
res = new(member.ListRes)
res.List = list res.List = list
res.PageCount = form.CalPageCount(totalCount, req.PerPage) res.PageCount = form.CalPageCount(totalCount, req.PerPage)
res.Page = req.Page res.Page = req.Page
res.PerPage = req.PerPage res.PerPage = req.PerPage
return
return &res, nil
} }
// Info 登录用户信息 // LoginInfo 登录用户信息
func (c *cMember) Info(ctx context.Context, req *member.InfoReq) (res *member.InfoRes, err error) { func (c *cMember) LoginInfo(ctx context.Context, req *member.LoginInfoReq) (res *member.LoginInfoRes, err error) {
data, err := service.AdminMember().LoginMemberInfo(ctx)
model, err := service.AdminMember().LoginMemberInfo(ctx, req)
if err != nil { if err != nil {
return nil, err return
} }
if err = gconv.Scan(model, &res); err != nil { res = new(member.LoginInfoRes)
return nil, err res.LoginMemberInfoModel = data
}
return return
} }
// Status 更新状态 // Status 更新状态
func (c *cMember) Status(ctx context.Context, req *member.StatusReq) (res *member.StatusRes, err error) { func (c *cMember) Status(ctx context.Context, req *member.StatusReq) (res *member.StatusRes, err error) {
var in adminin.MemberStatusInp var in adminin.MemberStatusInp
if err = gconv.Scan(req, &in); err != nil { if err = gconv.Scan(req, &in); err != nil {
return nil, err return
}
if err = service.AdminMember().Status(ctx, in); err != nil {
return nil, err
} }
return res, nil err = service.AdminMember().Status(ctx, in)
return
}
// Select 获取可选的后台用户选项
func (c *cMember) Select(ctx context.Context, req *member.SelectReq) (res *member.SelectRes, err error) {
data, err := service.AdminMember().Select(ctx, adminin.MemberSelectInp{})
if err != nil {
return
}
res = (*member.SelectRes)(&data)
return
} }

View File

@ -22,99 +22,67 @@ var (
type cMenu struct{} type cMenu struct{}
// RoleList 查询角色菜单列表 // RoleList 查询角色菜单列表
func (c *cMenu) RoleList(ctx context.Context, req *menu.RoleListReq) (*menu.RoleListRes, error) { func (c *cMenu) RoleList(ctx context.Context, req *menu.RoleListReq) (res *menu.RoleListRes, err error) {
var in adminin.MenuRoleListInp var in adminin.MenuRoleListInp
if err := gconv.Scan(req, &in); err != nil { if err = gconv.Scan(req, &in); err != nil {
return nil, err return
} }
data, err := service.AdminMenu().RoleList(ctx, in) data, err := service.AdminMenu().RoleList(ctx, in)
if err != nil { if err != nil {
return nil, err return
} }
var res menu.RoleListRes res = new(menu.RoleListRes)
res.CheckedKeys = data.CheckedKeys res.CheckedKeys = data.CheckedKeys
res.Menus = data.Menus res.Menus = data.Menus
return &res, nil return
} }
// SearchList 查询菜单列表 // SearchList 查询菜单列表
func (c *cMenu) SearchList(ctx context.Context, req *menu.SearchListReq) (res *menu.SearchListRes, err error) { func (c *cMenu) SearchList(ctx context.Context, req *menu.SearchListReq) (res *menu.SearchListRes, err error) {
res, err = service.AdminMenu().SearchList(ctx, req) res, err = service.AdminMenu().SearchList(ctx, req)
if err != nil { return
return nil, err
}
return res, nil
} }
// MaxSort 最大排序 // MaxSort 最大排序
func (c *cMenu) MaxSort(ctx context.Context, req *menu.MaxSortReq) (res *menu.MaxSortRes, err error) { func (c *cMenu) MaxSort(ctx context.Context, req *menu.MaxSortReq) (res *menu.MaxSortRes, err error) {
res, err = service.AdminMenu().MaxSort(ctx, req) res, err = service.AdminMenu().MaxSort(ctx, req)
if err != nil { return
return nil, err
}
return res, nil
} }
// NameUnique 菜单名称是否唯一 // NameUnique 菜单名称是否唯一
func (c *cMenu) NameUnique(ctx context.Context, req *menu.NameUniqueReq) (res *menu.NameUniqueRes, err error) { func (c *cMenu) NameUnique(ctx context.Context, req *menu.NameUniqueReq) (res *menu.NameUniqueRes, err error) {
res, err = service.AdminMenu().NameUnique(ctx, req) res, err = service.AdminMenu().NameUnique(ctx, req)
if err != nil { return
return nil, err
}
return res, nil
} }
// CodeUnique 菜单编码是否唯一 // CodeUnique 菜单编码是否唯一
func (c *cMenu) CodeUnique(ctx context.Context, req *menu.CodeUniqueReq) (res *menu.CodeUniqueRes, err error) { func (c *cMenu) CodeUnique(ctx context.Context, req *menu.CodeUniqueReq) (res *menu.CodeUniqueRes, err error) {
res, err = service.AdminMenu().CodeUnique(ctx, req) res, err = service.AdminMenu().CodeUnique(ctx, req)
if err != nil { return
return nil, err
}
return res, nil
} }
// Delete 删除 // Delete 删除
func (c *cMenu) Delete(ctx context.Context, req *menu.DeleteReq) (res *menu.DeleteRes, err error) { func (c *cMenu) Delete(ctx context.Context, req *menu.DeleteReq) (res *menu.DeleteRes, err error) {
err = service.AdminMenu().Delete(ctx, req)
if err = service.AdminMenu().Delete(ctx, req); err != nil { return
return nil, err
}
return res, nil
} }
// Edit 更新 // Edit 更新
func (c *cMenu) Edit(ctx context.Context, req *menu.EditReq) (res *menu.EditRes, err error) { func (c *cMenu) Edit(ctx context.Context, req *menu.EditReq) (res *menu.EditRes, err error) {
err = service.AdminMenu().Edit(ctx, req)
if err = service.AdminMenu().Edit(ctx, req); err != nil { return
return nil, err
}
return res, nil
} }
// View 获取信息 // View 获取信息
func (c *cMenu) View(ctx context.Context, req *menu.ViewReq) (res *menu.ViewRes, err error) { func (c *cMenu) View(ctx context.Context, req *menu.ViewReq) (res *menu.ViewRes, err error) {
res, err = service.AdminMenu().View(ctx, req) res, err = service.AdminMenu().View(ctx, req)
if err != nil { return
return nil, err
}
return res, nil
} }
// List 获取列表 // List 获取列表
func (c *cMenu) List(ctx context.Context, req *menu.ListReq) (res menu.ListRes, err error) { func (c *cMenu) List(ctx context.Context, req *menu.ListReq) (res menu.ListRes, err error) {
res.List, err = service.AdminMenu().List(ctx, req) res.List, err = service.AdminMenu().List(ctx, req)
return
if err != nil {
return res, err
}
return res, nil
} }

View File

@ -42,24 +42,23 @@ func (c *cMonitor) Offline(ctx context.Context, req *monitor.OfflineReq) (res *m
websocket.Close(client) websocket.Close(client)
}) })
return res, nil return
} }
// View 获取指定信息 // View 获取指定信息
func (c *cMonitor) View(ctx context.Context, req *monitor.OnlineViewReq) (*monitor.OnlineViewRes, error) { func (c *cMonitor) View(ctx context.Context, req *monitor.OnlineViewReq) (res *monitor.OnlineViewRes, err error) {
return &monitor.OnlineViewRes{}, nil return
} }
// OnlineList 获取在线列表 // OnlineList 获取在线列表
func (c *cMonitor) OnlineList(ctx context.Context, req *monitor.OnlineListReq) (*monitor.OnlineListRes, error) { func (c *cMonitor) OnlineList(ctx context.Context, req *monitor.OnlineListReq) (res *monitor.OnlineListRes, err error) {
var ( var (
res monitor.OnlineListRes
clients []*monitor.OnlineModel clients []*monitor.OnlineModel
i int i int
) )
if c.wsManager.GetClientsLen() == 0 { if c.wsManager.GetClientsLen() == 0 {
return &res, nil return
} }
for conn, _ := range c.wsManager.GetClients() { for conn, _ := range c.wsManager.GetClients() {
@ -90,6 +89,7 @@ func (c *cMonitor) OnlineList(ctx context.Context, req *monitor.OnlineListReq) (
}) })
} }
res = new(monitor.OnlineListRes)
res.PageCount = form.CalPageCount(len(clients), req.PerPage) res.PageCount = form.CalPageCount(len(clients), req.PerPage)
res.Page = req.Page res.Page = req.Page
res.PerPage = req.PerPage res.PerPage = req.PerPage
@ -108,5 +108,5 @@ func (c *cMonitor) OnlineList(ctx context.Context, req *monitor.OnlineListReq) (
} }
} }
return &res, nil return
} }

View File

@ -10,6 +10,7 @@ import (
"context" "context"
"github.com/gogf/gf/v2/util/gconv" "github.com/gogf/gf/v2/util/gconv"
"hotgo/api/backend/notice" "hotgo/api/backend/notice"
"hotgo/internal/consts"
"hotgo/internal/model/input/adminin" "hotgo/internal/model/input/adminin"
"hotgo/internal/model/input/form" "hotgo/internal/model/input/form"
"hotgo/internal/service" "hotgo/internal/service"
@ -25,63 +26,53 @@ type cNotice struct{}
func (c *cNotice) Delete(ctx context.Context, req *notice.DeleteReq) (res *notice.DeleteRes, err error) { func (c *cNotice) Delete(ctx context.Context, req *notice.DeleteReq) (res *notice.DeleteRes, err error) {
var in adminin.NoticeDeleteInp var in adminin.NoticeDeleteInp
if err = gconv.Scan(req, &in); err != nil { if err = gconv.Scan(req, &in); err != nil {
return nil, err return
} }
if err = service.AdminNotice().Delete(ctx, in); err != nil {
return nil, err err = service.AdminNotice().Delete(ctx, in)
} return
return res, nil
} }
// Edit 更新 // Edit 更新
func (c *cNotice) Edit(ctx context.Context, req *notice.EditReq) (res *notice.EditRes, err error) { func (c *cNotice) Edit(ctx context.Context, req *notice.EditReq) (res *notice.EditRes, err error) {
var in adminin.NoticeEditInp var in adminin.NoticeEditInp
if err = gconv.Scan(req, &in); err != nil { if err = gconv.Scan(req, &in); err != nil {
return nil, err return
}
if err = service.AdminNotice().Edit(ctx, in); err != nil {
return nil, err
} }
return res, nil in.Receiver = req.Receiver
err = service.AdminNotice().Edit(ctx, in)
return
} }
// MaxSort 最大排序 // MaxSort 最大排序
func (c *cNotice) MaxSort(ctx context.Context, req *notice.MaxSortReq) (*notice.MaxSortRes, error) { func (c *cNotice) MaxSort(ctx context.Context, req *notice.MaxSortReq) (res *notice.MaxSortRes, err error) {
data, err := service.AdminNotice().MaxSort(ctx, adminin.NoticeMaxSortInp{Id: req.Id}) data, err := service.AdminNotice().MaxSort(ctx, adminin.NoticeMaxSortInp{Id: req.Id})
if err != nil { if err != nil {
return nil, err return
} }
var res notice.MaxSortRes res = new(notice.MaxSortRes)
res.Sort = data.Sort res.Sort = data.Sort
return &res, nil return
} }
// View 获取指定信息 // View 获取指定信息
func (c *cNotice) View(ctx context.Context, req *notice.ViewReq) (*notice.ViewRes, error) { func (c *cNotice) View(ctx context.Context, req *notice.ViewReq) (res *notice.ViewRes, err error) {
data, err := service.AdminNotice().View(ctx, adminin.NoticeViewInp{Id: req.Id}) data, err := service.AdminNotice().View(ctx, adminin.NoticeViewInp{Id: req.Id})
if err != nil { if err != nil {
return nil, err return
} }
var res notice.ViewRes res = new(notice.ViewRes)
res.NoticeViewModel = data res.NoticeViewModel = data
return &res, nil return
} }
// List 查看列表 // List 查看列表
func (c *cNotice) List(ctx context.Context, req *notice.ListReq) (*notice.ListRes, error) { func (c *cNotice) List(ctx context.Context, req *notice.ListReq) (res *notice.ListRes, err error) {
var in adminin.NoticeListInp
var ( if err = gconv.Scan(req, &in); err != nil {
in adminin.NoticeListInp
res notice.ListRes
)
if err := gconv.Scan(req, &in); err != nil {
return nil, err return nil, err
} }
@ -90,24 +81,123 @@ func (c *cNotice) List(ctx context.Context, req *notice.ListReq) (*notice.ListRe
return nil, err return nil, err
} }
res = new(notice.ListRes)
res.List = list res.List = list
res.PageCount = form.CalPageCount(totalCount, req.PerPage) res.PageCount = form.CalPageCount(totalCount, req.PerPage)
res.Page = req.Page res.Page = req.Page
res.PerPage = req.PerPage res.PerPage = req.PerPage
return
return &res, nil
} }
// Status 更新部门状态 // Status 更新部门状态
func (c *cNotice) Status(ctx context.Context, req *notice.StatusReq) (res *notice.StatusRes, err error) { func (c *cNotice) Status(ctx context.Context, req *notice.StatusReq) (res *notice.StatusRes, err error) {
var in adminin.NoticeStatusInp var in adminin.NoticeStatusInp
if err = gconv.Scan(req, &in); err != nil { if err = gconv.Scan(req, &in); err != nil {
return nil, err return nil, err
} }
if err = service.AdminNotice().Status(ctx, in); err != nil {
err = service.AdminNotice().Status(ctx, in)
return
}
// Notify 更新通知
func (c *cNotice) Notify(ctx context.Context, req *notice.EditNotifyReq) (res *notice.EditNotifyRes, err error) {
var in adminin.NoticeEditInp
if err = gconv.Scan(req, &in); err != nil {
return
}
in.Type = consts.NoticeTypeNotify
in.Receiver = req.Receiver
err = service.AdminNotice().Edit(ctx, in)
return
}
// Notice 更新公告
func (c *cNotice) Notice(ctx context.Context, req *notice.EditNoticeReq) (res *notice.EditNoticeRes, err error) {
var in adminin.NoticeEditInp
if err = gconv.Scan(req, &in); err != nil {
return
}
in.Type = consts.NoticeTypeNotice
in.Receiver = req.Receiver
err = service.AdminNotice().Edit(ctx, in)
return
}
// Letter 更新私信
func (c *cNotice) Letter(ctx context.Context, req *notice.EditLetterReq) (res *notice.EditLetterRes, err error) {
var in adminin.NoticeEditInp
if err = gconv.Scan(req, &in); err != nil {
return
}
in.Type = consts.NoticeTypeLetter
in.Receiver = req.Receiver
err = service.AdminNotice().Edit(ctx, in)
return
}
// UpRead 更新已读
func (c *cNotice) UpRead(ctx context.Context, req *notice.UpReadReq) (res *notice.UpReadRes, err error) {
var in adminin.NoticeUpReadInp
if err = gconv.Scan(req, &in); err != nil {
return nil, err return nil, err
} }
err = service.AdminNotice().UpRead(ctx, in)
return res, nil return res, nil
} }
// PullMessages 拉取未读消息列表
func (c *cNotice) PullMessages(ctx context.Context, req *notice.PullMessagesReq) (res *notice.PullMessagesRes, err error) {
var in adminin.PullMessagesInp
if err = gconv.Scan(req, &in); err != nil {
return
}
if in.Limit == 0 {
in.Limit = 100
}
data, err := service.AdminNotice().PullMessages(ctx, in)
if err != nil {
return
}
res = new(notice.PullMessagesRes)
res.PullMessagesModel = data
return
}
// ReadAll 全部已读
func (c *cNotice) ReadAll(ctx context.Context, req *notice.ReadAllReq) (res *notice.ReadAllRes, err error) {
var in adminin.NoticeReadAllInp
if err = gconv.Scan(req, &in); err != nil {
return
}
err = service.AdminNotice().ReadAll(ctx, in)
return
}
// MessageList 我的消息列表
func (c *cNotice) MessageList(ctx context.Context, req *notice.MessageListReq) (res *notice.MessageListRes, err error) {
var in adminin.NoticeMessageListInp
if err = gconv.Scan(req, &in); err != nil {
return
}
list, totalCount, err := service.AdminNotice().MessageList(ctx, in)
if err != nil {
return
}
res = new(notice.MessageListRes)
res.List = list
res.PageCount = form.CalPageCount(totalCount, req.PerPage)
res.Page = req.Page
res.PerPage = req.PerPage
return
}

View File

@ -24,117 +24,99 @@ type cPost struct{}
func (c *cPost) Delete(ctx context.Context, req *post.DeleteReq) (res *post.DeleteRes, err error) { func (c *cPost) Delete(ctx context.Context, req *post.DeleteReq) (res *post.DeleteRes, err error) {
var in adminin.PostDeleteInp var in adminin.PostDeleteInp
if err = gconv.Scan(req, &in); err != nil { if err = gconv.Scan(req, &in); err != nil {
return nil, err return
}
if err = service.AdminPost().Delete(ctx, in); err != nil {
return nil, err
} }
err = service.AdminPost().Delete(ctx, in)
return res, nil return res, nil
} }
// Edit 修改/新增 // Edit 修改/新增
func (c *cPost) Edit(ctx context.Context, req *post.EditReq) (res *post.EditRes, err error) { func (c *cPost) Edit(ctx context.Context, req *post.EditReq) (res *post.EditRes, err error) {
var in adminin.PostEditInp var in adminin.PostEditInp
if err = gconv.Scan(req, &in); err != nil { if err = gconv.Scan(req, &in); err != nil {
return nil, err return
}
if err = service.AdminPost().Edit(ctx, in); err != nil {
return nil, err
} }
return res, nil err = service.AdminPost().Edit(ctx, in)
return
} }
// MaxSort 最大排序 // MaxSort 最大排序
func (c *cPost) MaxSort(ctx context.Context, req *post.MaxSortReq) (*post.MaxSortRes, error) { func (c *cPost) MaxSort(ctx context.Context, req *post.MaxSortReq) (res *post.MaxSortRes, err error) {
data, err := service.AdminPost().MaxSort(ctx, adminin.PostMaxSortInp{Id: req.Id}) data, err := service.AdminPost().MaxSort(ctx, adminin.PostMaxSortInp{Id: req.Id})
if err != nil { if err != nil {
return nil, err return
} }
var res post.MaxSortRes res = new(post.MaxSortRes)
res.Sort = data.Sort res.Sort = data.Sort
return &res, nil return
} }
// NameUnique 名称是否唯一 // NameUnique 名称是否唯一
func (c *cPost) NameUnique(ctx context.Context, req *post.NameUniqueReq) (*post.NameUniqueRes, error) { func (c *cPost) NameUnique(ctx context.Context, req *post.NameUniqueReq) (res *post.NameUniqueRes, err error) {
data, err := service.AdminPost().NameUnique(ctx, adminin.PostNameUniqueInp{Id: req.Id, Name: req.Name}) data, err := service.AdminPost().NameUnique(ctx, adminin.PostNameUniqueInp{Id: req.Id, Name: req.Name})
if err != nil { if err != nil {
return nil, err return
} }
var res post.NameUniqueRes res = new(post.NameUniqueRes)
res.IsUnique = data.IsUnique res.IsUnique = data.IsUnique
return &res, nil return
} }
// CodeUnique 编码是否唯一 // CodeUnique 编码是否唯一
func (c *cPost) CodeUnique(ctx context.Context, req *post.CodeUniqueReq) (*post.CodeUniqueRes, error) { func (c *cPost) CodeUnique(ctx context.Context, req *post.CodeUniqueReq) (res *post.CodeUniqueRes, err error) {
data, err := service.AdminPost().CodeUnique(ctx, adminin.PostCodeUniqueInp{Id: req.Id, Code: req.Code}) data, err := service.AdminPost().CodeUnique(ctx, adminin.PostCodeUniqueInp{Id: req.Id, Code: req.Code})
if err != nil { if err != nil {
return nil, err return nil, err
} }
var res post.CodeUniqueRes res = new(post.CodeUniqueRes)
res.IsUnique = data.IsUnique res.IsUnique = data.IsUnique
return &res, nil return
} }
// View 获取指定信息 // View 获取指定信息
func (c *cPost) View(ctx context.Context, req *post.ViewReq) (*post.ViewRes, error) { func (c *cPost) View(ctx context.Context, req *post.ViewReq) (res *post.ViewRes, err error) {
data, err := service.AdminPost().View(ctx, adminin.PostViewInp{Id: req.Id}) data, err := service.AdminPost().View(ctx, adminin.PostViewInp{Id: req.Id})
if err != nil { if err != nil {
return nil, err return
} }
var res post.ViewRes res = new(post.ViewRes)
res.PostViewModel = data res.PostViewModel = data
return &res, nil return
} }
// List 获取列表 // List 获取列表
func (c *cPost) List(ctx context.Context, req *post.ListReq) (*post.ListRes, error) { func (c *cPost) List(ctx context.Context, req *post.ListReq) (res *post.ListRes, err error) {
var in adminin.PostListInp var in adminin.PostListInp
if err := gconv.Scan(req, &in); err != nil { if err = gconv.Scan(req, &in); err != nil {
return nil, err return
}
//adminin.PostListInp{
// Page: req.Page,
// PerPage: req.PerPage,
// Name: req.Name,
// Code: req.Code,
// Status: req.Status,
//}
list, totalCount, err := service.AdminPost().List(ctx, in)
if err != nil {
return nil, err
} }
var res post.ListRes list, totalCount, err := service.AdminPost().List(ctx, in)
if err != nil {
return
}
res = new(post.ListRes)
res.List = list res.List = list
res.PageCount = form.CalPageCount(totalCount, req.PerPage) res.PageCount = form.CalPageCount(totalCount, req.PerPage)
res.Page = req.Page res.Page = req.Page
res.PerPage = req.PerPage res.PerPage = req.PerPage
return
return &res, nil
} }
// Status 更新状态 // Status 更新状态
func (c *cPost) Status(ctx context.Context, req *post.StatusReq) (res *post.StatusRes, err error) { func (c *cPost) Status(ctx context.Context, req *post.StatusReq) (res *post.StatusRes, err error) {
var in adminin.PostStatusInp var in adminin.PostStatusInp
if err = gconv.Scan(req, &in); err != nil { if err = gconv.Scan(req, &in); err != nil {
return nil, err return
}
if err = service.AdminPost().Status(ctx, in); err != nil {
return nil, err
} }
return res, nil err = service.AdminPost().Status(ctx, in)
return
} }

View File

@ -22,73 +22,61 @@ var (
type cRole struct{} type cRole struct{}
// RoleMemberList 获取角色下的会员列表 // RoleMemberList 获取角色下的用户列表
func (c *cRole) RoleMemberList(ctx context.Context, req *role.MemberListReq) (*role.MemberListRes, error) { func (c *cRole) RoleMemberList(ctx context.Context, req *role.MemberListReq) (res *role.MemberListRes, err error) {
var in adminin.RoleMemberListInp var in adminin.RoleMemberListInp
if err := gconv.Scan(req, &in); err != nil { if err = gconv.Scan(req, &in); err != nil {
return nil, err return
} }
list, totalCount, err := service.AdminMember().RoleMemberList(ctx, in) list, totalCount, err := service.AdminMember().RoleMemberList(ctx, in)
if err != nil { if err != nil {
return nil, err return
} }
var res role.MemberListRes res = new(role.MemberListRes)
res.List = list res.List = list
res.PageCount = form.CalPageCount(totalCount, req.PerPage) res.PageCount = form.CalPageCount(totalCount, req.PerPage)
res.PerPage = req.Page res.PerPage = req.Page
res.PerPage = req.PerPage res.PerPage = req.PerPage
return
return &res, nil
} }
// List 获取列表 // List 获取列表
func (c *cRole) List(ctx context.Context, req *role.ListReq) (*role.ListRes, error) { func (c *cRole) List(ctx context.Context, req *role.ListReq) (res *role.ListRes, err error) {
var in adminin.RoleListInp var in adminin.RoleListInp
if err := gconv.Scan(req, &in); err != nil { if err = gconv.Scan(req, &in); err != nil {
return nil, err return
}
list, totalCount, err := service.AdminRole().List(ctx, in)
if err != nil {
return nil, err
} }
var res role.ListRes list, totalCount, err := service.AdminRole().List(ctx, in)
if err != nil {
return
}
res = new(role.ListRes)
res.List = list res.List = list
res.PageCount = form.CalPageCount(totalCount, req.PerPage) res.PageCount = form.CalPageCount(totalCount, req.PerPage)
res.Page = req.Page res.Page = req.Page
res.PerPage = req.PerPage res.PerPage = req.PerPage
return
return &res, nil
} }
// Edit 修改角色 // Edit 修改角色
func (c *cRole) Edit(ctx context.Context, req *role.EditReq) (res *role.EditRes, err error) { func (c *cRole) Edit(ctx context.Context, req *role.EditReq) (res *role.EditRes, err error) {
err = service.AdminRole().Edit(ctx, req) err = service.AdminRole().Edit(ctx, req)
if err != nil { return
return nil, err
}
return res, nil
} }
// Delete 删除 // Delete 删除
func (c *cRole) Delete(ctx context.Context, req *role.DeleteReq) (res *role.DeleteRes, err error) { func (c *cRole) Delete(ctx context.Context, req *role.DeleteReq) (res *role.DeleteRes, err error) {
err = service.AdminRole().Delete(ctx, req)
if err = service.AdminRole().Delete(ctx, req); err != nil { return
return nil, err
}
return res, nil
} }
// Dynamic 动态路由 // Dynamic 动态路由
func (c *cRole) Dynamic(ctx context.Context, req *role.DynamicReq) (res role.DynamicRes, err error) { func (c *cRole) Dynamic(ctx context.Context, req *role.DynamicReq) (res role.DynamicRes, err error) {
return service.AdminMenu().GetMenuList(ctx, contexts.GetUserId(ctx))
res, err = service.AdminMenu().GetMenuList(ctx, contexts.GetUserId(ctx))
if err != nil {
return res, err
}
return res, nil
} }
// GetPermissions 获取指定角色权限 // GetPermissions 获取指定角色权限
@ -97,23 +85,21 @@ func (c *cRole) GetPermissions(ctx context.Context, req *role.GetPermissionsReq)
if err != nil { if err != nil {
return nil, err return nil, err
} }
res = &role.GetPermissionsRes{ res = &role.GetPermissionsRes{
MenuIds: []int64{}, MenuIds: []int64{},
} }
if MenuIds != nil { if MenuIds != nil {
res.MenuIds = MenuIds res.MenuIds = MenuIds
} }
return res, nil return res, nil
} }
// UpdatePermissions 修改角色菜单权限 // UpdatePermissions 修改角色菜单权限
func (c *cRole) UpdatePermissions(ctx context.Context, req *role.UpdatePermissionsReq) (res *role.UpdatePermissionsRes, err error) { func (c *cRole) UpdatePermissions(ctx context.Context, req *role.UpdatePermissionsReq) (res *role.UpdatePermissionsRes, err error) {
err = service.AdminRole().UpdatePermissions(ctx, req) err = service.AdminRole().UpdatePermissions(ctx, req)
if err != nil { return
return nil, err
}
return res, nil
} }
// DataScopeSelect 获取数据权限选项 // DataScopeSelect 获取数据权限选项
@ -121,21 +107,17 @@ func (c *cRole) DataScopeSelect(ctx context.Context, req *role.DataScopeSelectRe
data := service.AdminRole().DataScopeSelect(ctx) data := service.AdminRole().DataScopeSelect(ctx)
res = new(role.DataScopeSelectRes) res = new(role.DataScopeSelectRes)
res.List = data res.List = data
return res, nil return
} }
// DataScopeEdit 获取数据权限选项 // DataScopeEdit 获取数据权限选项
func (c *cRole) DataScopeEdit(ctx context.Context, req *role.DataScopeEditReq) (res *role.DataScopeEditRes, err error) { func (c *cRole) DataScopeEdit(ctx context.Context, req *role.DataScopeEditReq) (res *role.DataScopeEditRes, err error) {
var in adminin.DataScopeEditInp var in adminin.DataScopeEditInp
if err = gconv.Scan(req, &in); err != nil { if err = gconv.Scan(req, &in); err != nil {
return nil, err return
} }
in.CustomDept = req.CustomDept in.CustomDept = req.CustomDept
err = service.AdminRole().DataScopeEdit(ctx, &in) err = service.AdminRole().DataScopeEdit(ctx, &in)
if err != nil { return
return nil, err
}
return res, nil
} }

View File

@ -26,16 +26,16 @@ type cTest struct{}
func (c *cTest) List(ctx context.Context, req *test.ListReq) (res *test.ListRes, err error) { func (c *cTest) List(ctx context.Context, req *test.ListReq) (res *test.ListRes, err error) {
var in adminin.TestListInp var in adminin.TestListInp
if err = gconv.Scan(req, &in); err != nil { if err = gconv.Scan(req, &in); err != nil {
return nil, err return
} }
if err = validate.PreFilter(ctx, &in); err != nil { if err = validate.PreFilter(ctx, &in); err != nil {
return nil, err return
} }
list, totalCount, err := service.AdminTest().List(ctx, in) list, totalCount, err := service.AdminTest().List(ctx, in)
if err != nil { if err != nil {
return nil, err return
} }
res = new(test.ListRes) res = new(test.ListRes)
@ -43,102 +43,93 @@ func (c *cTest) List(ctx context.Context, req *test.ListReq) (res *test.ListRes,
res.PageCount = form.CalPageCount(totalCount, req.PerPage) res.PageCount = form.CalPageCount(totalCount, req.PerPage)
res.Page = req.Page res.Page = req.Page
res.PerPage = req.PerPage res.PerPage = req.PerPage
return res, nil return
} }
// Export 导出列表 // Export 导出列表
func (c *cTest) Export(ctx context.Context, req *test.ExportReq) (res *test.ExportRes, err error) { func (c *cTest) Export(ctx context.Context, req *test.ExportReq) (res *test.ExportRes, err error) {
var in adminin.TestListInp var in adminin.TestListInp
if err = gconv.Scan(req, &in); err != nil { if err = gconv.Scan(req, &in); err != nil {
return nil, err return
} }
if err = service.AdminTest().Export(ctx, in); err != nil {
return nil, err err = service.AdminTest().Export(ctx, in)
} return
return res, nil
} }
// Edit 更新 // Edit 更新
func (c *cTest) Edit(ctx context.Context, req *test.EditReq) (res *test.EditRes, err error) { func (c *cTest) Edit(ctx context.Context, req *test.EditReq) (res *test.EditRes, err error) {
var in adminin.TestEditInp var in adminin.TestEditInp
if err = gconv.Scan(req, &in); err != nil { if err = gconv.Scan(req, &in); err != nil {
return nil, err return
} }
if err = validate.PreFilter(ctx, &in); err != nil { if err = validate.PreFilter(ctx, &in); err != nil {
return nil, err return
} }
if err = service.AdminTest().Edit(ctx, in); err != nil {
return nil, err err = service.AdminTest().Edit(ctx, in)
} return
return res, nil
} }
// MaxSort 最大排序 // MaxSort 最大排序
func (c *cTest) MaxSort(ctx context.Context, req *test.MaxSortReq) (res *test.MaxSortRes, err error) { func (c *cTest) MaxSort(ctx context.Context, req *test.MaxSortReq) (res *test.MaxSortRes, err error) {
data, err := service.AdminTest().MaxSort(ctx, adminin.TestMaxSortInp{}) data, err := service.AdminTest().MaxSort(ctx, adminin.TestMaxSortInp{})
if err != nil { if err != nil {
return nil, err return
} }
res = new(test.MaxSortRes) res = new(test.MaxSortRes)
res.TestMaxSortModel = data res.TestMaxSortModel = data
return res, nil return
} }
// View 获取指定信息 // View 获取指定信息
func (c *cTest) View(ctx context.Context, req *test.ViewReq) (res *test.ViewRes, err error) { func (c *cTest) View(ctx context.Context, req *test.ViewReq) (res *test.ViewRes, err error) {
var in adminin.TestViewInp var in adminin.TestViewInp
if err = gconv.Scan(req, &in); err != nil { if err = gconv.Scan(req, &in); err != nil {
return nil, err return
} }
data, err := service.AdminTest().View(ctx, in) data, err := service.AdminTest().View(ctx, in)
if err != nil { if err != nil {
return nil, err return
} }
res = new(test.ViewRes) res = new(test.ViewRes)
res.TestViewModel = data res.TestViewModel = data
return res, nil return
} }
// Delete 删除 // Delete 删除
func (c *cTest) Delete(ctx context.Context, req *test.DeleteReq) (res *test.DeleteRes, err error) { func (c *cTest) Delete(ctx context.Context, req *test.DeleteReq) (res *test.DeleteRes, err error) {
var in adminin.TestDeleteInp var in adminin.TestDeleteInp
if err = gconv.Scan(req, &in); err != nil { if err = gconv.Scan(req, &in); err != nil {
return nil, err return
} }
if err = service.AdminTest().Delete(ctx, in); err != nil { err = service.AdminTest().Delete(ctx, in)
return nil, err return
}
return res, nil
} }
// Status 更新状态 // Status 更新状态
func (c *cTest) Status(ctx context.Context, req *test.StatusReq) (res *test.StatusRes, err error) { func (c *cTest) Status(ctx context.Context, req *test.StatusReq) (res *test.StatusRes, err error) {
var in adminin.TestStatusInp var in adminin.TestStatusInp
if err = gconv.Scan(req, &in); err != nil { if err = gconv.Scan(req, &in); err != nil {
return nil, err return
} }
if err = service.AdminTest().Status(ctx, in); err != nil { err = service.AdminTest().Status(ctx, in)
return nil, err return
}
return res, nil
} }
// Switch 更新开关状态 // Switch 更新开关状态
func (c *cTest) Switch(ctx context.Context, req *test.SwitchReq) (res *test.SwitchRes, err error) { func (c *cTest) Switch(ctx context.Context, req *test.SwitchReq) (res *test.SwitchRes, err error) {
var in adminin.TestSwitchInp var in adminin.TestSwitchInp
if err = gconv.Scan(req, &in); err != nil { if err = gconv.Scan(req, &in); err != nil {
return nil, err return
} }
if err = service.AdminTest().Switch(ctx, in); err != nil { err = service.AdminTest().Switch(ctx, in)
return nil, err return
}
return res, nil
} }

View File

@ -37,6 +37,5 @@ func (c *cConsole) Stat(ctx context.Context, req *common.ConsoleStatReq) (res *c
res.Volume.Rise = 40202 res.Volume.Rise = 40202
res.Volume.Decline = 45003 res.Volume.Decline = 45003
res.Volume.Amount = 49004 res.Volume.Amount = 49004
return return
} }

View File

@ -8,8 +8,13 @@ package common
import ( import (
"context" "context"
"github.com/gogf/gf/v2/errors/gerror"
"github.com/gogf/gf/v2/frame/g"
"hotgo/api/backend/common" "hotgo/api/backend/common"
"hotgo/internal/library/ems" "hotgo/internal/consts"
"hotgo/internal/library/contexts"
"hotgo/internal/model/entity"
"hotgo/internal/model/input/sysin"
"hotgo/internal/service" "hotgo/internal/service"
) )
@ -19,14 +24,56 @@ type cEms struct{}
// SendTest 发送测试邮件 // SendTest 发送测试邮件
func (c *cEms) SendTest(ctx context.Context, req *common.SendTestEmailReq) (res *common.SendTestEmailRes, err error) { func (c *cEms) SendTest(ctx context.Context, req *common.SendTestEmailReq) (res *common.SendTestEmailRes, err error) {
err = service.SysEmsLog().Send(ctx, sysin.SendEmsInp{
Event: consts.EmsTemplateText,
Email: req.To,
Content: `
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="iso-8859-15">
<title>这是一封来自HotGo的测试邮件</title>
</head>
<body>
这是您通过HotGo后台发送的测试邮件当你收到这封邮件的时候说明已经联调成功了恭喜你
</body>
</html>`,
})
return
}
conf, err := service.SysConfig().GetSmtp(ctx) // SendBindEms 发送换绑邮件
func (c *cSms) SendBindEms(ctx context.Context, req *common.SendBindEmsReq) (res *common.SendBindEmsRes, err error) {
var (
memberId = contexts.GetUserId(ctx)
models *entity.AdminMember
)
if memberId <= 0 {
err = gerror.New("用户身份异常,请重新登录!")
return
}
err = g.Model("admin_member").
Fields("email").
Where("id", memberId).
Scan(&models)
if err != nil { if err != nil {
return return
} }
if err = ems.SendTestMail(conf, req.To); err != nil { if models == nil {
return nil, err err = gerror.New("用户信息不存在")
return
} }
if models.Email == "" {
err = gerror.New("未绑定邮箱无需发送")
return
}
err = service.SysEmsLog().Send(ctx, sysin.SendEmsInp{
Event: consts.EmsTemplateBind,
Email: models.Email,
})
return return
} }

View File

@ -70,7 +70,7 @@ func (c *cSite) Captcha(ctx context.Context, req *common.LoginCaptchaReq) (res *
func (c *cSite) Login(ctx context.Context, req *common.LoginReq) (res *common.LoginRes, err error) { func (c *cSite) Login(ctx context.Context, req *common.LoginReq) (res *common.LoginRes, err error) {
var in adminin.MemberLoginInp var in adminin.MemberLoginInp
if err = gconv.Scan(req, &in); err != nil { if err = gconv.Scan(req, &in); err != nil {
return nil, err return
} }
defer func() { defer func() {
@ -89,33 +89,23 @@ func (c *cSite) Login(ctx context.Context, req *common.LoginReq) (res *common.Lo
model, err := service.AdminMember().Login(ctx, in) model, err := service.AdminMember().Login(ctx, in)
if err != nil { if err != nil {
return nil, err return
} }
if err = gconv.Scan(model, &res); err != nil { err = gconv.Scan(model, &res)
return nil, err
}
return return
} }
// Logout 注销登录 // Logout 注销登录
func (c *cSite) Logout(ctx context.Context, req *common.LoginLogoutReq) (res *common.LoginLogoutRes, err error) { func (c *cSite) Logout(ctx context.Context, req *common.LoginLogoutReq) (res *common.LoginLogoutRes, err error) {
token := consts.RedisJwtToken + gmd5.MustEncryptString(jwt.GetAuthorization(ghttp.RequestFromCtx(ctx)))
var authorization = jwt.GetAuthorization(ghttp.RequestFromCtx(ctx)) if len(token) == 0 {
// 获取jwtToken
jwtToken := consts.RedisJwtToken + gmd5.MustEncryptString(authorization)
if len(jwtToken) == 0 {
err = gerror.New("当前用户未登录!") err = gerror.New("当前用户未登录!")
return res, err return res, err
} }
// 删除登录token // 删除登录token
ca := cache.New() ca := cache.New()
_, err = ca.Remove(ctx, jwtToken) _, err = ca.Remove(ctx, token)
if err != nil {
return res, err
}
return return
} }

View File

@ -8,8 +8,13 @@ package common
import ( import (
"context" "context"
"github.com/gogf/gf/v2/errors/gerror"
"github.com/gogf/gf/v2/frame/g"
"github.com/gogf/gf/v2/util/gconv" "github.com/gogf/gf/v2/util/gconv"
"hotgo/api/backend/common" "hotgo/api/backend/common"
"hotgo/internal/consts"
"hotgo/internal/library/contexts"
"hotgo/internal/model/entity"
"hotgo/internal/model/input/sysin" "hotgo/internal/model/input/sysin"
"hotgo/internal/service" "hotgo/internal/service"
"hotgo/utility/validate" "hotgo/utility/validate"
@ -23,15 +28,50 @@ type cSms struct{}
func (c *cSms) SendTest(ctx context.Context, req *common.SendTestSmsReq) (res *common.SendTestSmsRes, err error) { func (c *cSms) SendTest(ctx context.Context, req *common.SendTestSmsReq) (res *common.SendTestSmsRes, err error) {
var in sysin.SendCodeInp var in sysin.SendCodeInp
if err = gconv.Scan(req, &in); err != nil { if err = gconv.Scan(req, &in); err != nil {
return nil, err return
} }
if err = validate.PreFilter(ctx, &in); err != nil { if err = validate.PreFilter(ctx, &in); err != nil {
return nil, err return
} }
if err = service.SysSmsLog().SendCode(ctx, in); err != nil { err = service.SysSmsLog().SendCode(ctx, in)
return nil, err return
} }
// SendBindSms 发送换绑短信
func (c *cSms) SendBindSms(ctx context.Context, req *common.SendBindSmsReq) (res *common.SendBindSmsRes, err error) {
var (
memberId = contexts.GetUserId(ctx)
models *entity.AdminMember
)
if memberId <= 0 {
err = gerror.New("用户身份异常,请重新登录!")
return
}
err = g.Model("admin_member").
Fields("mobile").
Where("id", memberId).
Scan(&models)
if err != nil {
return
}
if models == nil {
err = gerror.New("用户信息不存在")
return
}
if models.Mobile == "" {
err = gerror.New("未绑定手机号无需发送")
return
}
err = service.SysSmsLog().SendCode(ctx, sysin.SendCodeInp{
Event: consts.SmsTemplateBind,
Mobile: models.Mobile,
})
return return
} }

View File

@ -20,34 +20,22 @@ type cUpload struct{}
// UploadImage 上传图片 // UploadImage 上传图片
func (c *cUpload) UploadImage(ctx context.Context, req *common.UploadImageReq) (res common.UploadImageRes, err error) { func (c *cUpload) UploadImage(ctx context.Context, req *common.UploadImageReq) (res common.UploadImageRes, err error) {
r := g.RequestFromCtx(ctx) file := g.RequestFromCtx(ctx).GetUploadFile("file")
file := r.GetUploadFile("file")
if file == nil { if file == nil {
err = gerror.New("没有找到上传的文件") err = gerror.New("没有找到上传的文件")
return return
} }
res, err = service.CommonUpload().UploadImage(ctx, file) return service.CommonUpload().UploadImage(ctx, file)
if err != nil {
return
}
return
} }
// UploadFile 上传附件 // UploadFile 上传附件
func (c *cUpload) UploadFile(ctx context.Context, req *common.UploadFileReq) (res common.UploadFileRes, err error) { func (c *cUpload) UploadFile(ctx context.Context, req *common.UploadFileReq) (res common.UploadFileRes, err error) {
r := g.RequestFromCtx(ctx) file := g.RequestFromCtx(ctx).GetUploadFile("file")
file := r.GetUploadFile("file")
if file == nil { if file == nil {
err = gerror.New("没有找到上传的文件") err = gerror.New("没有找到上传的文件")
return return
} }
res, err = service.CommonUpload().UploadFile(ctx, file) return service.CommonUpload().UploadFile(ctx, file)
if err != nil {
return
}
return
} }

View File

@ -25,89 +25,75 @@ type cAttachment struct{}
func (c *cAttachment) Delete(ctx context.Context, req *attachment.DeleteReq) (res *attachment.DeleteRes, err error) { func (c *cAttachment) Delete(ctx context.Context, req *attachment.DeleteReq) (res *attachment.DeleteRes, err error) {
var in sysin.AttachmentDeleteInp var in sysin.AttachmentDeleteInp
if err = gconv.Scan(req, &in); err != nil { if err = gconv.Scan(req, &in); err != nil {
return nil, err return
} }
if err = service.SysAttachment().Delete(ctx, in); err != nil {
return nil, err err = service.SysAttachment().Delete(ctx, in)
} return
return res, nil
} }
// Edit 更新 // Edit 更新
func (c *cAttachment) Edit(ctx context.Context, req *attachment.EditReq) (res *attachment.EditRes, err error) { func (c *cAttachment) Edit(ctx context.Context, req *attachment.EditReq) (res *attachment.EditRes, err error) {
var in sysin.AttachmentEditInp var in sysin.AttachmentEditInp
if err = gconv.Scan(req, &in); err != nil { if err = gconv.Scan(req, &in); err != nil {
return nil, err return
}
if err = service.SysAttachment().Edit(ctx, in); err != nil {
return nil, err
} }
return res, nil err = service.SysAttachment().Edit(ctx, in)
return
} }
// MaxSort 最大排序 // MaxSort 最大排序
func (c *cAttachment) MaxSort(ctx context.Context, req *attachment.MaxSortReq) (*attachment.MaxSortRes, error) { func (c *cAttachment) MaxSort(ctx context.Context, req *attachment.MaxSortReq) (res *attachment.MaxSortRes, err error) {
data, err := service.SysAttachment().MaxSort(ctx, sysin.AttachmentMaxSortInp{Id: req.Id}) data, err := service.SysAttachment().MaxSort(ctx, sysin.AttachmentMaxSortInp{Id: req.Id})
if err != nil { if err != nil {
return nil, err return
} }
var res attachment.MaxSortRes res = new(attachment.MaxSortRes)
res.Sort = data.Sort res.Sort = data.Sort
return &res, nil return
} }
// View 获取指定信息 // View 获取指定信息
func (c *cAttachment) View(ctx context.Context, req *attachment.ViewReq) (*attachment.ViewRes, error) { func (c *cAttachment) View(ctx context.Context, req *attachment.ViewReq) (res *attachment.ViewRes, err error) {
data, err := service.SysAttachment().View(ctx, sysin.AttachmentViewInp{Id: req.Id}) data, err := service.SysAttachment().View(ctx, sysin.AttachmentViewInp{Id: req.Id})
if err != nil { if err != nil {
return nil, err return
} }
var res attachment.ViewRes res = new(attachment.ViewRes)
res.AttachmentViewModel = data res.AttachmentViewModel = data
return &res, nil return
} }
// List 查看列表 // List 查看列表
func (c *cAttachment) List(ctx context.Context, req *attachment.ListReq) (*attachment.ListRes, error) { func (c *cAttachment) List(ctx context.Context, req *attachment.ListReq) (res *attachment.ListRes, err error) {
var in sysin.AttachmentListInp
var ( if err = gconv.Scan(req, &in); err != nil {
in sysin.AttachmentListInp return
res attachment.ListRes
)
if err := gconv.Scan(req, &in); err != nil {
return nil, err
} }
list, totalCount, err := service.SysAttachment().List(ctx, in) list, totalCount, err := service.SysAttachment().List(ctx, in)
if err != nil { if err != nil {
return nil, err return
} }
res = new(attachment.ListRes)
res.List = list res.List = list
res.PageCount = form.CalPageCount(totalCount, req.PerPage) res.PageCount = form.CalPageCount(totalCount, req.PerPage)
res.Page = req.Page res.Page = req.Page
res.PerPage = req.PerPage res.PerPage = req.PerPage
return
return &res, nil
} }
// Status 更新部门状态 // Status 更新部门状态
func (c *cAttachment) Status(ctx context.Context, req *attachment.StatusReq) (res *attachment.StatusRes, err error) { func (c *cAttachment) Status(ctx context.Context, req *attachment.StatusReq) (res *attachment.StatusRes, err error) {
var in sysin.AttachmentStatusInp var in sysin.AttachmentStatusInp
if err = gconv.Scan(req, &in); err != nil { if err = gconv.Scan(req, &in); err != nil {
return nil, err return
}
if err = service.SysAttachment().Status(ctx, in); err != nil {
return nil, err
} }
return res, nil err = service.SysAttachment().Status(ctx, in)
return
} }

View File

@ -25,89 +25,75 @@ type cBlacklist struct{}
func (c *cBlacklist) Delete(ctx context.Context, req *blacklist.DeleteReq) (res *blacklist.DeleteRes, err error) { func (c *cBlacklist) Delete(ctx context.Context, req *blacklist.DeleteReq) (res *blacklist.DeleteRes, err error) {
var in sysin.BlacklistDeleteInp var in sysin.BlacklistDeleteInp
if err = gconv.Scan(req, &in); err != nil { if err = gconv.Scan(req, &in); err != nil {
return nil, err return
} }
if err = service.SysBlacklist().Delete(ctx, in); err != nil {
return nil, err err = service.SysBlacklist().Delete(ctx, in)
} return
return res, nil
} }
// Edit 更新 // Edit 更新
func (c *cBlacklist) Edit(ctx context.Context, req *blacklist.EditReq) (res *blacklist.EditRes, err error) { func (c *cBlacklist) Edit(ctx context.Context, req *blacklist.EditReq) (res *blacklist.EditRes, err error) {
var in sysin.BlacklistEditInp var in sysin.BlacklistEditInp
if err = gconv.Scan(req, &in); err != nil { if err = gconv.Scan(req, &in); err != nil {
return nil, err return
}
if err = service.SysBlacklist().Edit(ctx, in); err != nil {
return nil, err
} }
return res, nil err = service.SysBlacklist().Edit(ctx, in)
return
} }
// MaxSort 最大排序 // MaxSort 最大排序
func (c *cBlacklist) MaxSort(ctx context.Context, req *blacklist.MaxSortReq) (*blacklist.MaxSortRes, error) { func (c *cBlacklist) MaxSort(ctx context.Context, req *blacklist.MaxSortReq) (res *blacklist.MaxSortRes, err error) {
data, err := service.SysBlacklist().MaxSort(ctx, sysin.BlacklistMaxSortInp{Id: req.Id}) data, err := service.SysBlacklist().MaxSort(ctx, sysin.BlacklistMaxSortInp{Id: req.Id})
if err != nil { if err != nil {
return nil, err return
} }
var res blacklist.MaxSortRes res = new(blacklist.MaxSortRes)
res.Sort = data.Sort res.Sort = data.Sort
return &res, nil return
} }
// View 获取指定信息 // View 获取指定信息
func (c *cBlacklist) View(ctx context.Context, req *blacklist.ViewReq) (*blacklist.ViewRes, error) { func (c *cBlacklist) View(ctx context.Context, req *blacklist.ViewReq) (res *blacklist.ViewRes, err error) {
data, err := service.SysBlacklist().View(ctx, sysin.BlacklistViewInp{Id: req.Id}) data, err := service.SysBlacklist().View(ctx, sysin.BlacklistViewInp{Id: req.Id})
if err != nil { if err != nil {
return nil, err return
} }
var res blacklist.ViewRes res = new(blacklist.ViewRes)
res.BlacklistViewModel = data res.BlacklistViewModel = data
return &res, nil return
} }
// List 查看列表 // List 查看列表
func (c *cBlacklist) List(ctx context.Context, req *blacklist.ListReq) (*blacklist.ListRes, error) { func (c *cBlacklist) List(ctx context.Context, req *blacklist.ListReq) (res *blacklist.ListRes, err error) {
var in sysin.BlacklistListInp
var ( if err = gconv.Scan(req, &in); err != nil {
in sysin.BlacklistListInp return
res blacklist.ListRes
)
if err := gconv.Scan(req, &in); err != nil {
return nil, err
} }
list, totalCount, err := service.SysBlacklist().List(ctx, in) list, totalCount, err := service.SysBlacklist().List(ctx, in)
if err != nil { if err != nil {
return nil, err return
} }
res = new(blacklist.ListRes)
res.List = list res.List = list
res.PageCount = form.CalPageCount(totalCount, req.PerPage) res.PageCount = form.CalPageCount(totalCount, req.PerPage)
res.Page = req.Page res.Page = req.Page
res.PerPage = req.PerPage res.PerPage = req.PerPage
return
return &res, nil
} }
// Status 更新部门状态 // Status 更新部门状态
func (c *cBlacklist) Status(ctx context.Context, req *blacklist.StatusReq) (res *blacklist.StatusRes, err error) { func (c *cBlacklist) Status(ctx context.Context, req *blacklist.StatusReq) (res *blacklist.StatusRes, err error) {
var in sysin.BlacklistStatusInp var in sysin.BlacklistStatusInp
if err = gconv.Scan(req, &in); err != nil { if err = gconv.Scan(req, &in); err != nil {
return nil, err return
}
if err = service.SysBlacklist().Status(ctx, in); err != nil {
return nil, err
} }
return res, nil err = service.SysBlacklist().Status(ctx, in)
return
} }

View File

@ -23,39 +23,26 @@ var (
type cConfig struct{} type cConfig struct{}
// GetConfig 获取指定分组的配置 // GetConfig 获取指定分组的配置
func (c *cConfig) GetConfig(ctx context.Context, req *config.GetReq) (*config.GetRes, error) { func (c *cConfig) GetConfig(ctx context.Context, req *config.GetReq) (res *config.GetRes, err error) {
var ( var in sysin.GetConfigInp
in sysin.GetConfigInp
res config.GetRes
err error
)
if err = gconv.Scan(req, &in); err != nil { if err = gconv.Scan(req, &in); err != nil {
return nil, err return
}
res.GetConfigModel, err = service.SysConfig().GetConfigByGroup(ctx, in)
if err != nil {
return nil, err
} }
return &res, nil res = new(config.GetRes)
res.GetConfigModel, err = service.SysConfig().GetConfigByGroup(ctx, in)
return
} }
// UpdateConfig 更新指定分组的配置 // UpdateConfig 更新指定分组的配置
func (c *cConfig) UpdateConfig(ctx context.Context, req *config.UpdateReq) (*config.UpdateRes, error) { func (c *cConfig) UpdateConfig(ctx context.Context, req *config.UpdateReq) (res *config.UpdateRes, err error) {
var ( var in sysin.UpdateConfigInp
in sysin.UpdateConfigInp
res config.UpdateRes
err error
)
if err = gconv.Scan(req, &in); err != nil { if err = gconv.Scan(req, &in); err != nil {
return nil, err return
} }
if err = service.SysConfig().UpdateConfigByGroup(ctx, in); err != nil { err = service.SysConfig().UpdateConfigByGroup(ctx, in)
return nil, err return
}
return &res, nil
} }
// TypeSelect 数据类型选项 // TypeSelect 数据类型选项

View File

@ -26,91 +26,77 @@ type cCron struct{}
func (c *cCron) Delete(ctx context.Context, req *cron.DeleteReq) (res *cron.DeleteRes, err error) { func (c *cCron) Delete(ctx context.Context, req *cron.DeleteReq) (res *cron.DeleteRes, err error) {
var in sysin.CronDeleteInp var in sysin.CronDeleteInp
if err = gconv.Scan(req, &in); err != nil { if err = gconv.Scan(req, &in); err != nil {
return nil, err return
} }
if err = service.SysCron().Delete(ctx, in); err != nil {
return nil, err err = service.SysCron().Delete(ctx, in)
} return
return res, nil
} }
// Edit 更新 // Edit 更新
func (c *cCron) Edit(ctx context.Context, req *cron.EditReq) (res *cron.EditRes, err error) { func (c *cCron) Edit(ctx context.Context, req *cron.EditReq) (res *cron.EditRes, err error) {
var in sysin.CronEditInp var in sysin.CronEditInp
if err = gconv.Scan(req, &in); err != nil { if err = gconv.Scan(req, &in); err != nil {
return nil, err return
}
if err = service.SysCron().Edit(ctx, in); err != nil {
return nil, err
} }
return res, nil err = service.SysCron().Edit(ctx, in)
return
} }
// MaxSort 最大排序 // MaxSort 最大排序
func (c *cCron) MaxSort(ctx context.Context, req *cron.MaxSortReq) (*cron.MaxSortRes, error) { func (c *cCron) MaxSort(ctx context.Context, req *cron.MaxSortReq) (res *cron.MaxSortRes, err error) {
data, err := service.SysCron().MaxSort(ctx, sysin.CronMaxSortInp{Id: req.Id}) data, err := service.SysCron().MaxSort(ctx, sysin.CronMaxSortInp{Id: req.Id})
if err != nil { if err != nil {
return nil, err return
} }
var res cron.MaxSortRes res = new(cron.MaxSortRes)
res.Sort = data.Sort res.Sort = data.Sort
return &res, nil return
} }
// View 获取指定信息 // View 获取指定信息
func (c *cCron) View(ctx context.Context, req *cron.ViewReq) (*cron.ViewRes, error) { func (c *cCron) View(ctx context.Context, req *cron.ViewReq) (res *cron.ViewRes, err error) {
data, err := service.SysCron().View(ctx, sysin.CronViewInp{Id: req.Id}) data, err := service.SysCron().View(ctx, sysin.CronViewInp{Id: req.Id})
if err != nil { if err != nil {
return nil, err return
} }
var res cron.ViewRes res = new(cron.ViewRes)
res.CronViewModel = data res.CronViewModel = data
return &res, nil return
} }
// List 查看列表 // List 查看列表
func (c *cCron) List(ctx context.Context, req *cron.ListReq) (*cron.ListRes, error) { func (c *cCron) List(ctx context.Context, req *cron.ListReq) (res *cron.ListRes, err error) {
var in sysin.CronListInp
var ( if err = gconv.Scan(req, &in); err != nil {
in sysin.CronListInp return
res cron.ListRes
)
if err := gconv.Scan(req, &in); err != nil {
return nil, err
} }
list, totalCount, err := service.SysCron().List(ctx, in) list, totalCount, err := service.SysCron().List(ctx, in)
if err != nil { if err != nil {
return nil, err return
} }
res = new(cron.ListRes)
res.List = list res.List = list
res.PageCount = form.CalPageCount(totalCount, req.PerPage) res.PageCount = form.CalPageCount(totalCount, req.PerPage)
res.Page = req.Page res.Page = req.Page
res.PerPage = req.PerPage res.PerPage = req.PerPage
return
return &res, nil
} }
// Status 更新部门状态 // Status 更新部门状态
func (c *cCron) Status(ctx context.Context, req *cron.StatusReq) (res *cron.StatusRes, err error) { func (c *cCron) Status(ctx context.Context, req *cron.StatusReq) (res *cron.StatusRes, err error) {
var in sysin.CronStatusInp var in sysin.CronStatusInp
if err = gconv.Scan(req, &in); err != nil { if err = gconv.Scan(req, &in); err != nil {
return nil, err return
}
if err = service.SysCron().Status(ctx, in); err != nil {
return nil, err
} }
return res, nil err = service.SysCron().Status(ctx, in)
return
} }
// OnlineExec 在线执行 // OnlineExec 在线执行
@ -121,7 +107,7 @@ func (c *cCron) OnlineExec(ctx context.Context, req *cron.OnlineExecReq) (res *c
var in sysin.OnlineExecInp var in sysin.OnlineExecInp
if err = gconv.Scan(req, &in); err != nil { if err = gconv.Scan(req, &in); err != nil {
return nil, err return
} }
return res, service.SysCron().OnlineExec(ctx, in) return res, service.SysCron().OnlineExec(ctx, in)

View File

@ -25,90 +25,76 @@ type cCronGroup struct{}
func (c *cCronGroup) Delete(ctx context.Context, req *cron.GroupDeleteReq) (res *cron.GroupDeleteRes, err error) { func (c *cCronGroup) Delete(ctx context.Context, req *cron.GroupDeleteReq) (res *cron.GroupDeleteRes, err error) {
var in sysin.CronGroupDeleteInp var in sysin.CronGroupDeleteInp
if err = gconv.Scan(req, &in); err != nil { if err = gconv.Scan(req, &in); err != nil {
return nil, err return
} }
if err = service.SysCronGroup().Delete(ctx, in); err != nil {
return nil, err err = service.SysCronGroup().Delete(ctx, in)
} return
return res, nil
} }
// Edit 更新 // Edit 更新
func (c *cCronGroup) Edit(ctx context.Context, req *cron.GroupEditReq) (res *cron.GroupEditRes, err error) { func (c *cCronGroup) Edit(ctx context.Context, req *cron.GroupEditReq) (res *cron.GroupEditRes, err error) {
var in sysin.CronGroupEditInp var in sysin.CronGroupEditInp
if err = gconv.Scan(req, &in); err != nil { if err = gconv.Scan(req, &in); err != nil {
return nil, err return
}
if err = service.SysCronGroup().Edit(ctx, in); err != nil {
return nil, err
} }
err = service.SysCronGroup().Edit(ctx, in)
return res, nil return res, nil
} }
// MaxSort 最大排序 // MaxSort 最大排序
func (c *cCronGroup) MaxSort(ctx context.Context, req *cron.GroupMaxSortReq) (*cron.GroupMaxSortRes, error) { func (c *cCronGroup) MaxSort(ctx context.Context, req *cron.GroupMaxSortReq) (res *cron.GroupMaxSortRes, err error) {
data, err := service.SysCronGroup().MaxSort(ctx, sysin.CronGroupMaxSortInp{Id: req.Id}) data, err := service.SysCronGroup().MaxSort(ctx, sysin.CronGroupMaxSortInp{Id: req.Id})
if err != nil { if err != nil {
return nil, err return
} }
var res cron.GroupMaxSortRes res = new(cron.GroupMaxSortRes)
res.Sort = data.Sort res.Sort = data.Sort
return &res, nil return
} }
// View 获取指定信息 // View 获取指定信息
func (c *cCronGroup) View(ctx context.Context, req *cron.GroupViewReq) (*cron.GroupViewRes, error) { func (c *cCronGroup) View(ctx context.Context, req *cron.GroupViewReq) (res *cron.GroupViewRes, err error) {
data, err := service.SysCronGroup().View(ctx, sysin.CronGroupViewInp{Id: req.Id}) data, err := service.SysCronGroup().View(ctx, sysin.CronGroupViewInp{Id: req.Id})
if err != nil { if err != nil {
return nil, err return
} }
var res cron.GroupViewRes res = new(cron.GroupViewRes)
res.CronGroupViewModel = data res.CronGroupViewModel = data
return &res, nil return
} }
// List 查看列表 // List 查看列表
func (c *cCronGroup) List(ctx context.Context, req *cron.GroupListReq) (*cron.GroupListRes, error) { func (c *cCronGroup) List(ctx context.Context, req *cron.GroupListReq) (res *cron.GroupListRes, err error) {
var in sysin.CronGroupListInp
var ( if err = gconv.Scan(req, &in); err != nil {
in sysin.CronGroupListInp return
res cron.GroupListRes
)
if err := gconv.Scan(req, &in); err != nil {
return nil, err
} }
list, totalCount, err := service.SysCronGroup().List(ctx, in) list, totalCount, err := service.SysCronGroup().List(ctx, in)
if err != nil { if err != nil {
return nil, err return
} }
res = new(cron.GroupListRes)
res.List = list res.List = list
res.PageCount = form.CalPageCount(totalCount, req.PerPage) res.PageCount = form.CalPageCount(totalCount, req.PerPage)
res.Page = req.Page res.Page = req.Page
res.PerPage = req.PerPage res.PerPage = req.PerPage
return
return &res, nil
} }
// Status 更新部门状态 // Status 更新状态
func (c *cCronGroup) Status(ctx context.Context, req *cron.GroupStatusReq) (res *cron.GroupStatusRes, err error) { func (c *cCronGroup) Status(ctx context.Context, req *cron.GroupStatusReq) (res *cron.GroupStatusRes, err error) {
var in sysin.CronGroupStatusInp var in sysin.CronGroupStatusInp
if err = gconv.Scan(req, &in); err != nil { if err = gconv.Scan(req, &in); err != nil {
return nil, err return
}
if err = service.SysCronGroup().Status(ctx, in); err != nil {
return nil, err
} }
err = service.SysCronGroup().Status(ctx, in)
return res, nil return res, nil
} }
@ -116,9 +102,9 @@ func (c *cCronGroup) Status(ctx context.Context, req *cron.GroupStatusReq) (res
func (c *cCronGroup) Select(ctx context.Context, req *cron.GroupSelectReq) (res *cron.GroupSelectRes, err error) { func (c *cCronGroup) Select(ctx context.Context, req *cron.GroupSelectReq) (res *cron.GroupSelectRes, err error) {
list, err := service.SysCronGroup().Select(ctx, sysin.CronGroupSelectInp{}) list, err := service.SysCronGroup().Select(ctx, sysin.CronGroupSelectInp{})
if err != nil { if err != nil {
return nil, err return
} }
res = (*cron.GroupSelectRes)(&list)
return res, nil res = (*cron.GroupSelectRes)(&list)
return
} }

View File

@ -3,8 +3,8 @@
// @Copyright Copyright (c) 2023 HotGo CLI // @Copyright Copyright (c) 2023 HotGo CLI
// @Author Ms <133814250@qq.com> // @Author Ms <133814250@qq.com>
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE // @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
// @AutoGenerate Version 2.1.0 // @AutoGenerate Version 2.1.2
// @AutoGenerate Date 2023-01-18 15:19:42 // @AutoGenerate Date 2023-02-08 17:47:32
// //
package sys package sys
@ -164,6 +164,5 @@ func (c *cCurdDemo) Switch(ctx context.Context, req *curddemo.SwitchReq) (res *c
if err = service.SysCurdDemo().Switch(ctx, in); err != nil { if err = service.SysCurdDemo().Switch(ctx, in); err != nil {
return nil, err return nil, err
} }
return res, nil return res, nil
} }

View File

@ -25,75 +25,63 @@ type cDictData struct{}
func (c *cDictData) Delete(ctx context.Context, req *dict.DataDeleteReq) (res *dict.DataDeleteRes, err error) { func (c *cDictData) Delete(ctx context.Context, req *dict.DataDeleteReq) (res *dict.DataDeleteRes, err error) {
var in sysin.DictDataDeleteInp var in sysin.DictDataDeleteInp
if err = gconv.Scan(req, &in); err != nil { if err = gconv.Scan(req, &in); err != nil {
return nil, err return
} }
if err = service.SysDictData().Delete(ctx, in); err != nil {
return nil, err err = service.SysDictData().Delete(ctx, in)
} return
return res, nil
} }
// Edit 更新 // Edit 更新
func (c *cDictData) Edit(ctx context.Context, req *dict.DataEditReq) (res *dict.DataEditRes, err error) { func (c *cDictData) Edit(ctx context.Context, req *dict.DataEditReq) (res *dict.DataEditRes, err error) {
var in sysin.DictDataEditInp var in sysin.DictDataEditInp
if err = gconv.Scan(req, &in); err != nil { if err = gconv.Scan(req, &in); err != nil {
return nil, err return
}
if err = service.SysDictData().Edit(ctx, in); err != nil {
return nil, err
} }
return res, nil err = service.SysDictData().Edit(ctx, in)
return
} }
// List 查看列表 // List 查看列表
func (c *cDictData) List(ctx context.Context, req *dict.DataListReq) (*dict.DataListRes, error) { func (c *cDictData) List(ctx context.Context, req *dict.DataListReq) (res *dict.DataListRes, err error) {
var ( var in sysin.DictDataListInp
in sysin.DictDataListInp if err = gconv.Scan(req, &in); err != nil {
res dict.DataListRes return
)
if err := gconv.Scan(req, &in); err != nil {
return nil, err
} }
list, totalCount, err := service.SysDictData().List(ctx, in) list, totalCount, err := service.SysDictData().List(ctx, in)
if err != nil { if err != nil {
return nil, err return
} }
res = new(dict.DataListRes)
res.List = list res.List = list
res.PageCount = form.CalPageCount(totalCount, req.PerPage) res.PageCount = form.CalPageCount(totalCount, req.PerPage)
res.Page = req.Page res.Page = req.Page
res.PerPage = req.PerPage res.PerPage = req.PerPage
return
return &res, nil
} }
// Select 指定选项 // Select 指定选项
func (c *cDictData) Select(ctx context.Context, req *dict.DataSelectReq) (*dict.DataSelectRes, error) { func (c *cDictData) Select(ctx context.Context, req *dict.DataSelectReq) (res dict.DataSelectRes, err error) {
var ( var in sysin.DataSelectInp
in sysin.DataSelectInp if err = gconv.Scan(req, &in); err != nil {
res dict.DataSelectRes return
)
if err := gconv.Scan(req, &in); err != nil {
return nil, err
} }
list, err := service.SysDictData().Select(ctx, in) list, err := service.SysDictData().Select(ctx, in)
if err != nil { if err != nil {
return nil, err return
} }
res = dict.DataSelectRes(list) res = dict.DataSelectRes(list)
return &res, nil return
} }
// Selects 多个选项 // Selects 多个选项
func (c *cDictData) Selects(ctx context.Context, req *dict.DataSelectsReq) (*dict.DataSelectsRes, error) { func (c *cDictData) Selects(ctx context.Context, req *dict.DataSelectsReq) (res dict.DataSelectsRes, err error) {
res := make(dict.DataSelectsRes) res = make(dict.DataSelectsRes)
for _, v := range req.Types { for _, v := range req.Types {
option, err := service.SysDictData().Select(ctx, sysin.DataSelectInp{Type: v}) option, err := service.SysDictData().Select(ctx, sysin.DataSelectInp{Type: v})
if err != nil { if err != nil {
@ -102,5 +90,5 @@ func (c *cDictData) Selects(ctx context.Context, req *dict.DataSelectsReq) (*dic
res[v] = option res[v] = option
} }
return &res, nil return
} }

View File

@ -21,52 +21,41 @@ var (
type cDictType struct{} type cDictType struct{}
// Tree 树 // Tree 树
func (c *cDictType) Tree(ctx context.Context, req *dict.TypeTreeReq) (*dict.TypeTreeRes, error) { func (c *cDictType) Tree(ctx context.Context, req *dict.TypeTreeReq) (res *dict.TypeTreeRes, err error) {
var ( res = new(dict.TypeTreeRes)
res dict.TypeTreeRes
err error
)
res.List, err = service.SysDictType().Tree(ctx) res.List, err = service.SysDictType().Tree(ctx)
if err != nil { return
return nil, err
}
return &res, nil
} }
// Delete 删除 // Delete 删除
func (c *cDictType) Delete(ctx context.Context, req *dict.TypeDeleteReq) (res *dict.TypeDeleteRes, err error) { func (c *cDictType) Delete(ctx context.Context, req *dict.TypeDeleteReq) (res *dict.TypeDeleteRes, err error) {
var in sysin.DictTypeDeleteInp var in sysin.DictTypeDeleteInp
if err = gconv.Scan(req, &in); err != nil { if err = gconv.Scan(req, &in); err != nil {
return nil, err return
} }
if err = service.SysDictType().Delete(ctx, in); err != nil {
return nil, err err = service.SysDictType().Delete(ctx, in)
} return
return res, nil
} }
// Edit 更新 // Edit 更新
func (c *cDictType) Edit(ctx context.Context, req *dict.TypeEditReq) (res *dict.TypeEditRes, err error) { func (c *cDictType) Edit(ctx context.Context, req *dict.TypeEditReq) (res *dict.TypeEditRes, err error) {
var in sysin.DictTypeEditInp var in sysin.DictTypeEditInp
if err = gconv.Scan(req, &in); err != nil { if err = gconv.Scan(req, &in); err != nil {
return nil, err return
}
if err = service.SysDictType().Edit(ctx, in); err != nil {
return nil, err
} }
return res, nil err = service.SysDictType().Edit(ctx, in)
return
} }
// Select 选项 // Select 选项
func (c *cDictType) Select(ctx context.Context, req *dict.TypeSelectReq) (res *dict.TypeSelectRes, err error) { func (c *cDictType) Select(ctx context.Context, req *dict.TypeSelectReq) (res *dict.TypeSelectRes, err error) {
list, err := service.SysDictType().Select(ctx, sysin.DictTypeSelectInp{}) list, err := service.SysDictType().Select(ctx, sysin.DictTypeSelectInp{})
if err != nil { if err != nil {
return nil, err return
} }
res = (*dict.TypeSelectRes)(&list)
return res, nil res = (*dict.TypeSelectRes)(&list)
return
} }

View File

@ -0,0 +1,87 @@
// Package sys
// @Link https://github.com/bufanyun/hotgo
// @Copyright Copyright (c) 2022 HotGo CLI
// @Author Ms <133814250@qq.com>
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
//
package sys
import (
"context"
"github.com/gogf/gf/v2/util/gconv"
"hotgo/api/backend/emslog"
"hotgo/internal/model/input/form"
"hotgo/internal/model/input/sysin"
"hotgo/internal/service"
)
var (
EmsLog = cEmsLog{}
)
type cEmsLog struct{}
// Delete 删除
func (c *cEmsLog) Delete(ctx context.Context, req *emslog.DeleteReq) (res *emslog.DeleteRes, err error) {
var in sysin.EmsLogDeleteInp
if err = gconv.Scan(req, &in); err != nil {
return
}
err = service.SysEmsLog().Delete(ctx, in)
return
}
// Edit 更新
func (c *cEmsLog) Edit(ctx context.Context, req *emslog.EditReq) (res *emslog.EditRes, err error) {
var in sysin.EmsLogEditInp
if err = gconv.Scan(req, &in); err != nil {
return
}
err = service.SysEmsLog().Edit(ctx, in)
return
}
// View 获取指定信息
func (c *cEmsLog) View(ctx context.Context, req *emslog.ViewReq) (res *emslog.ViewRes, err error) {
data, err := service.SysEmsLog().View(ctx, sysin.EmsLogViewInp{Id: req.Id})
if err != nil {
return
}
res = new(emslog.ViewRes)
res.EmsLogViewModel = data
return
}
// List 查看列表
func (c *cEmsLog) List(ctx context.Context, req *emslog.ListReq) (res *emslog.ListRes, err error) {
var in sysin.EmsLogListInp
if err = gconv.Scan(req, &in); err != nil {
return
}
list, totalCount, err := service.SysEmsLog().List(ctx, in)
if err != nil {
return
}
res = new(emslog.ListRes)
res.List = list
res.PageCount = form.CalPageCount(totalCount, req.PerPage)
res.Page = req.Page
res.PerPage = req.PerPage
return
}
// Status 更新部门状态
func (c *cEmsLog) Status(ctx context.Context, req *emslog.StatusReq) (res *emslog.StatusRes, err error) {
var in sysin.EmsLogStatusInp
if err = gconv.Scan(req, &in); err != nil {
return
}
err = service.SysEmsLog().Status(ctx, in)
return
}

View File

@ -25,184 +25,159 @@ type cGenCodes struct{}
func (c *cGenCodes) Delete(ctx context.Context, req *gencodes.DeleteReq) (res *gencodes.DeleteRes, err error) { func (c *cGenCodes) Delete(ctx context.Context, req *gencodes.DeleteReq) (res *gencodes.DeleteRes, err error) {
var in sysin.GenCodesDeleteInp var in sysin.GenCodesDeleteInp
if err = gconv.Scan(req, &in); err != nil { if err = gconv.Scan(req, &in); err != nil {
return nil, err return
} }
if err = service.SysGenCodes().Delete(ctx, in); err != nil {
return nil, err err = service.SysGenCodes().Delete(ctx, in)
} return
return res, nil
} }
// Edit 更新 // Edit 更新
func (c *cGenCodes) Edit(ctx context.Context, req *gencodes.EditReq) (res *gencodes.EditRes, err error) { func (c *cGenCodes) Edit(ctx context.Context, req *gencodes.EditReq) (res *gencodes.EditRes, err error) {
var in sysin.GenCodesEditInp var in sysin.GenCodesEditInp
if err = gconv.Scan(req, &in); err != nil { if err = gconv.Scan(req, &in); err != nil {
return nil, err return
} }
data, err := service.SysGenCodes().Edit(ctx, in) data, err := service.SysGenCodes().Edit(ctx, in)
if err != nil { if err != nil {
return nil, err return
} }
res = new(gencodes.EditRes) res = new(gencodes.EditRes)
res.GenCodesEditModel = data res.GenCodesEditModel = data
return res, nil return
} }
// MaxSort 最大排序 // MaxSort 最大排序
func (c *cGenCodes) MaxSort(ctx context.Context, req *gencodes.MaxSortReq) (*gencodes.MaxSortRes, error) { func (c *cGenCodes) MaxSort(ctx context.Context, req *gencodes.MaxSortReq) (res *gencodes.MaxSortRes, err error) {
data, err := service.SysGenCodes().MaxSort(ctx, sysin.GenCodesMaxSortInp{Id: req.Id}) data, err := service.SysGenCodes().MaxSort(ctx, sysin.GenCodesMaxSortInp{Id: req.Id})
if err != nil { if err != nil {
return nil, err return
} }
var res gencodes.MaxSortRes res = new(gencodes.MaxSortRes)
res.Sort = data.Sort res.Sort = data.Sort
return &res, nil return
} }
// View 获取指定信息 // View 获取指定信息
func (c *cGenCodes) View(ctx context.Context, req *gencodes.ViewReq) (*gencodes.ViewRes, error) { func (c *cGenCodes) View(ctx context.Context, req *gencodes.ViewReq) (res *gencodes.ViewRes, err error) {
data, err := service.SysGenCodes().View(ctx, sysin.GenCodesViewInp{Id: req.Id}) data, err := service.SysGenCodes().View(ctx, sysin.GenCodesViewInp{Id: req.Id})
if err != nil { if err != nil {
return nil, err return
} }
var res gencodes.ViewRes res = new(gencodes.ViewRes)
res.GenCodesViewModel = data res.GenCodesViewModel = data
return &res, nil return
} }
// List 查看列表 // List 查看列表
func (c *cGenCodes) List(ctx context.Context, req *gencodes.ListReq) (*gencodes.ListRes, error) { func (c *cGenCodes) List(ctx context.Context, req *gencodes.ListReq) (res *gencodes.ListRes, err error) {
var in sysin.GenCodesListInp
var ( if err = gconv.Scan(req, &in); err != nil {
in sysin.GenCodesListInp return
res gencodes.ListRes
)
if err := gconv.Scan(req, &in); err != nil {
return nil, err
} }
list, totalCount, err := service.SysGenCodes().List(ctx, in) list, totalCount, err := service.SysGenCodes().List(ctx, in)
if err != nil { if err != nil {
return nil, err return
} }
res = new(gencodes.ListRes)
res.List = list res.List = list
res.PageCount = form.CalPageCount(totalCount, req.PerPage) res.PageCount = form.CalPageCount(totalCount, req.PerPage)
res.Page = req.Page res.Page = req.Page
res.PerPage = req.PerPage res.PerPage = req.PerPage
return
return &res, nil
} }
// Status 更新部门状态 // Status 更新部门状态
func (c *cGenCodes) Status(ctx context.Context, req *gencodes.StatusReq) (res *gencodes.StatusRes, err error) { func (c *cGenCodes) Status(ctx context.Context, req *gencodes.StatusReq) (res *gencodes.StatusRes, err error) {
var in sysin.GenCodesStatusInp var in sysin.GenCodesStatusInp
if err = gconv.Scan(req, &in); err != nil { if err = gconv.Scan(req, &in); err != nil {
return nil, err return
}
if err = service.SysGenCodes().Status(ctx, in); err != nil {
return nil, err
} }
return res, nil err = service.SysGenCodes().Status(ctx, in)
return
} }
// Selects 获取指定信息 // Selects 获取指定信息
func (c *cGenCodes) Selects(ctx context.Context, req *gencodes.SelectsReq) (*gencodes.SelectsRes, error) { func (c *cGenCodes) Selects(ctx context.Context, req *gencodes.SelectsReq) (res *gencodes.SelectsRes, err error) {
data, err := service.SysGenCodes().Selects(ctx, sysin.GenCodesSelectsInp{}) data, err := service.SysGenCodes().Selects(ctx, sysin.GenCodesSelectsInp{})
if err != nil { if err != nil {
return nil, err return
} }
var res gencodes.SelectsRes res = new(gencodes.SelectsRes)
res.GenCodesSelectsModel = data res.GenCodesSelectsModel = data
return &res, nil return
} }
// TableSelect 数据库表选项 // TableSelect 数据库表选项
func (c *cGenCodes) TableSelect(ctx context.Context, req *gencodes.TableSelectReq) (*gencodes.TableSelectRes, error) { func (c *cGenCodes) TableSelect(ctx context.Context, req *gencodes.TableSelectReq) (res *gencodes.TableSelectRes, err error) {
data, err := service.SysGenCodes().TableSelect(ctx, sysin.GenCodesTableSelectInp{Name: req.Name}) data, err := service.SysGenCodes().TableSelect(ctx, sysin.GenCodesTableSelectInp{Name: req.Name})
if err != nil { if err != nil {
return nil, err return
} }
var res gencodes.TableSelectRes res = (*gencodes.TableSelectRes)(&data)
res = data return
return &res, nil
} }
// ColumnSelect 表字段选项 // ColumnSelect 表字段选项
func (c *cGenCodes) ColumnSelect(ctx context.Context, req *gencodes.ColumnSelectReq) (*gencodes.ColumnSelectRes, error) { func (c *cGenCodes) ColumnSelect(ctx context.Context, req *gencodes.ColumnSelectReq) (res *gencodes.ColumnSelectRes, err error) {
data, err := service.SysGenCodes().ColumnSelect(ctx, sysin.GenCodesColumnSelectInp{Name: req.Name, Table: req.Table}) data, err := service.SysGenCodes().ColumnSelect(ctx, sysin.GenCodesColumnSelectInp{Name: req.Name, Table: req.Table})
if err != nil { if err != nil {
return nil, err return
} }
var res gencodes.ColumnSelectRes res = (*gencodes.ColumnSelectRes)(&data)
res = data return
return &res, nil
} }
// ColumnList 表字段列表 // ColumnList 表字段列表
func (c *cGenCodes) ColumnList(ctx context.Context, req *gencodes.ColumnListReq) (*gencodes.ColumnListRes, error) { func (c *cGenCodes) ColumnList(ctx context.Context, req *gencodes.ColumnListReq) (res *gencodes.ColumnListRes, err error) {
var ( var in sysin.GenCodesColumnListInp
in sysin.GenCodesColumnListInp
err error
)
if err = gconv.Scan(req, &in); err != nil { if err = gconv.Scan(req, &in); err != nil {
return nil, err return
} }
data, err := service.SysGenCodes().ColumnList(ctx, in) data, err := service.SysGenCodes().ColumnList(ctx, in)
if err != nil { if err != nil {
return nil, err return
} }
var res gencodes.ColumnListRes res = (*gencodes.ColumnListRes)(&data)
res = data return
return &res, nil
} }
// Preview 生成预览 // Preview 生成预览
func (c *cGenCodes) Preview(ctx context.Context, req *gencodes.PreviewReq) (*gencodes.PreviewRes, error) { func (c *cGenCodes) Preview(ctx context.Context, req *gencodes.PreviewReq) (res *gencodes.PreviewRes, err error) {
var ( var in sysin.GenCodesPreviewInp
in sysin.GenCodesPreviewInp
err error
)
if err = gconv.Scan(req, &in); err != nil { if err = gconv.Scan(req, &in); err != nil {
return nil, err return
} }
data, err := service.SysGenCodes().Preview(ctx, in) data, err := service.SysGenCodes().Preview(ctx, in)
if err != nil { if err != nil {
return nil, err return
} }
res := new(gencodes.PreviewRes) res = new(gencodes.PreviewRes)
res.GenCodesPreviewModel = data res.GenCodesPreviewModel = data
return res, nil return
} }
// Build 生成预览 // Build 生成预览
func (c *cGenCodes) Build(ctx context.Context, req *gencodes.BuildReq) (*gencodes.BuildRes, error) { func (c *cGenCodes) Build(ctx context.Context, req *gencodes.BuildReq) (res *gencodes.BuildRes, err error) {
var ( var in sysin.GenCodesBuildInp
in sysin.GenCodesBuildInp
err error
)
if err = gconv.Scan(req, &in); err != nil { if err = gconv.Scan(req, &in); err != nil {
return nil, err return
} }
if err = service.SysGenCodes().Build(ctx, in); err != nil { err = service.SysGenCodes().Build(ctx, in)
return nil, err return
}
return nil, nil
} }

View File

@ -23,7 +23,7 @@ type sLog struct{}
// Clear 清空日志 // Clear 清空日志
func (c *sLog) Clear(ctx context.Context, req *log.ClearReq) (res *log.ClearRes, err error) { func (c *sLog) Clear(ctx context.Context, req *log.ClearReq) (res *log.ClearRes, err error) {
err = gerror.New("考虑安全,请到数据库清空") err = gerror.New("暂时考虑安全问题,请到数据库清空")
return return
} }
@ -31,58 +31,52 @@ func (c *sLog) Clear(ctx context.Context, req *log.ClearReq) (res *log.ClearRes,
func (c *sLog) Export(ctx context.Context, req *log.ExportReq) (res *log.ExportRes, err error) { func (c *sLog) Export(ctx context.Context, req *log.ExportReq) (res *log.ExportRes, err error) {
var in sysin.LogListInp var in sysin.LogListInp
if err = gconv.Scan(req, &in); err != nil { if err = gconv.Scan(req, &in); err != nil {
return nil, err return
}
if err = service.SysLog().Export(ctx, in); err != nil {
return nil, err
} }
err = service.SysLog().Export(ctx, in)
return return
} }
// List 获取访问日志列表 // List 获取访问日志列表
func (c *sLog) List(ctx context.Context, req *log.ListReq) (*log.ListRes, error) { func (c *sLog) List(ctx context.Context, req *log.ListReq) (res *log.ListRes, err error) {
var ( var in sysin.LogListInp
in sysin.LogListInp if err = gconv.Scan(req, &in); err != nil {
res log.ListRes return
)
if err := gconv.Scan(req, &in); err != nil {
return nil, err
} }
list, totalCount, err := service.SysLog().List(ctx, in) list, totalCount, err := service.SysLog().List(ctx, in)
if err != nil { if err != nil {
return nil, err return
} }
res = new(log.ListRes)
res.List = list res.List = list
res.PageCount = form.CalPageCount(totalCount, req.PerPage) res.PageCount = form.CalPageCount(totalCount, req.PerPage)
res.Page = req.Page res.Page = req.Page
res.PerPage = req.PerPage res.PerPage = req.PerPage
return
return &res, nil
} }
// View 获取指定信息 // View 获取指定信息
func (c *sLog) View(ctx context.Context, req *log.ViewReq) (*log.ViewRes, error) { func (c *sLog) View(ctx context.Context, req *log.ViewReq) (res *log.ViewRes, err error) {
var res log.ViewRes
data, err := service.SysLog().View(ctx, sysin.LogViewInp{Id: req.Id}) data, err := service.SysLog().View(ctx, sysin.LogViewInp{Id: req.Id})
if err != nil { if err != nil {
return nil, err return
} }
res = new(log.ViewRes)
res.LogViewModel = data res.LogViewModel = data
return &res, nil return
} }
// Delete 删除 // Delete 删除
func (c *sLog) Delete(ctx context.Context, req *log.DeleteReq) (res *log.DeleteRes, err error) { func (c *sLog) Delete(ctx context.Context, req *log.DeleteReq) (res *log.DeleteRes, err error) {
var in sysin.LogDeleteInp var in sysin.LogDeleteInp
if err = gconv.Scan(req, &in); err != nil { if err = gconv.Scan(req, &in); err != nil {
return nil, err return
} }
if err = service.SysLog().Delete(ctx, in); err != nil {
return nil, err err = service.SysLog().Delete(ctx, in)
} return
return res, nil
} }

View File

@ -28,16 +28,16 @@ type cLoginLog struct{}
func (c *cLoginLog) List(ctx context.Context, req *loginlog.ListReq) (res *loginlog.ListRes, err error) { func (c *cLoginLog) List(ctx context.Context, req *loginlog.ListReq) (res *loginlog.ListRes, err error) {
var in sysin.LoginLogListInp var in sysin.LoginLogListInp
if err = gconv.Scan(req, &in); err != nil { if err = gconv.Scan(req, &in); err != nil {
return nil, err return
} }
if err = validate.PreFilter(ctx, &in); err != nil { if err = validate.PreFilter(ctx, &in); err != nil {
return nil, err return
} }
list, totalCount, err := service.SysLoginLog().List(ctx, in) list, totalCount, err := service.SysLoginLog().List(ctx, in)
if err != nil { if err != nil {
return nil, err return
} }
res = new(loginlog.ListRes) res = new(loginlog.ListRes)
@ -45,60 +45,56 @@ func (c *cLoginLog) List(ctx context.Context, req *loginlog.ListReq) (res *login
res.PageCount = form.CalPageCount(totalCount, req.PerPage) res.PageCount = form.CalPageCount(totalCount, req.PerPage)
res.Page = req.Page res.Page = req.Page
res.PerPage = req.PerPage res.PerPage = req.PerPage
return res, nil return
} }
// Export 导出登录日志列表 // Export 导出登录日志列表
func (c *cLoginLog) Export(ctx context.Context, req *loginlog.ExportReq) (res *loginlog.ExportRes, err error) { func (c *cLoginLog) Export(ctx context.Context, req *loginlog.ExportReq) (res *loginlog.ExportRes, err error) {
var in sysin.LoginLogListInp var in sysin.LoginLogListInp
if err = gconv.Scan(req, &in); err != nil { if err = gconv.Scan(req, &in); err != nil {
return nil, err return
} }
if err = validate.PreFilter(ctx, &in); err != nil { if err = validate.PreFilter(ctx, &in); err != nil {
return nil, err return
} }
if err = service.SysLoginLog().Export(ctx, in); err != nil { err = service.SysLoginLog().Export(ctx, in)
return nil, err return
}
return res, nil
} }
// View 获取指定登录日志信息 // View 获取指定登录日志信息
func (c *cLoginLog) View(ctx context.Context, req *loginlog.ViewReq) (res *loginlog.ViewRes, err error) { func (c *cLoginLog) View(ctx context.Context, req *loginlog.ViewReq) (res *loginlog.ViewRes, err error) {
var in sysin.LoginLogViewInp var in sysin.LoginLogViewInp
if err = gconv.Scan(req, &in); err != nil { if err = gconv.Scan(req, &in); err != nil {
return nil, err return
} }
if err = validate.PreFilter(ctx, &in); err != nil { if err = validate.PreFilter(ctx, &in); err != nil {
return nil, err return
} }
data, err := service.SysLoginLog().View(ctx, in) data, err := service.SysLoginLog().View(ctx, in)
if err != nil { if err != nil {
return nil, err return
} }
res = new(loginlog.ViewRes) res = new(loginlog.ViewRes)
res.LoginLogViewModel = data res.LoginLogViewModel = data
return res, nil return
} }
// Delete 删除登录日志 // Delete 删除登录日志
func (c *cLoginLog) Delete(ctx context.Context, req *loginlog.DeleteReq) (res *loginlog.DeleteRes, err error) { func (c *cLoginLog) Delete(ctx context.Context, req *loginlog.DeleteReq) (res *loginlog.DeleteRes, err error) {
var in sysin.LoginLogDeleteInp var in sysin.LoginLogDeleteInp
if err = gconv.Scan(req, &in); err != nil { if err = gconv.Scan(req, &in); err != nil {
return nil, err return
} }
if err = validate.PreFilter(ctx, &in); err != nil { if err = validate.PreFilter(ctx, &in); err != nil {
return nil, err return
} }
if err = service.SysLoginLog().Delete(ctx, in); err != nil { err = service.SysLoginLog().Delete(ctx, in)
return nil, err return
}
return res, nil
} }

View File

@ -10,6 +10,7 @@ import (
"context" "context"
"github.com/gogf/gf/v2/util/gconv" "github.com/gogf/gf/v2/util/gconv"
"hotgo/api/backend/provinces" "hotgo/api/backend/provinces"
"hotgo/internal/library/location"
"hotgo/internal/model/input/form" "hotgo/internal/model/input/form"
"hotgo/internal/model/input/sysin" "hotgo/internal/model/input/sysin"
"hotgo/internal/service" "hotgo/internal/service"
@ -22,140 +23,150 @@ var (
type cProvinces struct{} type cProvinces struct{}
// Tree 关系树选项列表 // Tree 关系树选项列表
func (c *cProvinces) Tree(ctx context.Context, req *provinces.TreeReq) (*provinces.TreeRes, error) { func (c *cProvinces) Tree(ctx context.Context, req *provinces.TreeReq) (res *provinces.TreeRes, err error) {
var ( res = new(provinces.TreeRes)
res provinces.TreeRes
err error
)
res.List, err = service.SysProvinces().Tree(ctx) res.List, err = service.SysProvinces().Tree(ctx)
if err != nil { return
return nil, err
}
return &res, nil
} }
// Delete 删除 // Delete 删除
func (c *cProvinces) Delete(ctx context.Context, req *provinces.DeleteReq) (res *provinces.DeleteRes, err error) { func (c *cProvinces) Delete(ctx context.Context, req *provinces.DeleteReq) (res *provinces.DeleteRes, err error) {
var in sysin.ProvincesDeleteInp var in sysin.ProvincesDeleteInp
if err = gconv.Scan(req, &in); err != nil { if err = gconv.Scan(req, &in); err != nil {
return nil, err return
} }
if err = service.SysProvinces().Delete(ctx, in); err != nil {
return nil, err err = service.SysProvinces().Delete(ctx, in)
} return
return res, nil
} }
// Edit 更新 // Edit 更新
func (c *cProvinces) Edit(ctx context.Context, req *provinces.EditReq) (res *provinces.EditRes, err error) { func (c *cProvinces) Edit(ctx context.Context, req *provinces.EditReq) (res *provinces.EditRes, err error) {
var in sysin.ProvincesEditInp var in sysin.ProvincesEditInp
if err = gconv.Scan(req, &in); err != nil { if err = gconv.Scan(req, &in); err != nil {
return nil, err return
}
if err = service.SysProvinces().Edit(ctx, in); err != nil {
return nil, err
} }
return res, nil err = service.SysProvinces().Edit(ctx, in)
return
} }
// MaxSort 最大排序 // MaxSort 最大排序
func (c *cProvinces) MaxSort(ctx context.Context, req *provinces.MaxSortReq) (res *provinces.MaxSortRes, err error) { func (c *cProvinces) MaxSort(ctx context.Context, req *provinces.MaxSortReq) (res *provinces.MaxSortRes, err error) {
data, err := service.SysProvinces().MaxSort(ctx, sysin.ProvincesMaxSortInp{}) data, err := service.SysProvinces().MaxSort(ctx, sysin.ProvincesMaxSortInp{})
if err != nil { if err != nil {
return nil, err return
} }
res = new(provinces.MaxSortRes) res = new(provinces.MaxSortRes)
res.ProvincesMaxSortModel = data res.ProvincesMaxSortModel = data
return res, nil return
} }
// View 获取指定信息 // View 获取指定信息
func (c *cProvinces) View(ctx context.Context, req *provinces.ViewReq) (*provinces.ViewRes, error) { func (c *cProvinces) View(ctx context.Context, req *provinces.ViewReq) (res *provinces.ViewRes, err error) {
data, err := service.SysProvinces().View(ctx, sysin.ProvincesViewInp{Id: req.Id}) data, err := service.SysProvinces().View(ctx, sysin.ProvincesViewInp{Id: req.Id})
if err != nil { if err != nil {
return nil, err return
} }
var res provinces.ViewRes
res = new(provinces.ViewRes)
res.ProvincesViewModel = data res.ProvincesViewModel = data
return &res, nil return
} }
// List 查看列表 // List 查看列表
func (c *cProvinces) List(ctx context.Context, req *provinces.ListReq) (*provinces.ListRes, error) { func (c *cProvinces) List(ctx context.Context, req *provinces.ListReq) (res *provinces.ListRes, err error) {
var ( var in sysin.ProvincesListInp
in sysin.ProvincesListInp if err = gconv.Scan(req, &in); err != nil {
res provinces.ListRes return
)
if err := gconv.Scan(req, &in); err != nil {
return nil, err
} }
list, totalCount, err := service.SysProvinces().List(ctx, in) list, totalCount, err := service.SysProvinces().List(ctx, in)
if err != nil { if err != nil {
return nil, err return
} }
res = new(provinces.ListRes)
res.List = list res.List = list
res.PageCount = form.CalPageCount(totalCount, req.PerPage) res.PageCount = form.CalPageCount(totalCount, req.PerPage)
res.Page = req.Page res.Page = req.Page
res.PerPage = req.PerPage res.PerPage = req.PerPage
return
return &res, nil
} }
// Status 更新部门状态 // Status 更新部门状态
func (c *cProvinces) Status(ctx context.Context, req *provinces.StatusReq) (res *provinces.StatusRes, err error) { func (c *cProvinces) Status(ctx context.Context, req *provinces.StatusReq) (res *provinces.StatusRes, err error) {
var in sysin.ProvincesStatusInp var in sysin.ProvincesStatusInp
if err = gconv.Scan(req, &in); err != nil { if err = gconv.Scan(req, &in); err != nil {
return nil, err return
}
if err = service.SysProvinces().Status(ctx, in); err != nil {
return nil, err
} }
return res, nil err = service.SysProvinces().Status(ctx, in)
return
} }
// ChildrenList 获取省市区下级列表 // ChildrenList 获取省市区下级列表
func (c *cProvinces) ChildrenList(ctx context.Context, req *provinces.ChildrenListReq) (*provinces.ChildrenListRes, error) { func (c *cProvinces) ChildrenList(ctx context.Context, req *provinces.ChildrenListReq) (res *provinces.ChildrenListRes, err error) {
var ( var in sysin.ProvincesChildrenListInp
in sysin.ProvincesChildrenListInp if err = gconv.Scan(req, &in); err != nil {
res provinces.ChildrenListRes return
)
if err := gconv.Scan(req, &in); err != nil {
return nil, err
} }
list, totalCount, err := service.SysProvinces().ChildrenList(ctx, in) list, totalCount, err := service.SysProvinces().ChildrenList(ctx, in)
if err != nil { if err != nil {
return nil, err return
} }
res = new(provinces.ChildrenListRes)
res.List = list res.List = list
res.PageCount = form.CalPageCount(totalCount, req.PerPage) res.PageCount = form.CalPageCount(totalCount, req.PerPage)
res.Page = req.Page res.Page = req.Page
res.PerPage = req.PerPage res.PerPage = req.PerPage
return
return &res, nil
} }
// UniqueId 地区ID是否唯一 // UniqueId 地区ID是否唯一
func (c *cProvinces) UniqueId(ctx context.Context, req *provinces.UniqueIdReq) (res *provinces.UniqueIdRes, err error) { func (c *cProvinces) UniqueId(ctx context.Context, req *provinces.UniqueIdReq) (res *provinces.UniqueIdRes, err error) {
var in sysin.ProvincesUniqueIdInp var in sysin.ProvincesUniqueIdInp
if err = gconv.Scan(req, &in); err != nil { if err = gconv.Scan(req, &in); err != nil {
return nil, err return
} }
data, err := service.SysProvinces().UniqueId(ctx, in) data, err := service.SysProvinces().UniqueId(ctx, in)
if err != nil { if err != nil {
return nil, err return
} }
res = new(provinces.UniqueIdRes) res = new(provinces.UniqueIdRes)
res.ProvincesUniqueIdModel = data res.ProvincesUniqueIdModel = data
return
return res, nil }
// Select 省市区选项
func (c *cProvinces) Select(ctx context.Context, req *provinces.SelectReq) (res *provinces.SelectRes, err error) {
var in sysin.ProvincesSelectInp
if err = gconv.Scan(req, &in); err != nil {
return
}
data, err := service.SysProvinces().Select(ctx, in)
if err != nil {
return
}
res = new(provinces.SelectRes)
res.ProvincesSelectModel = data
return
}
// CityLabel 省市区选项
func (c *cProvinces) CityLabel(ctx context.Context, req *provinces.CityLabelReq) (res *provinces.CityLabelRes, err error) {
cityLabel, err := location.ParseSimpleRegion(ctx, req.Id, req.Spilt)
if err != nil {
return
}
res = (*provinces.CityLabelRes)(&cityLabel)
return
} }

View File

@ -26,16 +26,16 @@ type cServeLog struct{}
func (c *cServeLog) List(ctx context.Context, req *servelog.ListReq) (res *servelog.ListRes, err error) { func (c *cServeLog) List(ctx context.Context, req *servelog.ListReq) (res *servelog.ListRes, err error) {
var in sysin.ServeLogListInp var in sysin.ServeLogListInp
if err = gconv.Scan(req, &in); err != nil { if err = gconv.Scan(req, &in); err != nil {
return nil, err return
} }
if err = validate.PreFilter(ctx, &in); err != nil { if err = validate.PreFilter(ctx, &in); err != nil {
return nil, err return
} }
list, totalCount, err := service.SysServeLog().List(ctx, in) list, totalCount, err := service.SysServeLog().List(ctx, in)
if err != nil { if err != nil {
return nil, err return
} }
res = new(servelog.ListRes) res = new(servelog.ListRes)
@ -43,60 +43,56 @@ func (c *cServeLog) List(ctx context.Context, req *servelog.ListReq) (res *serve
res.PageCount = form.CalPageCount(totalCount, req.PerPage) res.PageCount = form.CalPageCount(totalCount, req.PerPage)
res.Page = req.Page res.Page = req.Page
res.PerPage = req.PerPage res.PerPage = req.PerPage
return res, nil return
} }
// Export 导出服务日志列表 // Export 导出服务日志列表
func (c *cServeLog) Export(ctx context.Context, req *servelog.ExportReq) (res *servelog.ExportRes, err error) { func (c *cServeLog) Export(ctx context.Context, req *servelog.ExportReq) (res *servelog.ExportRes, err error) {
var in sysin.ServeLogListInp var in sysin.ServeLogListInp
if err = gconv.Scan(req, &in); err != nil { if err = gconv.Scan(req, &in); err != nil {
return nil, err return
} }
if err = validate.PreFilter(ctx, &in); err != nil { if err = validate.PreFilter(ctx, &in); err != nil {
return nil, err return
} }
if err = service.SysServeLog().Export(ctx, in); err != nil { err = service.SysServeLog().Export(ctx, in)
return nil, err return
}
return res, nil
} }
// View 获取指定服务日志信息 // View 获取指定服务日志信息
func (c *cServeLog) View(ctx context.Context, req *servelog.ViewReq) (res *servelog.ViewRes, err error) { func (c *cServeLog) View(ctx context.Context, req *servelog.ViewReq) (res *servelog.ViewRes, err error) {
var in sysin.ServeLogViewInp var in sysin.ServeLogViewInp
if err = gconv.Scan(req, &in); err != nil { if err = gconv.Scan(req, &in); err != nil {
return nil, err return
} }
if err = validate.PreFilter(ctx, &in); err != nil { if err = validate.PreFilter(ctx, &in); err != nil {
return nil, err return
} }
data, err := service.SysServeLog().View(ctx, in) data, err := service.SysServeLog().View(ctx, in)
if err != nil { if err != nil {
return nil, err return
} }
res = new(servelog.ViewRes) res = new(servelog.ViewRes)
res.ServeLogViewModel = data res.ServeLogViewModel = data
return res, nil return
} }
// Delete 删除服务日志 // Delete 删除服务日志
func (c *cServeLog) Delete(ctx context.Context, req *servelog.DeleteReq) (res *servelog.DeleteRes, err error) { func (c *cServeLog) Delete(ctx context.Context, req *servelog.DeleteReq) (res *servelog.DeleteRes, err error) {
var in sysin.ServeLogDeleteInp var in sysin.ServeLogDeleteInp
if err = gconv.Scan(req, &in); err != nil { if err = gconv.Scan(req, &in); err != nil {
return nil, err return
} }
if err = validate.PreFilter(ctx, &in); err != nil { if err = validate.PreFilter(ctx, &in); err != nil {
return nil, err return
} }
if err = service.SysServeLog().Delete(ctx, in); err != nil { err = service.SysServeLog().Delete(ctx, in)
return nil, err return
}
return res, nil
} }

View File

@ -25,89 +25,75 @@ type cSmsLog struct{}
func (c *cSmsLog) Delete(ctx context.Context, req *smslog.DeleteReq) (res *smslog.DeleteRes, err error) { func (c *cSmsLog) Delete(ctx context.Context, req *smslog.DeleteReq) (res *smslog.DeleteRes, err error) {
var in sysin.SmsLogDeleteInp var in sysin.SmsLogDeleteInp
if err = gconv.Scan(req, &in); err != nil { if err = gconv.Scan(req, &in); err != nil {
return nil, err return
} }
if err = service.SysSmsLog().Delete(ctx, in); err != nil {
return nil, err err = service.SysSmsLog().Delete(ctx, in)
} return
return res, nil
} }
// Edit 更新 // Edit 更新
func (c *cSmsLog) Edit(ctx context.Context, req *smslog.EditReq) (res *smslog.EditRes, err error) { func (c *cSmsLog) Edit(ctx context.Context, req *smslog.EditReq) (res *smslog.EditRes, err error) {
var in sysin.SmsLogEditInp var in sysin.SmsLogEditInp
if err = gconv.Scan(req, &in); err != nil { if err = gconv.Scan(req, &in); err != nil {
return nil, err return
}
if err = service.SysSmsLog().Edit(ctx, in); err != nil {
return nil, err
} }
return res, nil err = service.SysSmsLog().Edit(ctx, in)
return
} }
// MaxSort 最大排序 // MaxSort 最大排序
func (c *cSmsLog) MaxSort(ctx context.Context, req *smslog.MaxSortReq) (*smslog.MaxSortRes, error) { func (c *cSmsLog) MaxSort(ctx context.Context, req *smslog.MaxSortReq) (res *smslog.MaxSortRes, err error) {
data, err := service.SysSmsLog().MaxSort(ctx, sysin.SmsLogMaxSortInp{Id: req.Id}) data, err := service.SysSmsLog().MaxSort(ctx, sysin.SmsLogMaxSortInp{Id: req.Id})
if err != nil { if err != nil {
return nil, err return
} }
var res smslog.MaxSortRes res = new(smslog.MaxSortRes)
res.Sort = data.Sort res.Sort = data.Sort
return &res, nil return
} }
// View 获取指定信息 // View 获取指定信息
func (c *cSmsLog) View(ctx context.Context, req *smslog.ViewReq) (*smslog.ViewRes, error) { func (c *cSmsLog) View(ctx context.Context, req *smslog.ViewReq) (res *smslog.ViewRes, err error) {
data, err := service.SysSmsLog().View(ctx, sysin.SmsLogViewInp{Id: req.Id}) data, err := service.SysSmsLog().View(ctx, sysin.SmsLogViewInp{Id: req.Id})
if err != nil { if err != nil {
return nil, err return
} }
var res smslog.ViewRes res = new(smslog.ViewRes)
res.SmsLogViewModel = data res.SmsLogViewModel = data
return &res, nil return
} }
// List 查看列表 // List 查看列表
func (c *cSmsLog) List(ctx context.Context, req *smslog.ListReq) (*smslog.ListRes, error) { func (c *cSmsLog) List(ctx context.Context, req *smslog.ListReq) (res *smslog.ListRes, err error) {
var in sysin.SmsLogListInp
var ( if err = gconv.Scan(req, &in); err != nil {
in sysin.SmsLogListInp return
res smslog.ListRes
)
if err := gconv.Scan(req, &in); err != nil {
return nil, err
} }
list, totalCount, err := service.SysSmsLog().List(ctx, in) list, totalCount, err := service.SysSmsLog().List(ctx, in)
if err != nil { if err != nil {
return nil, err return
} }
res = new(smslog.ListRes)
res.List = list res.List = list
res.PageCount = form.CalPageCount(totalCount, req.PerPage) res.PageCount = form.CalPageCount(totalCount, req.PerPage)
res.Page = req.Page res.Page = req.Page
res.PerPage = req.PerPage res.PerPage = req.PerPage
return
return &res, nil
} }
// Status 更新部门状态 // Status 更新部门状态
func (c *cSmsLog) Status(ctx context.Context, req *smslog.StatusReq) (res *smslog.StatusRes, err error) { func (c *cSmsLog) Status(ctx context.Context, req *smslog.StatusReq) (res *smslog.StatusRes, err error) {
var in sysin.SmsLogStatusInp var in sysin.SmsLogStatusInp
if err = gconv.Scan(req, &in); err != nil { if err = gconv.Scan(req, &in); err != nil {
return nil, err return
} }
if err = service.SysSmsLog().Status(ctx, in); err != nil {
return nil, err err = service.SysSmsLog().Status(ctx, in)
} return
return res, nil
} }

View File

@ -10,6 +10,7 @@ import (
"context" "context"
"hotgo/internal/model/input/websocketin" "hotgo/internal/model/input/websocketin"
"hotgo/internal/websocket" "hotgo/internal/websocket"
"hotgo/utility/simple"
) )
// Send 通过http发送ws消息 // Send 通过http发送ws消息
@ -19,10 +20,11 @@ type send struct{}
// ToTag 发送标签消息 // ToTag 发送标签消息
func (c *send) ToTag(ctx context.Context, req *websocketin.SendToTagReq) (res *websocketin.SendToTagRes, err error) { func (c *send) ToTag(ctx context.Context, req *websocketin.SendToTagReq) (res *websocketin.SendToTagRes, err error) {
simple.SafeGo(ctx, func(ctx context.Context) {
go websocket.SendToTag(req.Tag, &websocket.WResponse{ websocket.SendToTag(req.Tag, &websocket.WResponse{
Event: req.Response.Event, Event: req.Response.Event,
Data: req.Response, Data: req.Response,
})
}) })
return return
} }

View File

@ -134,9 +134,28 @@ func StartALL(sysCron []*entity.SysCron) error {
return nil return nil
} }
// RefreshStatus 刷新状态
func RefreshStatus(sysCron *entity.SysCron) (err error) {
if sysCron == nil {
return
}
g.DumpWithType(sysCron)
if sysCron.Status == consts.StatusEnabled {
return Start(sysCron)
}
return Stop(sysCron)
}
// Stop 停止单个任务 // Stop 停止单个任务
func Stop(sysCron *entity.SysCron) error { func Stop(sysCron *entity.SysCron) (err error) {
return nil cr := gcron.Search(sysCron.Name)
if cr == nil {
return
}
cr.Stop()
return
} }
// Once 立即执行一次某个任务 // Once 立即执行一次某个任务
@ -152,15 +171,31 @@ func Once(ctx context.Context, sysCron *entity.SysCron) error {
} }
// Delete 删除任务 // Delete 删除任务
func Delete(sysCron *entity.SysCron) error { func Delete(sysCron *entity.SysCron) (err error) {
// ... if sysCron == nil {
return
}
for _, v := range gcron.Entries() {
if v.Name == sysCron.Name {
gcron.Remove(v.Name)
}
return Stop(sysCron) }
return
} }
// Start 启动单个任务 // Start 启动单个任务
func Start(sysCron *entity.SysCron) error { func Start(sysCron *entity.SysCron) (err error) {
return nil if sysCron == nil {
return
}
cr := gcron.Search(sysCron.Name)
if cr != nil {
cr.Start()
return
}
return StartALL([]*entity.SysCron{sysCron})
} }
// Add 添加任务 // Add 添加任务

View File

@ -47,7 +47,7 @@ func (dao *adminMemberPostDao) UpdatePostIds(ctx context.Context, memberId int64
PostId: postIds[i], PostId: postIds[i],
}) })
if err != nil { if err != nil {
err = gerror.Wrap(err, "插入会员岗位失败") err = gerror.Wrap(err, "插入用户岗位失败")
return err return err
} }
} }

View File

@ -0,0 +1,27 @@
// =================================================================================
// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish.
// =================================================================================
package dao
import (
"hotgo/internal/dao/internal"
)
// internalAdminNoticeReadDao is internal type for wrapping internal DAO implements.
type internalAdminNoticeReadDao = *internal.AdminNoticeReadDao
// adminNoticeReadDao is the data access object for table hg_admin_notice_read.
// You can define custom methods on it to extend its functionality as you wish.
type adminNoticeReadDao struct {
internalAdminNoticeReadDao
}
var (
// AdminNoticeRead is globally public accessible object for table hg_admin_notice_read operations.
AdminNoticeRead = adminNoticeReadDao{
internal.NewAdminNoticeReadDao(),
}
)
// Fill with you ideas below.

View File

@ -29,22 +29,20 @@ type AdminMemberColumns struct {
Salt string // 密码盐 Salt string // 密码盐
AuthKey string // 授权令牌 AuthKey string // 授权令牌
PasswordResetToken string // 密码重置令牌 PasswordResetToken string // 密码重置令牌
Balance string // 余额
Avatar string // 头像 Avatar string // 头像
Sex string // 性别 Sex string // 性别
Qq string // qq Qq string // qq
Email string // 邮箱 Email string // 邮箱
Mobile string // 手机号码 Mobile string // 手机号码
Birthday string // 生日 Birthday string // 生日
ProvinceId string // 省编码
CityId string // 城市编码 CityId string // 城市编码
CountyId string // 区域编码
Address string // 联系地址 Address string // 联系地址
VisitCount string // 访问次数
LastTime string // 最后一次登录时间
LastIp string // 最后一次登录ip
Pid string // 上级管理员ID Pid string // 上级管理员ID
Level string // 关系树等级 Level string // 关系树等级
Tree string // 关系树 Tree string // 关系树
Cash string // 提现配置
LastActiveAt string // 最后活跃时间
Remark string // 备注 Remark string // 备注
Status string // 状态 Status string // 状态
CreatedAt string // 创建时间 CreatedAt string // 创建时间
@ -62,22 +60,20 @@ var adminMemberColumns = AdminMemberColumns{
Salt: "salt", Salt: "salt",
AuthKey: "auth_key", AuthKey: "auth_key",
PasswordResetToken: "password_reset_token", PasswordResetToken: "password_reset_token",
Balance: "balance",
Avatar: "avatar", Avatar: "avatar",
Sex: "sex", Sex: "sex",
Qq: "qq", Qq: "qq",
Email: "email", Email: "email",
Mobile: "mobile", Mobile: "mobile",
Birthday: "birthday", Birthday: "birthday",
ProvinceId: "province_id",
CityId: "city_id", CityId: "city_id",
CountyId: "county_id",
Address: "address", Address: "address",
VisitCount: "visit_count",
LastTime: "last_time",
LastIp: "last_ip",
Pid: "pid", Pid: "pid",
Level: "level", Level: "level",
Tree: "tree", Tree: "tree",
Cash: "cash",
LastActiveAt: "last_active_at",
Remark: "remark", Remark: "remark",
Status: "status", Status: "status",
CreatedAt: "created_at", CreatedAt: "created_at",

View File

@ -23,14 +23,17 @@ type AdminNoticeColumns struct {
Id string // 公告ID Id string // 公告ID
Title string // 公告标题 Title string // 公告标题
Type string // 公告类型 Type string // 公告类型
Tag string // 标签
Content string // 公告内容 Content string // 公告内容
Receiver string // 接收者 Receiver string // 接收者
Reader string // 已读人
Remark string // 备注 Remark string // 备注
Sort string // 排序 Sort string // 排序
Status string // 公告状态 Status string // 公告状态
CreatedBy string // 发送人
UpdatedBy string // 修改人
CreatedAt string // 创建时间 CreatedAt string // 创建时间
UpdatedAt string // 更新时间 UpdatedAt string // 更新时间
DeletedAt string // 删除时间
} }
// adminNoticeColumns holds the columns for table hg_admin_notice. // adminNoticeColumns holds the columns for table hg_admin_notice.
@ -38,14 +41,17 @@ var adminNoticeColumns = AdminNoticeColumns{
Id: "id", Id: "id",
Title: "title", Title: "title",
Type: "type", Type: "type",
Tag: "tag",
Content: "content", Content: "content",
Receiver: "receiver", Receiver: "receiver",
Reader: "reader",
Remark: "remark", Remark: "remark",
Sort: "sort", Sort: "sort",
Status: "status", Status: "status",
CreatedBy: "created_by",
UpdatedBy: "updated_by",
CreatedAt: "created_at", CreatedAt: "created_at",
UpdatedAt: "updated_at", UpdatedAt: "updated_at",
DeletedAt: "deleted_at",
} }
// NewAdminNoticeDao creates and returns a new DAO object for table data access. // NewAdminNoticeDao creates and returns a new DAO object for table data access.

View File

@ -0,0 +1,83 @@
// ==========================================================================
// Code generated by GoFrame CLI tool. DO NOT EDIT.
// ==========================================================================
package internal
import (
"context"
"github.com/gogf/gf/v2/database/gdb"
"github.com/gogf/gf/v2/frame/g"
)
// AdminNoticeReadDao is the data access object for table hg_admin_notice_read.
type AdminNoticeReadDao struct {
table string // table is the underlying table name of the DAO.
group string // group is the database configuration group name of current DAO.
columns AdminNoticeReadColumns // columns contains all the column names of Table for convenient usage.
}
// AdminNoticeReadColumns defines and stores column names for table hg_admin_notice_read.
type AdminNoticeReadColumns struct {
Id string // 记录ID
NoticeId string // 公告ID
MemberId string // 会员ID
Clicks string // 已读次数
UpdatedAt string // 更新时间
CreatedAt string // 阅读时间
}
// adminNoticeReadColumns holds the columns for table hg_admin_notice_read.
var adminNoticeReadColumns = AdminNoticeReadColumns{
Id: "id",
NoticeId: "notice_id",
MemberId: "member_id",
Clicks: "clicks",
UpdatedAt: "updated_at",
CreatedAt: "created_at",
}
// NewAdminNoticeReadDao creates and returns a new DAO object for table data access.
func NewAdminNoticeReadDao() *AdminNoticeReadDao {
return &AdminNoticeReadDao{
group: "default",
table: "hg_admin_notice_read",
columns: adminNoticeReadColumns,
}
}
// DB retrieves and returns the underlying raw database management object of current DAO.
func (dao *AdminNoticeReadDao) DB() gdb.DB {
return g.DB(dao.group)
}
// Table returns the table name of current dao.
func (dao *AdminNoticeReadDao) Table() string {
return dao.table
}
// Columns returns all column names of current dao.
func (dao *AdminNoticeReadDao) Columns() AdminNoticeReadColumns {
return dao.columns
}
// Group returns the configuration group name of database of current dao.
func (dao *AdminNoticeReadDao) Group() string {
return dao.group
}
// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
func (dao *AdminNoticeReadDao) Ctx(ctx context.Context) *gdb.Model {
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
}
// Transaction wraps the transaction logic using function f.
// It rollbacks the transaction and returns the error from function f if it returns non-nil error.
// It commits the transaction and returns nil if function f returns nil.
//
// Note that, you should not Commit or Rollback the transaction in function f
// as it is automatically handled by this function.
func (dao *AdminNoticeReadDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
return dao.Ctx(ctx).Transaction(ctx, f)
}

View File

@ -0,0 +1,91 @@
// ==========================================================================
// Code generated by GoFrame CLI tool. DO NOT EDIT.
// ==========================================================================
package internal
import (
"context"
"github.com/gogf/gf/v2/database/gdb"
"github.com/gogf/gf/v2/frame/g"
)
// SysEmsLogDao is the data access object for table hg_sys_ems_log.
type SysEmsLogDao struct {
table string // table is the underlying table name of the DAO.
group string // group is the database configuration group name of current DAO.
columns SysEmsLogColumns // columns contains all the column names of Table for convenient usage.
}
// SysEmsLogColumns defines and stores column names for table hg_sys_ems_log.
type SysEmsLogColumns struct {
Id string // 主键
Event string // 事件
Email string // 邮箱地址,多个用;隔开
Code string // 验证码
Times string // 验证次数
Content string // 邮件内容
Ip string // ip地址
Status string // 状态(1未验证,2已验证)
CreatedAt string // 创建时间
UpdatedAt string // 更新时间
}
// sysEmsLogColumns holds the columns for table hg_sys_ems_log.
var sysEmsLogColumns = SysEmsLogColumns{
Id: "id",
Event: "event",
Email: "email",
Code: "code",
Times: "times",
Content: "content",
Ip: "ip",
Status: "status",
CreatedAt: "created_at",
UpdatedAt: "updated_at",
}
// NewSysEmsLogDao creates and returns a new DAO object for table data access.
func NewSysEmsLogDao() *SysEmsLogDao {
return &SysEmsLogDao{
group: "default",
table: "hg_sys_ems_log",
columns: sysEmsLogColumns,
}
}
// DB retrieves and returns the underlying raw database management object of current DAO.
func (dao *SysEmsLogDao) DB() gdb.DB {
return g.DB(dao.group)
}
// Table returns the table name of current dao.
func (dao *SysEmsLogDao) Table() string {
return dao.table
}
// Columns returns all column names of current dao.
func (dao *SysEmsLogDao) Columns() SysEmsLogColumns {
return dao.columns
}
// Group returns the configuration group name of database of current dao.
func (dao *SysEmsLogDao) Group() string {
return dao.group
}
// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
func (dao *SysEmsLogDao) Ctx(ctx context.Context) *gdb.Model {
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
}
// Transaction wraps the transaction logic using function f.
// It rollbacks the transaction and returns the error from function f if it returns non-nil error.
// It commits the transaction and returns nil if function f returns nil.
//
// Note that, you should not Commit or Rollback the transaction in function f
// as it is automatically handled by this function.
func (dao *SysEmsLogDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
return dao.Ctx(ctx).Transaction(ctx, f)
}

View File

@ -22,6 +22,7 @@ type SysGenCodesDao struct {
type SysGenCodesColumns struct { type SysGenCodesColumns struct {
Id string // 生成ID Id string // 生成ID
GenType string // 生成类型 GenType string // 生成类型
GenTemplate string // 生成模板
VarName string // 实体命名 VarName string // 实体命名
Options string // 配置选项 Options string // 配置选项
DbName string // 数据库名称 DbName string // 数据库名称
@ -38,6 +39,7 @@ type SysGenCodesColumns struct {
var sysGenCodesColumns = SysGenCodesColumns{ var sysGenCodesColumns = SysGenCodesColumns{
Id: "id", Id: "id",
GenType: "gen_type", GenType: "gen_type",
GenTemplate: "gen_template",
VarName: "var_name", VarName: "var_name",
Options: "options", Options: "options",
DbName: "db_name", DbName: "db_name",

View File

@ -27,6 +27,7 @@ type SysGenCurdDemoColumns struct {
Content string // 内容 Content string // 内容
Image string // 单图 Image string // 单图
Attachfile string // 附件 Attachfile string // 附件
CityId string // 所在城市
Switch string // 显示开关 Switch string // 显示开关
Sort string // 排序 Sort string // 排序
Status string // 状态 Status string // 状态
@ -46,6 +47,7 @@ var sysGenCurdDemoColumns = SysGenCurdDemoColumns{
Content: "content", Content: "content",
Image: "image", Image: "image",
Attachfile: "attachfile", Attachfile: "attachfile",
CityId: "city_id",
Switch: "switch", Switch: "switch",
Sort: "sort", Sort: "sort",
Status: "status", Status: "status",

View File

@ -26,6 +26,7 @@ type SysLoginLogColumns struct {
Username string // 用户名 Username string // 用户名
Response string // 响应数据 Response string // 响应数据
LoginAt string // 登录时间 LoginAt string // 登录时间
LoginIp string // 登录IP
ErrMsg string // 错误提示 ErrMsg string // 错误提示
Status string // 状态 Status string // 状态
CreatedAt string // 创建时间 CreatedAt string // 创建时间
@ -40,6 +41,7 @@ var sysLoginLogColumns = SysLoginLogColumns{
Username: "username", Username: "username",
Response: "response", Response: "response",
LoginAt: "login_at", LoginAt: "login_at",
LoginIp: "login_ip",
ErrMsg: "err_msg", ErrMsg: "err_msg",
Status: "status", Status: "status",
CreatedAt: "created_at", CreatedAt: "created_at",

View File

@ -46,6 +46,7 @@ type TestColumns struct {
Mobile string // 手机号码 Mobile string // 手机号码
Hobby string // 爱好 Hobby string // 爱好
Channel string // 渠道 Channel string // 渠道
CityId string // 所在城市
Pid string // 上级ID Pid string // 上级ID
Level string // 树等级 Level string // 树等级
Tree string // 关系树 Tree string // 关系树
@ -86,6 +87,7 @@ var testColumns = TestColumns{
Mobile: "mobile", Mobile: "mobile",
Hobby: "hobby", Hobby: "hobby",
Channel: "channel", Channel: "channel",
CityId: "city_id",
Pid: "pid", Pid: "pid",
Level: "level", Level: "level",
Tree: "tree", Tree: "tree",

View File

@ -0,0 +1,43 @@
// =================================================================================
// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish.
// =================================================================================
package dao
import (
"context"
"github.com/gogf/gf/v2/os/gtime"
"hotgo/internal/dao/internal"
)
// internalSysEmsLogDao is internal type for wrapping internal DAO implements.
type internalSysEmsLogDao = *internal.SysEmsLogDao
// sysEmsLogDao is the data access object for table hg_sys_ems_log.
// You can define custom methods on it to extend its functionality as you wish.
type sysEmsLogDao struct {
internalSysEmsLogDao
}
var (
// SysEmsLog is globally public accessible object for table hg_sys_ems_log operations.
SysEmsLog = sysEmsLogDao{
internal.NewSysEmsLogDao(),
}
)
// Fill with you ideas below.
// NowDayCount 当天发送次数
func (dao *sysEmsLogDao) NowDayCount(ctx context.Context, event, email string) (count int, err error) {
count, err = dao.Ctx(ctx).
Where("email", email).
Where("event", event).
WhereGTE("created_at", gtime.Now().Format("Y-m-d")).
Count()
if err != nil {
return 0, err
}
return
}

View File

@ -5,10 +5,6 @@
package dao package dao
import ( import (
"context"
"github.com/gogf/gf/v2/container/gvar"
"github.com/gogf/gf/v2/errors/gerror"
"hotgo/internal/consts"
"hotgo/internal/dao/internal" "hotgo/internal/dao/internal"
) )
@ -29,38 +25,3 @@ var (
) )
// Fill with you ideas below. // Fill with you ideas below.
// GetRegion 获取省市编码对应的地区名称
func (dao *sysProvincesDao) GetRegion(ctx context.Context, province int64, city int64, spilt ...string) (string, error) {
var (
provinceName *gvar.Var
cityName *gvar.Var
err error
)
// 分隔符
spiltSymbol := "-"
if len(spilt) > 0 {
spiltSymbol = spilt[0]
}
if province > 0 && province < 999999 {
provinceName, err = dao.Ctx(ctx).Where("id", province).Fields("title").Value()
if err != nil {
err = gerror.Wrap(err, consts.ErrorORM)
return "", err
}
if city > 0 {
cityName, err = dao.Ctx(ctx).Where("id", city).Fields("title").Value()
if err != nil {
err = gerror.Wrap(err, consts.ErrorORM)
return "", err
}
}
} else {
return "内网IP", nil
}
return provinceName.String() + spiltSymbol + cityName.String(), nil
}

View File

@ -26,6 +26,7 @@ import (
"hotgo/utility/charset" "hotgo/utility/charset"
"hotgo/utility/simple" "hotgo/utility/simple"
"os" "os"
"strings"
) )
func Init(ctx context.Context) { func Init(ctx context.Context) {
@ -45,12 +46,12 @@ func Init(ctx context.Context) {
RootPtah, _ = os.Getwd() RootPtah, _ = os.Getwd()
fmt.Printf("欢迎使用HotGo\r\n当前运行环境%v, 运行根路径为:%v \r\nHotGo版本v%v, gf版本%v \n", SysType, RootPtah, consts.VersionApp, gf.VERSION) fmt.Printf("欢迎使用HotGo\r\n当前运行环境%v, 运行根路径为:%v \r\nHotGo版本v%v, gf版本%v \n", SysType, RootPtah, consts.VersionApp, gf.VERSION)
g.Log().SetHandlers(LoggingServeLogHandler)
setOrmCacheAdapter() setOrmCacheAdapter()
service.SysBlacklist().Load(ctx) service.SysBlacklist().Load(ctx)
g.Log().SetHandlers(LoggingServeLogHandler)
startMonitor(ctx) startMonitor(ctx)
hggen.InIt(ctx) hggen.InIt(ctx)
@ -61,13 +62,13 @@ func startMonitor(ctx context.Context) {
MonitorData.STartTime = gtime.Now() MonitorData.STartTime = gtime.Now()
intranetIP, err := location.GetLocalIP() intranetIP, err := location.GetLocalIP()
if err != nil { if err != nil {
g.Log().Warningf(ctx, "parse intranetIP err:%+v", err) g.Log().Infof(ctx, "parse intranetIP err:%+v", err)
} }
MonitorData.IntranetIP = intranetIP MonitorData.IntranetIP = intranetIP
publicIP, err := location.GetPublicIP(ctx) publicIP, err := location.GetPublicIP(ctx)
if err != nil { if err != nil {
g.Log().Warningf(ctx, "parse publicIP err:%+v", err) g.Log().Infof(ctx, "parse publicIP err:%+v", err)
} }
MonitorData.PublicIP = publicIP MonitorData.PublicIP = publicIP
}) })
@ -81,47 +82,59 @@ func setOrmCacheAdapter() {
func LoggingServeLogHandler(ctx context.Context, in *glog.HandlerInput) { func LoggingServeLogHandler(ctx context.Context, in *glog.HandlerInput) {
in.Next(ctx) in.Next(ctx)
conf, err := service.SysConfig().GetLoadServeLog(ctx) err := g.Try(ctx, func(ctx context.Context) {
if err != nil { var err error
return defer func() {
} if err != nil {
panic(err)
}
}()
conf, err := service.SysConfig().GetLoadServeLog(ctx)
if err != nil {
return
}
if conf == nil { if conf == nil {
return return
} }
if !conf.Switch { if !conf.Switch {
return return
} }
if in.LevelFormat == "" || !gstr.InArray(conf.LevelFormat, in.LevelFormat) { if in.LevelFormat == "" || !gstr.InArray(conf.LevelFormat, in.LevelFormat) {
return return
} }
var data entity.SysServeLog if in.Stack == "" {
data.TraceId = gctx.CtxId(ctx) in.Stack = in.Logger.GetStack(4) // 4是跳过当前方法如果调整本行位置需要重新调整skip
data.LevelFormat = in.LevelFormat }
data.Content = in.Content
data.Stack = gjson.New(charset.ParseStack(in.Stack))
data.Line = in.CallerPath
data.TriggerNs = in.Time.UnixNano()
data.Status = consts.StatusEnabled
if data.Stack.IsNil() { var data entity.SysServeLog
data.Stack = gjson.New(consts.NilJsonToString) data.TraceId = gctx.CtxId(ctx)
} data.LevelFormat = in.LevelFormat
data.Content = in.Content
data.Stack = gjson.New(charset.ParseStack(in.Stack))
data.Line = strings.TrimRight(in.CallerPath, ":")
data.TriggerNs = in.Time.UnixNano()
data.Status = consts.StatusEnabled
if gstr.Contains(in.Content, `exception recovered`) { if data.Stack.IsNil() {
data.LevelFormat = "PANI" data.Stack = gjson.New(consts.NilJsonToString)
} }
if conf.Queue { if gstr.Contains(in.Content, `exception recovered`) {
err = queue.Push(consts.QueueServeLogTopic, data) data.LevelFormat = "PANI"
} else { }
err = service.SysServeLog().RealWrite(ctx, data)
} if conf.Queue {
err = queue.Push(consts.QueueServeLogTopic, data)
} else {
err = service.SysServeLog().RealWrite(ctx, data)
}
})
if err != nil { if err != nil {
g.Log().Printf(ctx, "LoggingServeLogHandler err:%+v", err) g.Log("serveLog").Errorf(ctx, "LoggingServeLogHandler err:%+v", err)
} }
} }

View File

@ -33,7 +33,7 @@ func Generate(ctx context.Context) (id string, base64 string) {
// Fonts: []string{"chromohv.ttf"}, // Fonts: []string{"chromohv.ttf"},
//} //}
// //
driver := &base64Captcha.DriverMath{ driver := &base64Captcha.DriverMath{
Height: 42, Height: 42,
Width: 100, Width: 100,

View File

@ -50,6 +50,16 @@ func SetTakeUpTime(ctx context.Context, takeUpTime int64) {
Get(ctx).TakeUpTime = takeUpTime Get(ctx).TakeUpTime = takeUpTime
} }
// GetUser 获取用户信息
func GetUser(ctx context.Context) *model.Identity {
c := Get(ctx)
if c == nil {
return nil
}
return c.User
}
// GetUserId 获取用户ID // GetUserId 获取用户ID
func GetUserId(ctx context.Context) int64 { func GetUserId(ctx context.Context) int64 {
user := Get(ctx).User user := Get(ctx).User

View File

@ -7,7 +7,3 @@
package debris package debris
// 碎片 // 碎片
func Test() {
}

View File

@ -19,24 +19,6 @@ func Send(config *model.EmailConfig, to string, subject string, body string) err
return sendToMail(config, to, subject, body, "html") return sendToMail(config, to, subject, body, "html")
} }
// SendTestMail 发送测试邮件
func SendTestMail(config *model.EmailConfig, to string) error {
subject := "这是一封来自HotGo的测试邮件"
body := `
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="iso-8859-15">
<title>这是一封来自HotGo的测试邮件</title>
</head>
<body>
当你收到这封邮件的时候说明已经联调成功了恭喜你
</body>
</html>`
return Send(config, to, subject, body)
}
func sendToMail(config *model.EmailConfig, to, subject, body, mailType string) error { func sendToMail(config *model.EmailConfig, to, subject, body, mailType string) error {
if config == nil { if config == nil {

View File

@ -15,6 +15,7 @@ import (
"hotgo/internal/library/hggen/internal/cmd" "hotgo/internal/library/hggen/internal/cmd"
"hotgo/internal/library/hggen/internal/cmd/gendao" "hotgo/internal/library/hggen/internal/cmd/gendao"
"hotgo/internal/library/hggen/views" "hotgo/internal/library/hggen/views"
"hotgo/internal/model"
"hotgo/internal/model/input/form" "hotgo/internal/model/input/form"
"hotgo/internal/model/input/sysin" "hotgo/internal/model/input/sysin"
"hotgo/internal/service" "hotgo/internal/service"
@ -49,11 +50,33 @@ func TableColumns(ctx context.Context, in sysin.GenCodesColumnListInp) (fields [
func TableSelects(ctx context.Context, in sysin.GenCodesSelectsInp) (res *sysin.GenCodesSelectsModel, err error) { func TableSelects(ctx context.Context, in sysin.GenCodesSelectsInp) (res *sysin.GenCodesSelectsModel, err error) {
res = new(sysin.GenCodesSelectsModel) res = new(sysin.GenCodesSelectsModel)
for k, v := range consts.GenCodesTypeNameMap { for k, v := range consts.GenCodesTypeNameMap {
res.GenType = append(res.GenType, &form.Select{ row := &sysin.GenTypeSelect{
Value: k, Value: k,
Name: v, Name: v,
Label: v, Label: v,
}) Templates: make(form.Selects, 0),
}
confName, ok := consts.GenCodesTypeConfMap[k]
if ok {
var temps []*model.GenerateAppCrudTemplate
err = g.Cfg().MustGet(ctx, "hggen.application."+confName+".templates").Scan(&temps)
if err != nil {
return
}
if len(temps) > 0 {
for index, temp := range temps {
row.Templates = append(row.Templates, &form.Select{
Value: index,
Label: temp.Group,
Name: temp.Group,
})
}
sort.Sort(row.Templates)
}
}
res.GenType = append(res.GenType, row)
} }
sort.Sort(res.GenType) sort.Sort(res.GenType)
res.Db = DbSelect(ctx) res.Db = DbSelect(ctx)

View File

@ -61,7 +61,6 @@ func GetServiceConfig() genservice.CGenServiceInput {
} }
func GetDaoConfig(group string) gendao.CGenDaoInput { func GetDaoConfig(group string) gendao.CGenDaoInput {
inp := defaultGenDaoInput
find := func(group string) g.Map { find := func(group string) g.Map {
for _, v := range daoConfig { for _, v := range daoConfig {
if v.(g.Map)["group"].(string) == group { if v.(g.Map)["group"].(string) == group {
@ -72,9 +71,9 @@ func GetDaoConfig(group string) gendao.CGenDaoInput {
} }
v := find(group) v := find(group)
inp := defaultGenDaoInput
if v != nil { if v != nil {
err := gconv.Scan(v, &inp) if err := gconv.Scan(v, &inp); err != nil {
if err != nil {
panic(err) panic(err)
} }
} }

View File

@ -10,7 +10,7 @@ var (
) )
type cGen struct { type cGen struct {
g.Meta `name:"hggen" brief:"{cGenBrief}" dc:"{cGenDc}"` g.Meta `name:"gen" brief:"{cGenBrief}" dc:"{cGenDc}"`
cGenDao cGenDao
cGenPb cGenPb
cGenPbEntity cGenPbEntity
@ -20,9 +20,9 @@ type cGen struct {
const ( const (
cGenBrief = `automatically generate go files for dao/do/entity/pb/pbentity` cGenBrief = `automatically generate go files for dao/do/entity/pb/pbentity`
cGenDc = ` cGenDc = `
The "hggen" command is designed for multiple generating purposes. The "gen" command is designed for multiple generating purposes.
It's currently supporting generating go files for ORM models, protobuf and protobuf entity files. It's currently supporting generating go files for ORM models, protobuf and protobuf entity files.
Please use "gf hggen dao -h" for specified type help. Please use "gf gen dao -h" for specified type help.
` `
) )

View File

@ -44,22 +44,22 @@ type (
) )
const ( const (
cGenPbEntityConfig = `gfcli.hggen.pbentity` cGenPbEntityConfig = `gfcli.gen.pbentity`
cGenPbEntityBrief = `generate entity message files in protobuf3 format` cGenPbEntityBrief = `generate entity message files in protobuf3 format`
cGenPbEntityEg = ` cGenPbEntityEg = `
gf hggen pbentity gf gen pbentity
gf hggen pbentity -l "mysql:root:12345678@tcp(127.0.0.1:3306)/test" gf gen pbentity -l "mysql:root:12345678@tcp(127.0.0.1:3306)/test"
gf hggen pbentity -p ./protocol/demos/entity -t user,user_detail,user_login gf gen pbentity -p ./protocol/demos/entity -t user,user_detail,user_login
gf hggen pbentity -r user_ gf gen pbentity -r user_
` `
cGenPbEntityAd = ` cGenPbEntityAd = `
CONFIGURATION SUPPORT CONFIGURATION SUPPORT
Options are also supported by configuration file. Options are also supported by configuration file.
It's suggested using configuration file instead of command line arguments making producing. It's suggested using configuration file instead of command line arguments making producing.
The configuration node name is "gf.hggen.pbentity", which also supports multiple databases, for example(config.yaml): The configuration node name is "gf.gen.pbentity", which also supports multiple databases, for example(config.yaml):
gfcli: gfcli:
hggen: gen:
- pbentity: - pbentity:
link: "mysql:root:12345678@tcp(127.0.0.1:3306)/test" link: "mysql:root:12345678@tcp(127.0.0.1:3306)/test"
path: "protocol/demos/entity" path: "protocol/demos/entity"

View File

@ -18,23 +18,23 @@ import (
) )
const ( const (
CGenDaoConfig = `gfcli.hggen.dao` CGenDaoConfig = `gfcli.gen.dao`
CGenDaoUsage = `gf hggen dao [OPTION]` CGenDaoUsage = `gf gen dao [OPTION]`
CGenDaoBrief = `automatically generate go files for dao/do/entity` CGenDaoBrief = `automatically generate go files for dao/do/entity`
CGenDaoEg = ` CGenDaoEg = `
gf hggen dao gf gen dao
gf hggen dao -l "mysql:root:12345678@tcp(127.0.0.1:3306)/test" gf gen dao -l "mysql:root:12345678@tcp(127.0.0.1:3306)/test"
gf hggen dao -p ./model -g user-center -t user,user_detail,user_login gf gen dao -p ./model -g user-center -t user,user_detail,user_login
gf hggen dao -r user_ gf gen dao -r user_
` `
CGenDaoAd = ` CGenDaoAd = `
CONFIGURATION SUPPORT CONFIGURATION SUPPORT
Options are also supported by configuration file. Options are also supported by configuration file.
It's suggested using configuration file instead of command line arguments making producing. It's suggested using configuration file instead of command line arguments making producing.
The configuration node name is "gfcli.hggen.dao", which also supports multiple databases, for example(config.yaml): The configuration node name is "gfcli.gen.dao", which also supports multiple databases, for example(config.yaml):
gfcli: gfcli:
hggen: gen:
dao: dao:
- link: "mysql:root:12345678@tcp(127.0.0.1:3306)/test" - link: "mysql:root:12345678@tcp(127.0.0.1:3306)/test"
tables: "order,products" tables: "order,products"
@ -179,7 +179,6 @@ type (
) )
func (c CGenDao) Dao(ctx context.Context, in CGenDaoInput) (out *CGenDaoOutput, err error) { func (c CGenDao) Dao(ctx context.Context, in CGenDaoInput) (out *CGenDaoOutput, err error) {
g.Log().Warningf(ctx, "g.Cfg().Available(ctx):%v", g.Cfg().Available(ctx))
if g.Cfg().Available(ctx) { if g.Cfg().Available(ctx) {
v := g.Cfg().MustGet(ctx, CGenDaoConfig) v := g.Cfg().MustGet(ctx, CGenDaoConfig)
if v.IsSlice() { if v.IsSlice() {
@ -200,7 +199,7 @@ func DoGenDaoForArray(ctx context.Context, in CGenDaoInput) {
doGenDaoForArray(ctx, -1, in) doGenDaoForArray(ctx, -1, in)
} }
// doGenDaoForArray implements the "hggen dao" command for configuration array. // doGenDaoForArray implements the "gen dao" command for configuration array.
func doGenDaoForArray(ctx context.Context, index int, in CGenDaoInput) { func doGenDaoForArray(ctx context.Context, index int, in CGenDaoInput) {
var ( var (
err error err error

View File

@ -20,12 +20,12 @@ import (
) )
const ( const (
CGenServiceConfig = `gfcli.hggen.service` CGenServiceConfig = `gfcli.gen.service`
CGenServiceUsage = `gf hggen service [OPTION]` CGenServiceUsage = `gf gen service [OPTION]`
CGenServiceBrief = `parse struct and associated functions from packages to generate service go file` CGenServiceBrief = `parse struct and associated functions from packages to generate service go file`
CGenServiceEg = ` CGenServiceEg = `
gf hggen service gf gen service
gf hggen service -f Snake gf gen service -f Snake
` `
CGenServiceBriefSrcFolder = `source folder path to be parsed. default: internal/logic` CGenServiceBriefSrcFolder = `source folder path to be parsed. default: internal/logic`
CGenServiceBriefDstFolder = `destination folder path storing automatically generated go files. default: internal/service` CGenServiceBriefDstFolder = `destination folder path storing automatically generated go files. default: internal/service`
@ -89,13 +89,13 @@ const (
func (c CGenService) Service(ctx context.Context, in CGenServiceInput) (out *CGenServiceOutput, err error) { func (c CGenService) Service(ctx context.Context, in CGenServiceInput) (out *CGenServiceOutput, err error) {
// File lock to avoid multiple processes. // File lock to avoid multiple processes.
var ( var (
flockFilePath = gfile.Temp("gf.cli.hggen.service.lock") flockFilePath = gfile.Temp("gf.cli.gen.service.lock")
flockContent = gfile.GetContents(flockFilePath) flockContent = gfile.GetContents(flockFilePath)
) )
if flockContent != "" { if flockContent != "" {
if gtime.Timestamp()-gconv.Int64(flockContent) < genServiceFileLockSeconds { if gtime.Timestamp()-gconv.Int64(flockContent) < genServiceFileLockSeconds {
// If another "hggen service" process is running, it just exits. // If another "gen service" process is running, it just exits.
mlog.Debug(`another "hggen service" process is running, exit`) mlog.Debug(`another "gen service" process is running, exit`)
return return
} }
} }
@ -127,7 +127,7 @@ func (c CGenService) Service(ctx context.Context, in CGenServiceInput) (out *CGe
mlog.Debug("Chdir:", newWorkingDir) mlog.Debug("Chdir:", newWorkingDir)
_ = gfile.Remove(flockFilePath) _ = gfile.Remove(flockFilePath)
var command = fmt.Sprintf( var command = fmt.Sprintf(
`%s hggen service -packages=%s`, `%s gen service -packages=%s`,
gfile.SelfName(), gfile.Basename(watchFileDir), gfile.SelfName(), gfile.Basename(watchFileDir),
) )
err = gproc.ShellRun(ctx, command) err = gproc.ShellRun(ctx, command)

View File

@ -157,6 +157,11 @@ func setDefaultFormMode(field *sysin.GenCodesColumnListModel) {
return return
} }
if (field.GoName == "ProvinceId" || field.GoName == "CityId") && IsNumberType(field.GoType) {
field.FormMode = FormModeCitySelector
return
}
if field.DataType == "datetime" || field.DataType == "timestamp" || field.DataType == "timestamptz" { if field.DataType == "datetime" || field.DataType == "timestamp" || field.DataType == "timestamptz" {
field.FormMode = FormModeTime field.FormMode = FormModeTime
return return

View File

@ -115,6 +115,7 @@ const (
FormModeUploadFiles = "UploadFiles" // 多文件上传 FormModeUploadFiles = "UploadFiles" // 多文件上传
FormModeSwitch = "Switch" // 开关 FormModeSwitch = "Switch" // 开关
FormModeRate = "Rate" // 评分 FormModeRate = "Rate" // 评分
FormModeCitySelector = "CitySelector" // 省市区选择
) )
var FormModes = []string{ var FormModes = []string{
@ -124,6 +125,7 @@ var FormModes = []string{
FormModeUploadImage, FormModeUploadImages, FormModeUploadFile, FormModeUploadFiles, FormModeUploadImage, FormModeUploadImages, FormModeUploadFile, FormModeUploadFiles,
FormModeSwitch, FormModeSwitch,
FormModeRate, FormModeRate,
FormModeCitySelector,
} }
var FormModeMap = map[string]string{ var FormModeMap = map[string]string{
@ -146,6 +148,7 @@ var FormModeMap = map[string]string{
FormModeUploadFiles: "多文件上传", FormModeUploadFiles: "多文件上传",
FormModeSwitch: "开关", FormModeSwitch: "开关",
FormModeRate: "评分", FormModeRate: "评分",
FormModeCitySelector: "省市区选择",
} }
// 表单验证 // 表单验证

View File

@ -118,7 +118,16 @@ func (l *gCurd) initInput(ctx context.Context, in *CurdPreviewInput) (err error)
initStep(ctx, in) initStep(ctx, in)
in.options.dictMap = make(g.Map) in.options.dictMap = make(g.Map)
in.options.TemplateGroup = "sys"
if len(in.Config.Application.Crud.Templates)-1 < in.In.GenTemplate {
return gerror.New("没有找到生成模板的配置,请检查!")
}
err = checkCurdPath(in.Config.Application.Crud.Templates[in.In.GenTemplate])
if err != nil {
return
}
in.options.TemplateGroup = in.Config.Application.Crud.Templates[in.In.GenTemplate].MasterPackage
return return
} }
@ -137,14 +146,14 @@ func initStep(ctx context.Context, in *CurdPreviewInput) {
in.options.Step.HasMenu = gstr.InArray(in.options.AutoOps, "genMenuPermissions") in.options.Step.HasMenu = gstr.InArray(in.options.AutoOps, "genMenuPermissions")
} }
func (l *gCurd) loadView(ctx context.Context, in *CurdPreviewInput) error { func (l *gCurd) loadView(ctx context.Context, in *CurdPreviewInput) (err error) {
view := gview.New() view := gview.New()
err := view.SetConfigWithMap(g.Map{ err = view.SetConfigWithMap(g.Map{
"Paths": "./resource/template/generate/default/curd", "Paths": in.Config.Application.Crud.Templates[in.In.GenTemplate].TemplatePath,
"Delimiters": in.Config.Delimiters, "Delimiters": in.Config.Delimiters,
}) })
if err != nil { if err != nil {
return err return
} }
view.BindFuncMap(g.Map{ view.BindFuncMap(g.Map{
@ -156,7 +165,7 @@ func (l *gCurd) loadView(ctx context.Context, in *CurdPreviewInput) error {
dictOptions, err := l.generateWebModelDictOptions(ctx, in) dictOptions, err := l.generateWebModelDictOptions(ctx, in)
if err != nil { if err != nil {
return err return
} }
view.Assigns(gview.Params{ view.Assigns(gview.Params{
@ -174,13 +183,13 @@ func (l *gCurd) loadView(ctx context.Context, in *CurdPreviewInput) error {
"dictOptions": dictOptions, // web字典选项 "dictOptions": dictOptions, // web字典选项
}) })
in.view = view in.view = view
return nil return
} }
func (l *gCurd) DoBuild(ctx context.Context, in *CurdBuildInput) (err error) { func (l *gCurd) DoBuild(ctx context.Context, in *CurdBuildInput) (err error) {
preview, err := l.DoPreview(ctx, in.PreviewIn) preview, err := l.DoPreview(ctx, in.PreviewIn)
if err != nil { if err != nil {
return err return
} }
// 前置操作 // 前置操作
@ -307,7 +316,7 @@ func (l *gCurd) generateApiContent(ctx context.Context, in *CurdPreviewInput) (e
return err return err
} }
genFile.Path = file.MergeAbs(in.Config.Application.Crud.Templates[0].ApiPath, strings.ToLower(in.In.VarName), strings.ToLower(in.In.VarName)+".go") genFile.Path = file.MergeAbs(in.Config.Application.Crud.Templates[in.In.GenTemplate].ApiPath, strings.ToLower(in.In.VarName), strings.ToLower(in.In.VarName)+".go")
genFile.Meth = consts.GenCodesBuildMethCreate genFile.Meth = consts.GenCodesBuildMethCreate
if gfile.Exists(genFile.Path) { if gfile.Exists(genFile.Path) {
genFile.Meth = consts.GenCodesBuildMethSkip genFile.Meth = consts.GenCodesBuildMethSkip
@ -338,7 +347,7 @@ func (l *gCurd) generateInputContent(ctx context.Context, in *CurdPreviewInput)
if err != nil { if err != nil {
return err return err
} }
genFile.Path = file.MergeAbs(in.Config.Application.Crud.Templates[0].InputPath, convert.CamelCaseToUnderline(in.In.VarName)+".go") genFile.Path = file.MergeAbs(in.Config.Application.Crud.Templates[in.In.GenTemplate].InputPath, convert.CamelCaseToUnderline(in.In.VarName)+".go")
genFile.Meth = consts.GenCodesBuildMethCreate genFile.Meth = consts.GenCodesBuildMethCreate
if gfile.Exists(genFile.Path) { if gfile.Exists(genFile.Path) {
genFile.Meth = consts.GenCodesBuildMethSkip genFile.Meth = consts.GenCodesBuildMethSkip
@ -364,7 +373,7 @@ func (l *gCurd) generateControllerContent(ctx context.Context, in *CurdPreviewIn
if err != nil { if err != nil {
return err return err
} }
genFile.Path = file.MergeAbs(in.Config.Application.Crud.Templates[0].ControllerPath, convert.CamelCaseToUnderline(in.In.VarName)+".go") genFile.Path = file.MergeAbs(in.Config.Application.Crud.Templates[in.In.GenTemplate].ControllerPath, convert.CamelCaseToUnderline(in.In.VarName)+".go")
genFile.Meth = consts.GenCodesBuildMethCreate genFile.Meth = consts.GenCodesBuildMethCreate
if gfile.Exists(genFile.Path) { if gfile.Exists(genFile.Path) {
genFile.Meth = consts.GenCodesBuildMethSkip genFile.Meth = consts.GenCodesBuildMethSkip
@ -394,7 +403,7 @@ func (l *gCurd) generateLogicContent(ctx context.Context, in *CurdPreviewInput)
if err != nil { if err != nil {
return err return err
} }
genFile.Path = file.MergeAbs(in.Config.Application.Crud.Templates[0].LogicPath, convert.CamelCaseToUnderline(in.In.VarName)+".go") genFile.Path = file.MergeAbs(in.Config.Application.Crud.Templates[in.In.GenTemplate].LogicPath, convert.CamelCaseToUnderline(in.In.VarName)+".go")
genFile.Meth = consts.GenCodesBuildMethCreate genFile.Meth = consts.GenCodesBuildMethCreate
if gfile.Exists(genFile.Path) { if gfile.Exists(genFile.Path) {
genFile.Meth = consts.GenCodesBuildMethSkip genFile.Meth = consts.GenCodesBuildMethSkip
@ -420,7 +429,7 @@ func (l *gCurd) generateRouterContent(ctx context.Context, in *CurdPreviewInput)
return err return err
} }
genFile.Path = file.MergeAbs(in.Config.Application.Crud.Templates[0].RouterPath, convert.CamelCaseToUnderline(in.In.VarName)+".go") genFile.Path = file.MergeAbs(in.Config.Application.Crud.Templates[in.In.GenTemplate].RouterPath, convert.CamelCaseToUnderline(in.In.VarName)+".go")
genFile.Meth = consts.GenCodesBuildMethCreate genFile.Meth = consts.GenCodesBuildMethCreate
if gfile.Exists(genFile.Path) { if gfile.Exists(genFile.Path) {
genFile.Meth = consts.GenCodesBuildMethSkip genFile.Meth = consts.GenCodesBuildMethSkip
@ -446,7 +455,7 @@ func (l *gCurd) generateWebApiContent(ctx context.Context, in *CurdPreviewInput)
return err return err
} }
genFile.Path = file.MergeAbs(in.Config.Application.Crud.Templates[0].WebApiPath, gstr.LcFirst(in.In.VarName), "index.ts") genFile.Path = file.MergeAbs(in.Config.Application.Crud.Templates[in.In.GenTemplate].WebApiPath, gstr.LcFirst(in.In.VarName), "index.ts")
genFile.Meth = consts.GenCodesBuildMethCreate genFile.Meth = consts.GenCodesBuildMethCreate
if gfile.Exists(genFile.Path) { if gfile.Exists(genFile.Path) {
genFile.Meth = consts.GenCodesBuildMethSkip genFile.Meth = consts.GenCodesBuildMethSkip
@ -477,7 +486,7 @@ func (l *gCurd) generateWebModelContent(ctx context.Context, in *CurdPreviewInpu
return err return err
} }
genFile.Path = file.MergeAbs(in.Config.Application.Crud.Templates[0].WebViewsPath, gstr.LcFirst(in.In.VarName), "model.ts") genFile.Path = file.MergeAbs(in.Config.Application.Crud.Templates[in.In.GenTemplate].WebViewsPath, gstr.LcFirst(in.In.VarName), "model.ts")
genFile.Meth = consts.GenCodesBuildMethCreate genFile.Meth = consts.GenCodesBuildMethCreate
if gfile.Exists(genFile.Path) { if gfile.Exists(genFile.Path) {
genFile.Meth = consts.GenCodesBuildMethSkip genFile.Meth = consts.GenCodesBuildMethSkip
@ -507,7 +516,7 @@ func (l *gCurd) generateWebIndexContent(ctx context.Context, in *CurdPreviewInpu
return err return err
} }
genFile.Path = file.MergeAbs(in.Config.Application.Crud.Templates[0].WebViewsPath, gstr.LcFirst(in.In.VarName), "index.vue") genFile.Path = file.MergeAbs(in.Config.Application.Crud.Templates[in.In.GenTemplate].WebViewsPath, gstr.LcFirst(in.In.VarName), "index.vue")
genFile.Meth = consts.GenCodesBuildMethCreate genFile.Meth = consts.GenCodesBuildMethCreate
if gfile.Exists(genFile.Path) { if gfile.Exists(genFile.Path) {
genFile.Meth = consts.GenCodesBuildMethSkip genFile.Meth = consts.GenCodesBuildMethSkip
@ -538,7 +547,7 @@ func (l *gCurd) generateWebEditContent(ctx context.Context, in *CurdPreviewInput
return err return err
} }
genFile.Path = file.MergeAbs(in.Config.Application.Crud.Templates[0].WebViewsPath, gstr.LcFirst(in.In.VarName), "edit.vue") genFile.Path = file.MergeAbs(in.Config.Application.Crud.Templates[in.In.GenTemplate].WebViewsPath, gstr.LcFirst(in.In.VarName), "edit.vue")
genFile.Meth = consts.GenCodesBuildMethCreate genFile.Meth = consts.GenCodesBuildMethCreate
if gfile.Exists(genFile.Path) { if gfile.Exists(genFile.Path) {
genFile.Meth = consts.GenCodesBuildMethSkip genFile.Meth = consts.GenCodesBuildMethSkip
@ -573,7 +582,7 @@ func (l *gCurd) generateWebViewContent(ctx context.Context, in *CurdPreviewInput
return err return err
} }
genFile.Path = file.MergeAbs(in.Config.Application.Crud.Templates[0].WebViewsPath, gstr.LcFirst(in.In.VarName), "view.vue") genFile.Path = file.MergeAbs(in.Config.Application.Crud.Templates[in.In.GenTemplate].WebViewsPath, gstr.LcFirst(in.In.VarName), "view.vue")
genFile.Meth = consts.GenCodesBuildMethCreate genFile.Meth = consts.GenCodesBuildMethCreate
if gfile.Exists(genFile.Path) { if gfile.Exists(genFile.Path) {
genFile.Meth = consts.GenCodesBuildMethSkip genFile.Meth = consts.GenCodesBuildMethSkip
@ -609,7 +618,7 @@ func (l *gCurd) generateSqlContent(ctx context.Context, in *CurdPreviewInput) (e
tplData["mainComponent"] = "ParentLayout" //gstr.LcFirst(in.In.VarName) tplData["mainComponent"] = "ParentLayout" //gstr.LcFirst(in.In.VarName)
} }
genFile.Path = file.MergeAbs(in.Config.Application.Crud.Templates[0].SqlPath, convert.CamelCaseToUnderline(in.In.VarName)+"_menu.sql") genFile.Path = file.MergeAbs(in.Config.Application.Crud.Templates[in.In.GenTemplate].SqlPath, convert.CamelCaseToUnderline(in.In.VarName)+"_menu.sql")
genFile.Meth = consts.GenCodesBuildMethCreate genFile.Meth = consts.GenCodesBuildMethCreate
if gfile.Exists(genFile.Path) { if gfile.Exists(genFile.Path) {
genFile.Meth = consts.GenCodesBuildMethSkip genFile.Meth = consts.GenCodesBuildMethSkip

View File

@ -19,11 +19,13 @@ import (
const ( const (
LogicWhereComments = "\n\t// 查询%s\n" LogicWhereComments = "\n\t// 查询%s\n"
LogicWhereNoSupport = "\t// TODO 暂不支持生成[ %s ]查询方式,请自行补充此处代码!" LogicWhereNoSupport = "\t// TODO 暂不支持生成[ %s ]查询方式,请自行补充此处代码!"
LogicListSimpleSelect = "\tfields, err := hgorm.GenSelect(ctx, sysin.%sListModel{}, dao.%s)\n\tif err != nil {\n\t\treturn nil, 0, err\n\t}" LogicListSimpleSelect = "\tfields, err := hgorm.GenSelect(ctx, sysin.%sListModel{}, dao.%s)\n\tif err != nil {\n\t\treturn\n\t}"
LogicListJoinSelect = "\t//关联表select\n\tfields, err := hgorm.GenJoinSelect(ctx, %sin.%sListModel{}, dao.%s, []*hgorm.Join{\n%v\t})" LogicListJoinSelect = "\t//关联表select\n\tfields, err := hgorm.GenJoinSelect(ctx, %sin.%sListModel{}, dao.%s, []*hgorm.Join{\n%v\t})"
LogicListJoinOnRelation = "\t// 关联表%s\n\tmod = mod.%s(hgorm.GenJoinOnRelation(\n\t\tdao.%s.Table(), dao.%s.Columns().%s, // 主表表名,关联条件\n\t\tdao.%s.Table(), \"%s\", dao.%s.Columns().%s, // 关联表表名,别名,关联条件\n\t)...)\n\n" LogicListJoinOnRelation = "\t// 关联表%s\n\tmod = mod.%s(hgorm.GenJoinOnRelation(\n\t\tdao.%s.Table(), dao.%s.Columns().%s, // 主表表名,关联条件\n\t\tdao.%s.Table(), \"%s\", dao.%s.Columns().%s, // 关联表表名,别名,关联条件\n\t)...)\n\n"
LogicEditUpdate = "\t\t_, err = dao.%s.Ctx(ctx).\n\t\t\tFieldsEx(\n%s\t\t\t).\n\t\t\tWhere(dao.%s.Columns().%s, in.%s).Data(in).Update()\n\t\tif err != nil {\n\t\t\terr = gerror.Wrap(err, consts.ErrorORM)\n\t\t\treturn err\n\t\t}\n\t\treturn nil" LogicEditUpdate = "\t\t_, err = s.Model(ctx).\n\t\t\tFieldsEx(\n%s\t\t\t).\n\t\t\tWhere(dao.%s.Columns().%s, in.%s).Data(in).Update()\n\t\treturn "
LogicEditInsert = "\t_, err = dao.%s.Ctx(ctx).\n\t\tFieldsEx(\n%s\t\t).\n\t\tData(in).Insert()\n\tif err != nil {\n\t\terr = gerror.Wrap(err, consts.ErrorORM)\n\t\treturn err\n\t}" LogicEditInsert = "\t_, err = s.Model(ctx, &handler.Option{FilterAuth: false}).\n\t\tFieldsEx(\n%s\t\t).\n\t\tData(in).Insert()"
LogicSwitchUpdate = "g.Map{\n\t\tin.Key: in.Value,\n%s}"
LogicStatusUpdate = "g.Map{\n\t\tdao.%s.Columns().Status: in.Status,\n%s}"
) )
func (l *gCurd) logicTplData(ctx context.Context, in *CurdPreviewInput) (data g.Map, err error) { func (l *gCurd) logicTplData(ctx context.Context, in *CurdPreviewInput) (data g.Map, err error) {
@ -33,9 +35,35 @@ func (l *gCurd) logicTplData(ctx context.Context, in *CurdPreviewInput) (data g.
data["listOrder"] = l.generateLogicListOrder(ctx, in) data["listOrder"] = l.generateLogicListOrder(ctx, in)
data["edit"] = l.generateLogicEdit(ctx, in) data["edit"] = l.generateLogicEdit(ctx, in)
data["switchFields"] = l.generateLogicSwitchFields(ctx, in) data["switchFields"] = l.generateLogicSwitchFields(ctx, in)
data["switchUpdate"] = l.generateLogicSwitchUpdate(ctx, in)
data["statusUpdate"] = l.generateLogicStatusUpdate(ctx, in)
return return
} }
func (l *gCurd) generateLogicStatusUpdate(ctx context.Context, in *CurdPreviewInput) string {
var update string
for _, field := range in.masterFields {
if field.GoName == "UpdatedBy" {
update += "\t\tdao." + in.In.DaoName + ".Columns().UpdatedBy: contexts.GetUserId(ctx),\n"
}
}
update += "\t"
return fmt.Sprintf(LogicStatusUpdate, in.In.DaoName, update)
}
func (l *gCurd) generateLogicSwitchUpdate(ctx context.Context, in *CurdPreviewInput) string {
var update string
for _, field := range in.masterFields {
if field.GoName == "UpdatedBy" {
update += "\t\tdao." + in.In.DaoName + ".Columns().UpdatedBy: contexts.GetUserId(ctx),\n"
}
}
update += "\t"
return fmt.Sprintf(LogicSwitchUpdate, update)
}
func (l *gCurd) generateLogicSwitchFields(ctx context.Context, in *CurdPreviewInput) string { func (l *gCurd) generateLogicSwitchFields(ctx context.Context, in *CurdPreviewInput) string {
buffer := bytes.NewBuffer(nil) buffer := bytes.NewBuffer(nil)
if in.options.Step.HasSwitch { if in.options.Step.HasSwitch {
@ -71,8 +99,8 @@ func (l *gCurd) generateLogicEdit(ctx context.Context, in *CurdPreviewInput) g.M
} }
} }
updateBuffer.WriteString(fmt.Sprintf(LogicEditUpdate, in.In.DaoName, updateFieldsEx, in.In.DaoName, in.pk.GoName, in.pk.GoName)) updateBuffer.WriteString(fmt.Sprintf(LogicEditUpdate, updateFieldsEx, in.In.DaoName, in.pk.GoName, in.pk.GoName))
insertBuffer.WriteString(fmt.Sprintf(LogicEditInsert, in.In.DaoName, insertFieldsEx)) insertBuffer.WriteString(fmt.Sprintf(LogicEditInsert, insertFieldsEx))
data["update"] = updateBuffer.String() data["update"] = updateBuffer.String()
data["insert"] = insertBuffer.String() data["insert"] = insertBuffer.String()

View File

@ -34,7 +34,7 @@ func (l *gCurd) generateWebEditFormItem(ctx context.Context, in *CurdPreviewInpu
} }
var ( var (
defaultComponent = fmt.Sprintf("<n-form-item label=\"%s\" path=\"%s\">\n <n-input placeholder=\"请输入%s\" v-model:value=\"params.%s\" />\n </n-form-item>", field.Dc, field.TsName, field.Dc, field.TsName) defaultComponent = fmt.Sprintf("<n-form-item label=\"%s\" path=\"%s\">\n <n-input placeholder=\"请输入%s\" v-model:value=\"params.%s\" />\n </n-form-item>", field.Dc, field.TsName, field.Dc, field.TsName)
component string component string
) )
@ -43,65 +43,68 @@ func (l *gCurd) generateWebEditFormItem(ctx context.Context, in *CurdPreviewInpu
component = defaultComponent component = defaultComponent
case FormModeInputNumber: case FormModeInputNumber:
component = fmt.Sprintf("<n-form-item label=\"%s\" path=\"%s\">\n <n-input-number placeholder=\"请输入%s\" v-model:value=\"params.%s\" />\n </n-form-item>", field.Dc, field.TsName, field.Dc, field.TsName) component = fmt.Sprintf("<n-form-item label=\"%s\" path=\"%s\">\n <n-input-number placeholder=\"请输入%s\" v-model:value=\"params.%s\" />\n </n-form-item>", field.Dc, field.TsName, field.Dc, field.TsName)
case FormModeInputTextarea: case FormModeInputTextarea:
component = fmt.Sprintf("<n-form-item label=\"%s\" path=\"%s\">\n <n-input type=\"textarea\" placeholder=\"%s\" v-model:value=\"params.%s\" />\n </n-form-item>", field.Dc, field.TsName, field.Dc, field.TsName) component = fmt.Sprintf("<n-form-item label=\"%s\" path=\"%s\">\n <n-input type=\"textarea\" placeholder=\"%s\" v-model:value=\"params.%s\" />\n </n-form-item>", field.Dc, field.TsName, field.Dc, field.TsName)
case FormModeInputEditor: case FormModeInputEditor:
component = fmt.Sprintf("<n-form-item label=\"%s\" path=\"%s\">\n <Editor style=\"height: 450px\" v-model:value=\"params.%s\" />\n </n-form-item>", field.Dc, field.TsName, field.TsName) component = fmt.Sprintf("<n-form-item label=\"%s\" path=\"%s\">\n <Editor style=\"height: 450px\" v-model:value=\"params.%s\" />\n </n-form-item>", field.Dc, field.TsName, field.TsName)
case FormModeInputDynamic: case FormModeInputDynamic:
component = fmt.Sprintf("<n-form-item label=\"%s\" path=\"%s\">\n <n-dynamic-input\n v-model:value=\"params.%s\"\n preset=\"pair\"\n key-placeholder=\"键名\"\n value-placeholder=\"键值\"\n />\n </n-form-item>", field.Dc, field.TsName, field.TsName) component = fmt.Sprintf("<n-form-item label=\"%s\" path=\"%s\">\n <n-dynamic-input\n v-model:value=\"params.%s\"\n preset=\"pair\"\n key-placeholder=\"键名\"\n value-placeholder=\"键值\"\n />\n </n-form-item>", field.Dc, field.TsName, field.TsName)
case FormModeDate: case FormModeDate:
component = fmt.Sprintf("<n-form-item label=\"%s\" path=\"%s\">\n <DatePicker v-model:formValue=\"params.%s\" type=\"date\" />\n </n-form-item>", field.Dc, field.TsName, field.TsName) component = fmt.Sprintf("<n-form-item label=\"%s\" path=\"%s\">\n <DatePicker v-model:formValue=\"params.%s\" type=\"date\" />\n </n-form-item>", field.Dc, field.TsName, field.TsName)
//case FormModeDateRange: // 必须要有两个字段,后面优化下 //case FormModeDateRange: // 必须要有两个字段,后面优化下
case FormModeTime: case FormModeTime:
component = fmt.Sprintf("<n-form-item label=\"%s\" path=\"%s\">\n <DatePicker v-model:formValue=\"params.%s\" type=\"datetime\" />\n </n-form-item>", field.Dc, field.TsName, field.TsName) component = fmt.Sprintf("<n-form-item label=\"%s\" path=\"%s\">\n <DatePicker v-model:formValue=\"params.%s\" type=\"datetime\" />\n </n-form-item>", field.Dc, field.TsName, field.TsName)
//case FormModeTimeRange: // 必须要有两个字段,后面优化下 //case FormModeTimeRange: // 必须要有两个字段,后面优化下
case FormModeRadio: case FormModeRadio:
component = fmt.Sprintf("<n-form-item label=\"%s\" path=\"%s\">\n <n-radio-group v-model:value=\"params.%s\" name=\"%s\">\n <n-radio-button\n v-for=\"%s in options.%s\"\n :key=\"%s.value\"\n :value=\"%s.value\"\n :label=\"%s.label\"\n />\n </n-radio-group>\n </n-form-item>", field.Dc, field.TsName, field.TsName, field.TsName, field.TsName, in.options.dictMap[field.TsName], field.TsName, field.TsName, field.TsName) component = fmt.Sprintf("<n-form-item label=\"%s\" path=\"%s\">\n <n-radio-group v-model:value=\"params.%s\" name=\"%s\">\n <n-radio-button\n v-for=\"%s in options.%s\"\n :key=\"%s.value\"\n :value=\"%s.value\"\n :label=\"%s.label\"\n />\n </n-radio-group>\n </n-form-item>", field.Dc, field.TsName, field.TsName, field.TsName, field.TsName, in.options.dictMap[field.TsName], field.TsName, field.TsName, field.TsName)
case FormModeCheckbox: case FormModeCheckbox:
component = fmt.Sprintf("<n-form-item label=\"%s\" path=\"%s\">\n <n-checkbox-group v-model:value=\"params.%s\">\n <n-space>\n <n-checkbox\n v-for=\"item in options.%s\"\n :key=\"item.value\"\n :value=\"item.value\"\n :label=\"item.label\"\n />\n </n-space>\n </n-checkbox-group>\n </n-form-item>", field.Dc, field.TsName, field.TsName, in.options.dictMap[field.TsName]) component = fmt.Sprintf("<n-form-item label=\"%s\" path=\"%s\">\n <n-checkbox-group v-model:value=\"params.%s\">\n <n-space>\n <n-checkbox\n v-for=\"item in options.%s\"\n :key=\"item.value\"\n :value=\"item.value\"\n :label=\"item.label\"\n />\n </n-space>\n </n-checkbox-group>\n </n-form-item>", field.Dc, field.TsName, field.TsName, in.options.dictMap[field.TsName])
case FormModeSelect: case FormModeSelect:
component = fmt.Sprintf("<n-form-item label=\"%s\" path=\"%s\">\n <n-select v-model:value=\"params.%s\" :options=\"options.%s\" />\n </n-form-item>", field.Dc, field.TsName, field.TsName, in.options.dictMap[field.TsName]) component = fmt.Sprintf("<n-form-item label=\"%s\" path=\"%s\">\n <n-select v-model:value=\"params.%s\" :options=\"options.%s\" />\n </n-form-item>", field.Dc, field.TsName, field.TsName, in.options.dictMap[field.TsName])
case FormModeSelectMultiple: case FormModeSelectMultiple:
component = fmt.Sprintf("<n-form-item label=\"%s\" path=\"%s\">\n <n-select multiple v-model:value=\"params.%s\" :options=\"options.%s\" />\n </n-form-item>", field.Dc, field.TsName, field.TsName, in.options.dictMap[field.TsName]) component = fmt.Sprintf("<n-form-item label=\"%s\" path=\"%s\">\n <n-select multiple v-model:value=\"params.%s\" :options=\"options.%s\" />\n </n-form-item>", field.Dc, field.TsName, field.TsName, in.options.dictMap[field.TsName])
case FormModeUploadImage: case FormModeUploadImage:
component = fmt.Sprintf("<n-form-item label=\"%s\" path=\"%s\">\n <UploadImage :maxNumber=\"1\" v-model:value=\"params.%s\" />\n </n-form-item>", field.Dc, field.TsName, field.TsName) component = fmt.Sprintf("<n-form-item label=\"%s\" path=\"%s\">\n <UploadImage :maxNumber=\"1\" v-model:value=\"params.%s\" />\n </n-form-item>", field.Dc, field.TsName, field.TsName)
case FormModeUploadImages: case FormModeUploadImages:
component = fmt.Sprintf("<n-form-item label=\"%s\" path=\"%s\">\n <UploadImage :maxNumber=\"10\" v-model:value=\"params.%s\" />\n </n-form-item>", field.Dc, field.TsName, field.TsName) component = fmt.Sprintf("<n-form-item label=\"%s\" path=\"%s\">\n <UploadImage :maxNumber=\"10\" v-model:value=\"params.%s\" />\n </n-form-item>", field.Dc, field.TsName, field.TsName)
case FormModeUploadFile: case FormModeUploadFile:
component = fmt.Sprintf("<n-form-item label=\"%s\" path=\"%s\">\n <UploadFile :maxNumber=\"1\" v-model:value=\"params.%s\" />\n </n-form-item>", field.Dc, field.TsName, field.TsName) component = fmt.Sprintf("<n-form-item label=\"%s\" path=\"%s\">\n <UploadFile :maxNumber=\"1\" v-model:value=\"params.%s\" />\n </n-form-item>", field.Dc, field.TsName, field.TsName)
case FormModeUploadFiles: case FormModeUploadFiles:
component = fmt.Sprintf("<n-form-item label=\"%s\" path=\"%s\">\n <UploadFile :maxNumber=\"10\" v-model:value=\"params.%s\" />\n </n-form-item>", field.Dc, field.TsName, field.TsName) component = fmt.Sprintf("<n-form-item label=\"%s\" path=\"%s\">\n <UploadFile :maxNumber=\"10\" v-model:value=\"params.%s\" />\n </n-form-item>", field.Dc, field.TsName, field.TsName)
case FormModeSwitch: case FormModeSwitch:
component = fmt.Sprintf("<n-form-item label=\"%s\" path=\"%s\">\n <n-switch v-model:value=\"params.%s\"\n />\n </n-form-item>", field.Dc, field.TsName, field.TsName) component = fmt.Sprintf("<n-form-item label=\"%s\" path=\"%s\">\n <n-switch :unchecked-value=\"2\" :checked-value=\"1\" v-model:value=\"params.%s\"\n />\n </n-form-item>", field.Dc, field.TsName, field.TsName)
case FormModeRate: case FormModeRate:
component = fmt.Sprintf("<n-form-item label=\"%s\" path=\"%s\">\n <n-rate allow-half :default-value=\"params.%s\" :on-update:value=\"update%s\" />\n </n-form-item>", field.Dc, field.TsName, field.TsName, field.GoName) component = fmt.Sprintf("<n-form-item label=\"%s\" path=\"%s\">\n <n-rate allow-half :default-value=\"params.%s\" :on-update:value=\"update%s\" />\n </n-form-item>", field.Dc, field.TsName, field.TsName, field.GoName)
case FormModeCitySelector:
component = fmt.Sprintf("<n-form-item label=\"%s\" path=\"%s\">\n <CitySelector v-model:value=\"params.%s\" />\n </n-form-item>", field.Dc, field.TsName, field.TsName)
default: default:
component = defaultComponent component = defaultComponent
} }
if len(in.masterFields) == k { if len(in.masterFields) == k {
buffer.WriteString(" " + component) buffer.WriteString(" " + component)
} else { } else {
buffer.WriteString(" " + component + "\n\n") buffer.WriteString(" " + component + "\n\n")
} }
} }
@ -117,11 +120,12 @@ func (l *gCurd) generateWebEditScript(ctx context.Context, in *CurdPreviewInput)
if in.options.Step.HasMaxSort { if in.options.Step.HasMaxSort {
importBuffer.WriteString(" import { onMounted, ref, computed, watch } from 'vue';\n") importBuffer.WriteString(" import { onMounted, ref, computed, watch } from 'vue';\n")
importBuffer.WriteString(" import { Edit, MaxSort } from '@/api/" + gstr.LcFirst(in.In.VarName) + "';\n") importBuffer.WriteString(" import { Edit, MaxSort, View } from '@/api/" + gstr.LcFirst(in.In.VarName) + "';\n")
setupBuffer.WriteString(" watch(\n () => params.value,\n (value) => {\n if (value.id === 0) {\n MaxSort().then((res) => {\n params.value.sort = res.sort;\n });\n }\n }\n );\n\n") setupBuffer.WriteString(" function loadForm(value) {\n loading.value = true;\n\n // 新增\n if (value.id < 1) {\n params.value = newState(value);\n MaxSort()\n .then((res) => {\n params.value.sort = res.sort;\n })\n .finally(() => {\n loading.value = false;\n });\n return;\n }\n\n // 编辑\n View({ id: value.id })\n .then((res) => {\n params.value = res;\n })\n .finally(() => {\n loading.value = false;\n });\n }\n\n watch(\n () => props.formParams,\n (value) => {\n loadForm(value);\n }\n );")
} else { } else {
importBuffer.WriteString(" import { onMounted, ref, computed } from 'vue';\n") importBuffer.WriteString(" import { onMounted, ref, computed } from 'vue';\n")
importBuffer.WriteString(" import { Edit } from '@/api/" + gstr.LcFirst(in.In.VarName) + "';\n") importBuffer.WriteString(" import { Edit, View } from '@/api/" + gstr.LcFirst(in.In.VarName) + "';\n")
setupBuffer.WriteString(" function loadForm(value) {\n // 新增\n if (value.id < 1) {\n params.value = newState(value);\n loading.value = false;\n return;\n }\n\n loading.value = true;\n // 编辑\n View({ id: value.id })\n .then((res) => {\n params.value = res;\n })\n .finally(() => {\n loading.value = false;\n });\n }\n\n watch(\n () => props.formParams,\n (value) => {\n loadForm(value);\n }\n );")
} }
for _, field := range in.masterFields { for _, field := range in.masterFields {
@ -147,12 +151,15 @@ func (l *gCurd) generateWebEditScript(ctx context.Context, in *CurdPreviewInput)
} }
case FormModeRate: case FormModeRate:
setupBuffer.WriteString(fmt.Sprintf(" function update%s(num) {\n params.value.%s = num;\n }\n", field.GoName, field.TsName)) setupBuffer.WriteString(fmt.Sprintf(" function update%s(num) {\n params.value.%s = num;\n }\n", field.GoName, field.TsName))
case FormModeCitySelector:
if !gstr.Contains(importBuffer.String(), `import CitySelector`) {
importBuffer.WriteString(" import CitySelector from '@/components/CitySelector/citySelector.vue';\n")
}
} }
} }
data["import"] = importBuffer.String() data["import"] = importBuffer.String()
data["setup"] = setupBuffer.String() data["setup"] = setupBuffer.String()
return data return data
} }

View File

@ -1,4 +1,4 @@
// Package hggen // Package views
// @Link https://github.com/bufanyun/hotgo // @Link https://github.com/bufanyun/hotgo
// @Copyright Copyright (c) 2022 HotGo CLI // @Copyright Copyright (c) 2022 HotGo CLI
// @Author Ms <133814250@qq.com> // @Author Ms <133814250@qq.com>
@ -8,9 +8,12 @@ package views
import ( import (
"context" "context"
"github.com/gogf/gf/v2/errors/gerror"
"github.com/gogf/gf/v2/frame/g" "github.com/gogf/gf/v2/frame/g"
"github.com/gogf/gf/v2/os/gfile"
"github.com/gogf/gf/v2/text/gstr" "github.com/gogf/gf/v2/text/gstr"
"hotgo/internal/consts" "hotgo/internal/consts"
"hotgo/internal/model"
"hotgo/internal/model/input/sysin" "hotgo/internal/model/input/sysin"
"io/ioutil" "io/ioutil"
"strings" "strings"
@ -94,3 +97,41 @@ func ImportSql(ctx context.Context, path string) error {
return nil return nil
} }
func checkCurdPath(temp *model.GenerateAppCrudTemplate) (err error) {
if temp == nil {
return gerror.New("生成模板配置不能为空")
}
tip := `生成模板配置参数'%s'路径不存在,请先创建路径`
if !gfile.Exists(temp.TemplatePath) {
return gerror.Newf(tip, "TemplatePath")
}
if !gfile.Exists(temp.ApiPath) {
return gerror.Newf(tip, "ApiPath")
}
if !gfile.Exists(temp.InputPath) {
return gerror.Newf(tip, "InputPath")
}
if !gfile.Exists(temp.ControllerPath) {
return gerror.Newf(tip, "ControllerPath")
}
if !gfile.Exists(temp.LogicPath) {
return gerror.Newf(tip, "LogicPath")
}
if !gfile.Exists(temp.RouterPath) {
return gerror.Newf(tip, "RouterPath")
}
if !gfile.Exists(temp.SqlPath) {
return gerror.Newf(tip, "SqlPath")
}
if !gfile.Exists(temp.WebApiPath) {
return gerror.Newf(tip, "WebApiPath")
}
if !gfile.Exists(temp.WebViewsPath) {
return gerror.Newf(tip, "WebViewsPath")
}
return
}

View File

@ -19,15 +19,6 @@ import (
"hotgo/utility/tree" "hotgo/utility/tree"
) )
// GenJoinOnRelation 生成关联表关联条件
func GenJoinOnRelation(masterTable, masterField, joinTable, alias, onField string) []string {
return []string{
joinTable,
alias,
fmt.Sprintf("`%s`.`%s` = `%s`.`%s`", alias, onField, masterTable, masterField),
}
}
type daoInstance interface { type daoInstance interface {
Table() string Table() string
Ctx(ctx context.Context) *gdb.Model Ctx(ctx context.Context) *gdb.Model
@ -40,6 +31,15 @@ type Join struct {
fields map[string]*gdb.TableField // 表字段列表 fields map[string]*gdb.TableField // 表字段列表
} }
// GenJoinOnRelation 生成关联表关联条件
func GenJoinOnRelation(masterTable, masterField, joinTable, alias, onField string) []string {
return []string{
joinTable,
alias,
fmt.Sprintf("`%s`.`%s` = `%s`.`%s`", alias, onField, masterTable, masterField),
}
}
// GenJoinSelect 生成关联表select // GenJoinSelect 生成关联表select
// 这里会将实体中的字段驼峰转为下划线于数据库进行匹配,意味着数据库字段必须全部是小写字母+下划线的格式 // 这里会将实体中的字段驼峰转为下划线于数据库进行匹配,意味着数据库字段必须全部是小写字母+下划线的格式
func GenJoinSelect(ctx context.Context, entity interface{}, masterDao interface{}, joins []*Join) (allFields string, err error) { func GenJoinSelect(ctx context.Context, entity interface{}, masterDao interface{}, joins []*Join) (allFields string, err error) {

View File

@ -1,14 +1,6 @@
// Package hgorm package handler
// @Link https://github.com/bufanyun/hotgo
// @Copyright Copyright (c) 2022 HotGo CLI
// @Author Ms <133814250@qq.com>
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
//
package hgorm
// 预处理
import ( import (
"fmt"
"github.com/gogf/gf/v2/database/gdb" "github.com/gogf/gf/v2/database/gdb"
"github.com/gogf/gf/v2/frame/g" "github.com/gogf/gf/v2/frame/g"
"github.com/gogf/gf/v2/text/gstr" "github.com/gogf/gf/v2/text/gstr"
@ -18,22 +10,15 @@ import (
"hotgo/utility/tree" "hotgo/utility/tree"
) )
// HandlerFilterAuth 过滤数据权限 // FilterAuth 过滤数据权限
// 通过上下文中的用户角色权限和表中是否含有需要过滤的字段附加查询条件 // 通过上下文中的用户角色权限和表中是否含有需要过滤的字段附加查询条件
func HandlerFilterAuth(m *gdb.Model) *gdb.Model { func FilterAuth(m *gdb.Model) *gdb.Model {
var ( var (
needAuth bool needAuth bool
filterField string filterField string
role *entity.AdminRole
ctx = m.GetCtx()
fields = escapeFieldsToSlice(m.GetFieldsStr()) fields = escapeFieldsToSlice(m.GetFieldsStr())
co = contexts.Get(ctx)
) )
if co == nil || co.User == nil {
return m
}
// 优先级created_by > member_id // 优先级created_by > member_id
if gstr.InArray(fields, "created_by") { if gstr.InArray(fields, "created_by") {
needAuth = true needAuth = true
@ -49,43 +34,54 @@ func HandlerFilterAuth(m *gdb.Model) *gdb.Model {
return m return m
} }
err := g.Model("admin_role").Where("id", co.User.RoleId).Scan(&role) return m.Handler(FilterAuthWithField(filterField))
if err != nil {
panic(fmt.Sprintf("failed to role information err:%+v", err))
}
if role == nil {
panic("failed to role information roleModel == nil")
}
sq := g.Model("admin_member").Fields("id")
switch role.DataScope {
case consts.RoleDataAll: // 全部权限
// ...
case consts.RoleDataNowDept: // 当前部门
m = m.WhereIn(filterField, sq.Where("dept_id", co.User.DeptId))
case consts.RoleDataDeptAndSub: // 当前部门及以下部门
m = m.WhereIn(filterField, sq.WhereIn("dept_id", GetDeptAndSub(co.User.DeptId)))
case consts.RoleDataDeptCustom: // 自定义部门
m = m.WhereIn(filterField, sq.WhereIn("dept_id", role.CustomDept.Var().Ints()))
case consts.RoleDataSelf: // 仅自己
m = m.Where(filterField, co.User.Id)
case consts.RoleDataSelfAndSub: // 自己和直属下级
m = m.WhereIn(filterField, GetSelfAndSub(co.User.Id))
case consts.RoleDataSelfAndAllSub: // 自己和全部下级
m = m.WhereIn(filterField, GetSelfAndAllSub(co.User.Id))
default:
panic("dataScope is not registered")
}
return m
} }
// HandlerForceCache 强制缓存 // FilterAuthWithField 过滤数据权限,设置指定字段
func HandlerForceCache(m *gdb.Model) *gdb.Model { func FilterAuthWithField(filterField string) func(m *gdb.Model) *gdb.Model {
return m.Cache(gdb.CacheOption{Duration: -1, Force: true}) return func(m *gdb.Model) *gdb.Model {
var (
role *entity.AdminRole
ctx = m.GetCtx()
co = contexts.Get(ctx)
)
if co == nil || co.User == nil {
return m
}
err := g.Model("admin_role").Where("id", co.User.RoleId).Scan(&role)
if err != nil {
g.Log().Fatalf(ctx, "failed to role information err:%+v", err)
}
if role == nil {
g.Log().Fatalf(ctx, "failed to role information roleModel == nil")
}
sq := g.Model("admin_member").Fields("id")
switch role.DataScope {
case consts.RoleDataAll: // 全部权限
// ...
case consts.RoleDataNowDept: // 当前部门
m = m.WhereIn(filterField, sq.Where("dept_id", co.User.DeptId))
case consts.RoleDataDeptAndSub: // 当前部门及以下部门
m = m.WhereIn(filterField, sq.WhereIn("dept_id", GetDeptAndSub(co.User.DeptId)))
case consts.RoleDataDeptCustom: // 自定义部门
m = m.WhereIn(filterField, sq.WhereIn("dept_id", role.CustomDept.Var().Ints()))
case consts.RoleDataSelf: // 仅自己
m = m.Where(filterField, co.User.Id)
case consts.RoleDataSelfAndSub: // 自己和直属下级
m = m.WhereIn(filterField, GetSelfAndSub(co.User.Id))
case consts.RoleDataSelfAndAllSub: // 自己和全部下级
m = m.WhereIn(filterField, GetSelfAndAllSub(co.User.Id))
default:
g.Log().Fatalf(ctx, "dataScope is not registered")
}
return m
}
} }
// escapeFieldsToSlice 将转义过的字段转换为字段集切片 // escapeFieldsToSlice 将转义过的字段转换为字段集切片

View File

@ -0,0 +1,8 @@
package handler
import "github.com/gogf/gf/v2/database/gdb"
// ForceCache 强制缓存
func ForceCache(m *gdb.Model) *gdb.Model {
return m.Cache(gdb.CacheOption{Duration: -1, Force: true})
}

View File

@ -0,0 +1,39 @@
// Package handler
// @Link https://github.com/bufanyun/hotgo
// @Copyright Copyright (c) 2022 HotGo CLI
// @Author Ms <133814250@qq.com>
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
//
package handler
// handler.
import (
"github.com/gogf/gf/v2/database/gdb"
)
// Option 预处理选项
type Option struct {
FilterAuth bool // 过滤权限
ForceCache bool // 强制缓存
}
// DefaultOption 默认预处理选项
var DefaultOption = &Option{
FilterAuth: true,
}
func Model(m *gdb.Model, opt ...*Option) *gdb.Model {
var option *Option
if len(opt) > 0 {
option = opt[0]
} else {
option = DefaultOption
}
if option.FilterAuth {
m = m.Handler(FilterAuth)
}
if option.ForceCache {
m = m.Handler(ForceCache)
}
return m
}

View File

@ -1,9 +0,0 @@
// Package hgorm
// @Link https://github.com/bufanyun/hotgo
// @Copyright Copyright (c) 2022 HotGo CLI
// @Author Ms <133814250@qq.com>
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
//
package hgorm
// 常用钩子

View File

@ -0,0 +1,3 @@
package hook
// hook.

View File

@ -0,0 +1,58 @@
package hook
import (
"context"
"github.com/gogf/gf/v2/container/gvar"
"github.com/gogf/gf/v2/database/gdb"
"github.com/gogf/gf/v2/frame/g"
)
// MemberInfo 后台用户信息
var MemberInfo = gdb.HookHandler{
Select: func(ctx context.Context, in *gdb.HookSelectInput) (result gdb.Result, err error) {
result, err = in.Next(ctx)
if err != nil {
return
}
for i, record := range result {
// 部门
if !record["dept_id"].IsEmpty() {
deptName, err := g.Model("admin_dept").Ctx(ctx).
Fields("name").
Where("id", record["dept_id"]).
Value()
if err != nil {
break
}
record["deptName"] = deptName
}
// 角色
if !record["role_id"].IsEmpty() {
roleName, err := g.Model("admin_role").Ctx(ctx).
Fields("name").
Where("id", record["role_id"]).
Value()
if err != nil {
break
}
record["roleName"] = roleName
}
if !record["password_hash"].IsEmpty() {
record["password_hash"] = gvar.New("")
}
if !record["salt"].IsEmpty() {
record["salt"] = gvar.New("")
}
if !record["auth_key"].IsEmpty() {
record["auth_key"] = gvar.New("")
}
result[i] = record
}
return
},
}

View File

@ -0,0 +1,59 @@
package hook
import (
"context"
"github.com/gogf/gf/v2/container/gvar"
"github.com/gogf/gf/v2/database/gdb"
"github.com/gogf/gf/v2/frame/g"
"hotgo/internal/library/location"
)
// CityLabel 城市地区标签
var CityLabel = gdb.HookHandler{
Select: func(ctx context.Context, in *gdb.HookSelectInput) (result gdb.Result, err error) {
result, err = in.Next(ctx)
if err != nil {
return
}
parse := func(id int64, index int) {
cityLabel, err := location.ParseSimpleRegion(ctx, id)
if err != nil {
g.Log().Warningf(ctx, "hook.CityLabel parse err:%+v", err)
}
result[index]["cityLabel"] = gvar.New(cityLabel)
return
}
for i, record := range result {
// 优先级: 区 > 市 > 省
cityId, ok := record["city_id"]
if ok && !cityId.IsEmpty() {
parse(cityId.Int64(), i)
continue
}
provinceId, ok := record["province_id"]
if ok && !provinceId.IsEmpty() {
parse(cityId.Int64(), i)
continue
}
// 以下是默认关联表 省市区字段
sysLogCityId, ok := record["sysLogCityId"]
if ok && !sysLogCityId.IsEmpty() {
parse(sysLogCityId.Int64(), i)
continue
}
sysLogProvinceId, ok := record["sysLogProvinceId"]
if ok && !sysLogProvinceId.IsEmpty() {
parse(cityId.Int64(), i)
continue
}
}
return
},
}

View File

@ -38,12 +38,9 @@ func GenerateLoginToken(ctx context.Context, user *model.Identity, isRefresh boo
"avatar": user.Avatar, "avatar": user.Avatar,
"email": user.Email, "email": user.Email,
"mobile": user.Mobile, "mobile": user.Mobile,
"lastTime": user.LastTime,
"lastIp": user.LastIp,
"exp": user.Exp, "exp": user.Exp,
"expires": user.Expires, "expires": user.Expires,
"app": user.App, "app": user.App,
"visitCount": user.VisitCount,
"isRefresh": isRefresh, "isRefresh": isRefresh,
"jwtVersion": jwtVersion.String(), "jwtVersion": jwtVersion.String(),
}) })

View File

@ -46,8 +46,8 @@ type AddressRegion struct {
CountyCode string `json:"countyCode"` CountyCode string `json:"countyCode"`
} }
// AnalysisAddress 将地址解析出省市区编码 // ParseAddress 将地址解析出省市区编码
func AnalysisAddress(ctx context.Context, address, key string) (region *AddressRegion, err error) { func ParseAddress(ctx context.Context, address, key string) (region *AddressRegion, err error) {
var ( var (
url = fmt.Sprintf("https://restapi.amap.com/v3/geocode/geo?address=%v&output=JSON&key=%v", address, key) url = fmt.Sprintf("https://restapi.amap.com/v3/geocode/geo?address=%v&output=JSON&key=%v", address, key)
responseMap = make(g.Map) responseMap = make(g.Map)

View File

@ -141,12 +141,12 @@ func GetPublicIP(ctx context.Context) (ip string, err error) {
var data *WhoisRegionData var data *WhoisRegionData
err = g.Client().Timeout(10*time.Second).GetVar(ctx, whoisApi).Scan(&data) err = g.Client().Timeout(10*time.Second).GetVar(ctx, whoisApi).Scan(&data)
if err != nil { if err != nil {
g.Log().Warningf(ctx, "GetPublicIP alternatives are being tried err:%+v", err) g.Log().Infof(ctx, "GetPublicIP alternatives are being tried err:%+v", err)
return GetPublicIP2() return GetPublicIP2()
} }
if data == nil { if data == nil {
g.Log().Warningf(ctx, "publicIP address Parsing failure, check the network and firewall blocking.") g.Log().Infof(ctx, "publicIP address Parsing failure, check the network and firewall blocking.")
return "0.0.0.0", nil return "0.0.0.0", nil
} }
return data.Ip, nil return data.Ip, nil

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