feat: add Go backend

This commit is contained in:
richjohnrambo
2026-10-10 20:56:17 +08:00
parent 50fcfd2d3d
commit f6024f0964
1040 changed files with 107169 additions and 0 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{}
+155
View File
@@ -0,0 +1,155 @@
// 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"`
AllowedMenuIds []int64 `json:"allowedMenuIds" dc:"上级角色允许分配的菜单ID"`
}
// 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,27 @@
// Package sysin
// @Link https://github.com/bufanyun/hotgo
// @Copyright Copyright (c) 2023 HotGo CLI
// @Author Ms <133814250@qq.com>
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
//
package sysin
import (
"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,427 @@
package sysin
import (
"context"
"strings"
"hotgo/internal/consts"
"hotgo/internal/library/dict"
"hotgo/internal/model/entity"
"hotgo/internal/model/input/form"
"github.com/gogf/gf/v2/encoding/gjson"
"github.com/gogf/gf/v2/errors/gerror"
"github.com/gogf/gf/v2/os/gtime"
)
type AppMemberListInp struct {
form.PageReq
Username string `json:"username" dc:"用户名"`
Mobile string `json:"mobile" dc:"手机号(精确查询)"`
MemberStatus int `json:"memberStatus" dc:"会员状态"`
AutoDispatch int `json:"autoDispatch" dc:"派单模式"`
MemberCategory int `json:"memberCategory" dc:"会员类别"`
CreatedAt []*gtime.Time `json:"createdAt" dc:"注册时间"`
}
func (in *AppMemberListInp) Filter(ctx context.Context) error { return nil }
type AppMemberListModel struct {
Id uint64 `json:"id"`
MemberNo string `json:"memberNo"`
Username string `json:"username"`
MobileMask string `json:"mobileMask"`
RealNameMask string `json:"realNameMask"`
AvailableAmount int64 `json:"availableAmount"`
FrozenAmount int64 `json:"frozenAmount"`
ParentId uint64 `json:"parentId"`
ParentUsername string `json:"parentUsername"`
InviteCode string `json:"inviteCode"`
MemberStatus int `json:"memberStatus"`
RiskStatus int `json:"riskStatus"`
AutoDispatch int `json:"autoDispatch"`
MemberCategory int `json:"memberCategory"`
IsTestAccount int `json:"isTestAccount"`
LastLoginAt *gtime.Time `json:"lastLoginAt"`
LastLoginIpMask string `json:"lastLoginIpMask"`
LastLoginRegion string `json:"lastLoginRegion"`
TodayTradeCount int `json:"todayTradeCount"`
CreatedAt *gtime.Time `json:"createdAt"`
}
type AppMemberViewInp struct {
Id uint64 `json:"id" v:"required|min:1#会员ID不能为空|会员ID不能为空"`
}
func (in *AppMemberViewInp) Filter(ctx context.Context) error { return nil }
type AppMemberViewModel struct {
AppMemberListModel
LevelId uint64 `json:"levelId"`
Level int `json:"level"`
CreditScore int `json:"creditScore"`
KycStatus int `json:"kycStatus"`
IdNoMask string `json:"idNoMask"`
PaymentAccountCount int `json:"paymentAccountCount"`
AddressCount int `json:"addressCount"`
TeamCount int `json:"teamCount"`
}
type AppMemberEditInp struct {
Id uint64 `json:"id"`
Username string `json:"username" v:"required|length:3,64#用户名不能为空|用户名长度为3到64个字符"`
Mobile string `json:"mobile" v:"phone-loose#手机号格式不正确"`
Password string `json:"password"`
TradePassword string `json:"tradePassword"`
RealName string `json:"realName" v:"max-length:64#姓名不能超过64个字符"`
IdNo string `json:"idNo" v:"max-length:32#证件号不能超过32个字符"`
ParentId uint64 `json:"parentId"`
LevelId uint64 `json:"levelId"`
RiskStatus int `json:"riskStatus" d:"1"`
CreditScore int `json:"creditScore" d:"100" v:"between:0,1000#信用分范围为0到1000"`
AutoDispatch int `json:"autoDispatch" d:"2"`
MemberCategory int `json:"memberCategory"`
IsTestAccount int `json:"isTestAccount"`
}
func (in *AppMemberEditInp) Filter(ctx context.Context) error {
if in.Id == 0 && strings.TrimSpace(in.Mobile) == "" {
return gerror.New("新增会员时手机号不能为空")
}
if in.Id == 0 && len(in.Password) < 8 {
return gerror.New("新增会员密码不能少于8位")
}
if in.Password != "" && (len(in.Password) < 8 || !containsLetterAndNumber(in.Password)) {
return gerror.New("密码至少8位且必须同时包含字母和数字")
}
if in.TradePassword != "" && len(in.TradePassword) < 6 {
return gerror.New("交易密码不能少于6位")
}
if !dict.HasOptionKey(consts.AppMemberRiskStatusOptions, in.RiskStatus) {
return gerror.New("风控状态不合法")
}
if !dict.HasOptionKey(consts.AppMemberDispatchModeOptions, in.AutoDispatch) {
return gerror.New("派单模式不合法")
}
if in.MemberCategory == 0 {
if in.IsTestAccount == 1 {
in.MemberCategory = consts.AppMemberCategoryFake
} else {
in.MemberCategory = consts.AppMemberCategoryReal
}
}
if !dict.HasOptionKey(consts.AppMemberCategoryOptions, in.MemberCategory) {
return gerror.New("会员类别不合法")
}
return nil
}
func containsLetterAndNumber(value string) bool {
letter, number := false, false
for _, r := range value {
if r >= '0' && r <= '9' {
number = true
}
if (r >= 'a' && r <= 'z') || (r >= 'A' && r <= 'Z') {
letter = true
}
}
return letter && number
}
type AppMemberDeleteInp struct {
Id uint64 `json:"id" v:"required|min:1#会员ID不能为空|会员ID不能为空"`
Reason string `json:"reason" v:"required|max-length:500#注销原因不能为空|注销原因不能超过500个字符"`
}
func (in *AppMemberDeleteInp) Filter(ctx context.Context) error { return nil }
type AppMemberAutoDispatchInp struct {
Id uint64 `json:"id" v:"required|min:1#会员ID不能为空|会员ID不能为空"`
AutoDispatch int `json:"autoDispatch" v:"required|in:1,2#派单模式不能为空|派单模式不合法"`
}
func (in *AppMemberAutoDispatchInp) Filter(ctx context.Context) error { return nil }
type AppMemberCategoryInp struct {
Id uint64 `json:"id" v:"required|min:1#会员ID不能为空|会员ID不能为空"`
MemberCategory int `json:"memberCategory" v:"required#会员类别不能为空"`
}
func (in *AppMemberCategoryInp) Filter(ctx context.Context) error {
if !dict.HasOptionKey(consts.AppMemberCategoryOptions, in.MemberCategory) {
return gerror.New("会员类别不合法")
}
return nil
}
type AppMemberPaymentListInp struct {
MemberId uint64 `json:"memberId" v:"required|min:1#会员ID不能为空|会员ID不能为空"`
}
func (in *AppMemberPaymentListInp) Filter(ctx context.Context) error { return nil }
type AppMemberPaymentModel struct {
Id uint64 `json:"id"`
MemberId uint64 `json:"memberId"`
AccountType int `json:"accountType"`
BankCode string `json:"bankCode"`
BankName string `json:"bankName"`
HolderMask string `json:"holderMask"`
MobileMask string `json:"mobileMask"`
AccountNoMask string `json:"accountNoMask"`
QrAttachmentId uint64 `json:"qrAttachmentId"`
VerifyStatus int `json:"verifyStatus"`
IsDefault int `json:"isDefault"`
CreatedAt *gtime.Time `json:"createdAt"`
UpdatedAt *gtime.Time `json:"updatedAt"`
}
type AppMemberPaymentEditInp struct {
Id uint64 `json:"id"`
MemberId uint64 `json:"memberId" v:"required|min:1#会员ID不能为空|会员ID不能为空"`
AccountType int `json:"accountType" v:"required#账户类型不能为空"`
BankCode string `json:"bankCode" v:"max-length:32#银行编码不能超过32个字符"`
BankName string `json:"bankName" v:"max-length:100#银行名称不能超过100个字符"`
Holder string `json:"holder"`
Mobile string `json:"mobile" v:"phone-loose#手机号格式不正确"`
AccountNo string `json:"accountNo"`
QrAttachmentId uint64 `json:"qrAttachmentId"`
VerifyStatus int `json:"verifyStatus" d:"1"`
IsDefault int `json:"isDefault" d:"2"`
}
func (in *AppMemberPaymentEditInp) Filter(ctx context.Context) error {
if !dict.HasOptionKey(consts.PaymentAccountTypeOptions, in.AccountType) {
return gerror.New("收款账户类型不合法")
}
if in.Id == 0 && (strings.TrimSpace(in.Holder) == "" || strings.TrimSpace(in.AccountNo) == "") {
return gerror.New("新增收款账户时持有人和账号不能为空")
}
return nil
}
type AppMemberPaymentDeleteInp struct {
Id uint64 `json:"id" v:"required|min:1#账户ID不能为空|账户ID不能为空"`
}
func (in *AppMemberPaymentDeleteInp) Filter(ctx context.Context) error { return nil }
type AppMemberAddressListInp struct {
MemberId uint64 `json:"memberId" v:"required|min:1#会员ID不能为空|会员ID不能为空"`
}
func (in *AppMemberAddressListInp) Filter(ctx context.Context) error { return nil }
type AppMemberAddressModel struct {
Id uint64 `json:"id"`
MemberId uint64 `json:"memberId"`
ReceiverMask string `json:"receiverMask"`
MobileMask string `json:"mobileMask"`
Province string `json:"province"`
City string `json:"city"`
District string `json:"district"`
AddressMask string `json:"addressMask"`
IsDefault int `json:"isDefault"`
CreatedAt *gtime.Time `json:"createdAt"`
UpdatedAt *gtime.Time `json:"updatedAt"`
}
type AppMemberAddressEditInp struct {
Id uint64 `json:"id"`
MemberId uint64 `json:"memberId" v:"required|min:1#会员ID不能为空|会员ID不能为空"`
Receiver string `json:"receiver"`
Mobile string `json:"mobile" v:"phone-loose#手机号格式不正确"`
Province string `json:"province"`
City string `json:"city"`
District string `json:"district"`
Address string `json:"address"`
IsDefault int `json:"isDefault" d:"2"`
}
func (in *AppMemberAddressEditInp) Filter(ctx context.Context) error {
if in.Id == 0 && (strings.TrimSpace(in.Receiver) == "" || strings.TrimSpace(in.Mobile) == "" || strings.TrimSpace(in.Address) == "") {
return gerror.New("新增地址时收货人、手机号和详细地址不能为空")
}
return nil
}
type AppMemberAddressDeleteInp struct {
Id uint64 `json:"id" v:"required|min:1#地址ID不能为空|地址ID不能为空"`
}
func (in *AppMemberAddressDeleteInp) Filter(ctx context.Context) error { return nil }
type AppMemberSensitiveInp struct {
TargetType string `json:"targetType" v:"required|in:member,payment,address#目标类型不能为空|目标类型不合法"`
TargetId uint64 `json:"targetId" v:"required|min:1#目标ID不能为空|目标ID不能为空"`
PurposeCode string `json:"purposeCode" v:"required|max-length:64#用途编码不能为空|用途编码不能超过64个字符"`
PurposeText string `json:"purposeText" v:"required|max-length:500#用途说明不能为空|用途说明不能超过500个字符"`
Confirm bool `json:"confirm" v:"required#必须确认敏感信息查看"`
}
func (in *AppMemberSensitiveInp) Filter(ctx context.Context) error {
if !in.Confirm {
return gerror.New("请确认本次敏感信息查看")
}
return nil
}
type AppMemberSensitiveModel struct {
Fields map[string]string `json:"fields"`
AccessNo string `json:"accessNo"`
}
type AppMemberTeamInp struct {
form.PageReq
MemberId uint64 `json:"memberId" v:"required|min:1#会员ID不能为空|会员ID不能为空"`
MaxLevel int `json:"maxLevel" d:"3" v:"between:1,10#团队层级范围为1到10"`
}
func (in *AppMemberTeamInp) Filter(ctx context.Context) error { return nil }
type AppMemberTeamModel struct {
Id uint64 `json:"id"`
Username string `json:"username"`
MobileMask string `json:"mobileMask"`
ParentId uint64 `json:"parentId"`
RelativeLevel int `json:"relativeLevel"`
TeamCount int `json:"teamCount"`
AvailableAmount int64 `json:"availableAmount"`
FrozenAmount int64 `json:"frozenAmount"`
MemberStatus int `json:"memberStatus"`
CreatedAt *gtime.Time `json:"createdAt"`
}
type AppMemberStatusRequestInp struct {
MemberId uint64 `json:"memberId" v:"required|min:1#会员ID不能为空|会员ID不能为空"`
ToStatus int `json:"toStatus" v:"required#目标状态不能为空"`
ReasonCode string `json:"reasonCode" v:"required|max-length:64#原因编码不能为空|原因编码不能超过64个字符"`
ReasonText string `json:"reasonText" v:"required|max-length:500#原因说明不能为空|原因说明不能超过500个字符"`
ExpireAt *gtime.Time `json:"expireAt"`
}
func (in *AppMemberStatusRequestInp) Filter(ctx context.Context) error {
if !dict.HasOptionKey(consts.AppMemberStatusOptions, in.ToStatus) {
return gerror.New("目标状态不合法")
}
return nil
}
type AppMemberStatusExecuteInp struct {
ApprovalId uint64 `json:"approvalId" v:"required|min:1#审批ID不能为空|审批ID不能为空"`
}
func (in *AppMemberStatusExecuteInp) Filter(ctx context.Context) error { return nil }
type AppMemberApprovalModel struct {
ApprovalId uint64 `json:"approvalId"`
ApprovalNo string `json:"approvalNo"`
}
type WalletAdjustmentListInp struct {
form.PageReq
MemberId uint64 `json:"memberId"`
RequestStatus int `json:"requestStatus"`
CreatedAt []*gtime.Time `json:"createdAt"`
}
func (in *WalletAdjustmentListInp) Filter(ctx context.Context) error { return nil }
type WalletLedgerListInp struct {
form.PageReq
MemberId uint64 `json:"memberId" v:"required|min:1#会员ID不能为空|会员ID不能为空"`
}
func (in *WalletLedgerListInp) Filter(ctx context.Context) error { return nil }
type WalletLedgerListModel struct {
Id uint64 `json:"id"`
LedgerNo string `json:"ledgerNo"`
BizType string `json:"bizType"`
BizNo string `json:"bizNo"`
EntryType string `json:"entryType"`
Direction int `json:"direction"`
Amount int64 `json:"amount"`
BeforeAmount int64 `json:"beforeAmount"`
AfterAmount int64 `json:"afterAmount"`
Currency string `json:"currency"`
Remark string `json:"remark"`
OccurredAt *gtime.Time `json:"occurredAt"`
}
type WalletAdjustmentListModel struct {
Id uint64 `json:"id"`
RequestNo string `json:"requestNo"`
MemberId uint64 `json:"memberId"`
Username string `json:"username"`
MobileMask string `json:"mobileMask"`
AdjustType int `json:"adjustType"`
Direction int `json:"direction"`
Amount int64 `json:"amount"`
ReasonCode string `json:"reasonCode"`
ReasonText string `json:"reasonText"`
RequestStatus int `json:"requestStatus"`
ApprovalRequestId uint64 `json:"approvalRequestId"`
LedgerId uint64 `json:"ledgerId"`
CreatedAt *gtime.Time `json:"createdAt"`
}
type WalletAdjustmentRequestInp struct {
MemberId uint64 `json:"memberId" v:"required|min:1#会员ID不能为空|会员ID不能为空"`
AdjustType int `json:"adjustType" v:"required#调整类型不能为空"`
Direction int `json:"direction" v:"required#资金方向不能为空"`
Amount int64 `json:"amount" v:"required|min:1#金额不能为空|金额必须大于0"`
ReasonCode string `json:"reasonCode" v:"required|max-length:64#原因编码不能为空|原因编码不能超过64个字符"`
ReasonText string `json:"reasonText" v:"required|max-length:500#原因说明不能为空|原因说明不能超过500个字符"`
EvidenceJson *gjson.Json `json:"evidenceJson"`
IdempotencyKey string `json:"idempotencyKey" v:"required|max-length:80#幂等键不能为空|幂等键不能超过80个字符"`
}
func (in *WalletAdjustmentRequestInp) Filter(ctx context.Context) error {
if !dict.HasOptionKey(consts.WalletAdjustTypeOptions, in.AdjustType) || !dict.HasOptionKey(consts.WalletDirectionOptions, in.Direction) {
return gerror.New("调整类型或资金方向不合法")
}
return nil
}
type WalletAdjustmentExecuteInp struct {
Id uint64 `json:"id" v:"required|min:1#调账申请ID不能为空|调账申请ID不能为空"`
}
func (in *WalletAdjustmentExecuteInp) Filter(ctx context.Context) error { return nil }
type MemberNoticeListInp struct {
form.PageReq
Title string `json:"title"`
SourceType int `json:"sourceType"`
NoticeStatus int `json:"noticeStatus"`
}
func (in *MemberNoticeListInp) Filter(ctx context.Context) error { return nil }
type MemberNoticeListModel struct {
entity.AppMemberNotice
Username string `json:"username"`
}
type MemberNoticeEditInp struct {
MemberId uint64 `json:"memberId"`
Title string `json:"title" v:"required|max-length:120#标题不能为空|标题不能超过120个字符"`
Content string `json:"content" v:"required|max-length:500#内容不能为空|内容不能超过500个字符"`
SourceType int `json:"sourceType" v:"required#来源不能为空"`
StartAt *gtime.Time `json:"startAt" v:"required#开始时间不能为空"`
EndAt *gtime.Time `json:"endAt" v:"required#结束时间不能为空"`
}
func (in *MemberNoticeEditInp) Filter(ctx context.Context) error {
if in.StartAt.After(in.EndAt) {
return gerror.New("结束时间必须晚于开始时间")
}
if !dict.HasOptionKey(consts.MemberNoticeSourceOptions, in.SourceType) {
return gerror.New("通知来源不合法")
}
return nil
}
type MemberNoticeRevokeInp struct {
Id uint64 `json:"id" v:"required|min:1#通知ID不能为空|通知ID不能为空"`
Reason string `json:"reason" v:"required|max-length:500#撤回原因不能为空|撤回原因不能超过500个字符"`
}
func (in *MemberNoticeRevokeInp) Filter(ctx context.Context) error { return nil }
@@ -0,0 +1,137 @@
package sysin
import (
"context"
"hotgo/internal/consts"
"hotgo/internal/library/dict"
"hotgo/internal/model/entity"
"hotgo/internal/model/input/form"
"github.com/gogf/gf/v2/encoding/gjson"
"github.com/gogf/gf/v2/errors/gerror"
"github.com/gogf/gf/v2/os/gtime"
)
type ApprovalRequestInsertFields struct {
ApprovalNo string `json:"approvalNo"`
ApprovalType string `json:"approvalType"`
TargetType string `json:"targetType"`
TargetId uint64 `json:"targetId"`
Action string `json:"action"`
Title string `json:"title"`
PayloadJson *gjson.Json `json:"payloadJson"`
DiffJson *gjson.Json `json:"diffJson"`
RiskLevel int `json:"riskLevel"`
RequiredApprovals uint `json:"requiredApprovals"`
ApprovalStatus int `json:"approvalStatus"`
ApplicantId uint64 `json:"applicantId"`
ExpireAt *gtime.Time `json:"expireAt"`
Version uint `json:"version"`
Remark string `json:"remark"`
CreatedBy uint64 `json:"createdBy"`
}
type ApprovalCreateInp struct {
ApprovalType string `json:"approvalType" v:"required|max-length:32#审批类型不能为空|审批类型不能超过32个字符" dc:"审批类型"`
TargetType string `json:"targetType" v:"required|max-length:32#目标类型不能为空|目标类型不能超过32个字符" dc:"目标类型"`
TargetId uint64 `json:"targetId" dc:"目标ID"`
Action string `json:"action" v:"required|max-length:64#拟执行动作不能为空|拟执行动作不能超过64个字符" dc:"拟执行动作"`
Title string `json:"title" v:"required|max-length:200#审批标题不能为空|审批标题不能超过200个字符" dc:"审批标题"`
PayloadJson *gjson.Json `json:"payloadJson" v:"required#待执行数据不能为空" dc:"待执行数据快照"`
DiffJson *gjson.Json `json:"diffJson" dc:"前后差异"`
RiskLevel int `json:"riskLevel" d:"1" dc:"风险等级"`
RequiredApprovals uint `json:"requiredApprovals" d:"1" v:"min:1|max:10#至少需要1人审批|审批人数不能超过10人" dc:"需要通过数"`
ExpireAt *gtime.Time `json:"expireAt" dc:"超时时间"`
Remark string `json:"remark" v:"max-length:500#备注不能超过500个字符" dc:"备注"`
}
func (in *ApprovalCreateInp) Filter(ctx context.Context) error {
if !dict.HasOptionKey(consts.ApprovalRiskLevelOptions, in.RiskLevel) {
return gerror.New("审批风险等级不合法")
}
if in.ExpireAt != nil && in.ExpireAt.Before(gtime.Now()) {
return gerror.New("审批超时时间必须晚于当前时间")
}
return nil
}
type ApprovalCreateModel struct {
Id uint64 `json:"id" dc:"审批ID"`
ApprovalNo string `json:"approvalNo" dc:"审批单号"`
}
type ApprovalListInp struct {
form.PageReq
ApprovalNo string `json:"approvalNo" dc:"审批单号"`
ApprovalType string `json:"approvalType" dc:"审批类型"`
TargetType string `json:"targetType" dc:"目标类型"`
TargetId uint64 `json:"targetId" dc:"目标ID"`
ApprovalStatus int `json:"approvalStatus" dc:"审批状态"`
RiskLevel int `json:"riskLevel" dc:"风险等级"`
Applicant string `json:"applicant" dc:"申请人关键词"`
CreatedAt []*gtime.Time `json:"createdAt" dc:"创建时间"`
}
func (in *ApprovalListInp) Filter(ctx context.Context) error { return nil }
type ApprovalListModel struct {
Id uint64 `json:"id"`
ApprovalNo string `json:"approvalNo"`
ApprovalType string `json:"approvalType"`
TargetType string `json:"targetType"`
TargetId uint64 `json:"targetId"`
Action string `json:"action"`
Title string `json:"title"`
RiskLevel int `json:"riskLevel"`
RequiredApprovals uint `json:"requiredApprovals"`
ApprovalStatus int `json:"approvalStatus"`
ApplicantId uint64 `json:"applicantId"`
SubmittedAt *gtime.Time `json:"submittedAt"`
DecidedAt *gtime.Time `json:"decidedAt"`
ExpireAt *gtime.Time `json:"expireAt"`
Version uint `json:"version"`
CreatedAt *gtime.Time `json:"createdAt"`
UpdatedAt *gtime.Time `json:"updatedAt"`
AllowedActions []string `json:"allowedActions" dc:"当前用户可执行动作"`
}
type ApprovalViewInp struct {
Id uint64 `json:"id" v:"required|min:1#审批ID不能为空|审批ID不能为空" dc:"审批ID"`
}
func (in *ApprovalViewInp) Filter(ctx context.Context) error { return nil }
type ApprovalActionModel struct {
entity.ApprovalAction
}
type ApprovalViewModel struct {
entity.ApprovalRequest
Actions []*ApprovalActionModel `json:"actions" dc:"审批记录"`
AllowedActions []string `json:"allowedActions" dc:"当前用户可执行动作"`
}
type ApprovalSubmitInp struct {
Id uint64 `json:"id" v:"required|min:1#审批ID不能为空|审批ID不能为空"`
Version uint `json:"version" dc:"数据版本"`
}
func (in *ApprovalSubmitInp) Filter(ctx context.Context) error { return nil }
type ApprovalDecisionInp struct {
Id uint64 `json:"id" v:"required|min:1#审批ID不能为空|审批ID不能为空"`
Version uint `json:"version" dc:"数据版本"`
ReasonCode string `json:"reasonCode" v:"max-length:64#原因编码不能超过64个字符" dc:"原因编码"`
Comment string `json:"comment" v:"max-length:1000#审批意见不能超过1000个字符" dc:"审批意见"`
MfaVerified int `json:"mfaVerified" dc:"是否已二次认证"`
}
func (in *ApprovalDecisionInp) Filter(ctx context.Context) error { return nil }
type ApprovalCancelInp struct {
Id uint64 `json:"id" v:"required|min:1#审批ID不能为空|审批ID不能为空"`
Version uint `json:"version" dc:"数据版本"`
Comment string `json:"comment" v:"max-length:1000#取消原因不能超过1000个字符" dc:"取消原因"`
}
func (in *ApprovalCancelInp) Filter(ctx context.Context) error { return nil }
@@ -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,50 @@
package sysin
import (
"context"
"hotgo/internal/model/entity"
"hotgo/internal/model/input/form"
"github.com/gogf/gf/v2/encoding/gjson"
"github.com/gogf/gf/v2/os/gtime"
)
type BizAuditRecordInp struct {
Module string
Action string
TargetType string
TargetId uint64
Before any
After any
ChangeJson *gjson.Json
Reason string
ApprovalNo string
}
type BizAuditListInp struct {
form.PageReq
AuditNo string `json:"auditNo" dc:"审计号"`
Module string `json:"module" dc:"业务模块"`
Action string `json:"action" dc:"操作动作"`
TargetType string `json:"targetType" dc:"目标类型"`
TargetId uint64 `json:"targetId" dc:"目标ID"`
Actor string `json:"actor" dc:"操作人关键词"`
ApprovalNo string `json:"approvalNo" dc:"审批单号"`
CreatedAt []*gtime.Time `json:"createdAt" dc:"创建时间"`
}
func (in *BizAuditListInp) Filter(ctx context.Context) error { return nil }
type BizAuditListModel struct {
entity.BizAuditLog
}
type BizAuditViewInp struct {
Id uint64 `json:"id" v:"required|min:1#审计ID不能为空|审计ID不能为空" dc:"审计ID"`
}
func (in *BizAuditViewInp) Filter(ctx context.Context) error { return nil }
type BizAuditViewModel struct {
entity.BizAuditLog
}
@@ -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,80 @@
package sysin
import (
"context"
"github.com/gogf/gf/v2/errors/gerror"
"github.com/gogf/gf/v2/os/gtime"
)
type DashboardSummaryInp struct {
StartDate *gtime.Time `json:"startDate" dc:"开始日期"`
EndDate *gtime.Time `json:"endDate" dc:"结束日期"`
}
func (in *DashboardSummaryInp) Filter(ctx context.Context) error {
if in.StartDate == nil && in.EndDate == nil {
return nil
}
if in.StartDate == nil || in.EndDate == nil {
return gerror.New("开始日期和结束日期必须同时填写")
}
if in.StartDate.After(in.EndDate) {
return gerror.New("开始日期不能晚于结束日期")
}
if in.EndDate.Sub(in.StartDate) > 366*24*60*60*1e9 {
return gerror.New("单次最多查询366天")
}
return nil
}
type DashboardRangeModel struct {
StartDate string `json:"startDate"`
EndDate string `json:"endDate"`
}
type DashboardMetricModel struct {
Code string `json:"code"`
Title string `json:"title"`
Value int64 `json:"value"`
PreviousValue int64 `json:"previousValue"`
ChangeRate float64 `json:"changeRate"`
ValueType string `json:"valueType" dc:"count或amount"`
Masked bool `json:"masked"`
Description string `json:"description"`
RouteName string `json:"routeName"`
}
type DashboardTrendPointModel struct {
Date string `json:"date"`
OrderAmount int64 `json:"orderAmount"`
RechargeAmount int64 `json:"rechargeAmount"`
WithdrawalAmount int64 `json:"withdrawalAmount"`
CommissionAmount int64 `json:"commissionAmount"`
}
type DashboardChannelModel struct {
Channel string `json:"channel"`
Label string `json:"label"`
RechargeCount int64 `json:"rechargeCount"`
RechargeAmount int64 `json:"rechargeAmount"`
WithdrawalCount int64 `json:"withdrawalCount"`
WithdrawalAmount int64 `json:"withdrawalAmount"`
PreviousRechargeCount int64 `json:"previousRechargeCount"`
PreviousRechargeAmount int64 `json:"previousRechargeAmount"`
PreviousWithdrawalCount int64 `json:"previousWithdrawalCount"`
PreviousWithdrawalAmount int64 `json:"previousWithdrawalAmount"`
Masked bool `json:"masked"`
}
type DashboardSummaryModel struct {
Range DashboardRangeModel `json:"range"`
Metrics []*DashboardMetricModel `json:"metrics"`
Trend []*DashboardTrendPointModel `json:"trend"`
Channels []*DashboardChannelModel `json:"channels"`
GeneratedAt *gtime.Time `json:"generatedAt"`
DataAsOf *gtime.Time `json:"dataAsOf"`
DataDelaySeconds int64 `json:"dataDelaySeconds"`
DataReady bool `json:"dataReady"`
Warning string `json:"warning"`
}
@@ -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,211 @@
package sysin
import (
"context"
"hotgo/internal/consts"
"hotgo/internal/library/dict"
"hotgo/internal/model"
"hotgo/internal/model/entity"
"hotgo/internal/model/input/form"
"github.com/gogf/gf/v2/encoding/gjson"
"github.com/gogf/gf/v2/errors/gerror"
"github.com/gogf/gf/v2/os/gtime"
)
type MemberLevelListInp struct {
form.PageReq
Name string `json:"name"`
Status int `json:"status"`
PublishStatus int `json:"publishStatus"`
}
func (in *MemberLevelListInp) Filter(ctx context.Context) error { return nil }
type MemberLevelListModel struct {
Id uint64 `json:"id"`
LevelCode string `json:"levelCode"`
Name string `json:"name"`
IconUrl string `json:"iconUrl"`
CurrentVersionId uint64 `json:"currentVersionId"`
MemberCount uint64 `json:"memberCount"`
Status int `json:"status"`
Sort int `json:"sort"`
Remark string `json:"remark"`
CreatedAt *gtime.Time `json:"createdAt"`
VersionNo uint `json:"versionNo"`
UpgradeAmount int64 `json:"upgradeAmount"`
GiftAmount int64 `json:"giftAmount"`
DailyOrderLimit uint `json:"dailyOrderLimit"`
CommissionRate uint `json:"commissionRate"`
DailyWithdrawLimit uint `json:"dailyWithdrawLimit"`
PublishStatus int `json:"publishStatus"`
EffectiveAt *gtime.Time `json:"effectiveAt"`
}
type MemberLevelViewInp struct {
Id uint64 `json:"id" v:"required|min:1#等级ID不能为空|等级ID不能为空"`
}
func (in *MemberLevelViewInp) Filter(ctx context.Context) error { return nil }
type MemberLevelViewModel struct {
Level *entity.AppMemberLevel `json:"level"`
Draft *entity.AppMemberLevelVersion `json:"draft"`
Published *entity.AppMemberLevelVersion `json:"published"`
}
type MemberLevelSaveInp struct {
Id uint64 `json:"id"`
VersionId uint64 `json:"versionId"`
Version uint `json:"version"`
LevelCode string `json:"levelCode" v:"required|max-length:32#等级编码不能为空|等级编码不能超过32个字符"`
Name string `json:"name" v:"required|max-length:64#等级名称不能为空|等级名称不能超过64个字符"`
IconAttachmentId uint64 `json:"iconAttachmentId"`
IconUrl string `json:"iconUrl" v:"max-length:1000#图标地址不能超过1000个字符"`
UpgradeAmount int64 `json:"upgradeAmount" v:"min:0#升级金额不能小于0"`
GiftAmount int64 `json:"giftAmount" v:"min:0#赠送金额不能小于0"`
DailyOrderLimit uint `json:"dailyOrderLimit"`
CommissionRate uint `json:"commissionRate" v:"max:10000#佣金比例不能超过100%"`
DailyWithdrawLimit uint `json:"dailyWithdrawLimit"`
RuleJson *gjson.Json `json:"ruleJson"`
EffectiveAt *gtime.Time `json:"effectiveAt"`
Sort int `json:"sort"`
Status int `json:"status" d:"1"`
Remark string `json:"remark" v:"max-length:500#备注不能超过500个字符"`
}
func (in *MemberLevelSaveInp) Filter(ctx context.Context) error {
if in.Status != consts.StatusEnabled && in.Status != consts.StatusDisable {
return gerror.New("等级状态不合法")
}
if in.UpgradeAmount > 0 && in.GiftAmount > in.UpgradeAmount {
return gerror.New("赠送金额不能超过升级金额")
}
return nil
}
type MemberLevelSubmitInp struct {
VersionId uint64 `json:"versionId" v:"required|min:1#版本ID不能为空|版本ID不能为空"`
Version uint `json:"version"`
Reason string `json:"reason" v:"required|max-length:500#提交原因不能为空|提交原因不能超过500个字符"`
}
func (in *MemberLevelSubmitInp) Filter(ctx context.Context) error { return nil }
type MemberLevelPublishInp struct {
VersionId uint64 `json:"versionId" v:"required|min:1#版本ID不能为空|版本ID不能为空"`
Version uint `json:"version"`
}
func (in *MemberLevelPublishInp) Filter(ctx context.Context) error { return nil }
type MemberLevelRollbackInp struct {
VersionId uint64 `json:"versionId" v:"required|min:1#版本ID不能为空|版本ID不能为空"`
Reason string `json:"reason" v:"required|max-length:500#回滚原因不能为空|回滚原因不能超过500个字符"`
}
func (in *MemberLevelRollbackInp) Filter(ctx context.Context) error { return nil }
type MemberLevelHistoryInp struct {
form.PageReq
LevelId uint64 `json:"levelId" v:"required|min:1#等级ID不能为空|等级ID不能为空"`
}
func (in *MemberLevelHistoryInp) Filter(ctx context.Context) error { return nil }
type MemberLevelStatusInp struct {
Id uint64 `json:"id" v:"required|min:1#等级ID不能为空|等级ID不能为空"`
Status int `json:"status" v:"required|in:1,2#状态不能为空|状态不合法"`
}
func (in *MemberLevelStatusInp) Filter(ctx context.Context) error { return nil }
type MemberLevelDeleteInp struct {
Id uint64 `json:"id" v:"required|min:1#等级ID不能为空|等级ID不能为空"`
Reason string `json:"reason" v:"required|max-length:500#删除原因不能为空|删除原因不能超过500个字符"`
}
func (in *MemberLevelDeleteInp) Filter(ctx context.Context) error { return nil }
type MemberLevelApprovalModel struct {
ApprovalId uint64 `json:"approvalId"`
ApprovalNo string `json:"approvalNo"`
}
type TaskHallListInp struct {
form.PageReq
Name string `json:"name"`
PublishStatus int `json:"publishStatus"`
}
func (in *TaskHallListInp) Filter(ctx context.Context) error { return nil }
type TaskHallListModel struct {
Id uint64 `json:"id"`
HallCode string `json:"hallCode"`
Name string `json:"name"`
IconAttachmentId uint64 `json:"iconAttachmentId"`
IconUrl string `json:"iconUrl"`
Summary string `json:"summary"`
CommissionRate uint `json:"commissionRate"`
RateUnit string `json:"rateUnit"`
ClientRoute string `json:"clientRoute"`
PublishStatus int `json:"publishStatus"`
Sort int `json:"sort"`
Version uint `json:"version"`
Remark string `json:"remark"`
CreatedAt *gtime.Time `json:"createdAt"`
LevelIds []uint64 `json:"levelIds"`
LevelNames []string `json:"levelNames"`
}
type TaskHallViewInp struct {
Id uint64 `json:"id" v:"required|min:1#大厅ID不能为空|大厅ID不能为空"`
}
func (in *TaskHallViewInp) Filter(ctx context.Context) error { return nil }
type TaskHallEditInp struct {
Id uint64 `json:"id"`
Version uint `json:"version"`
HallCode string `json:"hallCode" v:"required|max-length:32#大厅编码不能为空|大厅编码不能超过32个字符"`
Name string `json:"name" v:"required|max-length:100#大厅名称不能为空|大厅名称不能超过100个字符"`
IconAttachmentId uint64 `json:"iconAttachmentId"`
IconUrl string `json:"iconUrl" v:"required|max-length:1000#图标不能为空|图标地址不能超过1000个字符"`
Summary string `json:"summary" v:"required|max-length:500#简介不能为空|简介不能超过500个字符"`
CommissionRate uint `json:"commissionRate" v:"max:10000#佣金比例不能超过100%"`
ClientRoute string `json:"clientRoute" v:"required|max-length:500#C端跳转不能为空|C端跳转不能超过500个字符"`
LevelIds []uint64 `json:"levelIds" v:"required#至少绑定一个会员等级"`
Sort int `json:"sort"`
Remark string `json:"remark" v:"max-length:500#备注不能超过500个字符"`
}
func (in *TaskHallEditInp) Filter(ctx context.Context) error {
if len(in.LevelIds) != 1 {
return gerror.New("请选择一个会员等级")
}
return nil
}
type TaskHallStatusInp struct {
Id uint64 `json:"id" v:"required|min:1#大厅ID不能为空|大厅ID不能为空"`
Version uint `json:"version"`
PublishStatus int `json:"publishStatus" v:"required|in:3,4#状态不能为空|仅支持发布或下线"`
}
func (in *TaskHallStatusInp) Filter(ctx context.Context) error {
if !dict.HasOptionKey(consts.BizPublishStatusOptions, in.PublishStatus) {
return gerror.New("发布状态不合法")
}
return nil
}
type TaskHallDeleteInp struct {
Id uint64 `json:"id" v:"required|min:1#大厅ID不能为空|大厅ID不能为空"`
Reason string `json:"reason" v:"required|max-length:500#删除原因不能为空|删除原因不能超过500个字符"`
}
func (in *TaskHallDeleteInp) Filter(ctx context.Context) error { return nil }
type MemberLevelOptionModel struct {
Options []*model.Option `json:"options"`
}
@@ -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
}
+353
View File
@@ -0,0 +1,353 @@
package sysin
import (
"context"
"net/url"
"regexp"
"strings"
"hotgo/internal/consts"
"hotgo/internal/library/dict"
"hotgo/internal/model/entity"
"hotgo/internal/model/input/form"
"github.com/gogf/gf/v2/encoding/gjson"
"github.com/gogf/gf/v2/errors/gerror"
"github.com/gogf/gf/v2/os/gtime"
"github.com/microcosm-cc/bluemonday"
)
type SiteConfigData struct {
LogoUrl string `json:"logoUrl"`
SiteName string `json:"siteName"`
PrivacyPolicyUrl string `json:"privacyPolicyUrl"`
TradeBalanceAmount int64 `json:"tradeBalanceAmount"`
TradeWaitSeconds int `json:"tradeWaitSeconds"`
DailyTradeLimit int `json:"dailyTradeLimit"`
DailyRewardLimit int `json:"dailyRewardLimit"`
CommissionRates []float64 `json:"commissionRates"`
WithdrawTimeRanges []string `json:"withdrawTimeRanges"`
RechargeTimeRanges []string `json:"rechargeTimeRanges"`
TradeTimeRanges []string `json:"tradeTimeRanges"`
SignTimeRanges []string `json:"signTimeRanges"`
MinimumRechargeAmount int64 `json:"minimumRechargeAmount"`
AutoOrderDelaySeconds int `json:"autoOrderDelaySeconds"`
AutoOrderMinAmount int64 `json:"autoOrderMinAmount"`
AutoOrderMaxAmount int64 `json:"autoOrderMaxAmount"`
FreeClaimEnabled int `json:"freeClaimEnabled"`
ManualMallEnabled int `json:"manualMallEnabled"`
HomeTaskEnabled int `json:"homeTaskEnabled"`
SignEnabled int `json:"signEnabled"`
ProductModeEnabled int `json:"productModeEnabled"`
CaptchaEnabled int `json:"captchaEnabled"`
}
type SiteConfigSaveInp struct {
Id uint64 `json:"id"`
Version uint `json:"version"`
ConfigGroup string `json:"configGroup" d:"portal" v:"required|max-length:64#配置组不能为空|配置组过长"`
Config SiteConfigData `json:"config" v:"required#配置不能为空"`
EffectiveAt *gtime.Time `json:"effectiveAt"`
Remark string `json:"remark" v:"max-length:500#备注不能超过500个字符"`
}
func (in *SiteConfigSaveInp) Filter(ctx context.Context) error {
if strings.TrimSpace(in.Config.SiteName) == "" {
return gerror.New("站点名称不能为空")
}
if in.Config.PrivacyPolicyUrl != "" {
u, err := url.Parse(in.Config.PrivacyPolicyUrl)
if err != nil || u.Scheme != "https" || u.Host == "" {
return gerror.New("隐私政策地址必须是有效的 HTTPS 地址")
}
}
if in.Config.TradeWaitSeconds < 0 || in.Config.DailyTradeLimit < 0 || in.Config.DailyRewardLimit < 0 {
return gerror.New("交易等待时间和每日次数不能为负数")
}
if len(in.Config.CommissionRates) != 6 {
return gerror.New("必须配置 0 至 5 级共 6 个佣金比例")
}
total := float64(0)
for _, rate := range in.Config.CommissionRates {
if rate < 0 || rate > 1 {
return gerror.New("佣金比例必须在 0 至 1 之间")
}
total += rate
}
if total > 1 {
return gerror.New("各级佣金比例总和不能超过 100%")
}
if in.Config.AutoOrderDelaySeconds < 0 {
return gerror.New("自动派单时间不能为负数")
}
if in.Config.AutoOrderMinAmount < 0 || in.Config.AutoOrderMaxAmount < in.Config.AutoOrderMinAmount {
return gerror.New("自动派单最大金额不能小于最小金额")
}
for _, ranges := range [][]string{in.Config.WithdrawTimeRanges, in.Config.RechargeTimeRanges, in.Config.TradeTimeRanges, in.Config.SignTimeRanges} {
for _, value := range ranges {
parts := strings.Split(value, "-")
if len(parts) != 2 || parts[0] >= parts[1] {
return gerror.Newf("时间区间 %s 不合法,结束时间必须晚于开始时间", value)
}
}
}
return nil
}
type SiteConfigCurrentInp struct {
ConfigGroup string `json:"configGroup" d:"portal"`
}
func (in *SiteConfigCurrentInp) Filter(ctx context.Context) error { return nil }
type SiteConfigCurrentModel struct {
Draft *entity.SiteConfigVersion `json:"draft"`
Published *entity.SiteConfigVersion `json:"published"`
}
type SiteConfigSubmitInp struct {
Id uint64 `json:"id" v:"required|min:1#配置版本不能为空|配置版本不能为空"`
Version uint `json:"version"`
Reason string `json:"reason" v:"required|max-length:500#提交原因不能为空|提交原因过长"`
}
func (in *SiteConfigSubmitInp) Filter(ctx context.Context) error { return nil }
type SiteConfigPublishInp struct {
Id uint64 `json:"id" v:"required|min:1#配置版本不能为空|配置版本不能为空"`
Version uint `json:"version"`
}
func (in *SiteConfigPublishInp) Filter(ctx context.Context) error { return nil }
type SiteConfigRollbackInp struct {
Id uint64 `json:"id" v:"required|min:1#历史版本不能为空|历史版本不能为空"`
Reason string `json:"reason" v:"required|max-length:500#回滚原因不能为空|回滚原因过长"`
}
func (in *SiteConfigRollbackInp) Filter(ctx context.Context) error { return nil }
type SiteConfigHistoryInp struct {
form.PageReq
ConfigGroup string `json:"configGroup" d:"portal"`
}
func (in *SiteConfigHistoryInp) Filter(ctx context.Context) error { return nil }
type SiteConfigHistoryModel struct{ entity.SiteConfigVersion }
type ContentListInp struct {
form.PageReq
Title string `json:"title"`
ContentType string `json:"contentType"`
PublishStatus int `json:"publishStatus"`
}
func (in *ContentListInp) Filter(ctx context.Context) error { return nil }
type ContentListModel struct {
entity.Content
LatestVersionId uint64 `json:"latestVersionId"`
LatestVersionNo uint `json:"latestVersionNo"`
Summary string `json:"summary"`
CoverUrl string `json:"coverUrl"`
}
type ContentViewInp struct {
Id uint64 `json:"id" v:"required|min:1#内容ID不能为空|内容ID不能为空"`
}
func (in *ContentViewInp) Filter(ctx context.Context) error { return nil }
type ContentViewModel struct {
entity.Content
LatestVersion *entity.ContentVersion `json:"latestVersion"`
Versions []*entity.ContentVersion `json:"versions"`
}
type ContentEditInp struct {
Id uint64 `json:"id"`
Version uint `json:"version"`
ContentKey string `json:"contentKey" v:"required|max-length:64#内容标识不能为空|内容标识过长"`
ContentType string `json:"contentType" v:"required#内容类型不能为空"`
Title string `json:"title" v:"required|max-length:200#标题不能为空|标题过长"`
Summary string `json:"summary" v:"max-length:500#摘要过长"`
BodyHtml string `json:"bodyHtml" v:"required#正文不能为空"`
BodyText string `json:"bodyText"`
CoverUrl string `json:"coverUrl"`
EffectiveAt *gtime.Time `json:"effectiveAt"`
Sort int `json:"sort"`
Remark string `json:"remark" v:"max-length:500#备注过长"`
}
func (in *ContentEditInp) Filter(ctx context.Context) error {
if !regexp.MustCompile(`^[a-z][a-z0-9_]{1,63}$`).MatchString(in.ContentKey) {
return gerror.New("内容标识仅支持小写字母、数字和下划线,且必须以字母开头")
}
if unsafeHTML(in.BodyHtml) {
return gerror.New("正文包含 script、事件属性、javascript 链接或 iframe 等不安全内容")
}
in.BodyHtml = bluemonday.UGCPolicy().Sanitize(in.BodyHtml)
return nil
}
type ContentDeleteInp struct {
Id uint64 `json:"id" v:"required|min:1#内容ID不能为空|内容ID不能为空"`
}
func (in *ContentDeleteInp) Filter(ctx context.Context) error { return nil }
type ContentPublishInp struct {
Id uint64 `json:"id" v:"required|min:1#内容ID不能为空|内容ID不能为空"`
VersionId uint64 `json:"versionId" v:"required|min:1#内容版本不能为空|内容版本不能为空"`
}
func (in *ContentPublishInp) Filter(ctx context.Context) error { return nil }
type ContentOfflineInp struct {
Id uint64 `json:"id" v:"required|min:1#内容ID不能为空|内容ID不能为空"`
Reason string `json:"reason" v:"required#下线原因不能为空"`
}
func (in *ContentOfflineInp) Filter(ctx context.Context) error { return nil }
type BannerListInp struct {
form.PageReq
Name string `json:"name"`
Position string `json:"position"`
PublishStatus int `json:"publishStatus"`
}
func (in *BannerListInp) Filter(ctx context.Context) error { return nil }
type BannerListModel struct{ entity.Banner }
type BannerViewInp struct {
Id uint64 `json:"id" v:"required|min:1#Banner ID不能为空|Banner ID不能为空"`
}
func (in *BannerViewInp) Filter(ctx context.Context) error { return nil }
type BannerEditInp struct{ entity.Banner }
func (in *BannerEditInp) Filter(ctx context.Context) error {
if strings.TrimSpace(in.Name) == "" || strings.TrimSpace(in.ImageUrl) == "" || strings.TrimSpace(in.AltText) == "" {
return gerror.New("名称、图片和替代文本不能为空")
}
if !dict.HasOptionKey(consts.BannerPositionOptions, in.Position) {
return gerror.New("Banner 投放位置不合法")
}
if !dict.HasOptionKey(consts.BannerTargetTypeOptions, in.TargetType) {
return gerror.New("跳转类型不合法")
}
if in.TargetType != consts.BannerTargetNone && strings.TrimSpace(in.TargetValue) == "" {
return gerror.New("当前跳转类型必须填写跳转目标")
}
if in.TargetType == consts.BannerTargetExternal {
u, err := url.Parse(in.TargetValue)
if err != nil || u.Scheme != "https" || u.Host == "" {
return gerror.New("外部跳转必须是有效的 HTTPS 地址")
}
}
if in.StartAt != nil && in.EndAt != nil && !in.EndAt.After(in.StartAt) {
return gerror.New("结束时间必须晚于开始时间")
}
return nil
}
type BannerDeleteInp struct {
Id uint64 `json:"id" v:"required|min:1#Banner ID不能为空|Banner ID不能为空"`
}
func (in *BannerDeleteInp) Filter(ctx context.Context) error { return nil }
type BannerStatusInp struct {
Id uint64 `json:"id" v:"required|min:1#Banner ID不能为空|Banner ID不能为空"`
PublishStatus int `json:"publishStatus"`
Version uint `json:"version"`
}
func (in *BannerStatusInp) Filter(ctx context.Context) error {
if !dict.HasOptionKey(consts.BizPublishStatusOptions, in.PublishStatus) {
return gerror.New("发布状态不合法")
}
return nil
}
type ManualProductListInp struct {
form.PageReq
Name string `json:"name"`
PublishStatus int `json:"publishStatus"`
}
func (in *ManualProductListInp) Filter(ctx context.Context) error { return nil }
type ManualProductListModel struct {
entity.Product
Price string `json:"price"`
}
type ManualProductViewInp struct {
Id uint64 `json:"id" v:"required|min:1#商品ID不能为空|商品ID不能为空"`
}
func (in *ManualProductViewInp) Filter(ctx context.Context) error { return nil }
type ManualProductViewModel struct {
entity.Product
Price string `json:"price"`
}
type ManualProductEditInp struct {
entity.Product
Price string `json:"price" v:"required#价格不能为空"`
}
func (in *ManualProductEditInp) Filter(ctx context.Context) error {
if strings.TrimSpace(in.Name) == "" || strings.TrimSpace(in.CoverUrl) == "" {
return gerror.New("商品名称和图片不能为空")
}
return nil
}
type ManualProductDeleteInp struct {
Id uint64 `json:"id"`
Ids []uint64 `json:"ids"`
}
func (in *ManualProductDeleteInp) Filter(ctx context.Context) error {
if len(in.Ids) == 0 && in.Id > 0 {
in.Ids = []uint64{in.Id}
}
if len(in.Ids) == 0 {
return gerror.New("请选择要删除的商品")
}
return nil
}
type ManualProductStatusInp struct {
Id uint64 `json:"id" v:"required|min:1#商品ID不能为空|商品ID不能为空"`
PublishStatus int `json:"publishStatus"`
Version uint `json:"version"`
}
func (in *ManualProductStatusInp) Filter(ctx context.Context) error {
if !dict.HasOptionKey(consts.BizPublishStatusOptions, in.PublishStatus) {
return gerror.New("发布状态不合法")
}
return nil
}
func unsafeHTML(value string) bool {
lower := strings.ToLower(value)
patterns := []string{"<script", "javascript:", "<iframe", " onerror=", " onclick=", " onload="}
for _, pattern := range patterns {
if strings.Contains(lower, pattern) {
return true
}
}
return false
}
type PortalApprovalModel struct {
ApprovalId uint64 `json:"approvalId"`
ApprovalNo string `json:"approvalNo"`
}
type JsonPayload struct {
Value *gjson.Json `json:"value"`
}
@@ -0,0 +1,272 @@
package sysin
import (
"context"
"strings"
"hotgo/internal/consts"
"hotgo/internal/model/entity"
"hotgo/internal/model/input/form"
"github.com/gogf/gf/v2/encoding/gjson"
"github.com/gogf/gf/v2/errors/gerror"
"github.com/gogf/gf/v2/os/gtime"
"github.com/microcosm-cc/bluemonday"
)
type ProductUpdateFields struct {
CategoryId uint64
ProductType int
PaymentType string
Name string
ShopName string
PriceAmount int64
Currency string
CoverAttachmentId uint64
CoverUrl string
DetailHtml string
IsRecommended int
StartAt *gtime.Time
EndAt *gtime.Time
Sort int
Remark string
UpdatedBy uint64
Version uint
}
type ProductInsertFields struct {
ProductUpdateFields
ProductNo string
PublishStatus int
CreatedBy uint64
}
type ProductListInp struct {
form.PageReq
Name string `json:"name"`
PaymentType string `json:"paymentType"`
CategoryId uint64 `json:"categoryId"`
PublishStatus int `json:"publishStatus"`
}
func (in *ProductListInp) Filter(ctx context.Context) error { return nil }
type ProductListModel struct {
entity.Product
CategoryName string `json:"categoryName"`
Price string `json:"price"`
Referenced bool `json:"referenced"`
}
type ProductViewInp struct {
Id uint64 `json:"id" v:"required|min:1#商品ID不能为空|商品ID不能为空"`
}
func (in *ProductViewInp) Filter(ctx context.Context) error { return nil }
type ProductEditInp struct {
entity.Product
Price string `json:"price" v:"required#价格不能为空"`
}
func (in *ProductEditInp) Filter(ctx context.Context) error {
if strings.TrimSpace(in.Name) == "" || strings.TrimSpace(in.ShopName) == "" || strings.TrimSpace(in.CoverUrl) == "" {
return gerror.New("商品名称、店铺名称和展示图片不能为空")
}
if in.CategoryId == 0 {
return gerror.New("请选择商品分类")
}
if in.ProductType != consts.ProductTypeStandard && in.ProductType != consts.ProductTypeManual {
return gerror.New("商品类型不合法")
}
if in.IsRecommended != consts.StatusEnabled && in.IsRecommended != consts.StatusDisable {
return gerror.New("推荐状态不合法")
}
if unsafeHTML(in.DetailHtml) {
return gerror.New("商品详情包含不安全内容")
}
in.DetailHtml = bluemonday.UGCPolicy().Sanitize(in.DetailHtml)
if in.StartAt != nil && in.EndAt != nil && !in.EndAt.After(in.StartAt) {
return gerror.New("展示结束时间必须晚于开始时间")
}
return nil
}
type ProductStatusInp struct {
Id uint64 `json:"id" v:"required|min:1#商品ID不能为空|商品ID不能为空"`
Version uint `json:"version"`
PublishStatus int `json:"publishStatus"`
}
func (in *ProductStatusInp) Filter(ctx context.Context) error {
if in.PublishStatus != consts.BizPublishPublished && in.PublishStatus != consts.BizPublishOffline {
return gerror.New("商品状态只允许上架或下架")
}
return nil
}
type ProductRecommendInp struct {
Id uint64 `json:"id" v:"required|min:1#商品ID不能为空|商品ID不能为空"`
Version uint `json:"version"`
IsRecommended int `json:"isRecommended"`
}
func (in *ProductRecommendInp) Filter(ctx context.Context) error {
if in.IsRecommended != consts.StatusEnabled && in.IsRecommended != consts.StatusDisable {
return gerror.New("推荐状态不合法")
}
return nil
}
type ProductDeleteInp struct {
Id uint64 `json:"id" v:"required|min:1#商品ID不能为空|商品ID不能为空"`
}
func (in *ProductDeleteInp) Filter(ctx context.Context) error { return nil }
type TaskUpdateFields struct {
HallId uint64
Title string
Description string
DetailHtml string
CoverAttachmentId uint64
CoverUrl string
CommissionAmount int64
CommissionRate uint
DailyLimit uint
PerMemberLimit uint
StartAt *gtime.Time
EndAt *gtime.Time
Sort int
Remark string
UpdatedBy uint64
Version uint
}
type TaskInsertFields struct {
TaskUpdateFields
TaskNo string
PublishStatus int
CreatedBy uint64
}
type TaskListInp struct {
form.PageReq
Title string `json:"title"`
LevelId uint64 `json:"levelId"`
HallId uint64 `json:"hallId"`
PublishStatus int `json:"publishStatus"`
}
func (in *TaskListInp) Filter(ctx context.Context) error { return nil }
type TaskListModel struct {
entity.Task
HallName string `json:"hallName"`
LevelIds []uint64 `json:"levelIds"`
LevelNames []string `json:"levelNames"`
Referenced bool `json:"referenced"`
}
type TaskViewInp struct {
Id uint64 `json:"id" v:"required|min:1#任务ID不能为空|任务ID不能为空"`
}
func (in *TaskViewInp) Filter(ctx context.Context) error { return nil }
type TaskEditInp struct {
entity.Task
LevelIds []uint64 `json:"levelIds"`
Commission string `json:"commission" v:"required#佣金不能为空"`
}
func (in *TaskEditInp) Filter(ctx context.Context) error {
if strings.TrimSpace(in.Title) == "" || strings.TrimSpace(in.Description) == "" || strings.TrimSpace(in.CoverUrl) == "" {
return gerror.New("任务标题、描述和封面不能为空")
}
if in.HallId == 0 || len(in.LevelIds) == 0 {
return gerror.New("请选择任务大厅和会员等级")
}
if in.PerMemberLimit == 0 {
return gerror.New("单会员任务限制必须大于0")
}
if in.CommissionRate > 10000 {
return gerror.New("佣金比例不能超过100%")
}
if unsafeHTML(in.DetailHtml) {
return gerror.New("任务详情包含不安全内容")
}
in.DetailHtml = bluemonday.UGCPolicy().Sanitize(in.DetailHtml)
if in.StartAt != nil && in.EndAt != nil && !in.EndAt.After(in.StartAt) {
return gerror.New("任务结束时间必须晚于开始时间")
}
return nil
}
type TaskStatusInp struct {
Id uint64 `json:"id" v:"required|min:1#任务ID不能为空|任务ID不能为空"`
Version uint `json:"version"`
PublishStatus int `json:"publishStatus"`
}
func (in *TaskStatusInp) Filter(ctx context.Context) error {
if in.PublishStatus != consts.BizPublishPublished && in.PublishStatus != consts.BizPublishOffline {
return gerror.New("任务状态只允许发布或下线")
}
return nil
}
type TaskDeleteInp struct {
Id uint64 `json:"id" v:"required|min:1#任务ID不能为空|任务ID不能为空"`
}
func (in *TaskDeleteInp) Filter(ctx context.Context) error { return nil }
type TaskSubmissionListInp struct {
form.PageReq
Username string `json:"username"`
Mobile string `json:"mobile"`
SubmissionStatus int `json:"submissionStatus"`
CreatedAt []*gtime.Time `json:"createdAt"`
}
func (in *TaskSubmissionListInp) Filter(ctx context.Context) error { return nil }
type TaskSubmissionListModel struct {
Id uint64 `json:"id"`
SubmissionNo string `json:"submissionNo"`
TradeOrderId uint64 `json:"tradeOrderId"`
TaskId uint64 `json:"taskId"`
TaskTitle string `json:"taskTitle"`
MemberId uint64 `json:"memberId"`
Username string `json:"username"`
MobileMask string `json:"mobileMask"`
LevelName string `json:"levelName"`
EvidenceText string `json:"evidenceText"`
EvidenceAttachmentIds *gjson.Json `json:"evidenceAttachmentIds"`
SubmissionStatus int `json:"submissionStatus"`
CommissionAmount int64 `json:"commissionAmount"`
SuccessRate uint `json:"successRate"`
ReviewReasonCode string `json:"reviewReasonCode"`
ReviewReason string `json:"reviewReason"`
AllowResubmit int `json:"allowResubmit"`
LedgerId uint64 `json:"ledgerId"`
ReviewedAt *gtime.Time `json:"reviewedAt"`
SettledAt *gtime.Time `json:"settledAt"`
CreatedAt *gtime.Time `json:"createdAt"`
}
type TaskSubmissionViewInp struct {
Id uint64 `json:"id" v:"required|min:1#提交记录ID不能为空|提交记录ID不能为空"`
}
func (in *TaskSubmissionViewInp) Filter(ctx context.Context) error { return nil }
type TaskSubmissionReviewInp struct {
Id uint64 `json:"id" v:"required|min:1#提交记录ID不能为空|提交记录ID不能为空"`
Decision int `json:"decision" v:"required|in:1,2#审核结论不能为空|审核结论不合法"`
ReasonCode string `json:"reasonCode" v:"required|max-length:64#原因编码不能为空|原因编码过长"`
ReasonText string `json:"reasonText" v:"required|max-length:500#审核意见不能为空|审核意见过长"`
AllowResubmit int `json:"allowResubmit"`
IdempotencyKey string `json:"idempotencyKey" v:"required|max-length:128#幂等键不能为空|幂等键过长"`
}
func (in *TaskSubmissionReviewInp) Filter(ctx context.Context) error {
if in.AllowResubmit != consts.StatusEnabled && in.AllowResubmit != consts.StatusDisable {
return gerror.New("重提选项不合法")
}
return nil
}
@@ -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{}
+327
View File
@@ -0,0 +1,327 @@
package sysin
import (
"context"
"net/url"
"strings"
"hotgo/internal/consts"
"hotgo/internal/model/entity"
"hotgo/internal/model/input/form"
"github.com/gogf/gf/v2/encoding/gjson"
"github.com/gogf/gf/v2/errors/gerror"
"github.com/gogf/gf/v2/os/gtime"
)
type TradeOrderListInp struct {
form.PageReq
OrderNo string `json:"orderNo"`
Username string `json:"username"`
Mobile string `json:"mobile"`
OrderStatus int `json:"orderStatus"`
CreatedAt []*gtime.Time `json:"createdAt"`
}
func (in *TradeOrderListInp) Filter(ctx context.Context) error { return nil }
type TradeOrderListModel struct {
Id uint64 `json:"id"`
OrderNo string `json:"orderNo"`
MemberId uint64 `json:"memberId"`
Username string `json:"username"`
MobileMask string `json:"mobileMask"`
RealNameMask string `json:"realNameMask"`
AutoDispatch int `json:"autoDispatch"`
AvailableAmount int64 `json:"availableAmount"`
FrozenAmount int64 `json:"frozenAmount"`
TodayTradeCount int `json:"todayTradeCount"`
ProductName string `json:"productName"`
OrderType int `json:"orderType"`
Quantity uint `json:"quantity"`
UnitPriceAmount int64 `json:"unitPriceAmount"`
TotalAmount int64 `json:"totalAmount"`
CommissionAmount int64 `json:"commissionAmount"`
Currency string `json:"currency"`
Message string `json:"message"`
OrderStatus int `json:"orderStatus"`
FreezeStatus int `json:"freezeStatus"`
ApprovalRequestId uint64 `json:"approvalRequestId"`
MatchedAt *gtime.Time `json:"matchedAt"`
CompletedAt *gtime.Time `json:"completedAt"`
UnfrozenAt *gtime.Time `json:"unfrozenAt"`
CreatedAt *gtime.Time `json:"createdAt"`
ApprovalStatus int `json:"approvalStatus"`
CanMatch bool `json:"canMatch"`
CanApply bool `json:"canApply"`
CanExecute bool `json:"canExecute"`
}
type TradeOrderViewInp struct {
Id uint64 `json:"id" v:"required|min:1#订单ID不能为空|订单ID不能为空"`
}
func (in *TradeOrderViewInp) Filter(ctx context.Context) error { return nil }
type TradeOrderViewModel struct {
TradeOrderListModel
TaskId uint64 `json:"taskId"`
ProductId uint64 `json:"productId"`
MemberLevelId uint64 `json:"memberLevelId"`
RuleSnapshot *gjson.Json `json:"ruleSnapshot"`
}
type TradeOrderApplyInp struct {
Id uint64 `json:"id" v:"required|min:1#订单ID不能为空|订单ID不能为空"`
Action string `json:"action" v:"required|in:cancel_match,rematch,unfreeze#处理动作不能为空|处理动作不合法"`
ReasonCode string `json:"reasonCode" v:"required|max-length:64#原因编码不能为空|原因编码不能超过64个字符"`
ReasonText string `json:"reasonText" v:"required|max-length:500#原因说明不能为空|原因说明不能超过500个字符"`
}
func (in *TradeOrderApplyInp) Filter(ctx context.Context) error { return nil }
type TradeOrderExecuteInp struct {
ApprovalId uint64 `json:"approvalId" v:"required|min:1#审批ID不能为空|审批ID不能为空"`
}
func (in *TradeOrderExecuteInp) Filter(ctx context.Context) error { return nil }
type TradeOrderMatchProductListInp struct {
form.PageReq
Name string `json:"name" dc:"商品名称"`
PriceMin string `json:"priceMin" dc:"最低价格"`
PriceMax string `json:"priceMax" dc:"最高价格"`
}
func (in *TradeOrderMatchProductListInp) Filter(ctx context.Context) error { return nil }
type TradeOrderMatchProductModel struct {
Id uint64 `json:"id"`
Name string `json:"name"`
CoverUrl string `json:"coverUrl"`
PriceAmount int64 `json:"priceAmount"`
}
type TradeOrderMatchInp struct {
Id uint64 `json:"id" v:"required|min:1#订单ID不能为空|订单ID不能为空"`
ProductId uint64 `json:"productId" v:"required|min:1#请选择商品|请选择商品"`
Quantity uint `json:"quantity" v:"required|min:1|max:999#商品数量不能为空|商品数量最少为1|商品数量不能超过999"`
}
func (in *TradeOrderMatchInp) Filter(ctx context.Context) error { return nil }
type FinanceApprovalModel struct {
ApprovalId uint64 `json:"approvalId"`
ApprovalNo string `json:"approvalNo"`
}
type RechargeOrderListInp struct {
form.PageReq
RechargeNo string `json:"rechargeNo"`
Username string `json:"username"`
Mobile string `json:"mobile"`
RechargeStatus int `json:"rechargeStatus"`
ChannelId uint64 `json:"channelId"`
ChannelName string `json:"channelName"`
CreatedAt []*gtime.Time `json:"createdAt"`
}
func (in *RechargeOrderListInp) Filter(ctx context.Context) error { return nil }
type RechargeOrderListModel struct {
Id uint64 `json:"id"`
RechargeNo string `json:"rechargeNo"`
MemberId uint64 `json:"memberId"`
Username string `json:"username"`
MobileMask string `json:"mobileMask"`
RealNameMask string `json:"realNameMask"`
AvailableAmount int64 `json:"availableAmount"`
ChannelId uint64 `json:"channelId"`
ChannelName string `json:"channelName"`
RequestAmount int64 `json:"requestAmount"`
PaidAmount int64 `json:"paidAmount"`
Currency string `json:"currency"`
ExternalNo string `json:"externalNo"`
VoucherAttachmentIds *gjson.Json `json:"voucherAttachmentIds"`
RechargeType int `json:"rechargeType"`
RechargeStatus int `json:"rechargeStatus"`
Remark string `json:"remark"`
ReviewReasonCode string `json:"reviewReasonCode"`
ReviewReason string `json:"reviewReason"`
ApprovalRequestId uint64 `json:"approvalRequestId"`
LedgerId uint64 `json:"ledgerId"`
PaidAt *gtime.Time `json:"paidAt"`
ReviewedAt *gtime.Time `json:"reviewedAt"`
CreditedAt *gtime.Time `json:"creditedAt"`
CreatedAt *gtime.Time `json:"createdAt"`
}
type RechargeSummaryModel struct {
TotalCount int64 `json:"totalCount"`
TotalAmount int64 `json:"totalAmount"`
PaidCount int64 `json:"paidCount"`
PaidAmount int64 `json:"paidAmount"`
UnpaidCount int64 `json:"unpaidCount"`
UnpaidAmount int64 `json:"unpaidAmount"`
ReviewCount int64 `json:"reviewCount"`
ReviewAmount int64 `json:"reviewAmount"`
RejectedCount int64 `json:"rejectedCount"`
RejectedAmount int64 `json:"rejectedAmount"`
}
type RechargeOrderViewInp struct {
Id uint64 `json:"id" v:"required|min:1#充值单ID不能为空|充值单ID不能为空"`
}
func (in *RechargeOrderViewInp) Filter(ctx context.Context) error { return nil }
type RechargeReviewInp struct {
Id uint64 `json:"id" v:"required|min:1#充值单ID不能为空|充值单ID不能为空"`
Decision int `json:"decision" v:"required|in:1,2#审核结论不能为空|审核结论不合法"`
PaidAmount int64 `json:"paidAmount" v:"min:0#实付金额不能小于0"`
ExternalNo string `json:"externalNo" v:"max-length:128#外部单号不能超过128个字符"`
ReasonCode string `json:"reasonCode" v:"required|max-length:64#原因编码不能为空|原因编码不能超过64个字符"`
ReasonText string `json:"reasonText" v:"max-length:500#审核说明不能超过500个字符"`
}
func (in *RechargeReviewInp) Filter(ctx context.Context) error {
if in.Decision == consts.FinanceDecisionApprove && in.PaidAmount <= 0 {
return gerror.New("审核通过时实付金额必须大于0")
}
return nil
}
type FinanceExecuteInp struct {
ApprovalId uint64 `json:"approvalId" v:"required|min:1#审批ID不能为空|审批ID不能为空"`
}
func (in *FinanceExecuteInp) Filter(ctx context.Context) error { return nil }
type WithdrawalOrderListInp struct {
form.PageReq
WithdrawalNo string `json:"withdrawalNo"`
Username string `json:"username"`
Mobile string `json:"mobile"`
WithdrawalStatus int `json:"withdrawalStatus"`
CreatedAt []*gtime.Time `json:"createdAt"`
}
func (in *WithdrawalOrderListInp) Filter(ctx context.Context) error { return nil }
type WithdrawalOrderListModel struct {
Id uint64 `json:"id"`
WithdrawalNo string `json:"withdrawalNo"`
MemberId uint64 `json:"memberId"`
Username string `json:"username"`
MobileMask string `json:"mobileMask"`
AvailableAmount int64 `json:"availableAmount"`
FrozenAmount int64 `json:"frozenAmount"`
RequestAmount int64 `json:"requestAmount"`
FeeAmount int64 `json:"feeAmount"`
ActualAmount int64 `json:"actualAmount"`
Currency string `json:"currency"`
AccountMask string `json:"accountMask"`
BankName string `json:"bankName"`
HolderMask string `json:"holderMask"`
PaymentAccountType int `json:"paymentAccountType"`
QrCodeUrl string `json:"qrCodeUrl"`
RiskResult *gjson.Json `json:"riskResult"`
WithdrawalStatus int `json:"withdrawalStatus"`
ReviewReasonCode string `json:"reviewReasonCode"`
ReviewReason string `json:"reviewReason"`
ApprovalRequestId uint64 `json:"approvalRequestId"`
ExternalNo string `json:"externalNo"`
FreezeLedgerId uint64 `json:"freezeLedgerId"`
FinalLedgerId uint64 `json:"finalLedgerId"`
ReviewedAt *gtime.Time `json:"reviewedAt"`
ProcessedAt *gtime.Time `json:"processedAt"`
CompletedAt *gtime.Time `json:"completedAt"`
CreatedAt *gtime.Time `json:"createdAt"`
}
type WithdrawalOrderViewInp struct {
Id uint64 `json:"id" v:"required|min:1#提现单ID不能为空|提现单ID不能为空"`
}
func (in *WithdrawalOrderViewInp) Filter(ctx context.Context) error { return nil }
type WithdrawalReviewInp struct {
Id uint64 `json:"id" v:"required|min:1#提现单ID不能为空|提现单ID不能为空"`
Decision int `json:"decision" v:"required|in:1,2#审核结论不能为空|审核结论不合法"`
ReasonCode string `json:"reasonCode" v:"required|max-length:64#原因编码不能为空|原因编码不能超过64个字符"`
ReasonText string `json:"reasonText" v:"required|max-length:500#审核说明不能为空|审核说明不能超过500个字符"`
}
func (in *WithdrawalReviewInp) Filter(ctx context.Context) error { return nil }
type WithdrawalCompleteInp struct {
Id uint64 `json:"id" v:"required|min:1#提现单ID不能为空|提现单ID不能为空"`
Success bool `json:"success"`
ExternalNo string `json:"externalNo" v:"max-length:128#外部单号不能超过128个字符"`
ReasonText string `json:"reasonText" v:"required|max-length:500#处理说明不能为空|处理说明不能超过500个字符"`
}
func (in *WithdrawalCompleteInp) Filter(ctx context.Context) error {
if in.Success && strings.TrimSpace(in.ExternalNo) == "" {
return gerror.New("付款成功时外部付款单号不能为空")
}
return nil
}
type CustomerServiceListInp struct {
form.PageReq
Name string `json:"name"`
Status int `json:"status"`
}
func (in *CustomerServiceListInp) Filter(ctx context.Context) error { return nil }
type CustomerServiceEditInp struct {
Id uint64 `json:"id"`
ServiceCode string `json:"serviceCode" v:"required|max-length:32#客服编码不能为空|客服编码不能超过32个字符"`
Name string `json:"name" v:"required|max-length:100#客服名称不能为空|客服名称不能超过100个字符"`
AvatarUrl string `json:"avatarUrl" v:"max-length:1000#头像地址不能超过1000个字符"`
WorkTime string `json:"workTime" v:"required|max-length:200#工作时间不能为空|工作时间不能超过200个字符"`
OnlineStatus int `json:"onlineStatus" v:"required|in:1,2#在线状态不能为空|在线状态不合法"`
ServiceUrl string `json:"serviceUrl" v:"required|max-length:1000#客服链接不能为空|客服链接不能超过1000个字符"`
BackupContact string `json:"backupContact" v:"required|max-length:500#备用联系方式不能为空|备用联系方式不能超过500个字符"`
SessionMapping *gjson.Json `json:"sessionMapping"`
Status int `json:"status" d:"1" v:"required|in:1,2#状态不能为空|状态不合法"`
Sort int `json:"sort"`
Remark string `json:"remark" v:"max-length:500#备注不能超过500个字符"`
}
func (in *CustomerServiceEditInp) Filter(ctx context.Context) error {
u, err := url.Parse(in.ServiceUrl)
if err != nil || !strings.EqualFold(u.Scheme, "https") || u.Host == "" {
return gerror.New("客服链接必须是有效的 HTTPS 地址")
}
if in.OnlineStatus != consts.CustomerServiceOnline && in.OnlineStatus != consts.CustomerServiceOffline {
return gerror.New("客服在线状态不合法")
}
return nil
}
type CustomerServiceViewInp struct {
Id uint64 `json:"id" v:"required|min:1#客服ID不能为空|客服ID不能为空"`
}
func (in *CustomerServiceViewInp) Filter(ctx context.Context) error { return nil }
type CustomerServiceStatusInp struct {
Id uint64 `json:"id" v:"required|min:1#客服ID不能为空|客服ID不能为空"`
Status int `json:"status" v:"required|in:1,2#状态不能为空|状态不合法"`
}
func (in *CustomerServiceStatusInp) Filter(ctx context.Context) error { return nil }
type CustomerServiceDeleteInp struct {
Id uint64 `json:"id" v:"required|min:1#客服ID不能为空|客服ID不能为空"`
Reason string `json:"reason" v:"required|max-length:500#删除原因不能为空|删除原因不能超过500个字符"`
}
func (in *CustomerServiceDeleteInp) Filter(ctx context.Context) error { return nil }
type CustomerServiceListModel struct {
*entity.CustomerService
}
@@ -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:"响应内容"`
}