发布代码生成、更新20+表单组件,优化数据字典,gf版本更新到2.3.1

This commit is contained in:
孟帅
2023-01-18 16:23:39 +08:00
parent 50207ded90
commit 87c27a17a3
386 changed files with 27926 additions and 44297 deletions

View File

@@ -93,37 +93,38 @@ type MemberMaxSortModel struct {
Sort int
}
// MemberEditInp 修改/新增字典数据
// MemberEditInp 修改/新增管理员
type MemberEditInp struct {
Id int64 `json:"id" description:""`
PostIds []int64 `json:"postIds" v:"required#岗位不能为空" description:"岗位ID"`
DeptId int64 `json:"dept_id" v:"required#部门不能为空" description:"部门ID"`
Username string `json:"username" v:"required#账号不能为空" description:"帐号"`
Password string `json:"password" description:"密码"`
Realname string `json:"realname" description:"真实姓名"`
Avatar string `json:"avatar" description:"头像"`
Sex string `json:"sex" description:"性别[0:未知;1:男;2:女]"`
Qq string `json:"qq" description:"qq"`
Email string `json:"email" description:"邮箱"`
Birthday *gtime.Time `json:"birthday" description:"生日"`
ProvinceId int `json:"province_id" description:""`
CityId int `json:"city_id" description:"城市"`
AreaId int `json:"area_id" description:"地区"`
Address string `json:"address" description:"默认地址"`
Mobile string `json:"mobile" description:"手机号码"`
HomePhone string `json:"home_phone" description:"家庭号码"`
DingtalkRobotToken string `json:"dingtalk_robot_token" description:"钉钉机器人token"`
Role int `json:"role" v:"required#角色不能为空" description:"权限"`
Remark string `json:"remark" description:"备注"`
Status string `json:"status" description:"状态"`
CreatedAt *gtime.Time `json:"created_at" description:"创建时间"`
UpdatedAt *gtime.Time `json:"updated_at" description:"修改时间"`
Id int64 `json:"id" description:""`
RoleId int `json:"roleId" v:"required#角色不能为空" description:"角色ID"`
PostIds []int64 `json:"postIds" v:"required#岗位不能为空" description:"岗位ID"`
DeptId int64 `json:"deptId" v:"required#部门不能为空" description:"部门ID"`
Username string `json:"username" v:"required#账号不能为空" description:"帐号"`
Password string `json:"password" description:"密码"`
Realname string `json:"realName" description:"真实姓名"`
Avatar string `json:"avatar" description:"头像"`
Sex string `json:"sex" description:"性别"`
Qq string `json:"qq" description:"qq"`
Email string `json:"email" description:"邮箱"`
Birthday *gtime.Time `json:"birthday" description:"生日"`
ProvinceId int `json:"provinceId" description:""`
CityId int `json:"cityId" description:"城市"`
AreaId int `json:"areaId" description:"地区"`
Address string `json:"address" description:"默认地址"`
Mobile string `json:"mobile" description:"手机号码"`
Remark string `json:"remark" description:"备注"`
Status string `json:"status" description:"状态"`
CreatedAt *gtime.Time `json:"createdAt" description:"创建时间"`
UpdatedAt *gtime.Time `json:"updatedAt" description:"修改时间"`
}
type MemberAddInp struct {
MemberEditInp
PasswordHash string `json:"password_hash" description:"密码hash"`
PasswordHash string `json:"passwordHash" description:"密码hash"`
Salt string `json:"salt" description:"密码盐"`
Pid int64 `json:"pid" description:"上级ID"`
Level int `json:"level" description:"等级"`
Tree string `json:"tree" description:"关系树"`
}
type MemberEditModel struct{}
@@ -159,10 +160,10 @@ type MemberListInp struct {
type MemberListModel struct {
entity.AdminMember
DeptName string `json:"dept_name"`
RoleName string `json:"role_name"`
DeptName string `json:"deptName"`
RoleName string `json:"roleName"`
PostIds []int64 `json:"postIds"`
DeptId int64 `json:"dept_id" description:"部门ID"`
DeptId int64 `json:"deptId" description:"部门ID"`
}
// MemberLoginInp 登录
@@ -171,12 +172,12 @@ type MemberLoginInp struct {
Password string
}
type MemberLoginModel struct {
UserId int64 `json:"userId" description:"会员ID"`
Username string `json:"username" description:"用户名"`
RealName string `json:"realName" description:"昵称"`
Avatar string `json:"avatar" description:"头像"`
Token string `json:"token" v:"" description:"登录token"`
Permissions []MemberLoginPermissions `json:"permissions" description:"角色信息"`
UserId int64 `json:"userId" description:"会员ID"`
Username string `json:"username" description:"用户名"`
RealName string `json:"realName" description:"昵称"`
Avatar string `json:"avatar" description:"头像"`
Token string `json:"token" v:"" description:"登录token"`
Permissions []*MemberLoginPermissions `json:"permissions" description:"角色信息"`
}
// MemberLoginPermissions 登录用户角色信息

View File

@@ -14,8 +14,7 @@ import (
// RoleListInp 获取列表
type RoleListInp struct {
Page int64
PerPage int64
form.PageReq
}
type RoleListModel struct {
@@ -28,7 +27,7 @@ type RoleMemberListInp struct {
form.RangeDateReq
form.StatusReq
Role int `json:"role" description:"角色ID"`
DeptId int `json:"dept_id" description:"部门ID"`
DeptId int `json:"deptId" description:"部门ID"`
Mobile int `json:"mobile" description:"手机号"`
Username string `json:"username" description:"用户名"`
Realname string `json:"realname" description:"真实姓名"`
@@ -48,3 +47,9 @@ type MenuRoleListModel struct {
Menus []*model.LabelTreeMenu `json:"menus" description:"菜单列表"`
CheckedKeys []int64 `json:"checkedKeys" description:"选择的菜单ID"`
}
type DataScopeEditInp struct {
Id int64 `json:"id" v:"required" dc:"角色ID"`
DataScope int `json:"dataScope" v:"required" dc:"数据范围"`
CustomDept []int64 `json:"customDept" dc:"自定义部门权限"`
}

View File

@@ -0,0 +1,162 @@
// Package adminin
// @Link https://github.com/bufanyun/hotgo
// @Copyright Copyright (c) 2022 HotGo CLI
// @Author Ms <133814250@qq.com>
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
//
package adminin
import (
"context"
"errors"
"github.com/gogf/gf/v2/encoding/gjson"
"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"
)
// TestEditInp 修改/新增
type TestEditInp struct {
entity.Test
}
type TestEditModel struct{}
func (in *TestEditInp) Filter(ctx context.Context) (err error) {
if in.Map.IsNil() {
in.Map = gjson.New(consts.NilJsonToString)
}
if in.Flag.IsNil() {
in.Flag = gjson.New(consts.NilJsonToString)
}
if in.Images.IsNil() {
in.Images = gjson.New(consts.NilJsonToString)
}
if in.Attachfiles.IsNil() {
in.Attachfiles = gjson.New(consts.NilJsonToString)
}
if in.Hobby.IsNil() {
in.Hobby = gjson.New(consts.NilJsonToString)
}
if in.Title == "" {
return errors.New("标题不能为空")
}
if in.Email != "" && !validate.IsEmail(in.Email) {
return errors.New("邮箱格式不正确")
}
if err := g.Validator().Rules("float|between:0,5").Messages("请输入一个浮点数|推荐星只能是0~5星").Data(in.Star).Run(ctx); err != nil {
return err.Current()
}
return
}
// TestDeleteInp 删除类型
type TestDeleteInp struct {
Id interface{} `json:"id" v:"required#测试ID不能为空" dc:"测试ID"`
}
type TestDeleteModel struct{}
// TestViewInp 获取信息
type TestViewInp struct {
Id int64 `json:"id" v:"required#测试ID不能为空" dc:"测试ID"`
}
type TestViewModel struct {
entity.Test
}
// TestListInp 获取列表
type TestListInp struct {
form.PageReq
Id int64 `json:"id" description:""`
Flag *gjson.Json `json:"flag" description:"标签"`
Title string `json:"title" description:"标题"`
Content string `json:"content" description:"内容"`
Price []float64 `json:"price" description:"价格"`
ActivityAt *gtime.Time `json:"activityAt" description:"活动时间"`
Switch int `json:"switch" description:"开关"`
Hobby *gjson.Json `json:"hobby" description:"爱好"`
Status int `json:"status" description:"状态"`
CreatedAt []*gtime.Time `json:"createdAt" description:"创建时间"`
}
type TestListModel struct {
entity.Test
TestCategoryName string `json:"testCategoryName" description:"分类名称"`
TestCategoryDescription string `json:"testCategoryDescription" description:"分类描述"`
TestCategoryRemark string `json:"testCategoryRemark" description:"分类备注"`
SysProvincesTitle string `json:"sysProvincesTitle" description:""`
}
func (in *TestListInp) Filter(ctx context.Context) (err error) {
if !in.Flag.IsNil() {
in.Flag = gjson.New(in.Flag.Var().Ints())
}
if !in.Hobby.IsNil() {
in.Hobby = gjson.New(in.Hobby.Var().Ints())
}
return
}
type TestExportModel struct {
Id int64 `json:"id" description:""`
CategoryId int64 `json:"categoryId" description:"分类ID"`
Flag *gjson.Json `json:"flag" description:"标签"`
Title string `json:"title" description:"标题"`
Star float64 `json:"star" description:"推荐星"`
Price float64 `json:"price" description:"价格"`
Views int64 `json:"views" description:"浏览次数"`
ActivityAt *gtime.Time `json:"activityAt" description:"活动时间"`
StartAt *gtime.Time `json:"startAt" description:"开启时间"`
EndAt *gtime.Time `json:"endAt" description:"结束时间"`
Switch int `json:"switch" description:"开关"`
Sort int `json:"sort" description:"排序"`
Avatar string `json:"avatar" description:"头像"`
Sex int `json:"sex" description:"性别"`
Qq string `json:"qq" description:"qq"`
Email string `json:"email" description:"邮箱"`
Mobile string `json:"mobile" description:"手机号码"`
Hobby *gjson.Json `json:"hobby" description:"爱好"`
Channel int `json:"channel" description:"渠道"`
Pid int64 `json:"pid" description:"上级ID"`
Level int `json:"level" description:"树等级"`
Tree string `json:"tree" description:"关系树"`
Remark string `json:"remark" description:"备注"`
Status int `json:"status" description:"状态"`
CreatedBy int64 `json:"createdBy" description:"创建者"`
UpdatedBy int64 `json:"updatedBy" description:"更新者"`
CreatedAt *gtime.Time `json:"createdAt" description:"创建时间"`
UpdatedAt *gtime.Time `json:"updatedAt" description:"修改时间"`
DeletedAt *gtime.Time `json:"deletedAt" description:"删除时间"`
}
// TestMaxSortInp 最大排序
type TestMaxSortInp struct{}
type TestMaxSortModel struct {
Sort int `json:"sort" description:"排序"`
}
// TestStatusInp 更新状态
type TestStatusInp struct {
Id int64 `json:"id" v:"required#测试ID不能为空" dc:"测试ID"`
Status int `json:"status" dc:"状态"`
}
type TestStatusModel struct{}
// TestSwitchInp 更新开关状态
type TestSwitchInp struct {
form.SwitchReq
Id int64 `json:"id" v:"required#测试ID不能为空" dc:"测试ID"`
}
type TestSwitchModel struct{}