feat: add Go backend
This commit is contained in:
@@ -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:"修改时间"`
|
||||
}
|
||||
@@ -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{}
|
||||
@@ -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{}
|
||||
@@ -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{}
|
||||
@@ -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"`
|
||||
}
|
||||
Reference in New Issue
Block a user