im 管理后台

This commit is contained in:
richjohnrambo
2026-08-11 23:13:51 +08:00
parent 0397fe5f22
commit 331a55751d
1407 changed files with 162069 additions and 2 deletions
@@ -0,0 +1,49 @@
// Package adminin
// @Link https://github.com/bufanyun/hotgo
// @Copyright Copyright (c) 2023 HotGo CLI
// @Author Ms <133814250@qq.com>
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
package adminin
import (
"hotgo/internal/library/hgorm/hook"
"hotgo/internal/model/entity"
"hotgo/internal/model/input/form"
)
// CashViewInp 获取信息
type CashViewInp struct {
Id int64 `json:"id" v:"required#提现ID不能为空" dc:"提现ID"`
}
type CashViewModel struct {
entity.AdminCash
MemberCash
}
// CashListInp 获取列表
type CashListInp struct {
form.PageReq
form.StatusReq
MemberId int64 `json:"memberId"`
CreatedAt []int64 `json:"created_at"`
ComplexMemberId []string `json:"complexMemberId" dc:"申请人"`
}
type CashListModel struct {
MemberBySumma *hook.MemberSumma `json:"memberBySumma" dc:"申请人信息"`
entity.AdminCash
}
// CashApplyInp 申请提现
type CashApplyInp struct {
Money float64 `json:"money" description:"提现金额"`
MemberId int64
}
// CashPaymentInp 提现打款处理
type CashPaymentInp struct {
Id int64 `json:"id" description:"ID"`
Status int64 `json:"status" description:"状态码"`
Msg string `json:"msg" description:"处理结果"`
}
@@ -0,0 +1,154 @@
// Package adminin
// @Link https://github.com/bufanyun/hotgo
// @Copyright Copyright (c) 2023 HotGo CLI
// @Author Ms <133814250@qq.com>
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
// @AutoGenerate Version 2.5.3
// @AutoGenerate Date 2023-04-15 15:59:58
package adminin
import (
"context"
"github.com/gogf/gf/v2/errors/gerror"
"github.com/gogf/gf/v2/net/ghttp"
"hotgo/internal/consts"
"hotgo/internal/library/contexts"
"hotgo/internal/library/hgorm/hook"
"hotgo/internal/library/location"
"hotgo/internal/model/input/form"
"github.com/gogf/gf/v2/os/gtime"
)
// CreditsLogSaveBalanceInp 更新余额
type CreditsLogSaveBalanceInp struct {
MemberId int64 `json:"memberId" dc:"管理员ID"`
AppId string `json:"appId" dc:"应用id"`
AddonsName string `json:"addonsName" dc:"插件名称"`
CreditGroup string `json:"creditGroup" dc:"变动的组别"`
Num float64 `json:"num" dc:"变动数据"`
Ip string `json:"ip" dc:"操作人IP"`
MapId int64 `json:"mapId" dc:"关联ID"`
Remark string `json:"remark" dc:"备注"`
}
func (in *CreditsLogSaveBalanceInp) Filter(ctx context.Context) (err error) {
if in.Num == 0 {
err = gerror.New("更新余额不能为0")
}
if in.AppId == "" {
in.AppId = contexts.GetModule(ctx)
}
if in.CreditGroup == "" {
if in.Num > 0 {
in.CreditGroup = consts.CreditGroupIncr
} else {
in.CreditGroup = consts.CreditGroupDecr
}
}
if in.Ip == "" {
in.Ip = location.GetClientIp(ghttp.RequestFromCtx(ctx))
}
return
}
type CreditsLogSaveBalanceModel struct {
}
// CreditsLogSaveIntegralInp 更新积分
type CreditsLogSaveIntegralInp struct {
MemberId int64 `json:"memberId" dc:"管理员ID"`
AppId string `json:"appId" dc:"应用id"`
AddonsName string `json:"addonsName" dc:"插件名称"`
CreditGroup string `json:"creditGroup" dc:"变动的组别"`
Num float64 `json:"num" dc:"变动数据"`
Ip string `json:"ip" dc:"操作人IP"`
MapId int64 `json:"mapId" dc:"关联ID"`
Remark string `json:"remark" dc:"备注"`
}
func (in *CreditsLogSaveIntegralInp) Filter(ctx context.Context) (err error) {
if in.Num == 0 {
err = gerror.New("更新积分不能为0")
}
if in.AppId == "" {
in.AppId = contexts.GetModule(ctx)
}
if in.CreditGroup == "" {
if in.Num > 0 {
in.CreditGroup = consts.CreditGroupIncr
} else {
in.CreditGroup = consts.CreditGroupDecr
}
}
if in.Ip == "" {
in.Ip = location.GetClientIp(ghttp.RequestFromCtx(ctx))
}
return
}
type CreditsLogSaveIntegralModel struct {
}
// CreditsLogListInp 获取资产变动列表
type CreditsLogListInp struct {
form.PageReq
Id int64 `json:"id" dc:"变动ID"`
MemberId int64 `json:"memberId" dc:"管理员ID"`
AppId string `json:"appId" dc:"应用id"`
CreditType string `json:"creditType" dc:"变动类型"`
CreditGroup string `json:"creditGroup" dc:"变动的组别"`
Remark string `json:"remark" dc:"备注"`
Ip string `json:"ip" dc:"操作人IP"`
Status int `json:"status" dc:"状态"`
CreatedAt []*gtime.Time `json:"createdAt" dc:"创建时间"`
ComplexMemberId []string `json:"complexMemberId" dc:"用户"`
}
func (in *CreditsLogListInp) Filter(ctx context.Context) (err error) {
return
}
type CreditsLogListModel struct {
Id int64 `json:"id" dc:"变动ID"`
MemberId int64 `json:"memberId" dc:"管理员ID"`
AppId string `json:"appId" dc:"应用id"`
AddonsName string `json:"addonsName" dc:"插件名称"`
CreditType string `json:"creditType" dc:"变动类型"`
CreditGroup string `json:"creditGroup" dc:"变动的组别"`
BeforeNum float64 `json:"beforeNum" dc:"变动前"`
Num float64 `json:"num" dc:"变动数据"`
AfterNum float64 `json:"afterNum" dc:"变动后"`
Remark string `json:"remark" dc:"备注"`
Ip string `json:"ip" dc:"操作人IP"`
MapId int64 `json:"mapId" dc:"关联ID"`
Status int `json:"status" dc:"状态"`
CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"`
UpdatedAt *gtime.Time `json:"updatedAt" dc:"修改时间"`
MemberBySumma *hook.MemberSumma `json:"memberBySumma" dc:"用户信息"`
}
// CreditsLogExportModel 导出资产变动
type CreditsLogExportModel struct {
Id int64 `json:"id" dc:"变动ID"`
MemberId int64 `json:"memberId" dc:"管理员ID"`
AppId string `json:"appId" dc:"应用id"`
AddonsName string `json:"addonsName" dc:"插件名称"`
CreditType string `json:"creditType" dc:"变动类型"`
CreditGroup string `json:"creditGroup" dc:"变动的组别"`
BeforeNum float64 `json:"beforeNum" dc:"变动前"`
Num float64 `json:"num" dc:"变动数据"`
AfterNum float64 `json:"afterNum" dc:"变动后"`
Remark string `json:"remark" dc:"备注"`
Ip string `json:"ip" dc:"操作人IP"`
MapId int64 `json:"mapId" dc:"关联ID"`
Status int `json:"status" dc:"状态"`
CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"`
UpdatedAt *gtime.Time `json:"updatedAt" dc:"修改时间"`
}
+175
View File
@@ -0,0 +1,175 @@
// Package adminin
// @Link https://github.com/bufanyun/hotgo
// @Copyright Copyright (c) 2023 HotGo CLI
// @Author Ms <133814250@qq.com>
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
package adminin
import (
"context"
"github.com/gogf/gf/v2/errors/gerror"
"github.com/gogf/gf/v2/os/gtime"
"hotgo/internal/consts"
"hotgo/internal/model/entity"
"hotgo/internal/model/input/form"
"hotgo/utility/tree"
"hotgo/utility/validate"
)
// DeptMaxSortInp 最大排序
type DeptMaxSortInp struct {
Id int64 `json:"id" dc:"部门ID"`
}
type DeptMaxSortModel struct {
Sort int `json:"sort"`
}
// DeptEditInp 修改/新增部门数据
type DeptEditInp struct {
entity.AdminDept
}
func (in *DeptEditInp) Filter(ctx context.Context) (err error) {
if in.Name == "" {
err = gerror.New("名称不能为空")
return
}
if in.Id > 0 && in.Id == in.Pid {
err = gerror.New("上级部门不能是自己")
return
}
return
}
type DeptEditModel struct{}
// DeptUpdateFields 修改数据字段过滤
type DeptUpdateFields struct {
Id int64 `json:"id" description:"部门ID"`
Pid int64 `json:"pid" description:"父部门ID"`
Name string `json:"name" description:"部门名称"`
Code string `json:"code" description:"部门编码"`
Type string `json:"type" description:"部门类型"`
Leader string `json:"leader" description:"负责人"`
Phone string `json:"phone" description:"联系电话"`
Email string `json:"email" description:"邮箱"`
Level int `json:"level" description:"关系树等级"`
Tree string `json:"tree" description:"关系树"`
Sort int `json:"sort" description:"排序"`
Status int `json:"status" description:"部门状态"`
}
// DeptInsertFields 新增数据字段过滤
type DeptInsertFields struct {
Pid int64 `json:"pid" description:"父部门ID"`
Name string `json:"name" description:"部门名称"`
Code string `json:"code" description:"部门编码"`
Type string `json:"type" description:"部门类型"`
Leader string `json:"leader" description:"负责人"`
Phone string `json:"phone" description:"联系电话"`
Email string `json:"email" description:"邮箱"`
Level int `json:"level" description:"关系树等级"`
Tree string `json:"tree" description:"关系树"`
Sort int `json:"sort" description:"排序"`
Status int `json:"status" description:"部门状态"`
}
// DeptDeleteInp 删除部门类型
type DeptDeleteInp struct {
Id interface{} `json:"id" v:"required#部门ID不能为空" dc:"部门ID"`
}
type DeptDeleteModel struct{}
// DeptViewInp 获取信息
type DeptViewInp struct {
Id int64 `json:"id" v:"required#部门ID不能为空" dc:"部门ID"`
}
type DeptViewModel struct {
entity.AdminDept
}
// DeptListInp 获取列表
type DeptListInp struct {
Name string `json:"name" dc:"部门名称"`
Code string `json:"code" dc:"部门编码"`
Leader string `json:"leader" dc:"负责人"`
CreatedAt []*gtime.Time `json:"createdAt" dc:"创建时间"`
}
func (in *DeptListInp) Filter(ctx context.Context) (err error) {
return
}
// DeptTree 树
type DeptTree struct {
entity.AdminDept
Label string `json:"label" dc:"标签"`
Value int64 `json:"value" dc:"键值"`
Children []*DeptTree `json:"children"`
}
type DeptListModel struct {
List []*entity.AdminDept `json:"list"`
Ids []int64 `json:"ids"`
}
// DeptStatusInp 更新部门状态
type DeptStatusInp struct {
entity.AdminDept
}
func (in *DeptStatusInp) Filter(ctx context.Context) (err error) {
if in.Id <= 0 {
err = gerror.New("ID不能为空")
return
}
if in.Status <= 0 {
err = gerror.New("状态不能为空")
return
}
if !validate.InSlice(consts.StatusSlice, in.Status) {
err = gerror.New("状态不正确")
return
}
return
}
type DeptStatusModel struct{}
type DeptOptionInp struct {
form.PageReq
}
type DeptOptionModel struct {
List []*DeptTree `json:"list"`
}
// DeptTreeOption 关系树选项
type DeptTreeOption struct {
Id int64 `json:"id" dc:"部门ID"`
Pid int64 `json:"pid" dc:"父部门ID"`
Name string `json:"name" dc:"部门名称"`
Children []tree.Node `json:"children" dc:"子节点"`
}
// ID 获取节点ID
func (t *DeptTreeOption) ID() int64 {
return t.Id
}
// PID 获取父级节点ID
func (t *DeptTreeOption) PID() int64 {
return t.Pid
}
// SetChildren 设置子节点数据
func (t *DeptTreeOption) SetChildren(children []tree.Node) {
t.Children = children
}
@@ -0,0 +1,338 @@
// Package adminin
// @Link https://github.com/bufanyun/hotgo
// @Copyright Copyright (c) 2023 HotGo CLI
// @Author Ms <133814250@qq.com>
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
package adminin
import (
"context"
"fmt"
"github.com/gogf/gf/v2/errors/gerror"
"github.com/gogf/gf/v2/frame/g"
"github.com/gogf/gf/v2/os/gtime"
"hotgo/internal/consts"
"hotgo/internal/library/contexts"
"hotgo/internal/model/entity"
"hotgo/internal/model/input/form"
"hotgo/utility/validate"
)
// MemberUpdateCashInp 更新会员提现信息
type MemberUpdateCashInp struct {
Name string `json:"name" v:"required#支付宝姓名不能为空" dc:"支付宝姓名"`
PayeeCode string `json:"payeeCode" v:"required#支付宝收款码不能为空" dc:"支付宝收款码"`
Account string `json:"account" v:"required#支付宝账号不能为空" dc:"支付宝账号"`
Password string `json:"password" v:"required#密码不能为空" dc:"密码"`
}
type MemberUpdateEmailInp struct {
Email string `json:"email" v:"required#换绑邮箱不能为空" dc:"换绑邮箱"`
Code string `json:"code" dc:"原邮箱验证码"`
}
// MemberUpdateMobileInp 换绑手机号
type MemberUpdateMobileInp struct {
Mobile string `json:"mobile" v:"required#换绑手机号不能为空" dc:"换绑手机号"`
Code string `json:"code" dc:"原号码短信验证码"`
}
// GetIdByCodeInp 通过邀请码获取用户ID
type GetIdByCodeInp struct {
Code string `json:"code"`
}
type GetIdByCodeModel struct {
Id int64
}
// MemberProfileInp 获取指定用户资料
type MemberProfileInp struct {
Id int64
}
type MemberProfileModel struct {
PostGroup string `json:"postGroup" dc:"岗位名称"`
RoleGroup string `json:"roleGroup" dc:"角色名称"`
User *MemberViewModel `json:"member" dc:"用户基本信息"`
SysDept *DeptViewModel `json:"sysDept" dc:"部门信息"`
SysRoles []*RoleListModel `json:"sysRoles" dc:"角色列表"`
PostIds int64 `json:"postIds" dc:"当前岗位"`
RoleIds int64 `json:"roleIds" dc:"当前角色"`
}
// MemberUpdateProfileInp 更新用户资料
type MemberUpdateProfileInp struct {
Avatar string `json:"avatar" v:"required#头像不能为空" dc:"头像"`
RealName string `json:"realName" v:"required#真实姓名不能为空" dc:"真实姓名"`
Qq string `json:"qq" dc:"QQ"`
Birthday *gtime.Time `json:"birthday" dc:"生日"`
Sex int `json:"sex" dc:"性别"`
Address string `json:"address" dc:"联系地址"`
CityId int64 `json:"cityId" dc:"城市编码"`
}
// MemberUpdatePwdInp 修改登录密码
type MemberUpdatePwdInp struct {
Id int64 `json:"id" dc:"用户ID"`
OldPassword string `json:"oldPassword" v:"required#原密码不能为空" dc:"原密码"`
NewPassword string `json:"newPassword" v:"required|length:6,16#新密码不能为空#新密码需在6~16之间" dc:"新密码"`
}
// MemberResetPwdInp 重置密码
type MemberResetPwdInp struct {
Password string `json:"password" v:"required#密码不能为空" dc:"密码"`
Id int64 `json:"id" dc:"用户ID"`
}
type LoginMemberInfoModel struct {
Id int64 `json:"id" dc:"用户ID"`
DeptName string `json:"deptName" dc:"所属部门"`
RoleName string `json:"roleName" dc:"所属角色"`
Permissions []string `json:"permissions" dc:"角色信息"`
DeptType string `json:"deptType" dc:"部门类型"`
DeptId int64 `json:"-" dc:"部门ID"`
RoleId int64 `json:"-" dc:"角色ID"`
Username string `json:"username" dc:"用户名"`
RealName string `json:"realName" dc:"姓名"`
Avatar string `json:"avatar" dc:"头像"`
Balance float64 `json:"balance" dc:"余额"`
Integral float64 `json:"integral" dc:"积分"`
Sex int `json:"sex" dc:"性别"`
Qq string `json:"qq" dc:"qq"`
Email string `json:"email" dc:"邮箱"`
Mobile string `json:"mobile" dc:"手机号码"`
Birthday *gtime.Time `json:"birthday" dc:"生日"`
CityId int64 `json:"cityId" dc:"城市编码"`
Address string `json:"address" dc:"联系地址"`
Cash *MemberCash `json:"cash" dc:"收款信息"`
CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"`
OpenId string `json:"openId" dc:"本次登录的openId"` // 区别与绑定的微信openid
InviteCode string `json:"inviteCode" dc:"邀请码"`
*MemberLoginStatModel
}
// MemberEditInp 修改用户
type MemberEditInp struct {
Id int64 `json:"id" dc:"管理员ID"`
RoleId int64 `json:"roleId" v:"required#角色不能为空" dc:"角色ID"`
PostIds []int64 `json:"postIds" dc:"岗位ID"`
DeptId int64 `json:"deptId" v:"required#部门不能为空" dc:"部门ID"`
Username string `json:"username" v:"required#账号不能为空" dc:"帐号"`
PasswordHash string `json:"passwordHash" dc:"密码hash"`
Password string `json:"password" dc:"密码"`
RealName string `json:"realName" dc:"真实姓名"`
Avatar string `json:"avatar" dc:"头像"`
Sex int `json:"sex" dc:"性别"`
Qq string `json:"qq" dc:"qq"`
Email string `json:"email" dc:"邮箱"`
Birthday *gtime.Time `json:"birthday" dc:"生日"`
ProvinceId int `json:"provinceId" dc:"省"`
CityId int `json:"cityId" dc:"城市"`
AreaId int `json:"areaId" dc:"地区"`
Address string `json:"address" dc:"默认地址"`
Mobile string `json:"mobile" dc:"手机号码"`
Remark string `json:"remark" dc:"备注"`
Status int `json:"status" dc:"状态"`
}
// MemberAddInp 新增用户
type MemberAddInp struct {
*MemberEditInp
Salt string `json:"salt" dc:"密码盐"`
Pid int64 `json:"pid" dc:"上级ID"`
Level int `json:"level" dc:"等级"`
Tree string `json:"tree" dc:"关系树"`
InviteCode string `json:"inviteCode" dc:"邀请码"`
}
func (in *MemberEditInp) Filter(ctx context.Context) (err error) {
if in.Id < 1 || in.Password != "" {
if err := g.Validator().
Rules("length:6,16").
Messages("新密码不能为空#新密码需在6~16之间").
Data(in.Password).Run(ctx); err != nil {
return err.Current()
}
}
return
}
type MemberEditModel struct{}
// VerifyUniqueInp 验证管理员唯一属性
type VerifyUniqueInp struct {
Id int64
Where g.Map
}
// MemberDeleteInp 删除用户
type MemberDeleteInp struct {
Id interface{} `json:"id" v:"required#用户ID不能为空" dc:"用户ID"`
}
type MemberDeleteModel struct{}
// MemberViewInp 获取用户信息
type MemberViewInp struct {
Id int64 `json:"id" dc:"用户ID"`
}
type MemberViewModel struct {
entity.AdminMember
DeptName string `json:"deptName" dc:"所属部门"`
RoleName string `json:"roleName" dc:"所属角色"`
}
// MemberListInp 获取用户列表
type MemberListInp struct {
form.PageReq
form.StatusReq
Id int64 `json:"id" dc:"用户ID"`
Pid int64 `json:"pid" dc:"上级ID"`
RoleId int `json:"roleId" dc:"角色ID"`
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 MemberListModel struct {
entity.AdminMember
DeptName string `json:"deptName" dc:"所属部门"`
RoleName string `json:"roleName" dc:"所属角色"`
PostIds []int64 `json:"postIds" dc:"岗位"`
DeptId int64 `json:"deptId" dc:"部门ID"`
}
// MemberCash 用户提现配置
type MemberCash struct {
Name string `json:"name" dc:"收款人姓名"`
Account string `json:"account" dc:"收款账户"`
PayeeCode string `json:"payeeCode" dc:"收款码"`
}
// MemberStatusInp 更新状态
type MemberStatusInp struct {
entity.AdminMember
}
func (in *MemberStatusInp) Filter(ctx context.Context) (err error) {
if in.Id <= 0 {
err = gerror.New("ID不能为空")
return
}
if in.Status <= 0 {
err = gerror.New("状态不能为空")
return
}
if !validate.InSlice(consts.StatusSlice, in.Status) {
err = gerror.New("状态不正确")
return
}
return
}
type MemberStatusModel struct{}
// MemberSelectInp 获取可选的后台用户选项
type MemberSelectInp struct {
}
type MemberSelectModel struct {
Value int64 `json:"value" dc:"用户ID"`
Label string `json:"label" dc:"真实姓名"`
Username string `json:"username" dc:"用户名"`
Avatar string `json:"avatar" dc:"头像"`
}
// MemberAddBalanceInp 增加余额
type MemberAddBalanceInp struct {
Id int64 `json:"id" v:"required#用户ID不能为空" dc:"管理员ID"`
OperateMode int64 `json:"operateMode" v:"in:1,2#输入的操作方式是无效的" dc:"操作方式"`
Num float64 `json:"num" dc:"操作数量"`
AppId string `json:"appId"`
AddonsName string `json:"addonsName"`
SelfNum float64 `json:"selfNum"`
SelfCreditGroup string `json:"selfCreditGroup"`
OtherNum float64 `json:"otherNum"`
OtherCreditGroup string `json:"otherCreditGroup"`
Remark string `json:"remark"`
}
func (in *MemberAddBalanceInp) Filter(ctx context.Context) (err error) {
if in.Num <= 0 {
err = gerror.New("操作数量必须大于0")
return
}
if in.OperateMode == 1 {
// 加款
in.SelfNum = -in.Num
in.SelfCreditGroup = consts.CreditGroupOpIncr
in.OtherNum = in.Num
in.OtherCreditGroup = consts.CreditGroupIncr
in.Remark = fmt.Sprintf("增加余额:%v", in.OtherNum)
} else {
// 扣款
in.SelfNum = in.Num
in.SelfCreditGroup = consts.CreditGroupOpDecr
in.OtherNum = -in.Num
in.OtherCreditGroup = consts.CreditGroupDecr
in.Remark = fmt.Sprintf("扣除余额:%v", in.OtherNum)
}
in.AppId = contexts.GetModule(ctx)
in.AddonsName = contexts.GetAddonName(ctx)
return
}
type MemberAddBalanceModel struct{}
// MemberAddIntegralInp 增加积分
type MemberAddIntegralInp struct {
Id int64 `json:"id" v:"required#用户ID不能为空" dc:"管理员ID"`
OperateMode int64 `json:"operateMode" dc:"操作方式"`
Num float64 `json:"num" dc:"操作数量"`
AppId string `json:"appId"`
AddonsName string `json:"addonsName"`
SelfNum float64 `json:"selfNum"`
SelfCreditGroup string `json:"selfCreditGroup"`
OtherNum float64 `json:"otherNum"`
OtherCreditGroup string `json:"otherCreditGroup"`
Remark string `json:"remark"`
}
func (in *MemberAddIntegralInp) Filter(ctx context.Context) (err error) {
if in.Num <= 0 {
err = gerror.New("操作数量必须大于0")
return
}
if in.OperateMode == 1 {
// 加款
in.SelfNum = -in.Num
in.SelfCreditGroup = consts.CreditGroupOpIncr
in.OtherNum = in.Num
in.OtherCreditGroup = consts.CreditGroupIncr
in.Remark = fmt.Sprintf("增加积分:%v", in.OtherNum)
} else {
// 扣款
in.SelfNum = in.Num
in.SelfCreditGroup = consts.CreditGroupOpDecr
in.OtherNum = -in.Num
in.OtherCreditGroup = consts.CreditGroupDecr
in.Remark = fmt.Sprintf("扣除积分:%v", in.OtherNum)
}
in.AppId = contexts.GetModule(ctx)
in.AddonsName = contexts.GetAddonName(ctx)
return
}
type MemberAddIntegralModel struct{}
+147
View File
@@ -0,0 +1,147 @@
// Package adminin
// @Link https://github.com/bufanyun/hotgo
// @Copyright Copyright (c) 2023 HotGo CLI
// @Author Ms <133814250@qq.com>
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
package adminin
import (
"context"
"github.com/gogf/gf/v2/errors/gerror"
"hotgo/internal/model"
"hotgo/internal/model/entity"
"hotgo/internal/model/input/form"
)
// MenuEditInp 修改/新增菜单
type MenuEditInp struct {
entity.AdminMenu
}
func (in *MenuEditInp) Filter(ctx context.Context) (err error) {
if in.Title == "" {
err = gerror.New("菜单名称不能为空")
return
}
if in.Type != 3 && in.Path == "" {
err = gerror.New("路由地址不能为空")
return
}
if in.Name == "" {
err = gerror.New("路由别名不能为空")
return
}
return
}
type MenuEditModel struct{}
// MenuDeleteInp 删除菜单
type MenuDeleteInp struct {
Id interface{} `json:"id" v:"required#菜单ID不能为空" dc:"菜单ID"`
}
func (in *MenuDeleteInp) Filter(ctx context.Context) (err error) {
return
}
type MenuDeleteModel struct{}
// MenuListInp 获取菜单列表
type MenuListInp struct {
form.PageReq
Pid int64 `json:"pid" dc:"父ID"`
}
func (in *MenuListInp) Filter(ctx context.Context) (err error) {
return
}
// MenuSearchListInp 查询菜单列表
type MenuSearchListInp struct {
Name string `json:"name" dc:"菜单名称"`
form.StatusReq
}
func (in *MenuSearchListInp) Filter(ctx context.Context) (err error) {
return
}
type MenuSearchListModel []*model.TreeMenu
// MenuTree 树
type MenuTree struct {
entity.AdminMenu
Key int64 `json:"key" `
Label string `json:"label" dc:"标签"`
Children []*MenuTree `json:"children"`
}
type MenuListModel struct {
List []*MenuTree `json:"list"`
}
// MenuRouteMeta 菜单路由
type MenuRouteMeta struct {
// 解释参考:https://naive-ui-admin-docs.vercel.app/guide/router.html#%E5%A4%9A%E7%BA%A7%E8%B7%AF%E7%94%B1
Title string `json:"title"` // 菜单名称 一般必填
// Disabled bool `json:"disabled,omitempty"` // 禁用菜单
Icon string `json:"icon,omitempty"` // 菜单图标
KeepAlive bool `json:"keepAlive,omitempty"` // 缓存该路由
Hidden bool `json:"hidden,omitempty"` // 隐藏菜单
Sort int `json:"sort,omitempty"` // 排序越小越排前
AlwaysShow bool `json:"alwaysShow,omitempty"` // 取消自动计算根路由模式
ActiveMenu string `json:"activeMenu,omitempty"` // 当路由设置了该属性,则会高亮相对应的侧边栏。
// 这在某些场景非常有用,比如:一个列表页路由为:/list/basic-list
// 点击进入详情页,这时候路由为/list/basic-info/1,但你想在侧边栏高亮列表的路由,就可以进行如下设置
// 注意是配置高亮路由 `name`,不是path
IsRoot bool `json:"isRoot,omitempty"` // 是否跟路由 顶部混合菜单,必须传 true,否则左侧会显示异常(场景就是,分割菜单之后,当一级菜单没有子菜单)
FrameSrc string `json:"frameSrc,omitempty" ` // 内联外部地址
Permissions string `json:"permissions,omitempty"` // 菜单包含权限集合,满足其中一个就会显示
Affix bool `json:"affix,omitempty"` // 是否固定 设置为 true 之后 多页签不可删除
Type int `json:"type"` // 菜单类型
}
type MenuRoute struct {
Name string `json:"name"`
Path string `json:"path"`
Redirect string `json:"redirect"`
Component string `json:"component"`
Meta *MenuRouteMeta `json:"meta"`
Children []*MenuRoute `json:"children,omitempty" dc:"子路由"`
}
// MenuRouteSummary 菜单树结构
type MenuRouteSummary struct {
entity.AdminMenu
Children []*MenuRouteSummary
}
// DynamicMeta 动态路由元数据
type DynamicMeta struct {
Title string `json:"title" description:"菜单标题"`
Icon string `json:"icon" description:"菜单图标"`
NoCache bool `json:"noCache" description:"是否缓存"`
Remark string `json:"remark" description:"备注"`
}
// DynamicBase 动态路由
type DynamicBase struct {
Id int64 `json:"id" description:"菜单ID"`
Pid int64 `json:"pid" description:"父ID"`
Name string `json:"name" description:"菜单名称"`
Code string `json:"code" description:"菜单编码"`
Path string `json:"path" description:"路由地址"`
Hidden bool `json:"hidden" description:"是否隐藏"`
Redirect string `json:"redirect" description:"重定向"`
Component string `json:"component" description:"组件路径"`
AlwaysShow bool `json:"alwaysShow" description:"暂时不知道干啥"`
IsFrame string `json:"isFrame" description:"是否为外链(0是 1否)"`
Meta *DynamicMeta `json:"meta" description:"配置数据集"`
}
// DynamicMenu 动态路由菜单
type DynamicMenu struct {
DynamicBase
Children []*DynamicBase `json:"children" description:"子菜单"`
}
@@ -0,0 +1,139 @@
// Package adminin
// @Link https://github.com/bufanyun/hotgo
// @Copyright Copyright (c) 2023 HotGo CLI
// @Author Ms <133814250@qq.com>
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
package adminin
import (
"context"
"github.com/gogf/gf/v2/os/gtime"
"hotgo/internal/model/entity"
"hotgo/internal/model/input/form"
)
// NoticeMaxSortInp 最大排序
type NoticeMaxSortInp struct {
Id int64
}
type NoticeMaxSortModel struct {
Sort int `json:"sort" dc:"排序"`
}
// NoticeEditInp 修改/新增
type NoticeEditInp struct {
entity.AdminNotice
Receiver []int64 `json:"receiver" dc:"接收者"`
SenderAvatar string `json:"senderAvatar" dc:"发送者头像"`
}
type NoticeEditModel struct{}
// NoticeDeleteInp 删除字典类型
type NoticeDeleteInp struct {
Id interface{} `json:"id" v:"required#公告ID不能为空" dc:"公告ID"`
}
type NoticeDeleteModel struct{}
// NoticeViewInp 获取信息
type NoticeViewInp struct {
Id int64 `json:"id" v:"required#公告ID不能为空" dc:"公告ID"`
}
type NoticeViewModel struct {
entity.AdminNotice
}
// NoticeListInp 获取列表
type NoticeListInp struct {
form.PageReq
form.StatusReq
Title string
Content string
Type int64
}
type NoticeListModel struct {
entity.AdminNotice
ReadCount float64 `json:"readCount" dc:"阅读次数"`
ReceiverGroup []form.AvatarGroup `json:"receiverGroup" dc:"接收人头像组"`
}
// NoticeStatusInp 更新状态
type NoticeStatusInp struct {
entity.AdminNotice
}
type NoticeStatusModel struct{}
// NoticeUpReadInp 更新已读
type NoticeUpReadInp struct {
Id int64 `json:"id" v:"required#公告ID不能为空" dc:"公告ID"`
}
// NoticeReadAllInp 全部已读
type NoticeReadAllInp struct {
Type int64 `json:"type" v:"required#公告类型不能为空" dc:"公告类型"`
}
// PullMessagesInp 获取列表
type PullMessagesInp struct {
Limit int `json:"limit" dc:"拉取最大数量限制"`
}
func (in *PullMessagesInp) Filter(ctx context.Context) (err error) {
if in.Limit == 0 {
in.Limit = 100
}
return
}
type PullMessagesRow struct {
Id int64 `json:"id" dc:"消息ID"`
Type int64 `json:"type" dc:"消息类型"`
Title string `json:"title" dc:"消息标题"`
Content string `json:"content" dc:"消息内容"`
Tag int64 `json:"tag" dc:"标签"`
Sort int64 `json:"sort" dc:"排序"`
CreatedBy int64 `json:"createdBy" dc:"发送人"`
CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"`
SenderAvatar string `json:"senderAvatar" dc:"发送者头像"`
IsRead bool `json:"isRead" dc:"是否已读"`
}
type PullMessagesModel struct {
List []*PullMessagesRow `json:"list" dc:"消息列表"`
*NoticeUnreadCountModel
}
type NoticeUnreadCountInp struct {
MemberId int64
MessageIds []int64
}
type NoticeUnreadCountModel struct {
NotifyCount int `json:"notifyCount" dc:"未读通知数量"`
NoticeCount int `json:"noticeCount" dc:"未读公告数量"`
LetterCount int `json:"letterCount" dc:"未读私信数量"`
}
// NoticeMessageListInp 我的消息列表
type NoticeMessageListInp struct {
form.PageReq
Type int64 `json:"type" v:"required#公告类型不能为空" dc:"公告类型"`
}
type NoticeMessageListModel struct {
Id int64 `json:"id" dc:"消息ID"`
Type int64 `json:"type" dc:"消息类型"`
Title string `json:"title" dc:"消息标题"`
Content string `json:"content" dc:"消息内容"`
Tag int64 `json:"tag" dc:"标签"`
Sort int64 `json:"sort" dc:"排序"`
CreatedBy int64 `json:"createdBy" dc:"发送人"`
CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"`
SenderAvatar string `json:"senderAvatar" dc:"发送者头像"`
IsRead bool `json:"isRead" dc:"是否已读"`
}
@@ -0,0 +1,156 @@
// Package adminin
// @Link https://github.com/bufanyun/hotgo
// @Copyright Copyright (c) 2023 HotGo CLI
// @Author Ms <133814250@qq.com>
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
package adminin
import (
"context"
"github.com/gogf/gf/v2/errors/gerror"
"github.com/gogf/gf/v2/os/gtime"
"hotgo/internal/consts"
"hotgo/internal/library/dict"
"hotgo/internal/library/hgorm/hook"
"hotgo/internal/model/entity"
"hotgo/internal/model/input/form"
"hotgo/internal/model/input/payin"
)
// OrderAcceptRefundInp 受理申请退款
type OrderAcceptRefundInp struct {
Id int64 `json:"id" v:"required#ID不能为空" dc:"ID"`
RejectRefundReason string `json:"rejectRefundReason" dc:"拒绝退款原因"`
Status int64 `json:"status" dc:"状态"`
Remark string `json:"remark" dc:"退款备注"`
}
func (in *OrderAcceptRefundInp) Filter(ctx context.Context) (err error) {
if !dict.HasOptionKey(consts.OrderStatusOptions, in.Status) {
err = gerror.Newf("订单状态不正确")
return
}
if in.Status == consts.OrderStatusReturnReject && in.Remark == "" {
in.Remark = "退款申请被拒绝"
}
return
}
type OrderAcceptRefundModel struct {
}
// OrderApplyRefundInp 申请退款
type OrderApplyRefundInp struct {
Id int64 `json:"id" v:"required#ID不能为空" dc:"ID"`
RefundReason string `json:"refundReason" v:"required#退款原因不能为空" dc:"退款原因"`
}
func (in *OrderApplyRefundInp) Filter(ctx context.Context) (err error) {
return
}
type OrderApplyRefundModel struct {
}
// OrderCreateInp 创建充值订单
type OrderCreateInp struct {
PayType string `json:"payType" dc:"支付方式"`
TradeType string `json:"tradeType" dc:"交易类型"`
OrderType string `json:"orderType" dc:"订单类型"`
ProductId int64 `json:"productId" dc:"产品id"`
Money float64 `json:"money" dc:"充值金额"`
Remark string `json:"remark" dc:"备注"`
ReturnUrl string `json:"returnUrl" dc:"买家付款成功跳转地址"`
}
func (in *OrderCreateInp) Filter(ctx context.Context) (err error) {
return
}
type OrderCreateModel struct {
Order *payin.CreateOrderModel `json:"order"`
}
// OrderEditInp 修改/新增充值订单
type OrderEditInp struct {
entity.AdminOrder
}
func (in *OrderEditInp) Filter(ctx context.Context) (err error) {
return
}
type OrderEditModel struct{}
// OrderDeleteInp 删除充值订单
type OrderDeleteInp struct {
Id interface{} `json:"id" v:"required#ID不能为空" dc:"ID"`
}
func (in *OrderDeleteInp) Filter(ctx context.Context) (err error) {
return
}
type OrderDeleteModel struct{}
// OrderViewInp 获取指定充值订单信息
type OrderViewInp struct {
Id int64 `json:"id" v:"required#ID不能为空" dc:"ID"`
}
func (in *OrderViewInp) Filter(ctx context.Context) (err error) {
return
}
type OrderViewModel struct {
entity.AdminOrder
}
// OrderListInp 获取充值订单列表
type OrderListInp struct {
form.PageReq
MemberId uint64 `json:"memberId" dc:"用户id"`
OrderSn string `json:"orderSn" dc:"业务订单号"`
Status int `json:"status" dc:"状态"`
CreatedAt []*gtime.Time `json:"createdAt" dc:"创建时间"`
PayLogOutTradeNo string `json:"payLogOutTradeNo" dc:"商户订单号"`
ComplexMemberId []string `json:"complexMemberId" dc:"下单用户"`
}
func (in *OrderListInp) Filter(ctx context.Context) (err error) {
return
}
type OrderListModel struct {
entity.AdminOrder
OutTradeNo string `json:"payLogOutTradeNo" dc:"商户订单号"`
PayType string `json:"payLogPayType" dc:"支付类型"`
MemberBySumma *hook.MemberSumma `json:"memberBySumma" dc:"下单用户信息"`
}
// OrderExportModel 导出充值订单
type OrderExportModel struct {
Id int64 `json:"id" dc:"主键"`
MemberId uint64 `json:"memberId" dc:"用户id"`
OrderType string `json:"orderType" dc:"订单类型"`
ProductId int64 `json:"productId" dc:"产品id"`
OrderSn string `json:"orderSn" dc:"关联订单号"`
Money float64 `json:"money" dc:"充值金额"`
Remark string `json:"remark" dc:"备注"`
Status int `json:"status" dc:"状态"`
CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"`
UpdatedAt *gtime.Time `json:"updatedAt" dc:"修改时间"`
}
// OrderStatusInp 更新充值订单状态
type OrderStatusInp struct {
Id int64 `json:"id" v:"required#ID不能为空" dc:"ID"`
Status int `json:"status" dc:"状态"`
}
func (in *OrderStatusInp) Filter(ctx context.Context) (err error) {
return
}
type OrderStatusModel struct{}
+102
View File
@@ -0,0 +1,102 @@
// Package adminin
// @Link https://github.com/bufanyun/hotgo
// @Copyright Copyright (c) 2023 HotGo CLI
// @Author Ms <133814250@qq.com>
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
package adminin
import (
"context"
"github.com/gogf/gf/v2/errors/gerror"
"github.com/gogf/gf/v2/os/gtime"
"hotgo/internal/consts"
"hotgo/internal/model/entity"
"hotgo/internal/model/input/form"
"hotgo/utility/validate"
)
// PostListInp 获取列表
type PostListInp struct {
form.PageReq
form.StatusReq
Name string `json:"name" dc:"岗位名称"`
Code string `json:"code" dc:"岗位编码"`
CreatedAt []*gtime.Time `json:"createdAt" dc:"创建时间"`
}
func (in *PostListInp) Filter(ctx context.Context) (err error) {
return
}
type PostListModel struct {
entity.AdminPost
}
// PostViewInp 获取信息
type PostViewInp struct {
Id string `json:"id" v:"required#岗位ID不能为空" description:"岗位ID"`
}
type PostViewModel struct {
entity.AdminPost
}
// PostMaxSortInp 最大排序
type PostMaxSortInp struct {
Id int64 `json:"id" description:"岗位ID"`
}
type PostMaxSortModel struct {
Sort int `json:"sort" description:"排序"`
}
// PostEditInp 修改/新增字典数据
type PostEditInp struct {
entity.AdminPost
}
func (in *PostEditInp) Filter(ctx context.Context) (err error) {
if in.Name == "" {
err = gerror.New("名称不能为空")
return
}
if in.Code == "" {
err = gerror.New("编码不能为空")
return
}
return
}
type PostEditModel struct{}
// PostDeleteInp 删除字典类型
type PostDeleteInp struct {
Id interface{} `json:"id" v:"required#岗位ID不能为空" description:"岗位ID"`
}
type PostDeleteModel struct{}
// PostStatusInp 更新状态
type PostStatusInp struct {
entity.AdminPost
}
func (in *PostStatusInp) Filter(ctx context.Context) (err error) {
if in.Id <= 0 {
err = gerror.New("ID不能为空")
return
}
if in.Status <= 0 {
err = gerror.New("状态不能为空")
return
}
if !validate.InSlice(consts.StatusSlice, in.Status) {
err = gerror.New("状态不正确")
return
}
return
}
type PostStatusModel struct{}
+154
View File
@@ -0,0 +1,154 @@
// Package adminin
// @Link https://github.com/bufanyun/hotgo
// @Copyright Copyright (c) 2023 HotGo CLI
// @Author Ms <133814250@qq.com>
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
package adminin
import (
"context"
"github.com/gogf/gf/v2/encoding/gjson"
"github.com/gogf/gf/v2/errors/gerror"
"hotgo/internal/model"
"hotgo/internal/model/entity"
"hotgo/internal/model/input/form"
)
// GetPermissionsInp 获取指定角色的菜单权限
type GetPermissionsInp struct {
RoleId int64 `json:"id"`
}
type GetPermissionsModel struct {
MenuIds []int64 `json:"menuIds"`
}
// UpdatePermissionsInp 更新指定角色的菜单权限
type UpdatePermissionsInp struct {
RoleId int64 `json:"id"`
MenuIds []int64 `json:"menuIds"`
}
// RoleDeleteInp 删除角色
type RoleDeleteInp struct {
Id int64 `json:"id" v:"required"`
}
func (in *RoleDeleteInp) Filter(ctx context.Context) (err error) {
if in.Id <= 0 {
err = gerror.New("ID不能为空")
return
}
return
}
// RoleEditInp 获取列表
type RoleEditInp struct {
entity.AdminRole
}
func (in *RoleEditInp) Filter(ctx context.Context) (err error) {
if in.Name == "" {
err = gerror.New("名称不能为空")
return
}
if in.Key == "" {
err = gerror.New("编码不能为空")
return
}
if in.Id > 0 && in.Id == in.Pid {
err = gerror.New("上级角色不能是自己")
return
}
return
}
// RoleUpdateFields 修改数据字段过滤
type RoleUpdateFields struct {
Id int64 `json:"id" description:"角色ID"`
Name string `json:"name" description:"角色名称"`
Key string `json:"key" description:"角色权限字符串"`
DataScope int `json:"dataScope" description:"数据范围"`
CustomDept *gjson.Json `json:"customDept" description:"自定义部门权限"`
Pid int64 `json:"pid" description:"上级角色ID"`
Level int `json:"level" description:"关系树等级"`
Tree string `json:"tree" description:"关系树"`
Remark string `json:"remark" description:"备注"`
Sort int `json:"sort" description:"排序"`
Status int `json:"status" description:"角色状态"`
}
// RoleInsertFields 新增数据字段过滤
type RoleInsertFields struct {
Name string `json:"name" description:"角色名称"`
Key string `json:"key" description:"角色权限字符串"`
DataScope int `json:"dataScope" description:"数据范围"`
CustomDept *gjson.Json `json:"customDept" description:"自定义部门权限"`
Pid int64 `json:"pid" description:"上级角色ID"`
Level int `json:"level" description:"关系树等级"`
Tree string `json:"tree" description:"关系树"`
Remark string `json:"remark" description:"备注"`
Sort int `json:"sort" description:"排序"`
Status int `json:"status" description:"角色状态"`
}
// RoleListInp 获取列表
type RoleListInp struct {
form.PageReq
}
type RoleTree struct {
entity.AdminRole
Label string `json:"label" dc:"标签"`
Value int64 `json:"value" dc:"键值"`
Children []*RoleTree `json:"children" dc:"子级"`
}
type RoleListModel struct {
List []*RoleTree `json:"list"`
}
// RoleMemberListInp 查询列表
type RoleMemberListInp struct {
form.PageReq
form.StatusReq
Role int `json:"role" dc:"角色ID"`
DeptId int `json:"deptId" dc:"部门ID"`
Mobile int `json:"mobile" dc:"手机号"`
Username string `json:"username" dc:"用户名"`
RealName string `json:"realName" dc:"真实姓名"`
StartTime string `json:"start_time" dc:"开始时间"`
EndTime string `json:"end_time" dc:"结束时间"`
Name string `json:"name" dc:"岗位名称"`
Code string `json:"code" dc:"岗位编码"`
}
type RoleMemberListModel []*MemberListModel
// MenuRoleListInp 查询角色菜单列表
type MenuRoleListInp struct {
RoleId int64
}
type MenuRoleListModel struct {
Menus []*model.LabelTreeMenu `json:"menus" dc:"菜单列表"`
CheckedKeys []int64 `json:"checkedKeys" dc:"选择的菜单ID"`
}
// DataScopeEditInp 获取数据权限选项
type DataScopeEditInp struct {
Id int64 `json:"id" v:"required" dc:"角色ID"`
DataScope int `json:"dataScope" v:"required" dc:"数据范围"`
CustomDept []int64 `json:"customDept" dc:"自定义部门权限"`
}
func (in *DataScopeEditInp) Filter(ctx context.Context) (err error) {
if in.Id <= 0 {
return gerror.New("角色ID不正确!")
}
return
}
@@ -0,0 +1,69 @@
package adminin
import (
"context"
"github.com/gogf/gf/v2/frame/g"
"github.com/gogf/gf/v2/os/gtime"
"hotgo/utility/simple"
)
// RegisterInp 账号注册
type RegisterInp struct {
Username string `json:"username" v:"required#用户名不能为空" dc:"用户名"`
Password string `json:"password" v:"required#密码不能为空" dc:"密码"`
Mobile string `json:"mobile" v:"required|phone-loose#手机号不能为空|手机号格式不正确" dc:"手机号"`
Code string `json:"code" v:"required#验证码不能为空" dc:"验证码"`
InviteCode string `json:"inviteCode" dc:"邀请码"`
}
func (in *RegisterInp) Filter(ctx context.Context) (err error) {
// 解密密码
password, err := simple.DecryptText(in.Password)
if err != nil {
return err
}
if err = g.Validator().Data(password).Rules("password").Messages("密码长度在6~18之间").Run(ctx); err != nil {
return
}
in.Password = password
return
}
// LoginModel 统一登录响应
type LoginModel struct {
Id int64 `json:"id" dc:"用户ID"`
Username string `json:"username" dc:"用户名"`
Token string `json:"token" dc:"登录token"`
Expires int64 `json:"expires" dc:"登录有效期"`
}
// AccountLoginInp 账号登录
type AccountLoginInp struct {
Username string `json:"username" v:"required#用户名不能为空" dc:"用户名"`
Password string `json:"password" v:"required#密码不能为空" dc:"密码"`
Cid string `json:"cid" dc:"验证码ID"`
Code string `json:"code" dc:"验证码"`
IsLock bool `json:"isLock" dc:"是否为锁屏状态"`
}
// MobileLoginInp 手机号登录
type MobileLoginInp struct {
Mobile string `json:"mobile" v:"required|phone-loose#手机号不能为空|手机号格式不正确" dc:"手机号"`
Code string `json:"code" v:"required#验证码不能为空" dc:"验证码"`
}
// MemberLoginPermissions 登录用户角色信息
type MemberLoginPermissions []string
// MemberLoginStatInp 用户登录统计
type MemberLoginStatInp struct {
MemberId int64
}
type MemberLoginStatModel struct {
LoginCount int `json:"loginCount" dc:"登录次数"`
LastLoginAt *gtime.Time `json:"lastLoginAt" dc:"最后登录时间"`
LastLoginIp string `json:"lastLoginIp" dc:"最后登录IP"`
}
@@ -0,0 +1,22 @@
// Package commonin
// @Link https://github.com/bufanyun/hotgo
// @Copyright Copyright (c) 2023 HotGo CLI
// @Author Ms <133814250@qq.com>
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
package commonin
// WechatAuthorizeInp 微信用户授权
type WechatAuthorizeInp struct {
Type string `json:"type" v:"required#授权类型不能为空" dc:"授权类型"`
SyncRedirect string `json:"syncRedirect" v:"required#同步跳转地址不能为空" dc:"同步跳转地址"`
}
type WechatAuthorizeModel struct{}
// WechatAuthorizeCallInp 微信用户授权回调
type WechatAuthorizeCallInp struct {
Code string `json:"code" dc:"code作为换取access_token的票据"`
State string `json:"state" dc:"state"`
}
type WechatAuthorizeCallModel struct{}
+30
View File
@@ -0,0 +1,30 @@
// Package form
// @Link https://github.com/bufanyun/hotgo
// @Copyright Copyright (c) 2023 HotGo CLI
// @Author Ms <133814250@qq.com>
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
package form
import "hotgo/internal/consts"
// StatusReq 通用状态查询
type StatusReq struct {
Status int `json:"status" v:"in:-1,0,1,2,3#输入的状态是无效的" dc:"状态"`
}
// SwitchReq 更新开关状态
type SwitchReq struct {
Key string `json:"key" v:"required#测试ID不能为空" dc:"开关字段"`
Value int `json:"value" v:"in:1,2#输入的开关值是无效的" dc:"更新值"`
}
// AvatarGroup 头像组
type AvatarGroup struct {
Name string `json:"name" dc:"姓名"`
Src string `json:"src" dc:"头像地址"`
}
// DefaultMaxSort 默认最大排序
func DefaultMaxSort(baseSort int) int {
return baseSort + consts.MaxSortIncr
}
+68
View File
@@ -0,0 +1,68 @@
// Package form
// @Link https://github.com/bufanyun/hotgo
// @Copyright Copyright (c) 2023 HotGo CLI
// @Author Ms <133814250@qq.com>
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
package form
import (
"hotgo/internal/consts"
)
type ReqPageFunc interface {
GetPage() int
GetPerPage() int
}
// PageReq 分页请求
type PageReq struct {
Page int `json:"page" example:"10" d:"1" v:"page@min:1#页码最小值不能低于1" dc:"当前页码"`
PerPage int `json:"pageSize" example:"1" d:"10" v:"pageSize@min:1|max:200#每页数量最小值不能低于1|每页数量最大值不能大于200" dc:"每页数量"`
Pagination bool `json:"pagination" d:"true" dc:"是否需要进行分页"`
}
// GetPage 获取当前页码
func (req *PageReq) GetPage() int {
return req.Page
}
// GetPerPage 获取每页数量
func (req *PageReq) GetPerPage() int {
return req.PerPage
}
// PageRes 分页响应
type PageRes struct {
PageReq
PageCount int `json:"pageCount" example:"0" dc:"分页个数"`
TotalCount int `json:"totalCount" example:"0" dc:"数据总行数"`
}
// Pack 打包分页数据
func (res *PageRes) Pack(req ReqPageFunc, totalCount int) {
res.TotalCount = totalCount
res.PageCount = CalPageCount(totalCount, req.GetPerPage())
res.Page = req.GetPage()
res.PerPage = req.GetPerPage()
}
func CalPageCount(totalCount int, perPage int) int {
return (totalCount + perPage - 1) / perPage
}
// CalPage 计算分页偏移量
func CalPage(page, perPage int) (newPage, newPerPage int, offset int) {
if page <= 0 {
newPage = consts.DefaultPage
} else {
newPage = page
}
if perPage <= 0 {
newPerPage = consts.DefaultPageSize
} else {
newPerPage = perPage
}
offset = (newPage - 1) * newPerPage
return
}
@@ -0,0 +1,30 @@
// Package form
// @Link https://github.com/bufanyun/hotgo
// @Copyright Copyright (c) 2023 HotGo CLI
// @Author Ms <133814250@qq.com>
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
package form
import "github.com/gogf/gf/v2/util/gconv"
// Selects 选项
type Selects []*Select
type Select struct {
Value interface{} `json:"value"`
Label string `json:"label"`
Name string `json:"name"`
Disabled bool `json:"disabled"`
}
func (p Selects) Len() int {
return len(p)
}
func (p Selects) Swap(i, j int) {
p[i], p[j] = p[j], p[i]
}
func (p Selects) Less(i, j int) bool {
return gconv.Int64(p[j].Value) > gconv.Int64(p[i].Value)
}
@@ -0,0 +1,20 @@
// Package form
// @Link https://github.com/bufanyun/hotgo
// @Copyright Copyright (c) 2023 HotGo CLI
// @Author Ms <133814250@qq.com>
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
package form
// Sorter 排序器,兼容naiveUI
type Sorter struct {
ColumnKey string `json:"columnKey" dc:"排序字段"`
Order interface{} `json:"order" dc:"排序方式 descend|ascend|false"`
}
type Sorters struct {
Sorters []*Sorter `json:"sorters" dc:"排序器"`
}
func (s *Sorters) GetSorters() []*Sorter {
return s.Sorters
}
@@ -0,0 +1,60 @@
// Package payin
// @Link https://github.com/bufanyun/hotgo
// @Copyright Copyright (c) 2023 HotGo CLI
// @Author Ms <133814250@qq.com>
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
package payin
import (
"github.com/go-pay/gopay/wechat/v3"
"github.com/gogf/gf/v2/os/gtime"
officialJs "github.com/silenceper/wechat/v2/officialaccount/js"
"hotgo/internal/model/entity"
)
// 和功能库[payment]包的通用输入/输出
// CreateOrderInp 统一创建订单入口
type CreateOrderInp struct {
Pay *entity.PayLog
}
type CreateOrderModel struct {
TradeType string `json:"tradeType" description:"交易类型"`
PayURL string `json:"payURL" description:"支付地址"`
OutTradeNo string `json:"outTradeNo" description:"商户订单号"`
JsApi *JSAPI `json:"jsApi" description:"jsapi支付参数"`
}
type JSAPI struct {
Config *officialJs.Config `json:"config" description:"js初始化配置"`
Params *wechat.JSAPIPayParams `json:"params" description:"支付参数"`
}
// NotifyInp 统一异步通知处理入口
type NotifyInp struct {
}
type NotifyModel struct {
OutTradeNo string `json:"outTradeNo" description:"商户订单号"`
TransactionId string `json:"transactionId" description:"交易号"`
PayAt *gtime.Time `json:"payAt" description:"支付时间"`
ActualAmount float64 `json:"actualAmount" description:"实付金额"`
}
// NotifyCallFuncInp 异步通知回调,用于异步通知验签通过后回调到具体的业务中
type NotifyCallFuncInp struct {
Pay *entity.PayLog
}
// RefundInp 统一退款处理入口
type RefundInp struct {
Pay *entity.PayLog
RefundMoney float64 `json:"refundMoney" dc:"退款金额"`
RefundSn string `json:"refundSn" dc:"退款单号"`
Reason string `json:"reason" dc:"申请退款原因"`
Remark string `json:"remark" dc:"退款备注"`
}
type RefundModel struct {
}
+198
View File
@@ -0,0 +1,198 @@
// Package payin
// @Link https://github.com/bufanyun/hotgo
// @Copyright Copyright (c) 2023 HotGo CLI
// @Author Ms <133814250@qq.com>
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
package payin
import (
"context"
"github.com/gogf/gf/v2/encoding/gjson"
"hotgo/internal/model/entity"
"hotgo/internal/model/input/form"
"github.com/gogf/gf/v2/os/gtime"
)
// PayNotifyInp 异步通知
type PayNotifyInp struct {
PayType string `json:"payType" description:"支付类型"`
}
type PayNotifyModel struct {
PayType string `json:"payType" description:"支付类型"`
Code string `json:"code" description:"状态码"`
Message string `json:"message" description:"响应文本消息"`
}
type PayNotifyUpdate struct {
TransactionId string `json:"transactionId" description:"交易号"`
PayStatus int `json:"payStatus" description:"支付状态"`
PayAt *gtime.Time `json:"payAt" description:"支付时间"`
PayIp string `json:"payIp" description:"支付者ip"`
TraceIds *gjson.Json `json:"traceIds" description:"链路id集合"`
}
// PayCreateInp 创建支付订单和日志
type PayCreateInp struct {
Subject string `json:"subject" description:"订单标题"`
Detail *gjson.Json `json:"detail" description:"支付商品详情"`
OrderSn string `json:"orderSn" description:"关联订单号"`
OrderGroup string `json:"orderGroup" description:"组别[默认统一支付类型]"`
Openid string `json:"openid" description:"openid"`
PayType string `json:"payType" description:"支付类型"`
TradeType string `json:"tradeType" description:"交易类型"`
PayAmount float64 `json:"payAmount" description:"支付金额"`
ReturnUrl string `json:"returnUrl" description:"买家付款成功跳转地址"`
}
type PayCreateModel struct {
Order *CreateOrderModel
}
// PayEditInp 修改/新增支付日志
type PayEditInp struct {
entity.PayLog
}
func (in *PayEditInp) Filter(ctx context.Context) (err error) {
return
}
type PayEditModel struct{}
// PayDeleteInp 删除支付日志
type PayDeleteInp struct {
Id interface{} `json:"id" v:"required#ID不能为空" dc:"ID"`
}
func (in *PayDeleteInp) Filter(ctx context.Context) (err error) {
return
}
type PayDeleteModel struct{}
// PayViewInp 获取指定支付日志信息
type PayViewInp struct {
Id int64 `json:"id" v:"required#ID不能为空" dc:"ID"`
}
func (in *PayViewInp) Filter(ctx context.Context) (err error) {
return
}
type PayViewModel struct {
entity.PayLog
}
// PayListInp 获取支付日志列表
type PayListInp struct {
form.PageReq
Id int64 `json:"id" dc:"ID"`
Status int `json:"status" dc:"状态"`
CreatedAt []*gtime.Time `json:"createdAt" dc:"创建时间"`
}
func (in *PayListInp) Filter(ctx context.Context) (err error) {
return
}
type PayListModel struct {
Id int64 `json:"id" description:"主键"`
MemberId uint64 `json:"memberId" description:"用户id"`
AppId string `json:"appId" description:"应用id"`
AddonsName string `json:"addonsName" description:"插件名称"`
OrderSn string `json:"orderSn" description:"关联订单号"`
OrderGroup string `json:"orderGroup" description:"组别[默认统一支付类型]"`
Openid string `json:"openid" description:"openid"`
MchId string `json:"mchId" description:"商户支付账户"`
Body string `json:"body" description:"创建支付报文"`
AuthCode string `json:"authCode" description:"刷卡码"`
OutTradeNo string `json:"outTradeNo" description:"商户订单号"`
TransactionId string `json:"transactionId" description:"交易号"`
PayType int `json:"payType" description:"支付类型"`
PayFee float64 `json:"payFee" description:"支付金额"`
PayStatus int `json:"payStatus" description:"支付状态"`
PayAt *gtime.Time `json:"payAt" description:"支付时间"`
TradeType string `json:"tradeType" description:"交易类型"`
RefundSn string `json:"refundSn" description:"退款编号"`
RefundFee float64 `json:"refundFee" description:"退款金额"`
RefundRemark string `json:"refundRemark" description:"退款备注"`
IsRefund int `json:"isRefund" description:"是否退款"`
CreateIp string `json:"createIp" description:"创建者ip"`
PayIp string `json:"payIp" description:"支付者ip"`
NotifyUrl string `json:"notifyUrl" description:"支付通知回调地址"`
ReturnUrl string `json:"returnUrl" description:"买家付款成功跳转地址"`
TraceIds *gjson.Json `json:"traceIds" description:"链路id集合"`
Status int `json:"status" description:"状态"`
CreatedAt *gtime.Time `json:"createdAt" description:"创建时间"`
UpdatedAt *gtime.Time `json:"updatedAt" description:"修改时间"`
}
// PayExportModel 导出支付日志
type PayExportModel struct {
Id int64 `json:"id" description:"主键"`
MemberId uint64 `json:"memberId" description:"用户id"`
AppId string `json:"appId" description:"应用id"`
AddonsName string `json:"addonsName" description:"插件名称"`
OrderSn string `json:"orderSn" description:"关联订单号"`
OrderGroup string `json:"orderGroup" description:"组别[默认统一支付类型]"`
Openid string `json:"openid" description:"openid"`
MchId string `json:"mchId" description:"商户支付账户"`
Body string `json:"body" description:"创建支付报文"`
AuthCode string `json:"authCode" description:"刷卡码"`
OutTradeNo string `json:"outTradeNo" description:"商户订单号"`
TransactionId string `json:"transactionId" description:"交易号"`
PayType int `json:"payType" description:"支付类型"`
PayFee float64 `json:"payFee" description:"支付金额"`
PayStatus int `json:"payStatus" description:"支付状态"`
PayAt *gtime.Time `json:"payAt" description:"支付时间"`
TradeType string `json:"tradeType" description:"交易类型"`
RefundSn string `json:"refundSn" description:"退款编号"`
RefundFee float64 `json:"refundFee" description:"退款金额"`
RefundRemark string `json:"refundRemark" description:"退款备注"`
IsRefund int `json:"isRefund" description:"是否退款"`
CreateIp string `json:"createIp" description:"创建者ip"`
PayIp string `json:"payIp" description:"支付者ip"`
NotifyUrl string `json:"notifyUrl" description:"支付通知回调地址"`
ReturnUrl string `json:"returnUrl" description:"买家付款成功跳转地址"`
TraceIds *gjson.Json `json:"traceIds" description:"链路id集合"`
Status int `json:"status" description:"状态"`
CreatedAt *gtime.Time `json:"createdAt" description:"创建时间"`
UpdatedAt *gtime.Time `json:"updatedAt" description:"修改时间"`
}
// PayMaxSortInp 获取支付日志最大排序
type PayMaxSortInp struct{}
func (in *PayMaxSortInp) Filter(ctx context.Context) (err error) {
return
}
type PayMaxSortModel struct {
Sort int `json:"sort" description:"排序"`
}
// PayStatusInp 更新支付日志状态
type PayStatusInp struct {
Id int64 `json:"id" v:"required#ID不能为空" dc:"ID"`
Status int `json:"status" dc:"状态"`
}
func (in *PayStatusInp) Filter(ctx context.Context) (err error) {
return
}
type PayStatusModel struct{}
// PaySwitchInp 更新支付日志开关状态
type PaySwitchInp struct {
form.SwitchReq
Id int64 `json:"id" v:"required#ID不能为空" dc:"ID"`
}
func (in *PaySwitchInp) Filter(ctx context.Context) (err error) {
return
}
type PaySwitchModel struct{}
@@ -0,0 +1,59 @@
// Package payin
// @Link https://github.com/bufanyun/hotgo
// @Copyright Copyright (c) 2023 HotGo CLI
// @Author Ms <133814250@qq.com>
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
// @AutoGenerate Version 2.5.3
// @AutoGenerate Date 2023-04-15 15:59:58
package payin
import (
"context"
"hotgo/internal/model/entity"
"hotgo/internal/model/input/form"
"github.com/gogf/gf/v2/os/gtime"
)
// PayRefundInp 订单退款
type PayRefundInp struct {
OrderSn string `json:"orderSn" dc:"业务订单号"`
RefundMoney float64 `json:"refundMoney" dc:"退款金额"`
Reason string `json:"reason" dc:"申请退款原因"`
Remark string `json:"remark" dc:"退款备注"`
}
func (in *PayRefundInp) Filter(ctx context.Context) (err error) {
return
}
type PayRefundModel struct {
entity.PayRefund
}
// PayRefundListInp 获取资产变动列表
type PayRefundListInp struct {
form.PageReq
Id int64 `json:"id" dc:"变动ID"`
MemberId int64 `json:"memberId" dc:"管理员ID"`
AppId string `json:"appId" dc:"应用id"`
CreditType string `json:"creditType" dc:"变动类型"`
CreditGroup string `json:"creditGroup" dc:"变动的组别"`
Remark string `json:"remark" dc:"备注"`
Ip string `json:"ip" dc:"操作人IP"`
Status int `json:"status" dc:"状态"`
CreatedAt []*gtime.Time `json:"createdAt" dc:"创建时间"`
}
func (in *PayRefundListInp) Filter(ctx context.Context) (err error) {
return
}
type PayRefundListModel struct {
entity.PayRefund
}
// PayRefundExportModel 导出资产变动
type PayRefundExportModel struct {
entity.PayRefund
}
@@ -0,0 +1,16 @@
// Package servmsgin
// @Link https://github.com/bufanyun/hotgo
// @Copyright Copyright (c) 2023 HotGo CLI
// @Author Ms <133814250@qq.com>
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
package servmsgin
import "github.com/gogf/gf/v2/os/gtime"
// AuthSummaryModel 授权信息
type AuthSummaryModel struct {
EndAt *gtime.Time `json:"end_at" description:"授权过期时间"`
Online int `json:"online" description:"在线人数"`
// 请填充你的授权数据
// ...
}
@@ -0,0 +1,14 @@
// Package servmsgin
// @Link https://github.com/bufanyun/hotgo
// @Copyright Copyright (c) 2023 HotGo CLI
// @Author Ms <133814250@qq.com>
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
package servmsgin
import "github.com/gogf/gf/v2/os/gtime"
// ExampleHelloModel 授权信息
type ExampleHelloModel struct {
Desc string `json:"desc" description:"描述信息"`
Timestamp *gtime.Time `json:"timestamp" description:"服务器时间"`
}
@@ -0,0 +1,64 @@
// Package sysin
// @Link https://github.com/bufanyun/hotgo
// @Copyright Copyright (c) 2023 HotGo CLI
// @Author Ms <133814250@qq.com>
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
package sysin
import (
"context"
"github.com/gogf/gf/v2/errors/gerror"
"github.com/gogf/gf/v2/text/gregex"
"hotgo/internal/library/addons"
"hotgo/internal/model/input/form"
)
// AddonsListInp 获取列表
type AddonsListInp struct {
form.PageReq
Name string `json:"name" dc:"插件名称"`
Group int `json:"group" dc:"分组"`
Status int `json:"status" dc:"安装状态"`
}
type AddonsListModel struct {
addons.Skeleton
GroupName string `json:"groupName" dc:"分组名称"`
InstallVersion string `json:"installVersion" dc:"安装版本"`
InstallStatus int `json:"installStatus" dc:"安装状态"`
CanSave bool `json:"canSave" dc:"是否可以更新"`
}
// AddonsBuildInp 提交生成
type AddonsBuildInp struct {
addons.Skeleton
Extend []string `json:"extend" dc:"扩展功能"`
}
func (in *AddonsBuildInp) Filter(ctx context.Context) (err error) {
if in.Name == "" {
err = gerror.New("插件名称不能为空")
return
}
if !gregex.IsMatchString(`^[a-zA-Z]{1}\w{1,23}$`, in.Name) {
err = gerror.New("插件名称格式不正确,字母开头,只能包含字母、数字和下划线,长度在2~24之间")
return
}
return
}
// AddonsInstallInp 安装模块
type AddonsInstallInp struct {
addons.Skeleton
}
// AddonsUpgradeInp 更新模块
type AddonsUpgradeInp struct {
addons.Skeleton
}
// AddonsUnInstallInp 卸载模块
type AddonsUnInstallInp struct {
addons.Skeleton
}
@@ -0,0 +1,26 @@
// Package sysin
// @Link https://github.com/bufanyun/hotgo
// @Copyright Copyright (c) 2023 HotGo CLI
// @Author Ms <133814250@qq.com>
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
package sysin
import (
"github.com/gogf/gf/v2/frame/g"
)
// UpdateAddonsConfigInp 更新指定插件的配置
type UpdateAddonsConfigInp struct {
AddonName string `json:"addonName"`
Group string `json:"group"`
List g.Map `json:"list"`
}
// GetAddonsConfigInp 获取指定插件的配置
type GetAddonsConfigInp struct {
AddonName string `json:"addonName"`
Group string `json:"group"`
}
type GetAddonsConfigModel struct {
List g.Map `json:"list"`
}
@@ -0,0 +1,106 @@
// Package sysin
// @Link https://github.com/bufanyun/hotgo
// @Copyright Copyright (c) 2023 HotGo CLI
// @Author Ms <133814250@qq.com>
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
package sysin
import (
"context"
"github.com/gogf/gf/v2/errors/gerror"
"github.com/gogf/gf/v2/os/gtime"
"hotgo/internal/library/storager"
"hotgo/internal/model/entity"
"hotgo/internal/model/input/form"
"hotgo/utility/validate"
)
// AttachmentDeleteInp 删除附件
type AttachmentDeleteInp struct {
Id interface{} `json:"id" v:"required#附件ID不能为空" dc:"附件ID"`
}
type AttachmentDeleteModel struct{}
// AttachmentViewInp 获取附件信息
type AttachmentViewInp struct {
Id int64 `json:"id" v:"required#附件ID不能为空" dc:"附件ID"`
}
type AttachmentViewModel struct {
entity.SysAttachment
}
// AttachmentClearKindInp 清空上传类型
type AttachmentClearKindInp struct {
Kind string `json:"kind" v:"required#上传类型不能为空" dc:"上传类型"`
}
func (in *AttachmentClearKindInp) Filter(ctx context.Context) (err error) {
if !validate.InSlice(storager.KindSlice, in.Kind) {
err = gerror.New("上传类型是无效的")
return
}
return
}
// AttachmentListInp 获取附件列表
type AttachmentListInp struct {
form.PageReq
form.StatusReq
MemberId int64 `json:"member_id" dc:"用户ID"`
Name string `json:"name" dc:"文件名称"`
Drive string `json:"drive" dc:"驱动"`
Kind string `json:"kind" dc:"上传类型"`
UpdatedAt []*gtime.Time `json:"updatedAt" dc:"更新时间"`
}
type AttachmentListModel struct {
entity.SysAttachment
SizeFormat string `json:"sizeFormat" dc:"大小"`
}
// AttachmentChooserListInp 获取附件列表
type AttachmentChooserListInp struct {
form.PageReq
Drive string `json:"drive" dc:"驱动"`
Kind string `json:"kind" dc:"上传类型"`
UpdatedAt []int64 `json:"updatedAt" dc:"更新时间"`
}
type AttachmentChooserListModel struct {
entity.SysAttachment
SizeFormat string `json:"sizeFormat" dc:"大小"`
}
// AttachmentClearInp 清空分类
type AttachmentClearInp struct {
Kind string `json:"kind" dc:"上传类型"`
}
// CheckMultipartInp 检查文件分片
type CheckMultipartInp struct {
*storager.CheckMultipartParams
}
type CheckMultipartModel struct {
*storager.CheckMultipartModel
}
// UploadPartInp 上传分片
type UploadPartInp struct {
*storager.UploadPartParams
}
type UploadPartModel struct {
*storager.UploadPartModel
}
// ImageTransferStorageInp 图片链接转存
type ImageTransferStorageInp struct {
Url string `json:"url" v:"required#图片链接不能为空" dc:"图片链接"`
}
type ImageTransferStorageModel struct {
*AttachmentListModel
}
@@ -0,0 +1,81 @@
// Package sysin
// @Link https://github.com/bufanyun/hotgo
// @Copyright Copyright (c) 2023 HotGo CLI
// @Author Ms <133814250@qq.com>
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
package sysin
import (
"context"
"github.com/gogf/gf/v2/errors/gerror"
"hotgo/internal/consts"
"hotgo/internal/model/entity"
"hotgo/internal/model/input/form"
"hotgo/utility/validate"
)
// BlacklistEditInp 修改/新增黑名单数据
type BlacklistEditInp struct {
entity.SysBlacklist
}
type BlacklistEditModel struct{}
// BlacklistDeleteInp 删除黑名单类型
type BlacklistDeleteInp struct {
Id interface{} `json:"id" v:"required#黑名单ID不能为空" dc:"黑名单ID"`
}
type BlacklistDeleteModel struct{}
// BlacklistViewInp 获取信息
type BlacklistViewInp struct {
Id int64 `json:"id" v:"required#黑名单ID不能为空" dc:"黑名单ID"`
}
type BlacklistViewModel struct {
entity.SysBlacklist
}
// BlacklistListInp 获取列表
type BlacklistListInp struct {
form.PageReq
form.StatusReq
Ip string `json:"ip" dc:"IP"`
Remark string `json:"remark" dc:"备注"`
CreatedAt []int64 `json:"createdAt" dc:"创建时间"`
}
func (in *BlacklistListInp) Filter(ctx context.Context) (err error) {
return
}
type BlacklistListModel struct {
entity.SysBlacklist
}
// BlacklistStatusInp 更新状态
type BlacklistStatusInp struct {
entity.SysBlacklist
}
func (in *BlacklistStatusInp) Filter(ctx context.Context) (err error) {
if in.Id <= 0 {
err = gerror.New("ID不能为空")
return
}
if in.Status <= 0 {
err = gerror.New("状态不能为空")
return
}
if !validate.InSlice(consts.StatusSlice, in.Status) {
err = gerror.New("状态不正确")
return
}
return
}
type BlacklistStatusModel struct{}
@@ -0,0 +1,25 @@
// Package sysin
// @Link https://github.com/bufanyun/hotgo
// @Copyright Copyright (c) 2023 HotGo CLI
// @Author Ms <133814250@qq.com>
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
package sysin
import (
"github.com/gogf/gf/v2/frame/g"
)
// UpdateConfigInp 更新指定分组的配置
type UpdateConfigInp struct {
Group string `json:"group"`
List g.Map `json:"list"`
}
// GetConfigInp 获取指定分组的配置
type GetConfigInp struct {
Group string `json:"group"`
}
type GetConfigModel struct {
List g.Map `json:"list"`
}
+75
View File
@@ -0,0 +1,75 @@
// Package sysin
// @Link https://github.com/bufanyun/hotgo
// @Copyright Copyright (c) 2023 HotGo CLI
// @Author Ms <133814250@qq.com>
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
package sysin
import (
"hotgo/internal/library/cron"
"hotgo/internal/model/entity"
"hotgo/internal/model/input/form"
)
// CronMaxSortInp 最大排序
type CronMaxSortInp struct {
Id int64
}
type CronMaxSortModel struct {
Sort int
}
// CronEditInp 修改/新增
type CronEditInp struct {
entity.SysCron
}
type CronEditModel struct{}
// CronDeleteInp 删除
type CronDeleteInp struct {
Id interface{}
}
type CronDeleteModel struct{}
// CronViewInp 获取信息
type CronViewInp struct {
Id int64
}
type CronViewModel struct {
entity.SysCron
}
// CronListInp 获取列表
type CronListInp struct {
form.PageReq
form.StatusReq
GroupId int64 `json:"groupId" description:"分组ID"`
Name string `json:"name" description:"任务名称"`
}
type CronListModel struct {
entity.SysCron
GroupName string `json:"groupName"`
}
// CronStatusInp 更新状态
type CronStatusInp struct {
entity.SysCron
}
type CronStatusModel struct{}
// OnlineExecInp 在线执行
type OnlineExecInp struct {
entity.SysCron
}
type OnlineExecModel struct{}
// DispatchLogInp 查看指定任务的调度日志
type DispatchLogInp struct {
entity.SysCron
}
type DispatchLogModel struct {
*cron.Log
}
@@ -0,0 +1,134 @@
// Package sysin
// @Link https://github.com/bufanyun/hotgo
// @Copyright Copyright (c) 2023 HotGo CLI
// @Author Ms <133814250@qq.com>
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
package sysin
import (
"context"
"github.com/gogf/gf/v2/errors/gerror"
"hotgo/internal/consts"
"hotgo/internal/model/entity"
"hotgo/internal/model/input/form"
"hotgo/utility/validate"
)
// CronGroupMaxSortInp 最大排序
type CronGroupMaxSortInp struct {
Id int64
}
type CronGroupMaxSortModel struct {
Sort int
}
// CronGroupEditInp 修改/新增字典数据
type CronGroupEditInp struct {
entity.SysCronGroup
}
func (in *CronGroupEditInp) Filter(ctx context.Context) (err error) {
if in.Name == "" {
err = gerror.New("名称不能为空")
return
}
if in.Id > 0 && in.Id == in.Pid {
err = gerror.New("上级分组不能是自己")
return
}
return
}
type CronGroupEditModel struct{}
// CronGroupUpdateFields 修改数据字段过滤
type CronGroupUpdateFields struct {
Id int64 `json:"id" description:"任务分组ID"`
Pid int64 `json:"pid" description:"父类字典类型ID"`
Name string `json:"name" description:"字典类型名称"`
Type string `json:"type" description:"字典类型"`
Sort int `json:"sort" description:"排序"`
Remark string `json:"remark" description:"备注"`
Status int `json:"status" description:"字典类型状态"`
}
// CronGroupInsertFields 新增数据字段过滤
type CronGroupInsertFields struct {
Pid int64 `json:"pid" description:"父类任务分组ID"`
Name string `json:"name" description:"分组名称"`
IsDefault int `json:"isDefault" description:"是否默认"`
Sort int `json:"sort" description:"排序"`
Remark string `json:"remark" description:"备注"`
Status int `json:"status" description:"分组状态"`
}
// CronGroupDeleteInp 删除字典类型
type CronGroupDeleteInp struct {
Id interface{}
}
type CronGroupDeleteModel struct{}
// CronGroupViewInp 获取信息
type CronGroupViewInp struct {
Id int64
}
type CronGroupViewModel struct {
entity.SysCronGroup
}
// CronGroupListInp 获取列表
type CronGroupListInp struct {
form.PageReq
form.StatusReq
Name string
}
type CronGroupListModel struct {
entity.SysCronGroup
SupName string `json:"supName" description:"上级分组名称"`
}
// CronGroupStatusInp 更新状态
type CronGroupStatusInp struct {
entity.SysCronGroup
}
func (in *CronGroupStatusInp) Filter(ctx context.Context) (err error) {
if in.Id <= 0 {
err = gerror.New("ID不能为空")
return
}
if in.Status <= 0 {
err = gerror.New("状态不能为空")
return
}
if !validate.InSlice(consts.StatusSlice, in.Status) {
err = gerror.New("状态不正确")
return
}
return
}
type CronGroupStatusModel struct{}
// CronGroupSelectInp 选项
type CronGroupSelectInp struct {
}
type CronGroupSelectModel struct {
List []*CronGroupTree `json:"list"`
}
type CronGroupTree struct {
entity.SysCronGroup
Disabled bool `json:"disabled" dc:"是否禁用"`
Label string `json:"label" dc:"标签"`
Value int64 `json:"value" dc:"键值"`
Key int64 `json:"key" dc:"键名"`
Children []*CronGroupTree `json:"children" dc:"子级"`
}
@@ -0,0 +1,201 @@
// Package sysin
// @Link https://github.com/bufanyun/hotgo
// @Copyright Copyright (c) 2025 HotGo CLI
// @Author Ms <133814250@qq.com>
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
// @AutoGenerate Version 2.18.6
package sysin
import (
"context"
"hotgo/internal/consts"
"hotgo/internal/library/hgorm/hook"
"hotgo/internal/model/entity"
"hotgo/internal/model/input/form"
"hotgo/utility/validate"
"github.com/gogf/gf/v2/errors/gerror"
"github.com/gogf/gf/v2/frame/g"
"github.com/gogf/gf/v2/os/gtime"
)
// CurdDemoUpdateFields 修改CURD列表字段过滤
type CurdDemoUpdateFields struct {
Title string `json:"title" dc:"标题"`
Description string `json:"description" dc:"描述"`
Content string `json:"content" dc:"内容"`
Image string `json:"image" dc:"单图"`
Attachfile string `json:"attachfile" dc:"附件"`
CityId int64 `json:"cityId" dc:"所在城市"`
Switch int `json:"switch" dc:"显示开关"`
Sort int `json:"sort" dc:"排序"`
UpdatedBy int64 `json:"updatedBy" dc:"更新者"`
}
// CurdDemoInsertFields 新增CURD列表字段过滤
type CurdDemoInsertFields struct {
Title string `json:"title" dc:"标题"`
Description string `json:"description" dc:"描述"`
Content string `json:"content" dc:"内容"`
Image string `json:"image" dc:"单图"`
Attachfile string `json:"attachfile" dc:"附件"`
CityId int64 `json:"cityId" dc:"所在城市"`
Switch int `json:"switch" dc:"显示开关"`
Sort int `json:"sort" dc:"排序"`
CreatedBy int64 `json:"createdBy" dc:"创建者"`
}
// CurdDemoEditInp 修改/新增CURD列表
type CurdDemoEditInp struct {
entity.SysGenCurdDemo
}
func (in *CurdDemoEditInp) Filter(ctx context.Context) (err error) {
// 验证标题
if err := g.Validator().Rules("required").Data(in.Title).Messages("标题不能为空").Run(ctx); err != nil {
return err.Current()
}
// 验证描述
if err := g.Validator().Rules("required").Data(in.Description).Messages("描述不能为空").Run(ctx); err != nil {
return err.Current()
}
// 验证内容
if err := g.Validator().Rules("required").Data(in.Content).Messages("内容不能为空").Run(ctx); err != nil {
return err.Current()
}
// 验证排序
if err := g.Validator().Rules("required").Data(in.Sort).Messages("排序不能为空").Run(ctx); err != nil {
return err.Current()
}
return
}
type CurdDemoEditModel struct{}
// CurdDemoDeleteInp 删除CURD列表
type CurdDemoDeleteInp struct {
Id interface{} `json:"id" v:"required#ID不能为空" dc:"ID"`
}
func (in *CurdDemoDeleteInp) Filter(ctx context.Context) (err error) {
return
}
type CurdDemoDeleteModel struct{}
// CurdDemoViewInp 获取指定CURD列表信息
type CurdDemoViewInp struct {
Id int64 `json:"id" v:"required#ID不能为空" dc:"ID"`
}
func (in *CurdDemoViewInp) Filter(ctx context.Context) (err error) {
return
}
type CurdDemoViewModel struct {
entity.SysGenCurdDemo
CreatedBySumma *hook.MemberSumma `json:"createdBySumma" dc:"创建者摘要信息"`
UpdatedBySumma *hook.MemberSumma `json:"updatedBySumma" dc:"更新者摘要信息"`
DeletedBySumma *hook.MemberSumma `json:"deletedBySumma" dc:"删除者摘要信息"`
}
// CurdDemoListInp 获取CURD列表列表
type CurdDemoListInp struct {
form.PageReq
Id int64 `json:"id" dc:"ID"`
Title string `json:"title" dc:"标题"`
Description string `json:"description" dc:"描述"`
CreatedBy string `json:"createdBy" dc:"创建者"`
DeletedBy string `json:"deletedBy" dc:"删除者"`
CreatedAt []*gtime.Time `json:"createdAt" dc:"创建时间"`
TestCategoryName string `json:"testCategoryName" dc:"关联分类"`
}
func (in *CurdDemoListInp) Filter(ctx context.Context) (err error) {
return
}
type CurdDemoListModel struct {
Id int64 `json:"id" dc:"ID"`
Title string `json:"title" dc:"标题"`
Description string `json:"description" dc:"描述"`
Image string `json:"image" dc:"单图"`
Attachfile string `json:"attachfile" dc:"附件"`
Switch int `json:"switch" dc:"显示开关"`
Sort int `json:"sort" dc:"排序"`
CreatedBy int64 `json:"createdBy" dc:"创建者"`
CreatedBySumma *hook.MemberSumma `json:"createdBySumma" dc:"创建者摘要信息"`
UpdatedBy int64 `json:"updatedBy" dc:"更新者"`
UpdatedBySumma *hook.MemberSumma `json:"updatedBySumma" dc:"更新者摘要信息"`
DeletedBy int64 `json:"deletedBy" dc:"删除者"`
DeletedBySumma *hook.MemberSumma `json:"deletedBySumma" dc:"删除者摘要信息"`
CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"`
UpdatedAt *gtime.Time `json:"updatedAt" dc:"修改时间"`
TestCategoryName string `json:"testCategoryName" dc:"关联分类"`
}
// CurdDemoExportModel 导出CURD列表
type CurdDemoExportModel struct {
Id int64 `json:"id" dc:"ID"`
Title string `json:"title" dc:"标题"`
Description string `json:"description" dc:"描述"`
Image string `json:"image" dc:"单图"`
Attachfile string `json:"attachfile" dc:"附件"`
CityId int64 `json:"cityId" dc:"所在城市"`
Switch int `json:"switch" dc:"显示开关"`
Sort int `json:"sort" dc:"排序"`
CreatedBy int64 `json:"createdBy" dc:"创建者"`
UpdatedBy int64 `json:"updatedBy" dc:"更新者"`
DeletedBy int64 `json:"deletedBy" dc:"删除者"`
CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"`
TestCategoryName string `json:"testCategoryName" dc:"关联分类"`
}
// CurdDemoMaxSortInp 获取CURD列表最大排序
type CurdDemoMaxSortInp struct{}
func (in *CurdDemoMaxSortInp) Filter(ctx context.Context) (err error) {
return
}
type CurdDemoMaxSortModel struct {
Sort int `json:"sort" description:"排序"`
}
// CurdDemoStatusInp 更新CURD列表状态
type CurdDemoStatusInp struct {
Id int64 `json:"id" v:"required#ID不能为空" dc:"ID"`
Status int `json:"status" dc:"状态"`
}
func (in *CurdDemoStatusInp) Filter(ctx context.Context) (err error) {
if in.Id <= 0 {
err = gerror.New("ID不能为空")
return
}
if in.Status <= 0 {
err = gerror.New("状态不能为空")
return
}
if !validate.InSlice(consts.StatusSlice, in.Status) {
err = gerror.New("状态不正确")
return
}
return
}
type CurdDemoStatusModel struct{}
// CurdDemoSwitchInp 更新CURD列表开关状态
type CurdDemoSwitchInp struct {
form.SwitchReq
Id int64 `json:"id" v:"required#ID不能为空" dc:"ID"`
}
func (in *CurdDemoSwitchInp) Filter(ctx context.Context) (err error) {
return
}
type CurdDemoSwitchModel struct{}
@@ -0,0 +1,92 @@
// Package sysin
// @Link https://github.com/bufanyun/hotgo
// @Copyright Copyright (c) 2023 HotGo CLI
// @Author Ms <133814250@qq.com>
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
package sysin
import (
"context"
"github.com/gogf/gf/v2/errors/gerror"
"hotgo/internal/model"
"hotgo/internal/model/entity"
"hotgo/internal/model/input/form"
)
// DictDataEditInp 修改/新增字典数据
type DictDataEditInp struct {
entity.SysDictData
TypeID int64 `json:"typeID" dc:"字典类型ID"`
}
func (in *DictDataEditInp) Filter(ctx context.Context) (err error) {
if in.Label == "" {
err = gerror.New("字典标签不能为空")
return
}
if in.Id > 0 && in.TypeID <= 0 {
err = gerror.New("字典类型不能为空")
return
}
return
}
type DictDataEditModel struct{}
// DictDataUpdateFields 修改数据字段过滤
type DictDataUpdateFields struct {
Id int64 `json:"id" description:"字典数据ID"`
Label string `json:"label" description:"字典标签"`
Value string `json:"value" description:"字典键值"`
ValueType string `json:"valueType" description:"键值数据类型:string,int,uint,bool,datetime,date"`
Type string `json:"type" description:"字典类型"`
ListClass string `json:"listClass" description:"表格回显样式"`
IsDefault int `json:"isDefault" description:"是否为系统默认"`
Sort int `json:"sort" description:"字典排序"`
Remark string `json:"remark" description:"备注"`
Status int `json:"status" description:"状态"`
}
// DictDataInsertFields 新增数据字段过滤
type DictDataInsertFields struct {
Label string `json:"label" description:"字典标签"`
Value string `json:"value" description:"字典键值"`
ValueType string `json:"valueType" description:"键值数据类型:string,int,uint,bool,datetime,date"`
Type string `json:"type" description:"字典类型"`
ListClass string `json:"listClass" description:"表格回显样式"`
IsDefault int `json:"isDefault" description:"是否为系统默认"`
Sort int `json:"sort" description:"字典排序"`
Remark string `json:"remark" description:"备注"`
Status int `json:"status" description:"状态"`
}
// DictDataDeleteInp 删除字典数据
type DictDataDeleteInp struct {
Id interface{} `json:"id" v:"required#字典数据ID不能为空" dc:"字典数据ID"`
}
type DictDataDeleteModel struct{}
// DictDataListInp 获取列表
type DictDataListInp struct {
form.PageReq
form.StatusReq
TypeID int64 `json:"typeId" v:"required#字典类型ID不能为空" dc:"字典类型ID"`
Type string `json:"type" dc:"字典类型"`
Label string `json:"label" dc:"字典标签"`
Value string `json:"value" dc:"字典键值"`
}
type DictDataListModel struct {
TypeID int64 `json:"typeId"`
Key string `json:"key"`
entity.SysDictData
}
// DataSelectInp 获取指定字典选项
type DataSelectInp struct {
Type string `in:"path" v:"required#字典类型不能为空" dc:"字典类型"`
}
type DataSelectModel []*model.Option
@@ -0,0 +1,76 @@
// Package sysin
// @Link https://github.com/bufanyun/hotgo
// @Copyright Copyright (c) 2023 HotGo CLI
// @Author Ms <133814250@qq.com>
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
package sysin
import (
"context"
"github.com/gogf/gf/v2/errors/gerror"
"github.com/gogf/gf/v2/frame/g"
"hotgo/internal/model/entity"
)
// DictTypeEditInp 修改/新增字典数据
type DictTypeEditInp struct {
entity.SysDictType
}
func (in *DictTypeEditInp) Filter(ctx context.Context) (err error) {
if in.Name == "" {
err = gerror.New("名称不能为空")
return
}
if in.Id > 0 && in.Id == in.Pid {
err = gerror.New("上级字典不能是自己")
return
}
return
}
type DictTypeEditModel struct{}
// DictTypeUpdateFields 修改数据字段过滤
type DictTypeUpdateFields struct {
Id int64 `json:"id" description:"字典类型ID"`
Pid int64 `json:"pid" description:"父类字典类型ID"`
Name string `json:"name" description:"字典类型名称"`
Type string `json:"type" description:"字典类型"`
Sort int `json:"sort" description:"排序"`
Remark string `json:"remark" description:"备注"`
Status int `json:"status" description:"字典类型状态"`
}
// DictTypeInsertFields 新增数据字段过滤
type DictTypeInsertFields struct {
Pid int64 `json:"pid" description:"父类字典类型ID"`
Name string `json:"name" description:"字典类型名称"`
Type string `json:"type" description:"字典类型"`
Sort int `json:"sort" description:"排序"`
Remark string `json:"remark" description:"备注"`
Status int `json:"status" description:"字典类型状态"`
}
// DictTypeDeleteInp 删除字典类型
type DictTypeDeleteInp struct {
Id interface{} `json:"id" v:"required#字典类型ID不能为空" dc:"字典类型ID"`
}
type DictTypeDeleteModel struct{}
// DictTreeSelectInp 获取类型关系树选项
type DictTreeSelectInp struct {
}
type DictTreeSelectModel []g.Map
type DictTypeTree struct {
entity.SysDictType
Disabled bool `json:"disabled" dc:"是否禁用"`
Label string `json:"label" dc:"标签"`
Value int64 `json:"value" dc:"键值"`
Key int64 `json:"key" dc:"键名"`
Children []*DictTypeTree `json:"children" dc:"子级"`
}
@@ -0,0 +1,72 @@
// Package sysin
// @Link https://github.com/bufanyun/hotgo
// @Copyright Copyright (c) 2023 HotGo CLI
// @Author Ms <133814250@qq.com>
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
package sysin
import (
"github.com/gogf/gf/v2/frame/g"
"hotgo/internal/model/entity"
"hotgo/internal/model/input/form"
)
// EmsLogEditInp 修改/新增数据
type EmsLogEditInp struct {
entity.SysEmsLog
}
type EmsLogEditModel struct{}
// EmsLogDeleteInp 删除
type EmsLogDeleteInp struct {
Id interface{} `json:"id" v:"required#邮件记录ID不能为空" dc:"邮件记录ID"`
}
type EmsLogDeleteModel struct{}
// EmsLogViewInp 获取信息
type EmsLogViewInp struct {
Id int64 `json:"id" v:"required#邮件记录ID不能为空" dc:"邮件记录ID"`
}
type EmsLogViewModel struct {
entity.SysEmsLog
}
// EmsLogListInp 获取列表
type EmsLogListInp struct {
form.PageReq
form.StatusReq
Title string `json:"title"`
Content string `json:"content"`
}
type EmsLogListModel struct {
entity.SysEmsLog
}
// EmsLogStatusInp 更新状态
type EmsLogStatusInp struct {
entity.SysSmsLog
}
type EmsLogStatusModel struct{}
// SendEmsInp 发送邮件
type SendEmsInp struct {
Event string `json:"event" v:"required#邮件事件不能为空" description:"事件"`
Email string `json:"email" v:"required#邮箱地址不能为空" description:"邮箱地址"`
Code string `json:"code" description:"验证码或短信内容"`
Content string `json:"content" description:"邮件内容"`
Template string `json:"-" description:"发信模板"`
TplData g.Map `json:"-" description:"模板变量"`
}
// VerifyEmsCodeInp 效验验证码
type VerifyEmsCodeInp struct {
Event string `json:"event" v:"required#邮件事件不能为空" description:"事件"`
Email string `json:"email" v:"required#邮箱地址不能为空" description:"邮箱地址"`
Code string `json:"code" description:"验证码"`
}
@@ -0,0 +1,235 @@
// Package sysin
// @Link https://github.com/bufanyun/hotgo
// @Copyright Copyright (c) 2023 HotGo CLI
// @Author Ms <133814250@qq.com>
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
package sysin
import (
"context"
"github.com/gogf/gf/v2/errors/gerror"
"github.com/gogf/gf/v2/text/gregex"
"github.com/gogf/gf/v2/util/gconv"
"hotgo/internal/consts"
"hotgo/internal/model"
"hotgo/internal/model/entity"
"hotgo/internal/model/input/form"
)
// GenCodesMaxSortInp 最大排序
type GenCodesMaxSortInp struct {
Id int64 `json:"id" dc:"生成代码ID"`
}
type GenCodesMaxSortModel struct {
Sort int `json:"sort" dc:"排序"`
}
// GenCodesEditInp 修改/新增数据
type GenCodesEditInp struct {
entity.SysGenCodes
}
func (in *GenCodesEditInp) Filter(ctx context.Context) (err error) {
return genFilter(ctx, in.SysGenCodes)
}
type GenCodesEditModel struct {
entity.SysGenCodes
}
// GenCodesDeleteInp 删除
type GenCodesDeleteInp struct {
Id interface{} `json:"id" v:"required#生成代码ID不能为空" dc:"生成代码ID"`
}
type GenCodesDeleteModel struct{}
// GenCodesViewInp 获取信息
type GenCodesViewInp struct {
Id int64 `json:"id" v:"required#生成代码ID不能为空" dc:"生成代码ID"`
}
type GenCodesViewModel struct {
entity.SysGenCodes
}
// GenCodesListInp 获取列表
type GenCodesListInp struct {
form.PageReq
form.StatusReq
GenType int `json:"genType" dc:"生成类型"`
VarName string `json:"varName" dc:"实体"`
}
type GenCodesListModel struct {
entity.SysGenCodes
GenTemplateGroup string `json:"genTemplateGroup" dc:"生成模板组名"`
}
// GenCodesStatusInp 更新状态
type GenCodesStatusInp struct {
Id int64 `json:"id" description:"生成ID"`
Status int `json:"status" description:"生成状态"`
}
type GenCodesStatusModel struct{}
// GenCodesSelectsInp 选项
type GenCodesSelectsInp struct {
}
type GenCodesSelectsModel struct {
GenType GenTypeSelects `json:"genType" dc:"生成类型"`
Db form.Selects `json:"db" dc:"数据库选项"`
Status form.Selects `json:"status" dc:"生成状态"`
LinkMode form.Selects `json:"linkMode" dc:"关联表方式"`
BuildMeth form.Selects `json:"buildMeth" dc:"生成方式"`
// 字段表格选项
FormMode form.Selects `json:"formMode" dc:"表单组件"`
FormRole form.Selects `json:"formRole" dc:"表单验证"`
DictMode []*DictTypeTree `json:"dictMode" dc:"字典类型"`
WhereMode form.Selects `json:"whereMode" dc:"查询条件"`
Addons form.Selects `json:"addons" dc:"插件选项"`
TableAlign form.Selects `json:"tableAlign" dc:"表格排列方式"`
TreeStyleType []*model.Option `json:"treeStyleType" dc:"树表样式选项"`
}
type GenTypeSelects []*GenTypeSelect
type GenTypeSelect struct {
Value int `json:"value"`
Label string `json:"label"`
Name string `json:"name"`
Templates GenTemplateSelects `json:"templates"`
}
type GenTemplateSelects []*GenTemplateSelect
type GenTemplateSelect struct {
Value interface{} `json:"value"`
Label string `json:"label"`
Name string `json:"name"`
IsAddon bool `json:"isAddon"`
}
func (p GenTemplateSelects) Len() int {
return len(p)
}
func (p GenTemplateSelects) Swap(i, j int) {
p[i], p[j] = p[j], p[i]
}
func (p GenTemplateSelects) Less(i, j int) bool {
return gconv.Int64(p[j].Value) > gconv.Int64(p[i].Value)
}
func (p GenTypeSelects) Len() int {
return len(p)
}
func (p GenTypeSelects) Swap(i, j int) {
p[i], p[j] = p[j], p[i]
}
func (p GenTypeSelects) Less(i, j int) bool {
return gconv.Int64(p[j].Value) > gconv.Int64(p[i].Value)
}
// GenCodesTableSelectInp 数据库表选项
type GenCodesTableSelectInp struct {
Name string `json:"name" dc:"数据库配置名称"`
}
type GenCodesTableSelectModel struct {
Value string `json:"value"`
Label string `json:"label"`
Name string `json:"name"`
DaoName string `json:"daoName" dc:"orm模型名称"`
DefVarName string `json:"defVarName" dc:"默认实体名称"`
DefAlias string `json:"defAlias" dc:"默认关联表别名"`
DefTableComment string `json:"defTableComment" dc:"默认菜单名称"`
}
// GenCodesColumnSelectInp 表字段选项
type GenCodesColumnSelectInp struct {
Name string `json:"name" dc:"数据库配置名称"`
Table string `json:"table" dc:"表名称"`
}
type GenCodesColumnSelectModel struct {
Value string `json:"value"`
Label string `json:"label"`
Name string `json:"name"`
}
// GenCodesColumnListInp 表字段列表
type GenCodesColumnListInp struct {
Name string `json:"name" dc:"数据库配置名称"`
Table string `json:"table" dc:"表名称"`
IsLink int64 `json:"isLink" dc:"是否是关联表"`
Alias string `json:"alias" dc:"关联表别名"`
}
type GenCodesColumnListModel struct {
model.GenCodesColumn
}
// GenCodesPreviewInp 生成预览
type GenCodesPreviewInp struct {
entity.SysGenCodes
}
func (in *GenCodesPreviewInp) Filter(ctx context.Context) (err error) {
return genFilter(ctx, in.SysGenCodes)
}
// GenFile 生成文件配置
type GenFile struct {
Content string `json:"content" dc:"页面内容"`
Path string `json:"path" dc:"生成路径"`
Meth int `json:"meth" dc:"生成方式"`
Required bool `json:"required" dc:"是否是必要构建文件"`
}
type GenCodesPreviewModel struct {
Config *model.GenerateConfig `json:"config"`
Views map[string]*GenFile `json:"views" dc:"页面"`
}
// GenCodesBuildInp 提交生成
type GenCodesBuildInp struct {
entity.SysGenCodes
}
func (in *GenCodesBuildInp) Filter(ctx context.Context) (err error) {
return genFilter(ctx, in.SysGenCodes)
}
func genFilter(ctx context.Context, in entity.SysGenCodes) (err error) {
if in.VarName == "" {
err = gerror.New("实体命名不能为空")
return
}
if !gregex.IsMatchString(`^[a-zA-Z]{1}\w{1,23}$`, in.VarName) {
err = gerror.New("实体命名格式不正确,字母开头,只能包含字母、数字和下划线,长度在2~24之间")
return
}
if in.GenType == consts.GenCodesTypeCurd || in.GenType == consts.GenCodesTypeTree {
if in.DbName == "" {
err = gerror.New("数据库不能为空")
return
}
if in.TableName == "" {
err = gerror.New("数据库表不能为空")
return
}
if in.TableComment == "" {
err = gerror.New("菜单名称不能为空")
return
}
}
return
}
+58
View File
@@ -0,0 +1,58 @@
// Package sysin
// @Link https://github.com/bufanyun/hotgo
// @Copyright Copyright (c) 2023 HotGo CLI
// @Author Ms <133814250@qq.com>
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
package sysin
import (
"hotgo/internal/model/entity"
"hotgo/internal/model/input/form"
)
// LogListInp 获取菜单列表
type LogListInp struct {
form.PageReq
form.StatusReq
ReqId string `json:"reqId" dc:"对外ID"`
Module string `json:"module" dc:"应用端口"`
MemberId int `json:"memberId" dc:"用户ID"`
TakeUpTime string `json:"takeUpTime" dc:"请求耗时"`
Method string `json:"method" dc:"请求方式"`
Url string `json:"url" dc:"请求路径"`
Ip string `json:"ip" dc:"访问IP"`
ErrorCode string `json:"errorCode" dc:"状态码"`
CreatedAt []int64 `json:"createdAt" dc:"创建时间"`
Keyword string `json:"keyword" dc:"关键词"`
ComplexMemberId []string `json:"complexMemberId" dc:"操作人筛选"`
}
type LogListModel struct {
entity.SysLog
MemberName string `json:"memberName"`
Region string `json:"region"`
CityLabel string `json:"cityLabel" dc:"城市标签"`
Tags string `json:"tags" dc:"接口所属的标签,用于接口分类"`
Summary string `json:"summary" dc:"接口/参数概要描述"`
Description string `json:"description" dc:"接口/参数详细描述"`
}
// LogViewInp 获取信息
type LogViewInp struct {
Id string `json:"id" v:"required#日志ID不能为空" description:"日志ID"`
}
type LogViewModel struct {
entity.SysLog
CityLabel string `json:"cityLabel" dc:"城市标签"`
Tags string `json:"tags" dc:"接口所属的标签,用于接口分类"`
Summary string `json:"summary" dc:"接口/参数概要描述"`
Description string `json:"description" dc:"接口/参数详细描述"`
}
// LogDeleteInp 删除
type LogDeleteInp struct {
Id interface{} `json:"id" v:"required#日志ID不能为空" description:"日志ID"`
}
type LogDeleteModel struct{}
@@ -0,0 +1,79 @@
// Package sysin
// @Link https://github.com/bufanyun/hotgo
// @Copyright Copyright (c) 2023 HotGo CLI
// @Author Ms <133814250@qq.com>
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
package sysin
import (
"context"
"github.com/gogf/gf/v2/database/gdb"
"github.com/gogf/gf/v2/encoding/gjson"
"github.com/gogf/gf/v2/os/gtime"
"hotgo/internal/model/entity"
"hotgo/internal/model/input/adminin"
"hotgo/internal/model/input/form"
)
// LoginLogDeleteInp 删除登录日志
type LoginLogDeleteInp struct {
Id interface{} `json:"id" v:"required#日志ID不能为空" dc:"日志ID"`
}
type LoginLogDeleteModel struct{}
// LoginLogViewInp 获取指定登录日志信息
type LoginLogViewInp struct {
Id int64 `json:"id" v:"required#日志ID不能为空" dc:"日志ID"`
}
type LoginLogViewModel struct {
entity.SysLoginLog
}
// LoginLogListInp 获取登录日志列表
type LoginLogListInp struct {
form.PageReq
Username string `json:"username" dc:"用户名"`
Status int `json:"status" dc:"状态"`
LoginAt []*gtime.Time `json:"loginAt" dc:"登录时间"`
LoginIp string `json:"loginIp" dc:"登录IP"`
}
type LoginLogListModel struct {
entity.SysLoginLog
Os string `json:"os"`
Browser string `json:"browser"`
CityLabel string `json:"cityLabel"`
SysLogId gdb.Value `json:"sysLogId"`
}
func (in *LoginLogListInp) Filter(ctx context.Context) (err error) {
return
}
// LoginLogExportModel 导出登录日志
type LoginLogExportModel struct {
Id int64 `json:"id" orm:"id" description:"日志ID"`
ReqId string `json:"reqId" orm:"req_id" description:"请求ID"`
MemberId int64 `json:"memberId" orm:"member_id" description:"用户ID"`
Username string `json:"username" orm:"username" description:"用户名"`
Response *gjson.Json `json:"response" orm:"response" description:"响应数据"`
LoginAt *gtime.Time `json:"loginAt" orm:"login_at" description:"登录时间"`
LoginIp string `json:"loginIp" orm:"login_ip" description:"登录IP"`
ProvinceId int64 `json:"provinceId" orm:"province_id" description:"省编码"`
CityId int64 `json:"cityId" orm:"city_id" description:"市编码"`
UserAgent string `json:"userAgent" orm:"user_agent" description:"UA信息"`
ErrMsg string `json:"errMsg" orm:"err_msg" description:"错误提示"`
Status int `json:"status" orm:"status" description:"状态"`
CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" description:"创建时间"`
UpdatedAt *gtime.Time `json:"updatedAt" orm:"updated_at" description:"修改时间"`
Os string `json:"os"`
Browser string `json:"browser"`
}
// LoginLogPushInp 解推送登录日志
type LoginLogPushInp struct {
Response *adminin.LoginModel
Err error
}
@@ -0,0 +1,145 @@
// Package sysin
// @Link https://github.com/bufanyun/hotgo
// @Copyright Copyright (c) 2024 HotGo CLI
// @Author Ms <133814250@qq.com>
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
// @AutoGenerate Version 2.15.7
package sysin
import (
"context"
"hotgo/internal/library/hgorm/hook"
"hotgo/internal/model/entity"
"hotgo/internal/model/input/form"
"hotgo/utility/tree"
"github.com/gogf/gf/v2/frame/g"
"github.com/gogf/gf/v2/os/gtime"
)
// NormalTreeDemoUpdateFields 修改普通树表字段过滤
type NormalTreeDemoUpdateFields struct {
Title string `json:"title" dc:"标题"`
Pid int64 `json:"pid" dc:"上级"`
Level int `json:"level" dc:"关系树级别"`
Tree string `json:"tree" dc:"关系树"`
CategoryId int64 `json:"categoryId" dc:"测试分类"`
Description string `json:"description" dc:"描述"`
Sort int `json:"sort" dc:"排序"`
Status int `json:"status" dc:"状态"`
UpdatedBy int64 `json:"updatedBy" dc:"更新者"`
}
// NormalTreeDemoInsertFields 新增普通树表字段过滤
type NormalTreeDemoInsertFields struct {
Title string `json:"title" dc:"标题"`
Pid int64 `json:"pid" dc:"上级"`
Level int `json:"level" dc:"关系树级别"`
Tree string `json:"tree" dc:"关系树"`
CategoryId int64 `json:"categoryId" dc:"测试分类"`
Description string `json:"description" dc:"描述"`
Sort int `json:"sort" dc:"排序"`
Status int `json:"status" dc:"状态"`
CreatedBy int64 `json:"createdBy" dc:"创建者"`
}
// NormalTreeDemoEditInp 修改/新增普通树表
type NormalTreeDemoEditInp struct {
entity.SysGenTreeDemo
}
func (in *NormalTreeDemoEditInp) Filter(ctx context.Context) (err error) {
// 验证标题
if err := g.Validator().Rules("required").Data(in.Title).Messages("标题不能为空").Run(ctx); err != nil {
return err.Current()
}
return
}
type NormalTreeDemoEditModel struct{}
// NormalTreeDemoDeleteInp 删除普通树表
type NormalTreeDemoDeleteInp struct {
Id interface{} `json:"id" v:"required#ID不能为空" dc:"ID"`
}
func (in *NormalTreeDemoDeleteInp) Filter(ctx context.Context) (err error) {
return
}
type NormalTreeDemoDeleteModel struct{}
// NormalTreeDemoViewInp 获取指定普通树表信息
type NormalTreeDemoViewInp struct {
Id int64 `json:"id" v:"required#ID不能为空" dc:"ID"`
}
func (in *NormalTreeDemoViewInp) Filter(ctx context.Context) (err error) {
return
}
type NormalTreeDemoViewModel struct {
entity.SysGenTreeDemo
CreatedBySumma *hook.MemberSumma `json:"createdBySumma" dc:"创建者摘要信息"`
}
// NormalTreeDemoListInp 获取普通树表列表
type NormalTreeDemoListInp struct {
form.PageReq
Title string `json:"title" dc:"标题"`
Pid int64 `json:"pid" dc:"上级"`
CategoryId int64 `json:"categoryId" dc:"测试分类"`
Status int `json:"status" dc:"状态"`
CreatedAt []*gtime.Time `json:"createdAt" dc:"创建时间"`
}
func (in *NormalTreeDemoListInp) Filter(ctx context.Context) (err error) {
return
}
type NormalTreeDemoListModel struct {
Title string `json:"title" dc:"标题"`
Id int64 `json:"id" dc:"ID"`
Pid int64 `json:"pid" dc:"上级"`
CategoryId int64 `json:"categoryId" dc:"测试分类"`
Description string `json:"description" dc:"描述"`
Status int `json:"status" dc:"状态"`
CreatedBy int64 `json:"createdBy" dc:"创建者"`
CreatedBySumma *hook.MemberSumma `json:"createdBySumma" dc:"创建者摘要信息"`
CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"`
}
// NormalTreeDemoMaxSortInp 获取普通树表最大排序
type NormalTreeDemoMaxSortInp struct{}
func (in *NormalTreeDemoMaxSortInp) Filter(ctx context.Context) (err error) {
return
}
type NormalTreeDemoMaxSortModel struct {
Sort int `json:"sort" description:"排序"`
}
// NormalTreeDemoTreeOption 关系树选项
type NormalTreeDemoTreeOption struct {
Title string `json:"title" dc:"标题"`
Id int64 `json:"id" dc:"ID"`
Pid int64 `json:"pid" dc:"上级"`
Children []tree.Node `json:"children" dc:"子节点"`
}
// ID 获取节点ID
func (t *NormalTreeDemoTreeOption) ID() int64 {
return t.Id
}
// PID 获取父级节点ID
func (t *NormalTreeDemoTreeOption) PID() int64 {
return t.Pid
}
// SetChildren 设置子节点数据
func (t *NormalTreeDemoTreeOption) SetChildren(children []tree.Node) {
t.Children = children
}
@@ -0,0 +1,144 @@
// Package sysin
// @Link https://github.com/bufanyun/hotgo
// @Copyright Copyright (c) 2025 HotGo CLI
// @Author Ms <133814250@qq.com>
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
// @AutoGenerate Version 2.17.8
package sysin
import (
"context"
"hotgo/internal/library/hgorm/hook"
"hotgo/internal/model/entity"
"hotgo/internal/model/input/form"
"hotgo/utility/tree"
"github.com/gogf/gf/v2/frame/g"
"github.com/gogf/gf/v2/os/gtime"
)
// OptionTreeDemoUpdateFields 修改选项树表字段过滤
type OptionTreeDemoUpdateFields struct {
Title string `json:"title" dc:"标题"`
Pid int64 `json:"pid" dc:"上级"`
Level int `json:"level" dc:"关系树级别"`
Tree string `json:"tree" dc:"关系树"`
CategoryId int64 `json:"categoryId" dc:"测试分类"`
Description string `json:"description" dc:"描述"`
Sort int `json:"sort" dc:"排序"`
Status int `json:"status" dc:"状态"`
UpdatedBy int64 `json:"updatedBy" dc:"更新者"`
}
// OptionTreeDemoInsertFields 新增选项树表字段过滤
type OptionTreeDemoInsertFields struct {
Title string `json:"title" dc:"标题"`
Pid int64 `json:"pid" dc:"上级"`
Level int `json:"level" dc:"关系树级别"`
Tree string `json:"tree" dc:"关系树"`
CategoryId int64 `json:"categoryId" dc:"测试分类"`
Description string `json:"description" dc:"描述"`
Sort int `json:"sort" dc:"排序"`
Status int `json:"status" dc:"状态"`
CreatedBy int64 `json:"createdBy" dc:"创建者"`
}
// OptionTreeDemoEditInp 修改/新增选项树表
type OptionTreeDemoEditInp struct {
entity.SysGenTreeDemo
}
func (in *OptionTreeDemoEditInp) Filter(ctx context.Context) (err error) {
// 验证标题
if err := g.Validator().Rules("required").Data(in.Title).Messages("标题不能为空").Run(ctx); err != nil {
return err.Current()
}
return
}
type OptionTreeDemoEditModel struct{}
// OptionTreeDemoDeleteInp 删除选项树表
type OptionTreeDemoDeleteInp struct {
Id interface{} `json:"id" v:"required#ID不能为空" dc:"ID"`
}
func (in *OptionTreeDemoDeleteInp) Filter(ctx context.Context) (err error) {
return
}
type OptionTreeDemoDeleteModel struct{}
// OptionTreeDemoViewInp 获取指定选项树表信息
type OptionTreeDemoViewInp struct {
Id int64 `json:"id" v:"required#ID不能为空" dc:"ID"`
}
func (in *OptionTreeDemoViewInp) Filter(ctx context.Context) (err error) {
return
}
type OptionTreeDemoViewModel struct {
entity.SysGenTreeDemo
CreatedBySumma *hook.MemberSumma `json:"createdBySumma" dc:"创建者摘要信息"`
}
// OptionTreeDemoListInp 获取选项树表列表
type OptionTreeDemoListInp struct {
form.PageReq
Title string `json:"title" dc:"标题"`
Pid int64 `json:"pid" dc:"上级"`
CategoryId int64 `json:"categoryId" dc:"测试分类"`
Status int `json:"status" dc:"状态"`
CreatedAt []*gtime.Time `json:"createdAt" dc:"创建时间"`
}
func (in *OptionTreeDemoListInp) Filter(ctx context.Context) (err error) {
return
}
type OptionTreeDemoListModel struct {
Title string `json:"title" dc:"标题"`
Id int64 `json:"id" dc:"ID"`
Pid int64 `json:"pid" dc:"上级"`
CategoryId int64 `json:"categoryId" dc:"测试分类"`
Status int `json:"status" dc:"状态"`
CreatedBy int64 `json:"createdBy" dc:"创建者"`
CreatedBySumma *hook.MemberSumma `json:"createdBySumma" dc:"创建者摘要信息"`
CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"`
}
// OptionTreeDemoMaxSortInp 获取选项树表最大排序
type OptionTreeDemoMaxSortInp struct{}
func (in *OptionTreeDemoMaxSortInp) Filter(ctx context.Context) (err error) {
return
}
type OptionTreeDemoMaxSortModel struct {
Sort int `json:"sort" description:"排序"`
}
// OptionTreeDemoTreeOption 关系树选项
type OptionTreeDemoTreeOption struct {
Title string `json:"title" dc:"标题"`
Id int64 `json:"id" dc:"ID"`
Pid int64 `json:"pid" dc:"上级"`
Children []tree.Node `json:"children" dc:"子节点"`
}
// ID 获取节点ID
func (t *OptionTreeDemoTreeOption) ID() int64 {
return t.Id
}
// PID 获取父级节点ID
func (t *OptionTreeDemoTreeOption) PID() int64 {
return t.Pid
}
// SetChildren 设置子节点数据
func (t *OptionTreeDemoTreeOption) SetChildren(children []tree.Node) {
t.Children = children
}
@@ -0,0 +1,182 @@
// Package sysin
// @Link https://github.com/bufanyun/hotgo
// @Copyright Copyright (c) 2023 HotGo CLI
// @Author Ms <133814250@qq.com>
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
package sysin
import (
"context"
"github.com/gogf/gf/v2/errors/gerror"
"hotgo/internal/consts"
"hotgo/internal/model/entity"
"hotgo/internal/model/input/form"
"hotgo/utility/validate"
)
// ProvincesMaxSortInp 最大排序
type ProvincesMaxSortInp struct {
}
type ProvincesMaxSortModel struct {
Sort int `json:"sort" dc:"排序"`
}
// ProvincesEditInp 修改/新增字典数据
type ProvincesEditInp struct {
entity.SysProvinces
}
func (in *ProvincesEditInp) Filter(ctx context.Context) (err error) {
if in.Title == "" {
err = gerror.New("标题不能为空")
return
}
if in.Id <= 0 {
err = gerror.New("地区Id必须大于0")
return
}
return
}
type ProvincesEditModel struct{}
// ProvincesUpdateFields 修改数据字段过滤
type ProvincesUpdateFields struct {
Id int64 `json:"id" description:"省市区ID"`
Title string `json:"title" description:"栏目名称"`
Pinyin string `json:"pinyin" description:"拼音"`
Lng string `json:"lng" description:"经度"`
Lat string `json:"lat" description:"纬度"`
Pid int64 `json:"pid" description:"父栏目"`
Level int `json:"level" description:"关系树等级"`
Tree string `json:"tree" description:"关系"`
Sort int `json:"sort" description:"排序"`
Status int `json:"status" description:"状态"`
}
// ProvincesInsertFields 新增数据字段过滤
type ProvincesInsertFields struct {
Id int64 `json:"id" description:"省市区ID"`
Title string `json:"title" description:"栏目名称"`
Pinyin string `json:"pinyin" description:"拼音"`
Lng string `json:"lng" description:"经度"`
Lat string `json:"lat" description:"纬度"`
Pid int64 `json:"pid" description:"父栏目"`
Level int `json:"level" description:"关系树等级"`
Tree string `json:"tree" description:"关系"`
Sort int `json:"sort" description:"排序"`
Status int `json:"status" description:"状态"`
}
// ProvincesDeleteInp 删除字典类型
type ProvincesDeleteInp struct {
Id interface{} `json:"id" v:"required#省市区ID不能为空" dc:"省市区ID"`
}
type ProvincesDeleteModel struct{}
// ProvincesViewInp 获取信息
type ProvincesViewInp struct {
Id int64
}
type ProvincesViewModel struct {
Id int64 `json:"id" v:"required#省市区ID不能为空" dc:"省市区ID"`
}
// ProvincesListInp 获取列表
type ProvincesListInp struct {
form.PageReq
form.StatusReq
Title string `json:"title"`
Content string `json:"content"`
}
type ProvincesListModel struct {
entity.SysProvinces
}
// ProvincesStatusInp 更新状态
type ProvincesStatusInp struct {
entity.SysProvinces
}
func (in *ProvincesStatusInp) Filter(ctx context.Context) (err error) {
if in.Id <= 0 {
err = gerror.New("ID不能为空")
return
}
if in.Status <= 0 {
err = gerror.New("状态不能为空")
return
}
if !validate.InSlice(consts.StatusSlice, in.Status) {
err = gerror.New("状态不正确")
return
}
return
}
type ProvincesStatusModel struct{}
// ProvincesChildrenListInp 获取省市区下级列表
type ProvincesChildrenListInp struct {
form.PageReq
form.StatusReq
Pid int64 `json:"pid" dc:"上级ID"`
Id int64 `json:"id" dc:"地区ID"`
Title string `json:"title" dc:"地区名称"`
}
type ProvincesChildrenListModel struct {
entity.SysProvinces
}
// ProvincesUniqueIdInp 获取省市区下级列表
type ProvincesUniqueIdInp struct {
OldId int64 `json:"oldId" dc:"原始ID"`
NewId int64 `json:"newId" dc:"新的ID"`
}
type ProvincesUniqueIdModel struct {
IsUnique bool `json:"unique" dc:"是否唯一"`
}
type ProvincesSelectInp struct {
DataType string `json:"dataType" v:"required#数据类型不能为空" dc:"数据类型"`
Value int64 `json:"value" dc:"上级ID"`
}
type ProvincesSelectModel struct {
List []*ProvincesSelectData `json:"list" dc:"数据列表"`
}
type ProvincesSelectData struct {
Label string `json:"label" description:"地区名称"`
Value int64 `json:"value" description:"地区ID"`
Level int `json:"level" description:"地区等级"`
IsLeaf bool `json:"isLeaf" description:"是否是最后一个节点"`
}
// ProvincesCityLabelInp 获取指定城市标签
type ProvincesCityLabelInp struct {
Id int64 `json:"oldId" dc:"城市ID"`
Spilt string `json:"spilt" dc:"分隔符"`
}
type ProvincesCityLabelModel string
// ProvincesTree 树
type ProvincesTree struct {
entity.SysProvinces
Key int64 `json:"key" dc:"key"`
Label string `json:"label" dc:"标签"`
Value int64 `json:"value" dc:"键值"`
Children []*ProvincesTree `json:"children"`
}
@@ -0,0 +1,190 @@
// Package sysin
// @Link https://github.com/bufanyun/hotgo
// @Copyright Copyright (c) 2023 HotGo CLI
// @Author Ms <133814250@qq.com>
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
// @AutoGenerate Version 2.7.6
package sysin
import (
"context"
"github.com/gogf/gf/v2/encoding/gjson"
"github.com/gogf/gf/v2/errors/gerror"
"github.com/gogf/gf/v2/frame/g"
"github.com/gogf/gf/v2/os/gtime"
"hotgo/internal/consts"
"hotgo/internal/model/entity"
"hotgo/internal/model/input/form"
"hotgo/utility/validate"
)
// ServeLicenseUpdateFields 修改服务许可证字段过滤
type ServeLicenseUpdateFields struct {
Group string `json:"group" dc:"分组"`
Name string `json:"name" dc:"许可名称"`
Appid string `json:"appid" dc:"应用ID"`
SecretKey string `json:"secretKey" dc:"应用秘钥"`
OnlineLimit int `json:"onlineLimit" dc:"在线数量限制,默认1"`
// Routes *gjson.Json `json:"routes" dc:"路由表,空使用默认分组路由"`
AllowedIps string `json:"allowedIps" dc:"白名单,*代表所有,只有允许的IP才能连接到tcp服务"`
EndAt *gtime.Time `json:"endAt" dc:"授权结束时间"`
Remark string `json:"remark" dc:"备注"`
Status int `json:"status" dc:"状态"`
}
// ServeLicenseInsertFields 新增服务许可证字段过滤
type ServeLicenseInsertFields struct {
Group string `json:"group" dc:"分组"`
Name string `json:"name" dc:"许可名称"`
Appid string `json:"appid" dc:"应用ID"`
SecretKey string `json:"secretKey" dc:"应用秘钥"`
OnlineLimit int `json:"onlineLimit" dc:"在线数量限制,默认1"`
// Routes *gjson.Json `json:"routes" dc:"路由表,空使用默认分组路由"`
AllowedIps string `json:"allowedIps" dc:"白名单,*代表所有,只有允许的IP才能连接到tcp服务"`
EndAt *gtime.Time `json:"endAt" dc:"授权结束时间"`
Remark string `json:"remark" dc:"备注"`
Status int `json:"status" dc:"状态"`
}
// ServeLicenseEditInp 修改/新增服务许可证
type ServeLicenseEditInp struct {
entity.SysServeLicense
}
func (in *ServeLicenseEditInp) Filter(ctx context.Context) (err error) {
// 验证分组
if err := g.Validator().Rules("required").Data(in.Group).Messages("分组不能为空").Run(ctx); err != nil {
return err.Current()
}
// 验证许可名称
if err := g.Validator().Rules("required").Data(in.Name).Messages("许可名称不能为空").Run(ctx); err != nil {
return err.Current()
}
// 验证应用ID
if err := g.Validator().Rules("required").Data(in.Appid).Messages("应用ID不能为空").Run(ctx); err != nil {
return err.Current()
}
// 验证授权结束时间
if err := g.Validator().Rules("required").Data(in.EndAt).Messages("授权结束时间不能为空").Run(ctx); err != nil {
return err.Current()
}
return
}
type ServeLicenseEditModel struct{}
// ServeLicenseDeleteInp 删除服务许可证
type ServeLicenseDeleteInp struct {
Id interface{} `json:"id" v:"required#许可ID不能为空" dc:"许可ID"`
}
func (in *ServeLicenseDeleteInp) Filter(ctx context.Context) (err error) {
return
}
type ServeLicenseDeleteModel struct{}
// ServeLicenseViewInp 获取指定服务许可证信息
type ServeLicenseViewInp struct {
Id int64 `json:"id" v:"required#许可ID不能为空" dc:"许可ID"`
}
func (in *ServeLicenseViewInp) Filter(ctx context.Context) (err error) {
return
}
type ServeLicenseViewModel struct {
entity.SysServeLicense
}
// ServeLicenseListInp 获取服务许可证列表
type ServeLicenseListInp struct {
form.PageReq
Id int64 `json:"id" dc:"许可ID"`
Group string `json:"group" dc:"分组"`
Name string `json:"name" dc:"许可名称"`
Appid string `json:"appid" dc:"应用ID"`
EndAt []*gtime.Time `json:"endAt" dc:"授权结束时间"`
Status int `json:"status" dc:"状态"`
CreatedAt []*gtime.Time `json:"createdAt" dc:"创建时间"`
}
func (in *ServeLicenseListInp) Filter(ctx context.Context) (err error) {
return
}
type ServeLicenseListModel struct {
Id int64 `json:"id" dc:"许可ID"`
Group string `json:"group" dc:"分组"`
Name string `json:"name" dc:"许可名称"`
Appid string `json:"appid" dc:"应用ID"`
SecretKey string `json:"secretKey" dc:"应用秘钥"`
RemoteAddr string `json:"remoteAddr" dc:"最后连接地址"`
OnlineLimit int `json:"onlineLimit" dc:"在线数量限制,默认1"`
LoginTimes int64 `json:"loginTimes" dc:"登录次数"`
LastLoginAt *gtime.Time `json:"lastLoginAt" dc:"最后登录时间"`
LastActiveAt *gtime.Time `json:"lastActiveAt" dc:"最后活跃时间"`
EndAt *gtime.Time `json:"endAt" dc:"授权结束时间"`
Routes *gjson.Json `json:"routes" dc:"路由表,空使用默认分组路由"`
Status int `json:"status" dc:"状态"`
CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"`
UpdatedAt *gtime.Time `json:"updatedAt" dc:"修改时间"`
Online int `json:"online" dc:"在线"`
}
// ServeLicenseExportModel 导出服务许可证
type ServeLicenseExportModel struct {
Id int64 `json:"id" dc:"许可ID"`
Group string `json:"group" dc:"分组"`
Name string `json:"name" dc:"许可名称"`
Appid string `json:"appid" dc:"应用ID"`
SecretKey string `json:"secretKey" dc:"应用秘钥"`
RemoteAddr string `json:"remoteAddr" dc:"最后连接地址"`
OnlineLimit int `json:"onlineLimit" dc:"在线数量限制,默认1"`
LoginTimes int64 `json:"loginTimes" dc:"登录次数"`
LastLoginAt *gtime.Time `json:"lastLoginAt" dc:"最后登录时间"`
LastActiveAt *gtime.Time `json:"lastActiveAt" dc:"最后活跃时间"`
EndAt *gtime.Time `json:"endAt" dc:"授权结束时间"`
Status int `json:"status" dc:"状态"`
CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"`
UpdatedAt *gtime.Time `json:"updatedAt" dc:"修改时间"`
}
// ServeLicenseStatusInp 更新服务许可证状态
type ServeLicenseStatusInp struct {
Id int64 `json:"id" v:"required#许可ID不能为空" dc:"许可ID"`
Status int `json:"status" dc:"状态"`
}
func (in *ServeLicenseStatusInp) Filter(ctx context.Context) (err error) {
if in.Id <= 0 {
err = gerror.New("许可ID不能为空")
return
}
if in.Status <= 0 {
err = gerror.New("状态不能为空")
return
}
if !validate.InSlice(consts.StatusSlice, in.Status) {
err = gerror.New("状态不正确")
return
}
return
}
type ServeLicenseStatusModel struct{}
type ServeLicenseAssignRouterInp struct {
Id int64 `json:"id" v:"required#许可ID不能为空" dc:"许可ID"`
Routes *gjson.Json `json:"routes" dc:"路由表,空使用默认分组路由"`
}
func (in *ServeLicenseAssignRouterInp) Filter(ctx context.Context) (err error) {
return
}
@@ -0,0 +1,69 @@
// Package sysin
// @Link https://github.com/bufanyun/hotgo
// @Copyright Copyright (c) 2023 HotGo CLI
// @Author Ms <133814250@qq.com>
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
package sysin
import (
"context"
"github.com/gogf/gf/v2/os/gtime"
"hotgo/internal/model/entity"
"hotgo/internal/model/input/form"
)
// ServeLogDeleteInp 删除服务日志
type ServeLogDeleteInp struct {
Id interface{} `json:"id" v:"required#日志ID不能为空" dc:"日志ID"`
}
type ServeLogDeleteModel struct{}
// ServeLogViewInp 获取指定服务日志信息
type ServeLogViewInp struct {
Id int64 `json:"id" v:"required#日志ID不能为空" dc:"日志ID"`
}
type ServeLogViewModel struct {
entity.SysServeLog
}
// ServeLogListInp 获取服务日志列表
type ServeLogListInp struct {
form.PageReq
TraceId string `json:"traceId" dc:"链路ID"`
LevelFormat string `json:"levelFormat" dc:"日志级别"`
Content string `json:"content" dc:"日志内容"`
TriggerNs []int64 `json:"triggerNs" dc:"触发时间(ns)"`
CreatedAt []*gtime.Time `json:"createdAt" dc:"创建时间"`
}
type ServeLogListModel struct {
Id int64 `json:"id" dc:"日志ID"`
TraceId string `json:"traceId" dc:"链路ID"`
LevelFormat string `json:"levelFormat" dc:"日志级别"`
Content string `json:"content" dc:"日志内容"`
Stack string `json:"stack" dc:"堆栈"`
Line string `json:"line" dc:"调用行"`
TriggerNs int64 `json:"triggerNs" dc:"触发时间(ns)"`
CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"`
UpdatedAt *gtime.Time `json:"updatedAt" dc:"修改时间"`
SysLogId int64 `json:"sysLogId" dc:"访问日志ID"`
}
func (in *ServeLogListInp) Filter(ctx context.Context) (err error) {
return
}
// ServeLogExportModel 导出服务日志
type ServeLogExportModel struct {
Id int64 `json:"id" dc:"日志ID"`
Env string `json:"env" dc:"环境"`
TraceId string `json:"traceId" dc:"链路ID"`
LevelFormat string `json:"levelFormat" dc:"日志级别"`
Content string `json:"content" dc:"日志内容"`
Line string `json:"line" dc:"调用行"`
TriggerNs int64 `json:"triggerNs" dc:"触发时间(ns)"`
CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"`
UpdatedAt *gtime.Time `json:"updatedAt" dc:"修改时间"`
}
@@ -0,0 +1,84 @@
// Package sysin
// @Link https://github.com/bufanyun/hotgo
// @Copyright Copyright (c) 2023 HotGo CLI
// @Author Ms <133814250@qq.com>
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
package sysin
import (
"context"
"github.com/gogf/gf/v2/errors/gerror"
"github.com/gogf/gf/v2/os/gtime"
"hotgo/internal/consts"
"hotgo/internal/model/entity"
"hotgo/internal/model/input/form"
)
// SmsLogEditInp 修改/新增数据
type SmsLogEditInp struct {
entity.SysSmsLog
}
type SmsLogEditModel struct{}
// SmsLogDeleteInp 删除
type SmsLogDeleteInp struct {
Id interface{} `json:"id" v:"required#短信记录ID不能为空" dc:"短信记录ID"`
}
type SmsLogDeleteModel struct{}
// SmsLogViewInp 获取信息
type SmsLogViewInp struct {
Id int64 `json:"id" v:"required#短信记录ID不能为空" dc:"短信记录ID"`
}
type SmsLogViewModel struct {
entity.SysSmsLog
}
// SmsLogListInp 获取列表
type SmsLogListInp struct {
form.PageReq
form.StatusReq
Mobile string `json:"mobile" dc:"手机号"`
Ip string `json:"ip" dc:"IP"`
Event string `json:"event" dc:"事件"`
CreatedAt []*gtime.Time `json:"createdAt" dc:"创建时间"`
}
func (in *SmsLogListInp) Filter(ctx context.Context) (err error) {
if in.Event != "" {
if _, ok := consts.SmsTemplateEventMap[in.Event]; !ok {
err = gerror.Newf("无效的事件类型:%v", in.Event)
return
}
}
return
}
type SmsLogListModel struct {
entity.SysSmsLog
}
// SmsLogStatusInp 更新状态
type SmsLogStatusInp struct {
entity.SysSmsLog
}
type SmsLogStatusModel struct{}
// SendCodeInp 发送验证码
type SendCodeInp struct {
Event string `json:"event" description:"事件"` // 必填
Mobile string `json:"mobile" description:"手机号"` // 必填
Code string `json:"code" description:"验证码或短信内容"`
Template string `json:"-" description:"发信模板 "`
}
// VerifyCodeInp 效验验证码
type VerifyCodeInp struct {
Event string `json:"event" description:"事件"` // 必填
Mobile string `json:"mobile" description:"手机号"` // 必填
Code string `json:"code" description:"验证码或短信内容"` // 必填
}
@@ -0,0 +1,143 @@
// Package sysin
// @Link https://github.com/bufanyun/hotgo
// @Copyright Copyright (c) 2024 HotGo CLI
// @Author Ms <133814250@qq.com>
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
// @AutoGenerate Version 2.15.7
package sysin
import (
"context"
"hotgo/internal/consts"
"hotgo/internal/model/entity"
"hotgo/internal/model/input/form"
"hotgo/utility/validate"
"github.com/gogf/gf/v2/errors/gerror"
"github.com/gogf/gf/v2/frame/g"
"github.com/gogf/gf/v2/os/gtime"
)
// TestCategoryUpdateFields 修改测试分类字段过滤
type TestCategoryUpdateFields struct {
Name string `json:"name" dc:"分类名称"`
ShortName string `json:"shortName" dc:"简称"`
Description string `json:"description" dc:"描述"`
Sort int `json:"sort" dc:"排序"`
Status int `json:"status" dc:"状态"`
Remark string `json:"remark" dc:"备注"`
}
// TestCategoryInsertFields 新增测试分类字段过滤
type TestCategoryInsertFields struct {
Name string `json:"name" dc:"分类名称"`
ShortName string `json:"shortName" dc:"简称"`
Description string `json:"description" dc:"描述"`
Sort int `json:"sort" dc:"排序"`
Status int `json:"status" dc:"状态"`
Remark string `json:"remark" dc:"备注"`
}
// TestCategoryEditInp 修改/新增测试分类
type TestCategoryEditInp struct {
entity.TestCategory
}
func (in *TestCategoryEditInp) Filter(ctx context.Context) (err error) {
// 验证分类名称
if err := g.Validator().Rules("required").Data(in.Name).Messages("分类名称不能为空").Run(ctx); err != nil {
return err.Current()
}
// 验证排序
if err := g.Validator().Rules("required").Data(in.Sort).Messages("排序不能为空").Run(ctx); err != nil {
return err.Current()
}
return
}
type TestCategoryEditModel struct{}
// TestCategoryDeleteInp 删除测试分类
type TestCategoryDeleteInp struct {
Id interface{} `json:"id" v:"required#分类ID不能为空" dc:"分类ID"`
}
func (in *TestCategoryDeleteInp) Filter(ctx context.Context) (err error) {
return
}
type TestCategoryDeleteModel struct{}
// TestCategoryViewInp 获取指定测试分类信息
type TestCategoryViewInp struct {
Id int64 `json:"id" v:"required#分类ID不能为空" dc:"分类ID"`
}
func (in *TestCategoryViewInp) Filter(ctx context.Context) (err error) {
return
}
type TestCategoryViewModel struct {
entity.TestCategory
}
// TestCategoryListInp 获取测试分类列表
type TestCategoryListInp struct {
form.PageReq
Id int64 `json:"id" dc:"分类ID"`
Name string `json:"name" dc:"分类名称"`
Status int `json:"status" dc:"状态"`
CreatedAt []*gtime.Time `json:"createdAt" dc:"创建时间"`
}
func (in *TestCategoryListInp) Filter(ctx context.Context) (err error) {
return
}
type TestCategoryListModel struct {
Id int64 `json:"id" dc:"分类ID"`
Name string `json:"name" dc:"分类名称"`
ShortName string `json:"shortName" dc:"简称"`
Description string `json:"description" dc:"描述"`
Status int `json:"status" dc:"状态"`
CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"`
}
// TestCategoryMaxSortInp 获取测试分类最大排序
type TestCategoryMaxSortInp struct{}
func (in *TestCategoryMaxSortInp) Filter(ctx context.Context) (err error) {
return
}
type TestCategoryMaxSortModel struct {
Sort int `json:"sort" description:"排序"`
}
// TestCategoryStatusInp 更新测试分类状态
type TestCategoryStatusInp struct {
Id int64 `json:"id" v:"required#分类ID不能为空" dc:"分类ID"`
Status int `json:"status" dc:"状态"`
}
func (in *TestCategoryStatusInp) Filter(ctx context.Context) (err error) {
if in.Id <= 0 {
err = gerror.New("分类ID不能为空")
return
}
if in.Status <= 0 {
err = gerror.New("状态不能为空")
return
}
if !validate.InSlice(consts.StatusSlice, in.Status) {
err = gerror.New("状态不正确")
return
}
return
}
type TestCategoryStatusModel struct{}
@@ -0,0 +1,16 @@
// Package websocketin
// @Link https://github.com/bufanyun/hotgo
// @Copyright Copyright (c) 2023 HotGo CLI
// @Author Ms <133814250@qq.com>
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
package websocketin
import (
"hotgo/internal/websocket"
)
// SendToTagInp 发送标签消息
type SendToTagInp struct {
Tag string `json:"tag" v:"required#tag不能为空" description:"标签"`
Response websocket.WResponse `json:"response" v:"required#response不能为空" description:"响应内容"`
}