diff --git a/docs/guide-zh-CN/start-update-log.md b/docs/guide-zh-CN/start-update-log.md index 0270a5a..d78ae1b 100644 --- a/docs/guide-zh-CN/start-update-log.md +++ b/docs/guide-zh-CN/start-update-log.md @@ -11,6 +11,11 @@ > 如果升级(覆盖)代码后打开会出现 sql 报错, 请检查更新的数据库格式或自行调整 +### v2.7.3 +updated 2023.05.14 +- 增加:增加注册、手机号登录、二维码邀请注册功能 +- 优化:优化管理员业务模块验证唯一属性接口,将登录相关功能拆分到管理员基础模块中 +- 移除:移除web端mock插件 ### v2.6.10 updated 2023.05.12 diff --git a/server/addons/hgexample/logic/sys/table.go b/server/addons/hgexample/logic/sys/table.go index 190bf1a..faedc65 100644 --- a/server/addons/hgexample/logic/sys/table.go +++ b/server/addons/hgexample/logic/sys/table.go @@ -189,7 +189,7 @@ func (s *sSysTable) Status(ctx context.Context, in sysin.TableStatusInp) (err er return } - if !validate.InSliceInt(consts.StatusMap, in.Status) { + if !validate.InSliceInt(consts.StatusSlice, in.Status) { err = gerror.New("状态不正确") return } diff --git a/server/api/admin/common/site.go b/server/api/admin/common/site.go index b8052a1..0580f2b 100644 --- a/server/api/admin/common/site.go +++ b/server/api/admin/common/site.go @@ -7,6 +7,7 @@ package common import ( "github.com/gogf/gf/v2/frame/g" + "hotgo/internal/model" "hotgo/internal/model/input/adminin" ) @@ -16,6 +17,15 @@ type LoginLogoutReq struct { } type LoginLogoutRes struct{} +// RegisterReq 提交账号注册 +type RegisterReq struct { + g.Meta `path:"/site/register" method:"post" tags:"后台基础" summary:"账号注册"` + adminin.RegisterInp +} +type RegisterRes struct { + *adminin.LoginModel +} + // LoginCaptchaReq 获取登录验证码 type LoginCaptchaReq struct { g.Meta `path:"/site/captcha" method:"get" tags:"后台基础" summary:"获取登录验证码"` @@ -25,17 +35,22 @@ type LoginCaptchaRes struct { Base64 string `json:"base64" dc:"验证码"` } -// LoginReq 提交登录 -type LoginReq struct { - g.Meta `path:"/site/login" method:"post" tags:"后台基础" summary:"账号登录"` - 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:"是否为锁屏状态"` +// AccountLoginReq 提交账号登录 +type AccountLoginReq struct { + g.Meta `path:"/site/accountLogin" method:"post" tags:"后台基础" summary:"账号登录"` + adminin.AccountLoginInp } -type LoginRes struct { - *adminin.MemberLoginModel +type AccountLoginRes struct { + *adminin.LoginModel +} + +// MobileLoginReq 提交手机号登录 +type MobileLoginReq struct { + g.Meta `path:"/site/mobileLogin" method:"post" tags:"后台基础" summary:"手机号登录"` + adminin.MobileLoginInp +} +type MobileLoginRes struct { + *adminin.LoginModel } // SiteConfigReq 获取配置 @@ -43,9 +58,18 @@ type SiteConfigReq struct { g.Meta `path:"/site/config" method:"get" tags:"后台基础" summary:"获取配置"` } type SiteConfigRes struct { - Version string `json:"version" dc:"系统版本"` - WsAddr string `json:"wsAddr" dc:"客户端websocket地址"` - Domain string `json:"domain" dc:"对外域名"` + Version string `json:"version" dc:"系统版本"` + WsAddr string `json:"wsAddr" dc:"客户端websocket地址"` + Domain string `json:"domain" dc:"对外域名"` + //InviteUrl string `json:"inviteUrl" dc:"邀请注册地址"` +} + +// SiteLoginConfigReq 获取登录配置 +type SiteLoginConfigReq struct { + g.Meta `path:"/site/loginConfig" method:"get" tags:"后台基础" summary:"获取登录配置"` +} +type SiteLoginConfigRes struct { + *model.LoginConfig } // SitePingReq ping diff --git a/server/api/admin/common/sms.go b/server/api/admin/common/sms.go index ad79af8..f383755 100644 --- a/server/api/admin/common/sms.go +++ b/server/api/admin/common/sms.go @@ -3,7 +3,6 @@ // @Copyright Copyright (c) 2023 HotGo CLI // @Author Ms <133814250@qq.com> // @License https://github.com/bufanyun/hotgo/blob/master/LICENSE -// package common import "github.com/gogf/gf/v2/frame/g" @@ -24,3 +23,12 @@ type SendBindSmsReq struct { } type SendBindSmsRes struct { } + +// SendSmsReq 发送短信 +type SendSmsReq struct { + g.Meta `path:"/sms/send" tags:"短信" method:"post" summary:"发送短信"` + Event string `json:"event" v:"required#事件模板不能为空" dc:"事件模板"` + Mobile string `json:"mobile" v:"required#接收手机号不能为空" dc:"接收手机号"` +} +type SendSmsRes struct { +} diff --git a/server/api/admin/member/member.go b/server/api/admin/member/member.go index dbcb1ce..5de114e 100644 --- a/server/api/admin/member/member.go +++ b/server/api/admin/member/member.go @@ -53,33 +53,6 @@ type ResetPwdReq struct { } type ResetPwdRes struct{} -// EmailUniqueReq 邮箱是否唯一 -type EmailUniqueReq struct { - g.Meta `path:"/member/emailUnique" method:"get" tags:"用户" summary:"邮箱是否唯一"` - adminin.MemberEmailUniqueInp -} -type EmailUniqueRes struct { - *adminin.MemberEmailUniqueModel -} - -// MobileUniqueReq 手机号是否唯一 -type MobileUniqueReq struct { - g.Meta `path:"/member/mobileUnique" method:"get" tags:"用户" summary:"手机号是否唯一"` - adminin.MemberMobileUniqueInp -} -type MobileUniqueRes struct { - *adminin.MemberMobileUniqueModel -} - -// NameUniqueReq 名称是否唯一 -type NameUniqueReq struct { - g.Meta `path:"/member/nameUnique" method:"get" tags:"用户" summary:"用户名称是否唯一"` - adminin.MemberNameUniqueInp -} -type NameUniqueRes struct { - *adminin.MemberNameUniqueModel -} - // ListReq 查询列表 type ListReq struct { g.Meta `path:"/member/list" method:"get" tags:"用户" summary:"获取用户列表"` @@ -114,15 +87,6 @@ type DeleteReq struct { } type DeleteRes struct{} -// LoginInfoReq 获取登录用户信息 -type LoginInfoReq struct { - g.Meta `path:"/member/info" method:"get" tags:"用户" summary:"获取登录用户信息" dc:"获取管理后台的登录用户信息"` -} - -type LoginInfoRes struct { - *adminin.LoginMemberInfoModel -} - // StatusReq 更新用户状态 type StatusReq struct { g.Meta `path:"/member/status" method:"post" tags:"用户" summary:"更新用户状态"` @@ -132,10 +96,18 @@ type StatusRes struct{} // SelectReq 获取可选的后台用户选项 type SelectReq struct { - g.Meta `path:"/member/option" method:"get" summary:"用户" tags:"获取可选的后台用户选项"` + g.Meta `path:"/member/option" method:"get" tags:"用户" summary:"获取可选的后台用户选项"` } type SelectRes []*adminin.MemberSelectModel +// InfoReq 获取登录用户信息 +type InfoReq struct { + g.Meta `path:"/member/info" method:"get" tags:"用户" summary:"获取登录用户信息"` +} +type InfoRes struct { + *adminin.LoginMemberInfoModel +} + // AddBalanceReq 增加余额 type AddBalanceReq struct { g.Meta `path:"/member/addBalance" method:"post" tags:"用户" summary:"增加余额"` diff --git a/server/internal/consts/config.go b/server/internal/consts/config.go index 6d13dba..4039745 100644 --- a/server/internal/consts/config.go +++ b/server/internal/consts/config.go @@ -3,7 +3,6 @@ // @Copyright Copyright (c) 2023 HotGo CLI // @Author Ms <133814250@qq.com> // @License https://github.com/bufanyun/hotgo/blob/master/LICENSE -// package consts import "github.com/gogf/gf/v2/util/gconv" @@ -13,22 +12,25 @@ var RequestEncryptKey = []byte("f080a463654b2279") // 配置数据类型 const ( - ConfigTypeString = "string" - ConfigTypeInt = "int" - ConfigTypeInt8 = "int8" - ConfigTypeInt16 = "int16" - ConfigTypeInt32 = "int32" - ConfigTypeInt64 = "int64" - ConfigTypeUint = "uint" - ConfigTypeUint8 = "uint8" - ConfigTypeUint16 = "uint16" - ConfigTypeUint32 = "uint32" - ConfigTypeUint64 = "uint64" - ConfigTypeFloat32 = "float32" - ConfigTypeFloat64 = "float64" - ConfigTypeBool = "bool" - ConfigTypeDate = "date" - ConfigTypeDateTime = "datetime" + ConfigTypeString = "string" + ConfigTypeInt = "int" + ConfigTypeInt8 = "int8" + ConfigTypeInt16 = "int16" + ConfigTypeInt32 = "int32" + ConfigTypeInt64 = "int64" + ConfigTypeUint = "uint" + ConfigTypeUint8 = "uint8" + ConfigTypeUint16 = "uint16" + ConfigTypeUint32 = "uint32" + ConfigTypeUint64 = "uint64" + ConfigTypeFloat32 = "float32" + ConfigTypeFloat64 = "float64" + ConfigTypeBool = "bool" + ConfigTypeDate = "date" + ConfigTypeDateTime = "datetime" + ConfigTypeSliceString = "[]string" + ConfigTypeSliceInt = "[]int" + ConfigTypeSliceInt64 = "[]int64" ) var ConfigTypes = []string{ConfigTypeString, @@ -37,6 +39,7 @@ var ConfigTypes = []string{ConfigTypeString, ConfigTypeFloat32, ConfigTypeFloat64, ConfigTypeBool, ConfigTypeDate, ConfigTypeDateTime, + ConfigTypeSliceString, ConfigTypeSliceInt, ConfigTypeSliceInt64, } // ConvType 类型转换 @@ -74,6 +77,12 @@ func ConvType(val interface{}, t string) interface{} { val = gconv.Time(val, "Y-m-d") case ConfigTypeDateTime: val = gconv.Time(val, "Y-m-d H:i:s") + case ConfigTypeSliceInt: + val = gconv.SliceInt(val) + case ConfigTypeSliceInt64: + val = gconv.SliceInt64(val) + case ConfigTypeSliceString: + val = gconv.SliceStr(val) default: val = gconv.String(val) } diff --git a/server/internal/consts/status.go b/server/internal/consts/status.go index ee7ddf7..274fe9d 100644 --- a/server/internal/consts/status.go +++ b/server/internal/consts/status.go @@ -3,7 +3,6 @@ // @Copyright Copyright (c) 2023 HotGo CLI // @Author Ms <133814250@qq.com> // @License https://github.com/bufanyun/hotgo/blob/master/LICENSE -// package consts // 状态码 @@ -14,4 +13,4 @@ const ( StatusDelete int = 3 // 已删除 ) -var StatusMap = []int{StatusALL, StatusEnabled, StatusDisable, StatusDelete} +var StatusSlice = []int{StatusALL, StatusEnabled, StatusDisable, StatusDelete} diff --git a/server/internal/consts/version.go b/server/internal/consts/version.go index ff737c9..50ec7a9 100644 --- a/server/internal/consts/version.go +++ b/server/internal/consts/version.go @@ -7,5 +7,5 @@ package consts // VersionApp HotGo版本 const ( - VersionApp = "2.6.10" + VersionApp = "2.7.3" ) diff --git a/server/internal/controller/admin/admin/member.go b/server/internal/controller/admin/admin/member.go index df7b477..da3ed1b 100644 --- a/server/internal/controller/admin/admin/member.go +++ b/server/internal/controller/admin/admin/member.go @@ -96,54 +96,15 @@ func (c *cMember) ResetPwd(ctx context.Context, req *member.ResetPwdReq) (res *m return } -// EmailUnique 邮箱是否唯一 -func (c *cMember) EmailUnique(ctx context.Context, req *member.EmailUniqueReq) (res *member.EmailUniqueRes, err error) { - var in = adminin.MemberEmailUniqueInp{ - Id: req.Id, - Email: req.Email, - } - - data, err := service.AdminMember().EmailUnique(ctx, in) +// MemberInfo 登录用户信息 +func (c *cMember) MemberInfo(ctx context.Context, _ *member.InfoReq) (res *member.InfoRes, err error) { + data, err := service.AdminMember().LoginMemberInfo(ctx) if err != nil { return } - res = new(member.EmailUniqueRes) - res.IsUnique = data.IsUnique - return -} - -// MobileUnique 手机号是否唯一 -func (c *cMember) MobileUnique(ctx context.Context, req *member.MobileUniqueReq) (res *member.MobileUniqueRes, err error) { - var in = adminin.MemberMobileUniqueInp{ - Id: req.Id, - Mobile: req.Mobile, - } - - data, err := service.AdminMember().MobileUnique(ctx, in) - if err != nil { - return - } - - res = new(member.MobileUniqueRes) - res.IsUnique = data.IsUnique - return -} - -// NameUnique 名称是否唯一 -func (c *cMember) NameUnique(ctx context.Context, req *member.NameUniqueReq) (res *member.NameUniqueRes, err error) { - var in = adminin.MemberNameUniqueInp{ - Id: req.Id, - Username: req.Username, - } - - data, err := service.AdminMember().NameUnique(ctx, in) - if err != nil { - return - } - - res = new(member.NameUniqueRes) - res.IsUnique = data.IsUnique + res = new(member.InfoRes) + res.LoginMemberInfoModel = data return } @@ -206,18 +167,6 @@ func (c *cMember) List(ctx context.Context, req *member.ListReq) (res *member.Li return } -// LoginInfo 登录用户信息 -func (c *cMember) LoginInfo(ctx context.Context, req *member.LoginInfoReq) (res *member.LoginInfoRes, err error) { - data, err := service.AdminMember().LoginMemberInfo(ctx) - if err != nil { - return - } - - res = new(member.LoginInfoRes) - res.LoginMemberInfoModel = data - return -} - // Status 更新状态 func (c *cMember) Status(ctx context.Context, req *member.StatusReq) (res *member.StatusRes, err error) { var in adminin.MemberStatusInp diff --git a/server/internal/controller/admin/admin/role.go b/server/internal/controller/admin/admin/role.go index 84ea0f2..a8b26e8 100644 --- a/server/internal/controller/admin/admin/role.go +++ b/server/internal/controller/admin/admin/role.go @@ -3,7 +3,6 @@ // @Copyright Copyright (c) 2023 HotGo CLI // @Author Ms <133814250@qq.com> // @License https://github.com/bufanyun/hotgo/blob/master/LICENSE -// package admin import ( @@ -103,7 +102,7 @@ func (c *cRole) UpdatePermissions(ctx context.Context, req *role.UpdatePermissio } // DataScopeSelect 获取数据权限选项 -func (c *cRole) DataScopeSelect(ctx context.Context, req *role.DataScopeSelectReq) (res *role.DataScopeSelectRes, err error) { +func (c *cRole) DataScopeSelect(ctx context.Context, _ *role.DataScopeSelectReq) (res *role.DataScopeSelectRes, err error) { data := service.AdminRole().DataScopeSelect(ctx) res = new(role.DataScopeSelectRes) res.List = data diff --git a/server/internal/controller/admin/common/console.go b/server/internal/controller/admin/common/console.go index 8558aee..30c44c8 100644 --- a/server/internal/controller/admin/common/console.go +++ b/server/internal/controller/admin/common/console.go @@ -3,7 +3,6 @@ // @Copyright Copyright (c) 2023 HotGo CLI // @Author Ms <133814250@qq.com> // @License https://github.com/bufanyun/hotgo/blob/master/LICENSE -// package common import ( @@ -16,7 +15,7 @@ var Console = cConsole{} type cConsole struct{} // Stat 综合数据统计 -func (c *cConsole) Stat(ctx context.Context, req *common.ConsoleStatReq) (res *common.ConsoleStatRes, err error) { +func (c *cConsole) Stat(_ context.Context, _ *common.ConsoleStatReq) (res *common.ConsoleStatRes, err error) { res = new(common.ConsoleStatRes) res.Visits.DayVisits = 12010 diff --git a/server/internal/controller/admin/common/ems.go b/server/internal/controller/admin/common/ems.go index 95153e0..0cd32d8 100644 --- a/server/internal/controller/admin/common/ems.go +++ b/server/internal/controller/admin/common/ems.go @@ -3,7 +3,6 @@ // @Copyright Copyright (c) 2023 HotGo CLI // @Author Ms <133814250@qq.com> // @License https://github.com/bufanyun/hotgo/blob/master/LICENSE -// package common import ( @@ -43,7 +42,7 @@ func (c *cEms) SendTest(ctx context.Context, req *common.SendTestEmailReq) (res } // SendBindEms 发送换绑邮件 -func (c *cSms) SendBindEms(ctx context.Context, req *common.SendBindEmsReq) (res *common.SendBindEmsRes, err error) { +func (c *cSms) SendBindEms(ctx context.Context, _ *common.SendBindEmsReq) (res *common.SendBindEmsRes, err error) { var ( memberId = contexts.GetUserId(ctx) models *entity.AdminMember diff --git a/server/internal/controller/admin/common/site.go b/server/internal/controller/admin/common/site.go index 22ec469..8a27625 100644 --- a/server/internal/controller/admin/common/site.go +++ b/server/internal/controller/admin/common/site.go @@ -16,7 +16,6 @@ import ( "hotgo/internal/library/captcha" "hotgo/internal/library/token" "hotgo/internal/model/input/adminin" - "hotgo/internal/model/input/sysin" "hotgo/internal/service" "hotgo/utility/validate" ) @@ -26,12 +25,12 @@ var Site = cSite{} type cSite struct{} // Ping ping -func (c *cSite) Ping(ctx context.Context, req *common.SitePingReq) (res *common.SitePingRes, err error) { +func (c *cSite) Ping(_ context.Context, _ *common.SitePingReq) (res *common.SitePingRes, err error) { return } // Config 获取配置 -func (c *cSite) Config(ctx context.Context, req *common.SiteConfigReq) (res *common.SiteConfigRes, err error) { +func (c *cSite) Config(ctx context.Context, _ *common.SiteConfigReq) (res *common.SiteConfigRes, err error) { request := ghttp.RequestFromCtx(ctx) res = &common.SiteConfigRes{ Version: consts.VersionApp, @@ -71,35 +70,77 @@ func (c *cSite) getDomain(ctx context.Context, request *ghttp.Request) string { return basic.Domain } +// LoginConfig 登录配置 +func (c *cSite) LoginConfig(ctx context.Context, _ *common.SiteLoginConfigReq) (res *common.SiteLoginConfigRes, err error) { + res = new(common.SiteLoginConfigRes) + login, err := service.SysConfig().GetLogin(ctx) + if err != nil { + return + } + + res.LoginConfig = login + return +} + // Captcha 登录验证码 -func (c *cSite) Captcha(ctx context.Context, req *common.LoginCaptchaReq) (res *common.LoginCaptchaRes, err error) { +func (c *cSite) Captcha(ctx context.Context, _ *common.LoginCaptchaReq) (res *common.LoginCaptchaRes, err error) { cid, base64 := captcha.Generate(ctx) res = &common.LoginCaptchaRes{Cid: cid, Base64: base64} return } -// Login 提交登录 -func (c *cSite) Login(ctx context.Context, req *common.LoginReq) (res *common.LoginRes, err error) { - var in adminin.MemberLoginInp +// Register 账号注册 +func (c *cSite) Register(ctx context.Context, req *common.RegisterReq) (res *common.RegisterRes, err error) { + var in adminin.RegisterInp if err = gconv.Scan(req, &in); err != nil { return } - defer func() { - var response = new(adminin.MemberLoginModel) - if res != nil && res.MemberLoginModel != nil { - response = res.MemberLoginModel - } - service.SysLoginLog().Push(ctx, sysin.LoginLogPushInp{Input: in, Response: response, Err: err}) - }() - - // 校验 验证码 - if !req.IsLock && !captcha.Verify(req.Cid, req.Code) { - err = gerror.New("验证码错误") + if err = validate.PreFilter(ctx, &in); err != nil { return } - model, err := service.AdminMember().Login(ctx, in) + err = service.AdminSite().Register(ctx, in) + return +} + +// AccountLogin 账号登录 +func (c *cSite) AccountLogin(ctx context.Context, req *common.AccountLoginReq) (res *common.AccountLoginRes, err error) { + var in adminin.AccountLoginInp + if err = gconv.Scan(req, &in); err != nil { + return + } + + login, err := service.SysConfig().GetLogin(ctx) + if err != nil { + return + } + + if login.CaptchaSwitch == 1 { + // 校验 验证码 + if !req.IsLock && !captcha.Verify(req.Cid, req.Code) { + err = gerror.New("验证码错误") + return + } + } + + model, err := service.AdminSite().AccountLogin(ctx, in) + if err != nil { + return + } + + err = gconv.Scan(model, &res) + return +} + +// MobileLogin 手机号登录 +func (c *cSite) MobileLogin(ctx context.Context, req *common.MobileLoginReq) (res *common.MobileLoginRes, err error) { + var in adminin.MobileLoginInp + if err = gconv.Scan(req, &in); err != nil { + return + } + + model, err := service.AdminSite().MobileLogin(ctx, in) if err != nil { return } @@ -109,7 +150,7 @@ func (c *cSite) Login(ctx context.Context, req *common.LoginReq) (res *common.Lo } // Logout 注销登录 -func (c *cSite) Logout(ctx context.Context, req *common.LoginLogoutReq) (res *common.LoginLogoutRes, err error) { +func (c *cSite) Logout(ctx context.Context, _ *common.LoginLogoutReq) (res *common.LoginLogoutRes, err error) { err = token.Logout(ghttp.RequestFromCtx(ctx)) return } diff --git a/server/internal/controller/admin/common/sms.go b/server/internal/controller/admin/common/sms.go index a5d557e..573d93e 100644 --- a/server/internal/controller/admin/common/sms.go +++ b/server/internal/controller/admin/common/sms.go @@ -3,7 +3,6 @@ // @Copyright Copyright (c) 2023 HotGo CLI // @Author Ms <133814250@qq.com> // @License https://github.com/bufanyun/hotgo/blob/master/LICENSE -// package common import ( @@ -40,7 +39,7 @@ func (c *cSms) SendTest(ctx context.Context, req *common.SendTestSmsReq) (res *c } // SendBindSms 发送换绑短信 -func (c *cSms) SendBindSms(ctx context.Context, req *common.SendBindSmsReq) (res *common.SendBindSmsRes, err error) { +func (c *cSms) SendBindSms(ctx context.Context, _ *common.SendBindSmsReq) (res *common.SendBindSmsRes, err error) { var ( memberId = contexts.GetUserId(ctx) models *entity.AdminMember @@ -75,3 +74,18 @@ func (c *cSms) SendBindSms(ctx context.Context, req *common.SendBindSmsReq) (res }) return } + +// SendSms 发送短信 +func (c *cSms) SendSms(ctx context.Context, req *common.SendSmsReq) (res *common.SendSmsRes, err error) { + var in sysin.SendCodeInp + if err = gconv.Scan(req, &in); err != nil { + return + } + + if err = validate.PreFilter(ctx, &in); err != nil { + return + } + + err = service.SysSmsLog().SendCode(ctx, in) + return +} diff --git a/server/internal/controller/admin/common/upload.go b/server/internal/controller/admin/common/upload.go index 992295c..9d13d5d 100644 --- a/server/internal/controller/admin/common/upload.go +++ b/server/internal/controller/admin/common/upload.go @@ -3,7 +3,6 @@ // @Copyright Copyright (c) 2023 HotGo CLI // @Author Ms <133814250@qq.com> // @License https://github.com/bufanyun/hotgo/blob/master/LICENSE -// package common import ( @@ -19,7 +18,7 @@ var Upload = new(cUpload) type cUpload struct{} // UploadImage 上传图片 -func (c *cUpload) UploadImage(ctx context.Context, req *common.UploadImageReq) (res common.UploadImageRes, err error) { +func (c *cUpload) UploadImage(ctx context.Context, _ *common.UploadImageReq) (res common.UploadImageRes, err error) { file := g.RequestFromCtx(ctx).GetUploadFile("file") if file == nil { err = gerror.New("没有找到上传的文件") @@ -30,7 +29,7 @@ func (c *cUpload) UploadImage(ctx context.Context, req *common.UploadImageReq) ( } // UploadFile 上传附件 -func (c *cUpload) UploadFile(ctx context.Context, req *common.UploadFileReq) (res common.UploadFileRes, err error) { +func (c *cUpload) UploadFile(ctx context.Context, _ *common.UploadFileReq) (res common.UploadFileRes, err error) { file := g.RequestFromCtx(ctx).GetUploadFile("file") if file == nil { err = gerror.New("没有找到上传的文件") diff --git a/server/internal/controller/admin/sys/config.go b/server/internal/controller/admin/sys/config.go index 1f19d27..2be9551 100644 --- a/server/internal/controller/admin/sys/config.go +++ b/server/internal/controller/admin/sys/config.go @@ -3,7 +3,6 @@ // @Copyright Copyright (c) 2023 HotGo CLI // @Author Ms <133814250@qq.com> // @License https://github.com/bufanyun/hotgo/blob/master/LICENSE -// package sys import ( @@ -46,7 +45,7 @@ func (c *cConfig) UpdateConfig(ctx context.Context, req *config.UpdateReq) (res } // TypeSelect 数据类型选项 -func (c *cConfig) TypeSelect(ctx context.Context, req *config.TypeSelectReq) (res config.TypeSelectRes, err error) { +func (c *cConfig) TypeSelect(_ context.Context, _ *config.TypeSelectReq) (res config.TypeSelectRes, err error) { for _, v := range consts.ConfigTypes { res = append(res, form.Select{ Value: v, @@ -58,8 +57,8 @@ func (c *cConfig) TypeSelect(ctx context.Context, req *config.TypeSelectReq) (re } // GetCash 获取指定分组的配置 -func (c *cConfig) GetCash(ctx context.Context, req *config.GetCashReq) (res *config.GetCashRes, err error) { +func (c *cConfig) GetCash(ctx context.Context, _ *config.GetCashReq) (res *config.GetCashRes, err error) { res = new(config.GetCashRes) res.GetConfigModel, err = service.SysConfig().GetConfigByGroup(ctx, sysin.GetConfigInp{Group: "cash"}) return -} \ No newline at end of file +} diff --git a/server/internal/controller/admin/sys/cron_group.go b/server/internal/controller/admin/sys/cron_group.go index 6455c10..6037af2 100644 --- a/server/internal/controller/admin/sys/cron_group.go +++ b/server/internal/controller/admin/sys/cron_group.go @@ -3,7 +3,6 @@ // @Copyright Copyright (c) 2023 HotGo CLI // @Author Ms <133814250@qq.com> // @License https://github.com/bufanyun/hotgo/blob/master/LICENSE -// package sys import ( @@ -99,7 +98,7 @@ func (c *cCronGroup) Status(ctx context.Context, req *cron.GroupStatusReq) (res } // Select 选项 -func (c *cCronGroup) Select(ctx context.Context, req *cron.GroupSelectReq) (res *cron.GroupSelectRes, err error) { +func (c *cCronGroup) Select(ctx context.Context, _ *cron.GroupSelectReq) (res *cron.GroupSelectRes, err error) { data, err := service.SysCronGroup().Select(ctx, sysin.CronGroupSelectInp{}) if err != nil { return diff --git a/server/internal/controller/admin/sys/dict_type.go b/server/internal/controller/admin/sys/dict_type.go index b20483b..0ec805b 100644 --- a/server/internal/controller/admin/sys/dict_type.go +++ b/server/internal/controller/admin/sys/dict_type.go @@ -3,7 +3,6 @@ // @Copyright Copyright (c) 2023 HotGo CLI // @Author Ms <133814250@qq.com> // @License https://github.com/bufanyun/hotgo/blob/master/LICENSE -// package sys import ( @@ -21,7 +20,7 @@ var ( type cDictType struct{} // Tree 树 -func (c *cDictType) Tree(ctx context.Context, req *dict.TypeTreeReq) (res *dict.TypeTreeRes, err error) { +func (c *cDictType) Tree(ctx context.Context, _ *dict.TypeTreeReq) (res *dict.TypeTreeRes, err error) { res = new(dict.TypeTreeRes) res.List, err = service.SysDictType().Tree(ctx) return diff --git a/server/internal/controller/admin/sys/log.go b/server/internal/controller/admin/sys/log.go index 499b11b..e6fce95 100644 --- a/server/internal/controller/admin/sys/log.go +++ b/server/internal/controller/admin/sys/log.go @@ -3,7 +3,6 @@ // @Copyright Copyright (c) 2023 HotGo CLI // @Author Ms <133814250@qq.com> // @License https://github.com/bufanyun/hotgo/blob/master/LICENSE -// package sys import ( @@ -22,7 +21,7 @@ var Log = sLog{} type sLog struct{} // Clear 清空日志 -func (c *sLog) Clear(ctx context.Context, req *log.ClearReq) (res *log.ClearRes, err error) { +func (c *sLog) Clear(ctx context.Context, _ *log.ClearReq) (res *log.ClearRes, err error) { err = gerror.New("暂时考虑到安全问题,请到数据库清空") return } diff --git a/server/internal/controller/api/member/member.go b/server/internal/controller/api/member/member.go index 29a1727..9599400 100644 --- a/server/internal/controller/api/member/member.go +++ b/server/internal/controller/api/member/member.go @@ -3,7 +3,6 @@ // @Copyright Copyright (c) 2023 HotGo CLI // @Author Ms <133814250@qq.com> // @License https://github.com/bufanyun/hotgo/blob/master/LICENSE -// package member import ( @@ -18,7 +17,7 @@ var ( type cMember struct{} -func (c *cMember) GetIdByCode(ctx context.Context, req *member.GetIdByCodeReq) (res *member.GetIdByCodeRes, err error) { +func (c *cMember) GetIdByCode(ctx context.Context, _ *member.GetIdByCodeReq) (res *member.GetIdByCodeRes, err error) { g.RequestFromCtx(ctx).Response.Writeln("Hello World api member!") return } diff --git a/server/internal/controller/api/pay/notify.go b/server/internal/controller/api/pay/notify.go index 7b780c1..15497d3 100644 --- a/server/internal/controller/api/pay/notify.go +++ b/server/internal/controller/api/pay/notify.go @@ -20,7 +20,7 @@ var ( type cNotify struct{} // AliPay 支付宝回调 -func (c *cNotify) AliPay(ctx context.Context, req *pay.NotifyAliPayReq) (res *pay.NotifyAliPayRes, err error) { +func (c *cNotify) AliPay(ctx context.Context, _ *pay.NotifyAliPayReq) (res *pay.NotifyAliPayRes, err error) { _, err = service.Pay().Notify(ctx, payin.PayNotifyInp{PayType: consts.PayTypeAliPay}) if err != nil { return nil, err @@ -30,7 +30,7 @@ func (c *cNotify) AliPay(ctx context.Context, req *pay.NotifyAliPayReq) (res *pa } // WxPay 微信支付回调 -func (c *cNotify) WxPay(ctx context.Context, req *pay.NotifyWxPayReq) (res *pay.NotifyWxPayRes, err error) { +func (c *cNotify) WxPay(ctx context.Context, _ *pay.NotifyWxPayReq) (res *pay.NotifyWxPayRes, err error) { _, err = service.Pay().Notify(ctx, payin.PayNotifyInp{PayType: consts.PayTypeWxPay}) if err != nil { return nil, err @@ -42,7 +42,7 @@ func (c *cNotify) WxPay(ctx context.Context, req *pay.NotifyWxPayReq) (res *pay. } // QQPay QQ支付回调 -func (c *cNotify) QQPay(ctx context.Context, req *pay.NotifyQQPayReq) (res *pay.NotifyQQPayRes, err error) { +func (c *cNotify) QQPay(ctx context.Context, _ *pay.NotifyQQPayReq) (res *pay.NotifyQQPayRes, err error) { _, err = service.Pay().Notify(ctx, payin.PayNotifyInp{PayType: consts.PayTypeQQPay}) if err != nil { return nil, err diff --git a/server/internal/controller/api/user/hello.go b/server/internal/controller/api/user/hello.go index 7e05631..8ce539d 100644 --- a/server/internal/controller/api/user/hello.go +++ b/server/internal/controller/api/user/hello.go @@ -3,7 +3,6 @@ // @Copyright Copyright (c) 2023 HotGo CLI // @Author Ms <133814250@qq.com> // @License https://github.com/bufanyun/hotgo/blob/master/LICENSE -// package user import ( @@ -18,7 +17,7 @@ var ( type cHello struct{} -func (c *cHello) Hello(ctx context.Context, req *user.HelloReq) (res *user.HelloRes, err error) { +func (c *cHello) Hello(ctx context.Context, _ *user.HelloReq) (res *user.HelloRes, err error) { g.RequestFromCtx(ctx).Response.Writeln("Hello World api member!") return } diff --git a/server/internal/controller/home/base/site.go b/server/internal/controller/home/base/site.go index 1d10620..34ff311 100644 --- a/server/internal/controller/home/base/site.go +++ b/server/internal/controller/home/base/site.go @@ -3,7 +3,6 @@ // @Copyright Copyright (c) 2023 HotGo CLI // @Author Ms <133814250@qq.com> // @License https://github.com/bufanyun/hotgo/blob/master/LICENSE -// package base import ( @@ -20,7 +19,7 @@ var Site = cSite{} type cSite struct{} -func (a *cSite) Index(ctx context.Context, req *base.SiteIndexReq) (res *base.SiteIndexRes, err error) { +func (a *cSite) Index(ctx context.Context, _ *base.SiteIndexReq) (res *base.SiteIndexRes, err error) { service.View().Render(ctx, model.View{Data: g.Map{ "name": "HotGo", "version": consts.VersionApp, diff --git a/server/internal/dao/admin_member.go b/server/internal/dao/admin_member.go index d2ba4c3..d6d13ef 100644 --- a/server/internal/dao/admin_member.go +++ b/server/internal/dao/admin_member.go @@ -5,11 +5,7 @@ package dao import ( - "context" - "github.com/gogf/gf/v2/errors/gerror" - "hotgo/internal/consts" "hotgo/internal/dao/internal" - "hotgo/internal/model/entity" ) // internalAdminMemberDao is internal type for wrapping internal DAO implements. @@ -29,66 +25,3 @@ var ( ) // Fill with you ideas below. - -// IsUniqueName 判断用户名是否唯一 -func (dao *adminMemberDao) IsUniqueName(ctx context.Context, id int64, name string) (bool, error) { - var data *entity.AdminDept - m := dao.Ctx(ctx).Where("username", name) - - if id > 0 { - m = m.WhereNot("id", id) - } - - if err := m.Scan(&data); err != nil { - err = gerror.Wrap(err, consts.ErrorORM) - return false, err - } - - if data == nil { - return true, nil - } - - return false, nil -} - -// IsUniqueEmail 判断邮箱是否唯一 -func (dao *adminMemberDao) IsUniqueEmail(ctx context.Context, id int64, email string) (bool, error) { - var data *entity.AdminMember - m := dao.Ctx(ctx).Where("email", email) - - if id > 0 { - m = m.WhereNot("id", id) - } - - if err := m.Scan(&data); err != nil { - err = gerror.Wrap(err, consts.ErrorORM) - return false, err - } - - if data == nil { - return true, nil - } - - return false, nil -} - -// IsUniqueMobile 判断手机号是否唯一 -func (dao *adminMemberDao) IsUniqueMobile(ctx context.Context, id int64, mobile string) (bool, error) { - var data *entity.AdminMember - m := dao.Ctx(ctx).Where("mobile", mobile) - - if id > 0 { - m = m.WhereNot("id", id) - } - - if err := m.Scan(&data); err != nil { - err = gerror.Wrap(err, consts.ErrorORM) - return false, err - } - - if data == nil { - return true, nil - } - - return false, nil -} diff --git a/server/internal/dao/admin_member_post.go b/server/internal/dao/admin_member_post.go index dd59983..1afd6f3 100644 --- a/server/internal/dao/admin_member_post.go +++ b/server/internal/dao/admin_member_post.go @@ -7,7 +7,6 @@ package dao import ( "context" "github.com/gogf/gf/v2/errors/gerror" - "github.com/gogf/gf/v2/frame/g" "hotgo/internal/dao/internal" "hotgo/internal/model/entity" ) @@ -30,7 +29,6 @@ var ( // UpdatePostIds 更新管理员岗位 func (dao *adminMemberPostDao) UpdatePostIds(ctx context.Context, memberId int64, postIds []int64) (err error) { - g.DumpWithType(postIds) _, err = dao.Ctx(ctx). Where("member_id", memberId). Delete() diff --git a/server/internal/dao/internal/admin_member.go b/server/internal/dao/internal/admin_member.go index 3ed51dd..48a77fa 100644 --- a/server/internal/dao/internal/admin_member.go +++ b/server/internal/dao/internal/admin_member.go @@ -41,6 +41,7 @@ type AdminMemberColumns struct { Pid string // 上级管理员ID Level string // 关系树等级 Tree string // 关系树 + InviteCode string // 邀请码 Cash string // 提现配置 LastActiveAt string // 最后活跃时间 Remark string // 备注 @@ -72,6 +73,7 @@ var adminMemberColumns = AdminMemberColumns{ Pid: "pid", Level: "level", Tree: "tree", + InviteCode: "invite_code", Cash: "cash", LastActiveAt: "last_active_at", Remark: "remark", diff --git a/server/internal/library/hgorm/handler/filter_auth.go b/server/internal/library/hgorm/handler/filter_auth.go index 843520f..558b149 100644 --- a/server/internal/library/hgorm/handler/filter_auth.go +++ b/server/internal/library/hgorm/handler/filter_auth.go @@ -1,3 +1,8 @@ +// Package handler +// @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 handler import ( diff --git a/server/internal/library/hgorm/handler/force_cache.go b/server/internal/library/hgorm/handler/force_cache.go index edfb85f..a59f2a5 100644 --- a/server/internal/library/hgorm/handler/force_cache.go +++ b/server/internal/library/hgorm/handler/force_cache.go @@ -1,3 +1,8 @@ +// Package handler +// @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 handler import ( diff --git a/server/internal/library/hgorm/hook/hook.go b/server/internal/library/hgorm/hook/hook.go index 2b894e6..abd78d5 100644 --- a/server/internal/library/hgorm/hook/hook.go +++ b/server/internal/library/hgorm/hook/hook.go @@ -1,3 +1,8 @@ +// Package hook +// @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 hook // hook. diff --git a/server/internal/library/hgorm/hook/member.go b/server/internal/library/hgorm/hook/member.go index ce1f3da..0513015 100644 --- a/server/internal/library/hgorm/hook/member.go +++ b/server/internal/library/hgorm/hook/member.go @@ -1,3 +1,8 @@ +// Package hook +// @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 hook import ( diff --git a/server/internal/library/hgorm/hook/provinces.go b/server/internal/library/hgorm/hook/provinces.go index 0cf0c1f..7027986 100644 --- a/server/internal/library/hgorm/hook/provinces.go +++ b/server/internal/library/hgorm/hook/provinces.go @@ -1,3 +1,8 @@ +// Package hook +// @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 hook import ( diff --git a/server/internal/library/location/geocode.go b/server/internal/library/location/geocode.go index ccb5575..94e1153 100644 --- a/server/internal/library/location/geocode.go +++ b/server/internal/library/location/geocode.go @@ -1,3 +1,8 @@ +// Package location +// @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 location import ( diff --git a/server/internal/library/location/region.go b/server/internal/library/location/region.go index cf6cdba..96246bc 100644 --- a/server/internal/library/location/region.go +++ b/server/internal/library/location/region.go @@ -1,3 +1,8 @@ +// Package location +// @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 location import ( diff --git a/server/internal/library/network/tcp/client.go b/server/internal/library/network/tcp/client.go index 0217b0b..c55dd37 100644 --- a/server/internal/library/network/tcp/client.go +++ b/server/internal/library/network/tcp/client.go @@ -1,3 +1,8 @@ +// Package tcp +// @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 tcp import ( diff --git a/server/internal/library/network/tcp/client_cron.go b/server/internal/library/network/tcp/client_cron.go index c232605..75a6368 100644 --- a/server/internal/library/network/tcp/client_cron.go +++ b/server/internal/library/network/tcp/client_cron.go @@ -1,3 +1,8 @@ +// Package tcp +// @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 tcp import ( diff --git a/server/internal/library/network/tcp/client_handle.go b/server/internal/library/network/tcp/client_handle.go index 227c20c..a003dfa 100644 --- a/server/internal/library/network/tcp/client_handle.go +++ b/server/internal/library/network/tcp/client_handle.go @@ -1,3 +1,8 @@ +// Package tcp +// @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 tcp import ( diff --git a/server/internal/library/network/tcp/context.go b/server/internal/library/network/tcp/context.go index 176c636..87fa0fc 100644 --- a/server/internal/library/network/tcp/context.go +++ b/server/internal/library/network/tcp/context.go @@ -1,3 +1,8 @@ +// Package tcp +// @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 tcp import ( diff --git a/server/internal/library/network/tcp/model.go b/server/internal/library/network/tcp/model.go index ce5411b..2b16435 100644 --- a/server/internal/library/network/tcp/model.go +++ b/server/internal/library/network/tcp/model.go @@ -1,3 +1,8 @@ +// Package tcp +// @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 tcp import ( diff --git a/server/internal/library/network/tcp/response.go b/server/internal/library/network/tcp/response.go index c3c53aa..f1584d2 100644 --- a/server/internal/library/network/tcp/response.go +++ b/server/internal/library/network/tcp/response.go @@ -1,3 +1,8 @@ +// Package tcp +// @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 tcp type Response interface { diff --git a/server/internal/library/network/tcp/router.go b/server/internal/library/network/tcp/router.go index 6751c52..c449d82 100644 --- a/server/internal/library/network/tcp/router.go +++ b/server/internal/library/network/tcp/router.go @@ -1,3 +1,8 @@ +// Package tcp +// @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 tcp import ( diff --git a/server/internal/library/network/tcp/rpc.go b/server/internal/library/network/tcp/rpc.go index 7459d3f..6aee4e1 100644 --- a/server/internal/library/network/tcp/rpc.go +++ b/server/internal/library/network/tcp/rpc.go @@ -1,3 +1,8 @@ +// Package tcp +// @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 tcp import ( diff --git a/server/internal/library/network/tcp/server.go b/server/internal/library/network/tcp/server.go index 3bbbb6c..47fa078 100644 --- a/server/internal/library/network/tcp/server.go +++ b/server/internal/library/network/tcp/server.go @@ -1,3 +1,8 @@ +// Package tcp +// @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 tcp import ( diff --git a/server/internal/library/network/tcp/server_cron.go b/server/internal/library/network/tcp/server_cron.go index c8b31bd..bdf3b2d 100644 --- a/server/internal/library/network/tcp/server_cron.go +++ b/server/internal/library/network/tcp/server_cron.go @@ -1,3 +1,8 @@ +// Package tcp +// @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 tcp import ( diff --git a/server/internal/library/network/tcp/server_handle.go b/server/internal/library/network/tcp/server_handle.go index 52d7e99..dfbf99a 100644 --- a/server/internal/library/network/tcp/server_handle.go +++ b/server/internal/library/network/tcp/server_handle.go @@ -1,3 +1,8 @@ +// Package tcp +// @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 tcp import ( diff --git a/server/internal/library/network/tcp/sign.go b/server/internal/library/network/tcp/sign.go index 818f591..db4bae6 100644 --- a/server/internal/library/network/tcp/sign.go +++ b/server/internal/library/network/tcp/sign.go @@ -1,3 +1,8 @@ +// Package tcp +// @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 tcp import ( diff --git a/server/internal/logic/admin/dept.go b/server/internal/logic/admin/dept.go index a4345e7..1fa89e7 100644 --- a/server/internal/logic/admin/dept.go +++ b/server/internal/logic/admin/dept.go @@ -112,7 +112,7 @@ func (s *sAdminDept) Status(ctx context.Context, in adminin.DeptStatusInp) (err return } - if !validate.InSliceInt(consts.StatusMap, in.Status) { + if !validate.InSliceInt(consts.StatusSlice, in.Status) { err = gerror.New("状态不正确") return } diff --git a/server/internal/logic/admin/member.go b/server/internal/logic/admin/member.go index 087648a..e1efa79 100644 --- a/server/internal/logic/admin/member.go +++ b/server/internal/logic/admin/member.go @@ -19,16 +19,13 @@ import ( "hotgo/internal/consts" "hotgo/internal/dao" "hotgo/internal/library/contexts" + "hotgo/internal/library/hgorm" "hotgo/internal/library/hgorm/handler" "hotgo/internal/library/hgorm/hook" - "hotgo/internal/library/token" - "hotgo/internal/model" - "hotgo/internal/model/do" "hotgo/internal/model/entity" "hotgo/internal/model/input/adminin" "hotgo/internal/model/input/sysin" "hotgo/internal/service" - "hotgo/utility/simple" "hotgo/utility/tree" "hotgo/utility/validate" ) @@ -157,7 +154,7 @@ func (s *sAdminMember) UpdateCash(ctx context.Context, in adminin.MemberUpdateCa _, err = dao.AdminMember.Ctx(ctx). Where("id", memberId). Data(g.Map{ - "cash": adminin.MemberCash{ + dao.AdminMember.Columns().Cash: adminin.MemberCash{ Name: in.Name, Account: in.Account, PayeeCode: in.PayeeCode, @@ -316,13 +313,13 @@ func (s *sAdminMember) UpdateProfile(ctx context.Context, in adminin.MemberUpdat // UpdatePwd 修改登录密码 func (s *sAdminMember) UpdatePwd(ctx context.Context, in adminin.MemberUpdatePwdInp) (err error) { - var memberInfo entity.AdminMember - if err = dao.AdminMember.Ctx(ctx).Where("id", in.Id).Scan(&memberInfo); err != nil { + var mb entity.AdminMember + if err = dao.AdminMember.Ctx(ctx).Where("id", in.Id).Scan(&mb); err != nil { err = gerror.Wrap(err, consts.ErrorORM) return err } - if gmd5.MustEncryptString(in.OldPassword+memberInfo.Salt) != memberInfo.PasswordHash { + if gmd5.MustEncryptString(in.OldPassword+mb.Salt) != mb.PasswordHash { err = gerror.New("原密码不正确") return err } @@ -330,10 +327,10 @@ func (s *sAdminMember) UpdatePwd(ctx context.Context, in adminin.MemberUpdatePwd _, err = dao.AdminMember.Ctx(ctx). Where("id", in.Id). Data(g.Map{ - "password_hash": gmd5.MustEncryptString(in.NewPassword + memberInfo.Salt), - "updated_at": gtime.Now(), + dao.AdminMember.Columns().PasswordHash: gmd5.MustEncryptString(in.NewPassword + mb.Salt), }). Update() + if err != nil { err = gerror.Wrap(err, consts.ErrorORM) return err @@ -362,61 +359,40 @@ func (s *sAdminMember) ResetPwd(ctx context.Context, in adminin.MemberResetPwdIn _, err = s.FilterAuthModel(ctx, memberId). Where("id", in.Id). Data(g.Map{ - "password_hash": gmd5.MustEncryptString(in.Password + mb.Salt), - "updated_at": gtime.Now(), + dao.AdminMember.Columns().PasswordHash: gmd5.MustEncryptString(in.Password + mb.Salt), }). Update() return } -// EmailUnique 菜单名称是否唯一 -func (s *sAdminMember) EmailUnique(ctx context.Context, in adminin.MemberEmailUniqueInp) (res *adminin.MemberEmailUniqueModel, err error) { - isUnique, err := dao.AdminMember.IsUniqueEmail(ctx, in.Id, in.Email) - if err != nil { - err = gerror.Wrap(err, consts.ErrorORM) +// VerifyUnique 验证管理员唯一属性 +func (s *sAdminMember) VerifyUnique(ctx context.Context, in adminin.VerifyUniqueInp) (err error) { + if in.Where == nil { return } - res = new(adminin.MemberEmailUniqueModel) - res.IsUnique = isUnique - return -} - -// MobileUnique 手机号是否唯一 -func (s *sAdminMember) MobileUnique(ctx context.Context, in adminin.MemberMobileUniqueInp) (res *adminin.MemberMobileUniqueModel, err error) { - isUnique, err := dao.AdminMember.IsUniqueMobile(ctx, in.Id, in.Mobile) - if err != nil { - err = gerror.Wrap(err, consts.ErrorORM) - return + msgMap := g.MapStrStr{ + "username": "用户名已存在,请换一个", + "email": "邮箱已存在,请换一个", + "mobile": "手机号已存在,请换一个", + "invite_code": "邀请码已存在,请换一个", } - res = new(adminin.MemberMobileUniqueModel) - res.IsUnique = isUnique - return -} - -// NameUnique 菜单名称是否唯一 -func (s *sAdminMember) NameUnique(ctx context.Context, in adminin.MemberNameUniqueInp) (res *adminin.MemberNameUniqueModel, err error) { - isUnique, err := dao.AdminMember.IsUniqueName(ctx, in.Id, in.Username) - if err != nil { - err = gerror.Wrap(err, consts.ErrorORM) - return - } - - res = new(adminin.MemberNameUniqueModel) - res.IsUnique = isUnique - return -} - -// VerifySuperId 验证是否为超管 -func (s *sAdminMember) VerifySuperId(ctx context.Context, verifyId int64) bool { - superIds := g.Cfg().MustGet(ctx, "hotgo.admin.superIds") - for _, id := range superIds.Int64s() { - if id == verifyId { - return true + for k, v := range in.Where { + if v == "" { + continue + } + message, ok := msgMap[k] + if !ok { + err = gerror.Newf("字段 [ %v ] 未配置唯一属性验证", k) + return + } + if err = hgorm.IsUnique(ctx, dao.AdminMember, g.Map{k: v}, message, in.Id); err != nil { + return } } - return false + + return } // Delete 删除 @@ -449,37 +425,23 @@ func (s *sAdminMember) Edit(ctx context.Context, in adminin.MemberEditInp) (err return } - uniqueName, err := dao.AdminMember.IsUniqueName(ctx, in.Id, in.Username) + err = s.VerifyUnique(ctx, adminin.VerifyUniqueInp{ + Id: in.Id, + Where: g.Map{ + dao.AdminMember.Columns().Username: in.Username, + dao.AdminMember.Columns().Mobile: in.Mobile, + dao.AdminMember.Columns().Email: in.Email, + }, + }) if err != nil { return } - if !uniqueName { - err = gerror.New("用户名已存在") + + config, err := service.SysConfig().GetLogin(ctx) + if err != nil { return } - if in.Mobile != "" { - uniqueMobile, err := dao.AdminMember.IsUniqueMobile(ctx, in.Id, in.Mobile) - if err != nil { - return err - } - if !uniqueMobile { - err = gerror.New("手机号已存在") - return err - } - } - - if in.Email != "" { - uniqueEmail, err := dao.AdminMember.IsUniqueEmail(ctx, in.Id, in.Email) - if err != nil { - return err - } - if !uniqueEmail { - err = gerror.New("邮箱已存在") - return err - } - } - // 修改 if in.Id > 0 { if s.VerifySuperId(ctx, in.Id) { @@ -488,8 +450,13 @@ func (s *sAdminMember) Edit(ctx context.Context, in adminin.MemberEditInp) (err } mod := s.FilterAuthModel(ctx, opMemberId) + if in.Password != "" { - salt, err := s.FilterAuthModel(ctx, contexts.GetUserId(ctx)).Fields(dao.AdminMember.Columns().Salt).Where("id", in.Id).Value() + // 修改密码 + salt, err := s.FilterAuthModel(ctx, contexts.GetUserId(ctx)). + Fields(dao.AdminMember.Columns().Salt). + Where("id", in.Id). + Value() if err != nil { return err } @@ -498,35 +465,52 @@ func (s *sAdminMember) Edit(ctx context.Context, in adminin.MemberEditInp) (err mod = mod.FieldsEx(dao.AdminMember.Columns().PasswordHash) } - if _, err = mod.Where("id", in.Id).Data(in).Update(); err != nil { - return - } + return g.DB().Transaction(ctx, func(ctx context.Context, tx gdb.TX) (err error) { + if _, err = mod.Where("id", in.Id).Data(in).Update(); err != nil { + err = gerror.Wrap(err, consts.ErrorORM) + return + } - // 更新岗位 - err = dao.AdminMemberPost.UpdatePostIds(ctx, in.Id, in.PostIds) - return + // 更新岗位 + if err = dao.AdminMemberPost.UpdatePostIds(ctx, in.Id, in.PostIds); err != nil { + err = gerror.Wrap(err, consts.ErrorORM) + } + return + }) } // 新增用户时的额外属性 var data adminin.MemberAddInp - data.MemberEditInp = in data.Salt = grand.S(6) + data.InviteCode = grand.S(12) data.PasswordHash = gmd5.MustEncryptString(data.Password + data.Salt) // 关系树 data.Pid = opMemberId - data.Level, data.Tree, err = s.genTree(ctx, opMemberId) + data.Level, data.Tree, err = s.GenTree(ctx, opMemberId) if err != nil { return } - id, err := dao.AdminMember.Ctx(ctx).Data(data).InsertAndGetId() - if err != nil { - return + // 默认头像 + if in.Avatar == "" { + in.Avatar = config.Avatar } + data.MemberEditInp = in - err = dao.AdminMemberPost.UpdatePostIds(ctx, id, in.PostIds) - return + return g.DB().Transaction(ctx, func(ctx context.Context, tx gdb.TX) (err error) { + id, err := dao.AdminMember.Ctx(ctx).Data(data).InsertAndGetId() + if err != nil { + err = gerror.Wrap(err, consts.ErrorORM) + return + } + + // 更新岗位 + if err = dao.AdminMemberPost.UpdatePostIds(ctx, id, in.PostIds); err != nil { + err = gerror.Wrap(err, consts.ErrorORM) + } + return + }) } // View 获取信息 @@ -589,6 +573,7 @@ func (s *sAdminMember) List(ctx context.Context, in adminin.MemberListInp) (list Fields("post_id"). Where("member_id", list[i].Id). Array() + if err != nil { return nil, 0, err } @@ -601,20 +586,68 @@ func (s *sAdminMember) List(ctx context.Context, in adminin.MemberListInp) (list return } -// genTree 生成关系树 -func (s *sAdminMember) genTree(ctx context.Context, pid int64) (level int, newTree string, err error) { - var pInfo *entity.AdminMember - if err = dao.AdminMember.Ctx(ctx).Where("id", pid).Scan(&pInfo); err != nil { +// Status 更新状态 +func (s *sAdminMember) Status(ctx context.Context, in adminin.MemberStatusInp) (err error) { + if in.Id <= 0 { + err = gerror.New("ID不能为空") return } - if pInfo == nil { + if s.VerifySuperId(ctx, in.Id) { + err = gerror.New("超管账号不能更改状态") + return + } + + if in.Status <= 0 { + err = gerror.New("状态不能为空") + return + } + + if !validate.InSliceInt(consts.StatusSlice, in.Status) { + err = gerror.New("状态不正确") + return + } + + // 修改 + in.UpdatedAt = gtime.Now() + _, err = s.FilterAuthModel(ctx, contexts.GetUserId(ctx)).Where("id", in.Id).Data("status", in.Status).Update() + return +} + +// GenTree 生成关系树 +func (s *sAdminMember) GenTree(ctx context.Context, pid int64) (level int, newTree string, err error) { + var pmb *entity.AdminMember + if err = dao.AdminMember.Ctx(ctx).Where("id", pid).Scan(&pmb); err != nil { + return + } + + if pmb == nil { err = gerror.New("上级信息不存在") return } - level = pInfo.Level + 1 - newTree = tree.GenLabel(pInfo.Tree, pInfo.Id) + level = pmb.Level + 1 + newTree = tree.GenLabel(pmb.Tree, pmb.Id) + return +} + +// RoleMemberList 获取角色下的用户列表 +func (s *sAdminMember) RoleMemberList(ctx context.Context, in adminin.RoleMemberListInp) (list []*adminin.MemberListModel, totalCount int, err error) { + mod := dao.AdminMember.Ctx(ctx) + if in.Role > 0 { + mod = mod.Where("role", in.Role) + } + + totalCount, err = mod.Count() + if err != nil { + err = gerror.Wrap(err, consts.ErrorORM) + return + } + + if err = mod.Page(in.Page, in.PerPage).Order("id desc").Scan(&list); err != nil { + err = gerror.Wrap(err, consts.ErrorORM) + return + } return } @@ -626,11 +659,7 @@ func (s *sAdminMember) LoginMemberInfo(ctx context.Context) (res *adminin.LoginM return } - err = dao.AdminMember.Ctx(ctx). - Hook(hook.MemberInfo). - Where("id", memberId). - Scan(&res) - if err != nil { + if err = dao.AdminMember.Ctx(ctx).Hook(hook.MemberInfo).Where("id", memberId).Scan(&res); err != nil { err = gerror.Wrap(err, consts.ErrorORM) return } @@ -660,142 +689,36 @@ func (s *sAdminMember) LoginMemberInfo(ctx context.Context) (res *adminin.LoginM return } -// Login 提交登录 -func (s *sAdminMember) Login(ctx context.Context, in adminin.MemberLoginInp) (res *adminin.MemberLoginModel, err error) { - var ( - ro *entity.AdminRole - mb *entity.AdminMember - ) +// MemberLoginStat 用户登录统计 +func (s *sAdminMember) MemberLoginStat(ctx context.Context, in adminin.MemberLoginStatInp) (res *adminin.MemberLoginStatModel, err error) { + var models *entity.SysLoginLog + err = dao.SysLoginLog.Ctx(ctx). + Fields("login_at,login_ip"). + Where("member_id", in.MemberId). + Where("status", consts.StatusEnabled). + Scan(&models) - if err = dao.AdminMember.Ctx(ctx).Where("username", in.Username).Scan(&mb); err != nil { - err = gerror.Wrap(err, consts.ErrorORM) - return - } - - if mb == nil { - err = gerror.New("账号不存在") - return - } - - if mb.Salt == "" { - err = gerror.New("用户信息错误") - return - } - - if err = simple.CheckPassword(in.Password, mb.Salt, mb.PasswordHash); err != nil { - return - } - - if mb.Status != consts.StatusEnabled { - err = gerror.New("账号已被禁用") - return - } - - if err = dao.AdminRole.Ctx(ctx).Fields("id,key,status").Where("id", mb.RoleId).Scan(&ro); err != nil { - err = gerror.Wrap(err, consts.ErrorORM) - return - } - - if ro == nil { - err = gerror.New("角色不存在") - return - } - - if ro.Status != consts.StatusEnabled { - err = gerror.New("角色已被禁用") - return - } - - user := &model.Identity{ - Id: mb.Id, - Pid: mb.Pid, - DeptId: mb.DeptId, - RoleId: ro.Id, - RoleKey: ro.Key, - Username: mb.Username, - RealName: mb.RealName, - Avatar: mb.Avatar, - Email: mb.Email, - Mobile: mb.Mobile, - App: consts.AppAdmin, - LoginAt: gtime.Now(), - } - - loginToken, expires, err := token.Login(ctx, user) if err != nil { - return nil, err - } - - update := do.AdminMember{ - LastActiveAt: user.LoginAt, - } - - // 更新登录信息 - if _, err = dao.AdminMember.Ctx(ctx).Data(update).Where(do.AdminMember{Id: mb.Id}).Update(); err != nil { return } - res = &adminin.MemberLoginModel{ - Id: user.Id, - Token: loginToken, - Expires: expires, - } - - return -} - -// RoleMemberList 获取角色下的用户列表 -func (s *sAdminMember) RoleMemberList(ctx context.Context, in adminin.RoleMemberListInp) (list []*adminin.MemberListModel, totalCount int, err error) { - mod := dao.AdminMember.Ctx(ctx) - if in.Role > 0 { - mod = mod.Where("role", in.Role) - } - - totalCount, err = mod.Count() - if err != nil { - err = gerror.Wrap(err, consts.ErrorORM) + res = new(adminin.MemberLoginStatModel) + if models == nil { return } - if err = mod.Page(in.Page, in.PerPage).Order("id desc").Scan(&list); err != nil { - err = gerror.Wrap(err, consts.ErrorORM) - return - } - - return -} - -// Status 更新状态 -func (s *sAdminMember) Status(ctx context.Context, in adminin.MemberStatusInp) (err error) { - if in.Id <= 0 { - err = gerror.New("ID不能为空") - return - } - - if s.VerifySuperId(ctx, in.Id) { - err = gerror.New("超管账号不能更改状态") - return - } - - if in.Status <= 0 { - err = gerror.New("状态不能为空") - return - } - - if !validate.InSliceInt(consts.StatusMap, in.Status) { - err = gerror.New("状态不正确") - return - } - - // 修改 - in.UpdatedAt = gtime.Now() - _, err = s.FilterAuthModel(ctx, contexts.GetUserId(ctx)).Where("id", in.Id).Data("status", in.Status).Update() + res.LastLoginAt = models.LoginAt + res.LastLoginIp = models.LoginIp + res.LoginCount, err = dao.SysLoginLog.Ctx(ctx). + Where("member_id", in.MemberId). + Where("status", consts.StatusEnabled). + Count() return } // GetIdByCode 通过邀请码获取用户ID func (s *sAdminMember) GetIdByCode(ctx context.Context, in adminin.GetIdByCodeInp) (res *adminin.GetIdByCodeModel, err error) { - err = dao.AdminMember.Ctx(ctx).Fields("invite_code").Where("invite_code", in.Code).Scan(&res) + err = dao.AdminMember.Ctx(ctx).Fields(adminin.GetIdByCodeModel{}).Where("invite_code", in.Code).Scan(&res) return } @@ -808,6 +731,17 @@ func (s *sAdminMember) Select(ctx context.Context, in adminin.MemberSelectInp) ( return } +// VerifySuperId 验证是否为超管 +func (s *sAdminMember) VerifySuperId(ctx context.Context, verifyId int64) bool { + superIds := g.Cfg().MustGet(ctx, "hotgo.admin.superIds") + for _, id := range superIds.Int64s() { + if id == verifyId { + return true + } + } + return false +} + func (s *sAdminMember) FilterAuthModel(ctx context.Context, memberId int64) *gdb.Model { m := dao.AdminMember.Ctx(ctx) if !s.VerifySuperId(ctx, memberId) { @@ -815,26 +749,3 @@ func (s *sAdminMember) FilterAuthModel(ctx context.Context, memberId int64) *gdb } return m.Handler(handler.FilterAuthWithField("id")) } - -// MemberLoginStat 用户登录统计 -func (s *sAdminMember) MemberLoginStat(ctx context.Context, in adminin.MemberLoginStatInp) (res *adminin.MemberLoginStatModel, err error) { - var models *entity.SysLoginLog - err = dao.SysLoginLog.Ctx(ctx). - Fields("login_at,login_ip"). - Where("member_id", in.MemberId). - Where("status", consts.StatusEnabled). - Scan(&models) - if err != nil { - return - } - - res = new(adminin.MemberLoginStatModel) - if models == nil { - return - } - - res.LastLoginAt = models.LoginAt - res.LastLoginIp = models.LoginIp - res.LoginCount, err = dao.SysLoginLog.Ctx(ctx).Where("member_id", in.MemberId).Where("status", consts.StatusEnabled).Count() - return -} diff --git a/server/internal/logic/admin/notice.go b/server/internal/logic/admin/notice.go index 56d01aa..2b03f93 100644 --- a/server/internal/logic/admin/notice.go +++ b/server/internal/logic/admin/notice.go @@ -124,7 +124,7 @@ func (s *sAdminNotice) Status(ctx context.Context, in adminin.NoticeStatusInp) ( return } - if !validate.InSliceInt(consts.StatusMap, in.Status) { + if !validate.InSliceInt(consts.StatusSlice, in.Status) { err = gerror.New("状态不正确") return } diff --git a/server/internal/logic/admin/order.go b/server/internal/logic/admin/order.go index f623b6d..cb322e8 100644 --- a/server/internal/logic/admin/order.go +++ b/server/internal/logic/admin/order.go @@ -378,7 +378,7 @@ func (s *sAdminOrder) Status(ctx context.Context, in adminin.OrderStatusInp) (er return } - if !validate.InSliceInt(consts.StatusMap, in.Status) { + if !validate.InSliceInt(consts.StatusSlice, in.Status) { err = gerror.New("状态不正确") return } diff --git a/server/internal/logic/admin/post.go b/server/internal/logic/admin/post.go index 7680ce1..205003c 100644 --- a/server/internal/logic/admin/post.go +++ b/server/internal/logic/admin/post.go @@ -203,7 +203,7 @@ func (s *sAdminPost) Status(ctx context.Context, in adminin.PostStatusInp) (err return } - if !validate.InSliceInt(consts.StatusMap, in.Status) { + if !validate.InSliceInt(consts.StatusSlice, in.Status) { err = gerror.New("状态不正确") return } diff --git a/server/internal/logic/admin/site.go b/server/internal/logic/admin/site.go new file mode 100644 index 0000000..082c734 --- /dev/null +++ b/server/internal/logic/admin/site.go @@ -0,0 +1,276 @@ +package admin + +import ( + "context" + "github.com/gogf/gf/v2/crypto/gmd5" + "github.com/gogf/gf/v2/database/gdb" + "github.com/gogf/gf/v2/errors/gerror" + "github.com/gogf/gf/v2/frame/g" + "github.com/gogf/gf/v2/os/gtime" + "github.com/gogf/gf/v2/util/grand" + "hotgo/internal/consts" + "hotgo/internal/dao" + "hotgo/internal/library/token" + "hotgo/internal/model" + "hotgo/internal/model/do" + "hotgo/internal/model/entity" + "hotgo/internal/model/input/adminin" + "hotgo/internal/model/input/sysin" + "hotgo/internal/service" + "hotgo/utility/simple" +) + +type sAdminSite struct{} + +func NewAdminSite() *sAdminSite { + return &sAdminSite{} +} + +func init() { + service.RegisterAdminSite(NewAdminSite()) +} + +// Register 账号注册 +func (s *sAdminSite) Register(ctx context.Context, in adminin.RegisterInp) (err error) { + config, err := service.SysConfig().GetLogin(ctx) + if err != nil { + return + } + + if config.ForceInvite == 1 && in.InviteCode == "" { + err = gerror.New("请填写邀请码") + return + } + + var data adminin.MemberAddInp + // 默认上级 + data.Pid = 1 + + // 存在邀请人 + if in.InviteCode != "" { + pmb, err := service.AdminMember().GetIdByCode(ctx, adminin.GetIdByCodeInp{Code: in.InviteCode}) + if err != nil { + return err + } + + if pmb == nil { + err = gerror.New("邀请人信息不存在") + return err + } + + data.Pid = pmb.Id + } + + if config.RegisterSwitch != 1 { + err = gerror.New("管理员未开放注册") + return + } + + if config.RoleId < 1 { + err = gerror.New("管理员未配置默认角色") + return + } + + if config.DeptId < 1 { + err = gerror.New("管理员未配置默认部门") + return + } + + if len(config.PostIds) == 0 { + err = gerror.New("管理员未配置默认岗位") + return + } + + // 验证唯一性 + err = service.AdminMember().VerifyUnique(ctx, adminin.VerifyUniqueInp{ + Where: g.Map{ + dao.AdminMember.Columns().Username: in.Username, + dao.AdminMember.Columns().Mobile: in.Mobile, + }, + }) + if err != nil { + return + } + + // 验证短信验证码 + err = service.SysSmsLog().VerifyCode(ctx, sysin.VerifyCodeInp{ + Event: consts.SmsTemplateRegister, + Mobile: in.Mobile, + Code: in.Code, + }) + if err != nil { + return + } + + data.MemberEditInp = adminin.MemberEditInp{ + Id: 0, + RoleId: config.RoleId, + PostIds: config.PostIds, + DeptId: config.DeptId, + Username: in.Username, + Password: in.Password, + RealName: "", + Avatar: config.Avatar, + Sex: 3, // 保密 + Mobile: in.Mobile, + Status: consts.StatusEnabled, + } + data.Salt = grand.S(6) + data.InviteCode = grand.S(12) + data.PasswordHash = gmd5.MustEncryptString(data.Password + data.Salt) + data.Level, data.Tree, err = service.AdminMember().GenTree(ctx, data.Pid) + if err != nil { + return + } + + // 提交注册信息 + return g.DB().Transaction(ctx, func(ctx context.Context, tx gdb.TX) (err error) { + id, err := dao.AdminMember.Ctx(ctx).Data(data).InsertAndGetId() + if err != nil { + err = gerror.Wrap(err, consts.ErrorORM) + return + } + + // 更新岗位 + if err = dao.AdminMemberPost.UpdatePostIds(ctx, id, config.PostIds); err != nil { + err = gerror.Wrap(err, consts.ErrorORM) + } + return + }) +} + +// AccountLogin 账号登录 +func (s *sAdminSite) AccountLogin(ctx context.Context, in adminin.AccountLoginInp) (res *adminin.LoginModel, err error) { + defer func() { + service.SysLoginLog().Push(ctx, sysin.LoginLogPushInp{Response: res, Err: err}) + }() + + var mb *entity.AdminMember + if err = dao.AdminMember.Ctx(ctx).Where("username", in.Username).Scan(&mb); err != nil { + err = gerror.Wrap(err, consts.ErrorORM) + return + } + + if mb == nil { + err = gerror.New("账号不存在") + return + } + + res = new(adminin.LoginModel) + res.Id = mb.Id + res.Username = mb.Username + if mb.Salt == "" { + err = gerror.New("用户信息错误") + return + } + + if err = simple.CheckPassword(in.Password, mb.Salt, mb.PasswordHash); err != nil { + return + } + + if mb.Status != consts.StatusEnabled { + err = gerror.New("账号已被禁用") + return + } + + res, err = s.handleLogin(ctx, mb) + return +} + +// MobileLogin 手机号登录 +func (s *sAdminSite) MobileLogin(ctx context.Context, in adminin.MobileLoginInp) (res *adminin.LoginModel, err error) { + defer func() { + service.SysLoginLog().Push(ctx, sysin.LoginLogPushInp{Response: res, Err: err}) + }() + + var mb *entity.AdminMember + if err = dao.AdminMember.Ctx(ctx).Where("mobile ", in.Mobile).Scan(&mb); err != nil { + err = gerror.Wrap(err, consts.ErrorORM) + return + } + + if mb == nil { + err = gerror.New("账号不存在") + return + } + + res = new(adminin.LoginModel) + res.Id = mb.Id + res.Username = mb.Username + + err = service.SysSmsLog().VerifyCode(ctx, sysin.VerifyCodeInp{ + Event: consts.SmsTemplateLogin, + Mobile: in.Mobile, + Code: in.Code, + }) + + if err != nil { + return + } + + if mb.Status != consts.StatusEnabled { + err = gerror.New("账号已被禁用") + return + } + + res, err = s.handleLogin(ctx, mb) + return +} + +// handleLogin . +func (s *sAdminSite) handleLogin(ctx context.Context, mb *entity.AdminMember) (res *adminin.LoginModel, err error) { + var ro *entity.AdminRole + if err = dao.AdminRole.Ctx(ctx).Fields("id,key,status").Where("id", mb.RoleId).Scan(&ro); err != nil { + err = gerror.Wrap(err, consts.ErrorORM) + return + } + + if ro == nil { + err = gerror.New("角色不存在") + return + } + + if ro.Status != consts.StatusEnabled { + err = gerror.New("角色已被禁用") + return + } + + user := &model.Identity{ + Id: mb.Id, + Pid: mb.Pid, + DeptId: mb.DeptId, + RoleId: ro.Id, + RoleKey: ro.Key, + Username: mb.Username, + RealName: mb.RealName, + Avatar: mb.Avatar, + Email: mb.Email, + Mobile: mb.Mobile, + App: consts.AppAdmin, + LoginAt: gtime.Now(), + } + + loginToken, expires, err := token.Login(ctx, user) + if err != nil { + return nil, err + } + + update := do.AdminMember{ + LastActiveAt: user.LoginAt, + } + + // 更新登录信息 + if _, err = dao.AdminMember.Ctx(ctx).Data(update).Where(do.AdminMember{Id: mb.Id}).Update(); err != nil { + err = gerror.Wrap(err, consts.ErrorORM) + return + } + + res = &adminin.LoginModel{ + Username: user.Username, + Id: user.Id, + Token: loginToken, + Expires: expires, + } + + return +} diff --git a/server/internal/logic/middleware/init.go b/server/internal/logic/middleware/init.go index 331e0d8..2e38db4 100644 --- a/server/internal/logic/middleware/init.go +++ b/server/internal/logic/middleware/init.go @@ -39,8 +39,9 @@ func NewMiddleware() *sMiddleware { return &sMiddleware{ LoginUrl: "/common", DemoWhiteList: g.Map{ - "/admin/site/login": struct{}{}, // 后台登录 - "/admin/genCodes/preview": struct{}{}, // 预览代码 + "/admin/site/accountLogin": struct{}{}, // 账号登录 + "/admin/site/mobileLogin": struct{}{}, // 手机号登录 + "/admin/genCodes/preview": struct{}{}, // 预览代码 }, PayNotifyRoutes: g.Map{ "/api/pay/notify/alipay": struct{}{}, // 支付宝 diff --git a/server/internal/logic/pay/pay.go b/server/internal/logic/pay/pay.go index 02a2f98..35b8462 100644 --- a/server/internal/logic/pay/pay.go +++ b/server/internal/logic/pay/pay.go @@ -61,11 +61,6 @@ func (s *sPay) List(ctx context.Context, in payin.PayListInp) (list []*payin.Pay mod = mod.WhereBetween(dao.PayLog.Columns().CreatedAt, in.CreatedAt[0], in.CreatedAt[1]) } - // 查询分类名称 - if in.TestCategoryName != "" { - mod = mod.WhereLike(dao.TestCategory.Columns().Name, in.TestCategoryName) - } - totalCount, err = mod.Clone().Count() if err != nil { return @@ -143,7 +138,7 @@ func (s *sPay) Status(ctx context.Context, in payin.PayStatusInp) (err error) { return } - if !validate.InSliceInt(consts.StatusMap, in.Status) { + if !validate.InSliceInt(consts.StatusSlice, in.Status) { err = gerror.New("状态不正确") return } diff --git a/server/internal/logic/sys/attachment.go b/server/internal/logic/sys/attachment.go index e73d884..cbbdb6f 100644 --- a/server/internal/logic/sys/attachment.go +++ b/server/internal/logic/sys/attachment.go @@ -73,7 +73,7 @@ func (s *sSysAttachment) Status(ctx context.Context, in sysin.AttachmentStatusIn return } - if !validate.InSliceInt(consts.StatusMap, in.Status) { + if !validate.InSliceInt(consts.StatusSlice, in.Status) { err = gerror.New("状态不正确") return } diff --git a/server/internal/logic/sys/blacklist.go b/server/internal/logic/sys/blacklist.go index fa10603..dd9e88a 100644 --- a/server/internal/logic/sys/blacklist.go +++ b/server/internal/logic/sys/blacklist.go @@ -68,7 +68,7 @@ func (s *sSysBlacklist) Status(ctx context.Context, in sysin.BlacklistStatusInp) return } - if !validate.InSliceInt(consts.StatusMap, in.Status) { + if !validate.InSliceInt(consts.StatusSlice, in.Status) { err = gerror.New("状态不正确") return } diff --git a/server/internal/logic/sys/config.go b/server/internal/logic/sys/config.go index 7c67eb8..7dc3771 100644 --- a/server/internal/logic/sys/config.go +++ b/server/internal/logic/sys/config.go @@ -83,27 +83,13 @@ func (s *sSysConfig) InitConfig(ctx context.Context) { } -// GetLoadTCP 获取本地tcp配置 -func (s *sSysConfig) GetLoadTCP(ctx context.Context) (conf *model.TCPConfig, err error) { - err = g.Cfg().MustGet(ctx, "tcp").Scan(&conf) - return -} - -// GetLoadCache 获取本地缓存配置 -func (s *sSysConfig) GetLoadCache(ctx context.Context) (conf *model.CacheConfig, err error) { - err = g.Cfg().MustGet(ctx, "cache").Scan(&conf) - return -} - -// GetLoadGenerate 获取本地生成配置 -func (s *sSysConfig) GetLoadGenerate(ctx context.Context) (conf *model.GenerateConfig, err error) { - err = g.Cfg().MustGet(ctx, "hggen").Scan(&conf) - return -} - -// GetLoadToken 获取本地token配置 -func (s *sSysConfig) GetLoadToken(ctx context.Context) (conf *model.TokenConfig, err error) { - err = g.Cfg().MustGet(ctx, "token").Scan(&conf) +// GetLogin 获取登录配置 +func (s *sSysConfig) GetLogin(ctx context.Context) (conf *model.LoginConfig, err error) { + models, err := s.GetConfigByGroup(ctx, sysin.GetConfigInp{Group: "login"}) + if err != nil { + return + } + err = gconv.Scan(models.List, &conf) return } @@ -182,6 +168,30 @@ func (s *sSysConfig) GetBasic(ctx context.Context) (conf *model.BasicConfig, err return } +// GetLoadTCP 获取本地tcp配置 +func (s *sSysConfig) GetLoadTCP(ctx context.Context) (conf *model.TCPConfig, err error) { + err = g.Cfg().MustGet(ctx, "tcp").Scan(&conf) + return +} + +// GetLoadCache 获取本地缓存配置 +func (s *sSysConfig) GetLoadCache(ctx context.Context) (conf *model.CacheConfig, err error) { + err = g.Cfg().MustGet(ctx, "cache").Scan(&conf) + return +} + +// GetLoadGenerate 获取本地生成配置 +func (s *sSysConfig) GetLoadGenerate(ctx context.Context) (conf *model.GenerateConfig, err error) { + err = g.Cfg().MustGet(ctx, "hggen").Scan(&conf) + return +} + +// GetLoadToken 获取本地token配置 +func (s *sSysConfig) GetLoadToken(ctx context.Context) (conf *model.TokenConfig, err error) { + err = g.Cfg().MustGet(ctx, "token").Scan(&conf) + return +} + // GetLoadSSL 获取本地日志配置 func (s *sSysConfig) GetLoadSSL(ctx context.Context) (conf *model.SSLConfig, err error) { err = g.Cfg().MustGet(ctx, "hotgo.ssl").Scan(&conf) diff --git a/server/internal/logic/sys/cron.go b/server/internal/logic/sys/cron.go index 503d59a..89bfb68 100644 --- a/server/internal/logic/sys/cron.go +++ b/server/internal/logic/sys/cron.go @@ -107,7 +107,7 @@ func (s *sSysCron) Status(ctx context.Context, in sysin.CronStatusInp) (err erro return } - if !validate.InSliceInt(consts.StatusMap, in.Status) { + if !validate.InSliceInt(consts.StatusSlice, in.Status) { err = gerror.New("状态不正确") return } diff --git a/server/internal/logic/sys/cron_group.go b/server/internal/logic/sys/cron_group.go index 6d201d3..fc6889d 100644 --- a/server/internal/logic/sys/cron_group.go +++ b/server/internal/logic/sys/cron_group.go @@ -63,7 +63,7 @@ func (s *sSysCronGroup) Status(ctx context.Context, in sysin.CronGroupStatusInp) return } - if !validate.InSliceInt(consts.StatusMap, in.Status) { + if !validate.InSliceInt(consts.StatusSlice, in.Status) { err = gerror.New("状态不正确") return } diff --git a/server/internal/logic/sys/curd_demo.go b/server/internal/logic/sys/curd_demo.go index e20d922..d4c7d14 100644 --- a/server/internal/logic/sys/curd_demo.go +++ b/server/internal/logic/sys/curd_demo.go @@ -180,7 +180,7 @@ func (s *sSysCurdDemo) Status(ctx context.Context, in sysin.CurdDemoStatusInp) ( return } - if !validate.InSliceInt(consts.StatusMap, in.Status) { + if !validate.InSliceInt(consts.StatusSlice, in.Status) { err = gerror.New("状态不正确") return } diff --git a/server/internal/logic/sys/ems_log.go b/server/internal/logic/sys/ems_log.go index c3a25dd..06fd5da 100644 --- a/server/internal/logic/sys/ems_log.go +++ b/server/internal/logic/sys/ems_log.go @@ -76,7 +76,7 @@ func (s *sSysEmsLog) Status(ctx context.Context, in sysin.EmsLogStatusInp) (err return } - if !validate.InSliceInt(consts.StatusMap, in.Status) { + if !validate.InSliceInt(consts.StatusSlice, in.Status) { err = gerror.New("状态不正确") return } diff --git a/server/internal/logic/sys/gen_codes.go b/server/internal/logic/sys/gen_codes.go index a18c57f..dd62293 100644 --- a/server/internal/logic/sys/gen_codes.go +++ b/server/internal/logic/sys/gen_codes.go @@ -110,7 +110,7 @@ func (s *sSysGenCodes) Status(ctx context.Context, in sysin.GenCodesStatusInp) ( return } - if !validate.InSliceInt(consts.StatusMap, in.Status) { + if !validate.InSliceInt(consts.StatusSlice, in.Status) { err = gerror.New("状态不正确") return } diff --git a/server/internal/logic/sys/login_log.go b/server/internal/logic/sys/login_log.go index 9e1c5b7..8a23ced 100644 --- a/server/internal/logic/sys/login_log.go +++ b/server/internal/logic/sys/login_log.go @@ -24,6 +24,7 @@ import ( "hotgo/internal/library/location" "hotgo/internal/library/queue" "hotgo/internal/model/entity" + "hotgo/internal/model/input/adminin" "hotgo/internal/model/input/form" "hotgo/internal/model/input/sysin" "hotgo/internal/service" @@ -147,10 +148,13 @@ func (s *sSysLoginLog) View(ctx context.Context, in sysin.LoginLogViewInp) (res // Push 推送登录日志 func (s *sSysLoginLog) Push(ctx context.Context, in sysin.LoginLogPushInp) { + if in.Response == nil { + in.Response = new(adminin.LoginModel) + } var models entity.SysLoginLog models.ReqId = gctx.CtxId(ctx) models.MemberId = in.Response.Id - models.Username = in.Input.Username + models.Username = in.Response.Username models.LoginAt = gtime.Now() models.LoginIp = location.GetClientIp(ghttp.RequestFromCtx(ctx)) models.Status = consts.StatusEnabled @@ -161,12 +165,12 @@ func (s *sSysLoginLog) Push(ctx context.Context, in sysin.LoginLogPushInp) { } models.Response = gjson.New(consts.NilJsonToString) - if in.Response != nil && in.Response.Id > 0 { + if in.Response != nil { models.Response = gjson.New(in.Response) } if err := queue.Push(consts.QueueLoginLogTopic, models); err != nil { - g.Log().Warningf(ctx, "sSysLoginLog.Push err:%+v, models:%+v", err, models) + g.Log().Warningf(ctx, "push err:%+v, models:%+v", err, models) } return } diff --git a/server/internal/logic/sys/provinces.go b/server/internal/logic/sys/provinces.go index 5e07198..ab5fa5a 100644 --- a/server/internal/logic/sys/provinces.go +++ b/server/internal/logic/sys/provinces.go @@ -3,7 +3,6 @@ // @Copyright Copyright (c) 2023 HotGo CLI // @Author Ms <133814250@qq.com> // @License https://github.com/bufanyun/hotgo/blob/master/LICENSE -// package sys import ( @@ -127,7 +126,7 @@ func (s *sSysProvinces) Status(ctx context.Context, in sysin.ProvincesStatusInp) return } - if !validate.InSliceInt(consts.StatusMap, in.Status) { + if !validate.InSliceInt(consts.StatusSlice, in.Status) { err = gerror.New("状态不正确") return } diff --git a/server/internal/logic/sys/sms_log.go b/server/internal/logic/sys/sms_log.go index 87d0620..2031609 100644 --- a/server/internal/logic/sys/sms_log.go +++ b/server/internal/logic/sys/sms_log.go @@ -15,7 +15,6 @@ import ( "hotgo/internal/consts" "hotgo/internal/dao" "hotgo/internal/library/location" - "hotgo/internal/library/sms" "hotgo/internal/model" "hotgo/internal/model/entity" "hotgo/internal/model/input/form" @@ -71,7 +70,7 @@ func (s *sSysSmsLog) Status(ctx context.Context, in sysin.SmsLogStatusInp) (err return } - if !validate.InSliceInt(consts.StatusMap, in.Status) { + if !validate.InSliceInt(consts.StatusSlice, in.Status) { err = gerror.New("状态不正确") return } @@ -180,9 +179,9 @@ func (s *sSysSmsLog) SendCode(ctx context.Context, in sysin.SendCodeInp) (err er in.Code = grand.Digits(4) } - if err = sms.New(config.SmsDrive).SendCode(ctx, in, config); err != nil { - return - } + //if err = sms.New(config.SmsDrive).SendCode(ctx, in, config); err != nil { + // return + //} var data = new(entity.SysSmsLog) data.Event = in.Event diff --git a/server/internal/logic/tcpclient/auth.go b/server/internal/logic/tcpclient/auth.go index f7e8674..768dea4 100644 --- a/server/internal/logic/tcpclient/auth.go +++ b/server/internal/logic/tcpclient/auth.go @@ -50,6 +50,7 @@ func (s *sAuthClient) Start(ctx context.Context) { LoginEvent: s.onLoginEvent, CloseEvent: s.onCloseEvent, }) + if err != nil { g.Log().Errorf(ctx, "AuthClient NewClient fail:%+v", err) return diff --git a/server/internal/logic/tcpclient/cron.go b/server/internal/logic/tcpclient/cron.go index 287d5fb..55dcb73 100644 --- a/server/internal/logic/tcpclient/cron.go +++ b/server/internal/logic/tcpclient/cron.go @@ -37,7 +37,7 @@ func (s *sCronClient) Start(ctx context.Context) { } simple.SafeGo(ctx, func(ctx context.Context) { - client, err := tcp.NewClient(&tcp.ClientConfig{ + s.client, err = tcp.NewClient(&tcp.ClientConfig{ Addr: config.Client.Cron.Address, Auth: &tcp.AuthMeta{ Group: config.Client.Cron.Group, @@ -48,13 +48,12 @@ func (s *sCronClient) Start(ctx context.Context) { LoginEvent: s.onLoginEvent, CloseEvent: s.onCloseEvent, }) + if err != nil { g.Log().Errorf(ctx, "CronClient NewClient fail:%+v", err) return } - s.client = client - err = s.client.RegisterRouter(map[string]tcp.RouterHandler{ "CronDelete": s.OnCronDelete, // 删除任务 "CronEdit": s.OnCronEdit, // 编辑任务 diff --git a/server/internal/model/config.go b/server/internal/model/config.go index 935bd1c..9a7ff09 100644 --- a/server/internal/model/config.go +++ b/server/internal/model/config.go @@ -157,6 +157,20 @@ type WechatConfig struct { *WechatOpenPlatformConfig } +// LoginConfig 登录配置 +type LoginConfig struct { + RegisterSwitch int `json:"loginRegisterSwitch"` + CaptchaSwitch int `json:"loginCaptchaSwitch"` + Avatar string `json:"loginAvatar"` + RoleId int64 `json:"loginRoleId"` + DeptId int64 `json:"loginDeptId"` + PostIds []int64 `json:"loginPostIds"` + Protocol string `json:"loginProtocol"` + Policy string `json:"loginPolicy"` + AutoOpenId int `json:"loginAutoOpenId"` + ForceInvite int `json:"loginForceInvite"` +} + ///////////// 以下是本地配置 // SSLConfig https配置 diff --git a/server/internal/model/do/admin_member.go b/server/internal/model/do/admin_member.go index 5b57c6c..5b281d8 100644 --- a/server/internal/model/do/admin_member.go +++ b/server/internal/model/do/admin_member.go @@ -34,6 +34,7 @@ type AdminMember struct { Pid interface{} // 上级管理员ID Level interface{} // 关系树等级 Tree interface{} // 关系树 + InviteCode interface{} // 邀请码 Cash *gjson.Json // 提现配置 LastActiveAt *gtime.Time // 最后活跃时间 Remark interface{} // 备注 diff --git a/server/internal/model/entity/admin_member.go b/server/internal/model/entity/admin_member.go index 339c0e1..ababd28 100644 --- a/server/internal/model/entity/admin_member.go +++ b/server/internal/model/entity/admin_member.go @@ -32,6 +32,7 @@ type AdminMember struct { Pid int64 `json:"pid" description:"上级管理员ID"` Level int `json:"level" description:"关系树等级"` Tree string `json:"tree" description:"关系树"` + InviteCode string `json:"inviteCode" description:"邀请码"` Cash *gjson.Json `json:"cash" description:"提现配置"` LastActiveAt *gtime.Time `json:"lastActiveAt" description:"最后活跃时间"` Remark string `json:"remark" description:"备注"` diff --git a/server/internal/model/input/adminin/member.go b/server/internal/model/input/adminin/member.go index 5d7aff2..b058a25 100644 --- a/server/internal/model/input/adminin/member.go +++ b/server/internal/model/input/adminin/member.go @@ -82,48 +82,44 @@ type MemberResetPwdInp struct { Id int64 `json:"id" dc:"用户ID"` } -// MemberEmailUniqueInp 邮箱是否唯一 -type MemberEmailUniqueInp struct { - Email string `json:"email" v:"required#邮箱不能为空" dc:"邮箱"` - Id int64 `json:"id" dc:"用户ID"` -} - -type MemberEmailUniqueModel struct { - IsUnique bool -} - -// MemberMobileUniqueInp 手机号是否唯一 -type MemberMobileUniqueInp struct { - Mobile string `json:"mobile" v:"required#手机号不能为空" dc:"手机号"` - Id int64 `json:"id" dc:"用户ID"` -} - -type MemberMobileUniqueModel struct { - IsUnique bool -} - -// MemberNameUniqueInp 名称是否唯一 -type MemberNameUniqueInp struct { - Username string `json:"username" v:"required#用户名称不能为空" dc:"用户名称"` - Id int64 `json:"id" dc:"用户ID"` -} - -type MemberNameUniqueModel struct { - IsUnique bool +type LoginMemberInfoModel struct { + Id int64 `json:"id" dc:"用户ID"` + DeptName string `json:"deptName" dc:"所属部门"` + RoleName string `json:"roleName" dc:"所属角色"` + Permissions []string `json:"permissions" 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:""` - RoleId int `json:"roleId" v:"required#角色不能为空" dc:"角色ID"` - PostIds []int64 `json:"postIds" v:"required#岗位不能为空" dc:"岗位ID"` - DeptId int64 `json:"deptId" v:"required#部门不能为空" dc:"部门ID"` - Username string `json:"username" v:"required#账号不能为空" dc:"帐号"` + RoleId int64 `json:"roleId" v:"required#角色不能为空" dc:"角色ID"` + PostIds []int64 `json:"postIds" v:"required#岗位不能为空" 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 string `json:"sex" dc:"性别"` + Sex int `json:"sex" dc:"性别"` Qq string `json:"qq" dc:"qq"` Email string `json:"email" dc:"邮箱"` Birthday *gtime.Time `json:"birthday" dc:"生日"` @@ -133,17 +129,18 @@ type MemberEditInp struct { Address string `json:"address" dc:"默认地址"` Mobile string `json:"mobile" dc:"手机号码"` Remark string `json:"remark" dc:"备注"` - Status string `json:"status" dc:"状态"` + Status int `json:"status" dc:"状态"` CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"` UpdatedAt *gtime.Time `json:"updatedAt" dc:"修改时间"` } 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:"关系树"` + 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) { @@ -160,6 +157,12 @@ func (in *MemberEditInp) Filter(ctx context.Context) (err error) { 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"` @@ -200,45 +203,6 @@ type MemberListModel struct { DeptId int64 `json:"deptId" dc:"部门ID"` } -// MemberLoginInp 登录 -type MemberLoginInp struct { - Username string - Password string -} -type MemberLoginModel struct { - Id int64 `json:"id" dc:"用户ID"` - Token string `json:"token" dc:"登录token"` - Expires int64 `json:"expires" dc:"登录有效期"` -} - -type LoginMemberInfoModel struct { - Id int64 `json:"id" dc:"用户ID"` - DeptName string `json:"deptName" dc:"所属部门"` - RoleName string `json:"roleName" dc:"所属角色"` - Permissions []string `json:"permissions" 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 - *MemberLoginStatModel -} - -// MemberLoginPermissions 登录用户角色信息 -type MemberLoginPermissions []string - // MemberCash 用户提现配置 type MemberCash struct { Name string `json:"name" dc:"收款人姓名"` @@ -263,17 +227,6 @@ type MemberSelectModel struct { Avatar string `json:"avatar" dc:"头像"` } -// 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"` -} - // MemberAddBalanceInp 增加余额 type MemberAddBalanceInp struct { Id int64 `json:"id" v:"required#用户ID不能为空" dc:"管理员ID"` diff --git a/server/internal/model/input/adminin/site.go b/server/internal/model/input/adminin/site.go new file mode 100644 index 0000000..c061442 --- /dev/null +++ b/server/internal/model/input/adminin/site.go @@ -0,0 +1,78 @@ +package adminin + +import ( + "context" + "github.com/gogf/gf/v2/encoding/gbase64" + "github.com/gogf/gf/v2/frame/g" + "github.com/gogf/gf/v2/os/gtime" + "hotgo/internal/consts" + "hotgo/utility/encrypt" +) + +// 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) { + // 解密密码 + str, err := gbase64.Decode([]byte(in.Password)) + if err != nil { + return err + } + + str, err = encrypt.AesECBDecrypt(str, consts.RequestEncryptKey) + if err != nil { + return err + } + + password := string(str) + + 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"` +} diff --git a/server/internal/model/input/payin/pay.go b/server/internal/model/input/payin/pay.go index 8bcc34f..84bcee6 100644 --- a/server/internal/model/input/payin/pay.go +++ b/server/internal/model/input/payin/pay.go @@ -88,10 +88,9 @@ type PayViewModel struct { // PayListInp 获取支付日志列表 type PayListInp struct { form.PageReq - Id int64 `json:"id" dc:"ID"` - Status int `json:"status" dc:"状态"` - CreatedAt []*gtime.Time `json:"createdAt" dc:"创建时间"` - TestCategoryName string `json:"testCategoryName" dc:"分类名称"` + 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) { diff --git a/server/internal/model/input/sysin/login_log.go b/server/internal/model/input/sysin/login_log.go index 7a4e3ab..e6dff1e 100644 --- a/server/internal/model/input/sysin/login_log.go +++ b/server/internal/model/input/sysin/login_log.go @@ -3,7 +3,6 @@ // @Copyright Copyright (c) 2023 HotGo CLI // @Author Ms <133814250@qq.com> // @License https://github.com/bufanyun/hotgo/blob/master/LICENSE -// package sysin import ( @@ -84,7 +83,6 @@ type LoginLogExportModel struct { // LoginLogPushInp 解推送登录日志 type LoginLogPushInp struct { - Input adminin.MemberLoginInp - Response *adminin.MemberLoginModel + Response *adminin.LoginModel Err error } diff --git a/server/internal/model/input/sysin/sms_log.go b/server/internal/model/input/sysin/sms_log.go index 9d14236..d1e2003 100644 --- a/server/internal/model/input/sysin/sms_log.go +++ b/server/internal/model/input/sysin/sms_log.go @@ -55,8 +55,7 @@ type SmsLogListInp struct { func (in *SmsLogListInp) Filter(ctx context.Context) (err error) { if in.Event != "" { - _, ok := consts.SmsTemplateEventMap[in.Event] - if !ok { + if _, ok := consts.SmsTemplateEventMap[in.Event]; !ok { err = gerror.Newf("无效的事件类型:%v", in.Event) return } diff --git a/server/internal/router/admin.go b/server/internal/router/admin.go index 04879df..82d6523 100644 --- a/server/internal/router/admin.go +++ b/server/internal/router/admin.go @@ -25,9 +25,11 @@ func Admin(ctx context.Context, group *ghttp.RouterGroup) { prefix := g.Cfg().MustGet(ctx, "router.admin.prefix", "/admin") group.Group(prefix.String(), func(group *ghttp.RouterGroup) { + group.Bind( + common.Site, // 基础 + ) group.Middleware(service.Middleware().AdminAuth) group.Bind( - common.Site, // 基础 common.Console, // 控制台 common.Ems, // 邮件 common.Sms, // 短信 diff --git a/server/internal/service/admin.go b/server/internal/service/admin.go index 42f97a8..624ee85 100644 --- a/server/internal/service/admin.go +++ b/server/internal/service/admin.go @@ -19,17 +19,37 @@ import ( ) type ( - IAdminRole interface { - Verify(ctx context.Context, path, method string) bool - List(ctx context.Context, in adminin.RoleListInp) (res *adminin.RoleListModel, totalCount int, err error) - GetName(ctx context.Context, RoleId int64) (name string, err error) - GetMemberList(ctx context.Context, RoleId int64) (list []*adminin.RoleListModel, err error) - GetPermissions(ctx context.Context, reqInfo *role.GetPermissionsReq) (MenuIds []int64, err error) - UpdatePermissions(ctx context.Context, reqInfo *role.UpdatePermissionsReq) (err error) - Edit(ctx context.Context, in *role.EditReq) (err error) - Delete(ctx context.Context, in *role.DeleteReq) (err error) - DataScopeSelect(ctx context.Context) (res form.Selects) - DataScopeEdit(ctx context.Context, in *adminin.DataScopeEditInp) (err error) + IAdminCash interface { + View(ctx context.Context, in adminin.CashViewInp) (res *adminin.CashViewModel, err error) + List(ctx context.Context, in adminin.CashListInp) (list []*adminin.CashListModel, totalCount int, err error) + Apply(ctx context.Context, in adminin.CashApplyInp) (err error) + Payment(ctx context.Context, in adminin.CashPaymentInp) (err error) + } + IAdminMenu interface { + MaxSort(ctx context.Context, req *menu.MaxSortReq) (res *menu.MaxSortRes, err error) + NameUnique(ctx context.Context, req *menu.NameUniqueReq) (res *menu.NameUniqueRes, err error) + CodeUnique(ctx context.Context, req *menu.CodeUniqueReq) (res *menu.CodeUniqueRes, err error) + Delete(ctx context.Context, req *menu.DeleteReq) (err error) + Edit(ctx context.Context, req *menu.EditReq) (err error) + View(ctx context.Context, req *menu.ViewReq) (res *menu.ViewRes, err error) + List(ctx context.Context, req *menu.ListReq) (lists []map[string]interface{}, err error) + GetMenuList(ctx context.Context, memberId int64) (lists role.DynamicRes, err error) + LoginPermissions(ctx context.Context, memberId int64) (lists adminin.MemberLoginPermissions, err error) + } + IAdminMonitor interface { + StartMonitor(ctx context.Context) + GetMeta(ctx context.Context) *model.MonitorData + } + IAdminPost interface { + Delete(ctx context.Context, in adminin.PostDeleteInp) (err error) + Edit(ctx context.Context, in adminin.PostEditInp) (err error) + MaxSort(ctx context.Context, in adminin.PostMaxSortInp) (res *adminin.PostMaxSortModel, err error) + NameUnique(ctx context.Context, in adminin.PostNameUniqueInp) (res *adminin.PostNameUniqueModel, err error) + CodeUnique(ctx context.Context, in adminin.PostCodeUniqueInp) (res *adminin.PostCodeUniqueModel, err error) + View(ctx context.Context, in adminin.PostViewInp) (res *adminin.PostViewModel, err error) + List(ctx context.Context, in adminin.PostListInp) (list []*adminin.PostListModel, totalCount int, err error) + GetMemberByStartName(ctx context.Context, memberId int64) (name string, err error) + Status(ctx context.Context, in adminin.PostStatusInp) (err error) } IAdminNotice interface { Model(ctx context.Context, option ...*handler.Option) *gdb.Model @@ -45,11 +65,35 @@ type ( ReadAll(ctx context.Context, in adminin.NoticeReadAllInp) (err error) MessageList(ctx context.Context, in adminin.NoticeMessageListInp) (list []*adminin.NoticeMessageListModel, totalCount int, err error) } - IAdminCash interface { - View(ctx context.Context, in adminin.CashViewInp) (res *adminin.CashViewModel, err error) - List(ctx context.Context, in adminin.CashListInp) (list []*adminin.CashListModel, totalCount int, err error) - Apply(ctx context.Context, in adminin.CashApplyInp) (err error) - Payment(ctx context.Context, in adminin.CashPaymentInp) (err error) + IAdminOrder interface { + Model(ctx context.Context, option ...*handler.Option) *gdb.Model + AcceptRefund(ctx context.Context, in adminin.OrderAcceptRefundInp) (err error) + ApplyRefund(ctx context.Context, in adminin.OrderApplyRefundInp) (err error) + PayNotify(ctx context.Context, in payin.NotifyCallFuncInp) (err error) + Create(ctx context.Context, in adminin.OrderCreateInp) (res *adminin.OrderCreateModel, err error) + List(ctx context.Context, in adminin.OrderListInp) (list []*adminin.OrderListModel, totalCount int, err error) + Export(ctx context.Context, in adminin.OrderListInp) (err error) + Edit(ctx context.Context, in adminin.OrderEditInp) (err error) + Delete(ctx context.Context, in adminin.OrderDeleteInp) (err error) + View(ctx context.Context, in adminin.OrderViewInp) (res *adminin.OrderViewModel, err error) + Status(ctx context.Context, in adminin.OrderStatusInp) (err error) + } + IAdminRole interface { + Verify(ctx context.Context, path, method string) bool + List(ctx context.Context, in adminin.RoleListInp) (res *adminin.RoleListModel, totalCount int, err error) + GetName(ctx context.Context, RoleId int64) (name string, err error) + GetMemberList(ctx context.Context, RoleId int64) (list []*adminin.RoleListModel, err error) + GetPermissions(ctx context.Context, reqInfo *role.GetPermissionsReq) (MenuIds []int64, err error) + UpdatePermissions(ctx context.Context, reqInfo *role.UpdatePermissionsReq) (err error) + Edit(ctx context.Context, in *role.EditReq) (err error) + Delete(ctx context.Context, in *role.DeleteReq) (err error) + DataScopeSelect(ctx context.Context) (res form.Selects) + DataScopeEdit(ctx context.Context, in *adminin.DataScopeEditInp) (err error) + } + IAdminSite interface { + Register(ctx context.Context, in adminin.RegisterInp) (err error) + AccountLogin(ctx context.Context, in adminin.AccountLoginInp) (res *adminin.LoginModel, err error) + MobileLogin(ctx context.Context, in adminin.MobileLoginInp) (res *adminin.LoginModel, err error) } IAdminCreditsLog interface { Model(ctx context.Context, option ...*handler.Option) *gdb.Model @@ -78,102 +122,62 @@ type ( UpdateProfile(ctx context.Context, in adminin.MemberUpdateProfileInp) (err error) UpdatePwd(ctx context.Context, in adminin.MemberUpdatePwdInp) (err error) ResetPwd(ctx context.Context, in adminin.MemberResetPwdInp) (err error) - EmailUnique(ctx context.Context, in adminin.MemberEmailUniqueInp) (res *adminin.MemberEmailUniqueModel, err error) - MobileUnique(ctx context.Context, in adminin.MemberMobileUniqueInp) (res *adminin.MemberMobileUniqueModel, err error) - NameUnique(ctx context.Context, in adminin.MemberNameUniqueInp) (res *adminin.MemberNameUniqueModel, err error) - VerifySuperId(ctx context.Context, verifyId int64) bool + VerifyUnique(ctx context.Context, in adminin.VerifyUniqueInp) (err error) Delete(ctx context.Context, in adminin.MemberDeleteInp) (err error) Edit(ctx context.Context, in adminin.MemberEditInp) (err error) View(ctx context.Context, in adminin.MemberViewInp) (res *adminin.MemberViewModel, err error) List(ctx context.Context, in adminin.MemberListInp) (list []*adminin.MemberListModel, totalCount int, err error) - LoginMemberInfo(ctx context.Context) (res *adminin.LoginMemberInfoModel, err error) - Login(ctx context.Context, in adminin.MemberLoginInp) (res *adminin.MemberLoginModel, err error) - RoleMemberList(ctx context.Context, in adminin.RoleMemberListInp) (list []*adminin.MemberListModel, totalCount int, err error) Status(ctx context.Context, in adminin.MemberStatusInp) (err error) + GenTree(ctx context.Context, pid int64) (level int, newTree string, err error) + RoleMemberList(ctx context.Context, in adminin.RoleMemberListInp) (list []*adminin.MemberListModel, totalCount int, err error) + LoginMemberInfo(ctx context.Context) (res *adminin.LoginMemberInfoModel, err error) + MemberLoginStat(ctx context.Context, in adminin.MemberLoginStatInp) (res *adminin.MemberLoginStatModel, err error) GetIdByCode(ctx context.Context, in adminin.GetIdByCodeInp) (res *adminin.GetIdByCodeModel, err error) Select(ctx context.Context, in adminin.MemberSelectInp) (res []*adminin.MemberSelectModel, err error) + VerifySuperId(ctx context.Context, verifyId int64) bool FilterAuthModel(ctx context.Context, memberId int64) *gdb.Model - MemberLoginStat(ctx context.Context, in adminin.MemberLoginStatInp) (res *adminin.MemberLoginStatModel, err error) } IAdminMemberPost interface { UpdatePostIds(ctx context.Context, memberId int64, postIds []int64) (err error) GetMemberByIds(ctx context.Context, memberId int64) (postIds []int64, err error) } - IAdminMenu interface { - MaxSort(ctx context.Context, req *menu.MaxSortReq) (res *menu.MaxSortRes, err error) - NameUnique(ctx context.Context, req *menu.NameUniqueReq) (res *menu.NameUniqueRes, err error) - CodeUnique(ctx context.Context, req *menu.CodeUniqueReq) (res *menu.CodeUniqueRes, err error) - Delete(ctx context.Context, req *menu.DeleteReq) (err error) - Edit(ctx context.Context, req *menu.EditReq) (err error) - View(ctx context.Context, req *menu.ViewReq) (res *menu.ViewRes, err error) - List(ctx context.Context, req *menu.ListReq) (lists []map[string]interface{}, err error) - GetMenuList(ctx context.Context, memberId int64) (lists role.DynamicRes, err error) - LoginPermissions(ctx context.Context, memberId int64) (lists adminin.MemberLoginPermissions, err error) - } - IAdminMonitor interface { - StartMonitor(ctx context.Context) - GetMeta(ctx context.Context) *model.MonitorData - } - IAdminOrder interface { - Model(ctx context.Context, option ...*handler.Option) *gdb.Model - AcceptRefund(ctx context.Context, in adminin.OrderAcceptRefundInp) (err error) - ApplyRefund(ctx context.Context, in adminin.OrderApplyRefundInp) (err error) - PayNotify(ctx context.Context, in payin.NotifyCallFuncInp) (err error) - Create(ctx context.Context, in adminin.OrderCreateInp) (res *adminin.OrderCreateModel, err error) - List(ctx context.Context, in adminin.OrderListInp) (list []*adminin.OrderListModel, totalCount int, err error) - Export(ctx context.Context, in adminin.OrderListInp) (err error) - Edit(ctx context.Context, in adminin.OrderEditInp) (err error) - Delete(ctx context.Context, in adminin.OrderDeleteInp) (err error) - View(ctx context.Context, in adminin.OrderViewInp) (res *adminin.OrderViewModel, err error) - Status(ctx context.Context, in adminin.OrderStatusInp) (err error) - } - IAdminPost interface { - Delete(ctx context.Context, in adminin.PostDeleteInp) (err error) - Edit(ctx context.Context, in adminin.PostEditInp) (err error) - MaxSort(ctx context.Context, in adminin.PostMaxSortInp) (res *adminin.PostMaxSortModel, err error) - NameUnique(ctx context.Context, in adminin.PostNameUniqueInp) (res *adminin.PostNameUniqueModel, err error) - CodeUnique(ctx context.Context, in adminin.PostCodeUniqueInp) (res *adminin.PostCodeUniqueModel, err error) - View(ctx context.Context, in adminin.PostViewInp) (res *adminin.PostViewModel, err error) - List(ctx context.Context, in adminin.PostListInp) (list []*adminin.PostListModel, totalCount int, err error) - GetMemberByStartName(ctx context.Context, memberId int64) (name string, err error) - Status(ctx context.Context, in adminin.PostStatusInp) (err error) - } ) var ( - localAdminCash IAdminCash + localAdminMemberPost IAdminMemberPost + localAdminNotice IAdminNotice + localAdminOrder IAdminOrder + localAdminRole IAdminRole + localAdminSite IAdminSite localAdminCreditsLog IAdminCreditsLog localAdminDept IAdminDept localAdminMember IAdminMember - localAdminMemberPost IAdminMemberPost + localAdminPost IAdminPost + localAdminCash IAdminCash localAdminMenu IAdminMenu localAdminMonitor IAdminMonitor - localAdminNotice IAdminNotice - localAdminOrder IAdminOrder - localAdminPost IAdminPost - localAdminRole IAdminRole ) -func AdminMenu() IAdminMenu { - if localAdminMenu == nil { - panic("implement not found for interface IAdminMenu, forgot register?") +func AdminMember() IAdminMember { + if localAdminMember == nil { + panic("implement not found for interface IAdminMember, forgot register?") } - return localAdminMenu + return localAdminMember } -func RegisterAdminMenu(i IAdminMenu) { - localAdminMenu = i +func RegisterAdminMember(i IAdminMember) { + localAdminMember = i } -func AdminMonitor() IAdminMonitor { - if localAdminMonitor == nil { - panic("implement not found for interface IAdminMonitor, forgot register?") +func AdminMemberPost() IAdminMemberPost { + if localAdminMemberPost == nil { + panic("implement not found for interface IAdminMemberPost, forgot register?") } - return localAdminMonitor + return localAdminMemberPost } -func RegisterAdminMonitor(i IAdminMonitor) { - localAdminMonitor = i +func RegisterAdminMemberPost(i IAdminMemberPost) { + localAdminMemberPost = i } func AdminNotice() IAdminNotice { @@ -187,15 +191,37 @@ func RegisterAdminNotice(i IAdminNotice) { localAdminNotice = i } -func AdminCash() IAdminCash { - if localAdminCash == nil { - panic("implement not found for interface IAdminCash, forgot register?") +func AdminOrder() IAdminOrder { + if localAdminOrder == nil { + panic("implement not found for interface IAdminOrder, forgot register?") } - return localAdminCash + return localAdminOrder } -func RegisterAdminCash(i IAdminCash) { - localAdminCash = i +func RegisterAdminOrder(i IAdminOrder) { + localAdminOrder = i +} + +func AdminRole() IAdminRole { + if localAdminRole == nil { + panic("implement not found for interface IAdminRole, forgot register?") + } + return localAdminRole +} + +func RegisterAdminRole(i IAdminRole) { + localAdminRole = i +} + +func AdminSite() IAdminSite { + if localAdminSite == nil { + panic("implement not found for interface IAdminSite, forgot register?") + } + return localAdminSite +} + +func RegisterAdminSite(i IAdminSite) { + localAdminSite = i } func AdminCreditsLog() IAdminCreditsLog { @@ -220,37 +246,15 @@ func RegisterAdminDept(i IAdminDept) { localAdminDept = i } -func AdminMember() IAdminMember { - if localAdminMember == nil { - panic("implement not found for interface IAdminMember, forgot register?") +func AdminMonitor() IAdminMonitor { + if localAdminMonitor == nil { + panic("implement not found for interface IAdminMonitor, forgot register?") } - return localAdminMember + return localAdminMonitor } -func RegisterAdminMember(i IAdminMember) { - localAdminMember = i -} - -func AdminMemberPost() IAdminMemberPost { - if localAdminMemberPost == nil { - panic("implement not found for interface IAdminMemberPost, forgot register?") - } - return localAdminMemberPost -} - -func RegisterAdminMemberPost(i IAdminMemberPost) { - localAdminMemberPost = i -} - -func AdminOrder() IAdminOrder { - if localAdminOrder == nil { - panic("implement not found for interface IAdminOrder, forgot register?") - } - return localAdminOrder -} - -func RegisterAdminOrder(i IAdminOrder) { - localAdminOrder = i +func RegisterAdminMonitor(i IAdminMonitor) { + localAdminMonitor = i } func AdminPost() IAdminPost { @@ -264,13 +268,24 @@ func RegisterAdminPost(i IAdminPost) { localAdminPost = i } -func AdminRole() IAdminRole { - if localAdminRole == nil { - panic("implement not found for interface IAdminRole, forgot register?") +func AdminCash() IAdminCash { + if localAdminCash == nil { + panic("implement not found for interface IAdminCash, forgot register?") } - return localAdminRole + return localAdminCash } -func RegisterAdminRole(i IAdminRole) { - localAdminRole = i +func RegisterAdminCash(i IAdminCash) { + localAdminCash = i +} + +func AdminMenu() IAdminMenu { + if localAdminMenu == nil { + panic("implement not found for interface IAdminMenu, forgot register?") + } + return localAdminMenu +} + +func RegisterAdminMenu(i IAdminMenu) { + localAdminMenu = i } diff --git a/server/internal/service/sys.go b/server/internal/service/sys.go index 04c2292..d854205 100644 --- a/server/internal/service/sys.go +++ b/server/internal/service/sys.go @@ -17,20 +17,112 @@ import ( ) type ( + ISysBlacklist interface { + Delete(ctx context.Context, in sysin.BlacklistDeleteInp) (err error) + Edit(ctx context.Context, in sysin.BlacklistEditInp) (err error) + Status(ctx context.Context, in sysin.BlacklistStatusInp) (err error) + MaxSort(ctx context.Context, in sysin.BlacklistMaxSortInp) (res *sysin.BlacklistMaxSortModel, err error) + View(ctx context.Context, in sysin.BlacklistViewInp) (res *sysin.BlacklistViewModel, err error) + List(ctx context.Context, in sysin.BlacklistListInp) (list []*sysin.BlacklistListModel, totalCount int, err error) + VariableLoad(ctx context.Context, err error) + Load(ctx context.Context) + } + ISysCronGroup interface { + Delete(ctx context.Context, in sysin.CronGroupDeleteInp) (err error) + Edit(ctx context.Context, in sysin.CronGroupEditInp) (err error) + Status(ctx context.Context, in sysin.CronGroupStatusInp) (err error) + MaxSort(ctx context.Context, in sysin.CronGroupMaxSortInp) (res *sysin.CronGroupMaxSortModel, err error) + View(ctx context.Context, in sysin.CronGroupViewInp) (res *sysin.CronGroupViewModel, err error) + List(ctx context.Context, in sysin.CronGroupListInp) (list []*sysin.CronGroupListModel, totalCount int, err error) + Select(ctx context.Context, in sysin.CronGroupSelectInp) (res *sysin.CronGroupSelectModel, err error) + } + ISysGenCodes interface { + Delete(ctx context.Context, in sysin.GenCodesDeleteInp) (err error) + Edit(ctx context.Context, in sysin.GenCodesEditInp) (res *sysin.GenCodesEditModel, err error) + Status(ctx context.Context, in sysin.GenCodesStatusInp) (err error) + MaxSort(ctx context.Context, in sysin.GenCodesMaxSortInp) (res *sysin.GenCodesMaxSortModel, err error) + View(ctx context.Context, in sysin.GenCodesViewInp) (res *sysin.GenCodesViewModel, err error) + List(ctx context.Context, in sysin.GenCodesListInp) (list []*sysin.GenCodesListModel, totalCount int, err error) + Selects(ctx context.Context, in sysin.GenCodesSelectsInp) (res *sysin.GenCodesSelectsModel, err error) + TableSelect(ctx context.Context, in sysin.GenCodesTableSelectInp) (res []*sysin.GenCodesTableSelectModel, err error) + ColumnSelect(ctx context.Context, in sysin.GenCodesColumnSelectInp) (res []*sysin.GenCodesColumnSelectModel, err error) + ColumnList(ctx context.Context, in sysin.GenCodesColumnListInp) (res []*sysin.GenCodesColumnListModel, err error) + Preview(ctx context.Context, in sysin.GenCodesPreviewInp) (res *sysin.GenCodesPreviewModel, err error) + Build(ctx context.Context, in sysin.GenCodesBuildInp) (err error) + } + ISysLoginLog interface { + Model(ctx context.Context) *gdb.Model + List(ctx context.Context, in sysin.LoginLogListInp) (list []*sysin.LoginLogListModel, totalCount int, err error) + Export(ctx context.Context, in sysin.LoginLogListInp) (err error) + Delete(ctx context.Context, in sysin.LoginLogDeleteInp) (err error) + View(ctx context.Context, in sysin.LoginLogViewInp) (res *sysin.LoginLogViewModel, err error) + Push(ctx context.Context, in sysin.LoginLogPushInp) + RealWrite(ctx context.Context, models entity.SysLoginLog) (err error) + } ISysAddonsConfig interface { GetConfigByGroup(ctx context.Context, in sysin.GetAddonsConfigInp) (res *sysin.GetAddonsConfigModel, err error) ConversionType(ctx context.Context, models *entity.SysAddonsConfig) (value interface{}, err error) UpdateConfigByGroup(ctx context.Context, in sysin.UpdateAddonsConfigInp) (err error) } - ISysCron interface { - StartCron(ctx context.Context) - Delete(ctx context.Context, in sysin.CronDeleteInp) (err error) - Edit(ctx context.Context, in sysin.CronEditInp) (err error) - Status(ctx context.Context, in sysin.CronStatusInp) (err error) - MaxSort(ctx context.Context, in sysin.CronMaxSortInp) (res *sysin.CronMaxSortModel, err error) - View(ctx context.Context, in sysin.CronViewInp) (res *sysin.CronViewModel, err error) - List(ctx context.Context, in sysin.CronListInp) (list []*sysin.CronListModel, totalCount int, err error) - OnlineExec(ctx context.Context, in sysin.OnlineExecInp) (err error) + ISysAttachment interface { + Model(ctx context.Context, option ...*handler.Option) *gdb.Model + Delete(ctx context.Context, in sysin.AttachmentDeleteInp) (err error) + Edit(ctx context.Context, in sysin.AttachmentEditInp) (err error) + Status(ctx context.Context, in sysin.AttachmentStatusInp) (err error) + MaxSort(ctx context.Context, in sysin.AttachmentMaxSortInp) (res *sysin.AttachmentMaxSortModel, err error) + View(ctx context.Context, in sysin.AttachmentViewInp) (res *sysin.AttachmentViewModel, err error) + List(ctx context.Context, in sysin.AttachmentListInp) (list []*sysin.AttachmentListModel, totalCount int, err error) + Add(ctx context.Context, meta *sysin.UploadFileMeta, fullPath, drive string) (models *entity.SysAttachment, err error) + } + ISysConfig interface { + InitConfig(ctx context.Context) + GetLogin(ctx context.Context) (conf *model.LoginConfig, err error) + GetWechat(ctx context.Context) (conf *model.WechatConfig, err error) + GetPay(ctx context.Context) (conf *model.PayConfig, err error) + GetSms(ctx context.Context) (conf *model.SmsConfig, err error) + GetGeo(ctx context.Context) (conf *model.GeoConfig, err error) + GetUpload(ctx context.Context) (conf *model.UploadConfig, err error) + GetSmtp(ctx context.Context) (conf *model.EmailConfig, err error) + GetBasic(ctx context.Context) (conf *model.BasicConfig, err error) + GetLoadTCP(ctx context.Context) (conf *model.TCPConfig, err error) + GetLoadCache(ctx context.Context) (conf *model.CacheConfig, err error) + GetLoadGenerate(ctx context.Context) (conf *model.GenerateConfig, err error) + GetLoadToken(ctx context.Context) (conf *model.TokenConfig, err error) + GetLoadSSL(ctx context.Context) (conf *model.SSLConfig, err error) + GetLoadLog(ctx context.Context) (conf *model.LogConfig, err error) + GetLoadServeLog(ctx context.Context) (conf *model.ServeLogConfig, err error) + GetConfigByGroup(ctx context.Context, in sysin.GetConfigInp) (res *sysin.GetConfigModel, err error) + ConversionType(ctx context.Context, models *entity.SysConfig) (value interface{}, err error) + UpdateConfigByGroup(ctx context.Context, in sysin.UpdateConfigInp) (err error) + } + ISysLog interface { + Export(ctx context.Context, in sysin.LogListInp) (err error) + RealWrite(ctx context.Context, log entity.SysLog) (err error) + AutoLog(ctx context.Context) error + AnalysisLog(ctx context.Context) entity.SysLog + View(ctx context.Context, in sysin.LogViewInp) (res *sysin.LogViewModel, err error) + Delete(ctx context.Context, in sysin.LogDeleteInp) (err error) + List(ctx context.Context, in sysin.LogListInp) (list []*sysin.LogListModel, totalCount int, err error) + } + ISysServeLog interface { + Model(ctx context.Context) *gdb.Model + List(ctx context.Context, in sysin.ServeLogListInp) (list []*sysin.ServeLogListModel, totalCount int, err error) + Export(ctx context.Context, in sysin.ServeLogListInp) (err error) + Delete(ctx context.Context, in sysin.ServeLogDeleteInp) (err error) + View(ctx context.Context, in sysin.ServeLogViewInp) (res *sysin.ServeLogViewModel, err error) + RealWrite(ctx context.Context, models entity.SysServeLog) (err error) + } + ISysDictData interface { + Delete(ctx context.Context, in sysin.DictDataDeleteInp) error + Edit(ctx context.Context, in sysin.DictDataEditInp) (err error) + List(ctx context.Context, in sysin.DictDataListInp) (list []*sysin.DictDataListModel, totalCount int, err error) + Select(ctx context.Context, in sysin.DataSelectInp) (list sysin.DataSelectModel, err error) + } + ISysDictType interface { + Tree(ctx context.Context) (list []*sysin.DictTypeTree, err error) + Delete(ctx context.Context, in sysin.DictTypeDeleteInp) (err error) + Edit(ctx context.Context, in sysin.DictTypeEditInp) (err error) + TreeSelect(ctx context.Context, in sysin.DictTreeSelectInp) (list []*sysin.DictTypeTree, err error) } ISysCurdDemo interface { Model(ctx context.Context, option ...*handler.Option) *gdb.Model @@ -43,27 +135,6 @@ type ( Status(ctx context.Context, in sysin.CurdDemoStatusInp) (err error) Switch(ctx context.Context, in sysin.CurdDemoSwitchInp) (err error) } - ISysDictType interface { - Tree(ctx context.Context) (list []*sysin.DictTypeTree, err error) - Delete(ctx context.Context, in sysin.DictTypeDeleteInp) (err error) - Edit(ctx context.Context, in sysin.DictTypeEditInp) (err error) - TreeSelect(ctx context.Context, in sysin.DictTreeSelectInp) (list []*sysin.DictTypeTree, err error) - } - ISysCronGroup interface { - Delete(ctx context.Context, in sysin.CronGroupDeleteInp) (err error) - Edit(ctx context.Context, in sysin.CronGroupEditInp) (err error) - Status(ctx context.Context, in sysin.CronGroupStatusInp) (err error) - MaxSort(ctx context.Context, in sysin.CronGroupMaxSortInp) (res *sysin.CronGroupMaxSortModel, err error) - View(ctx context.Context, in sysin.CronGroupViewInp) (res *sysin.CronGroupViewModel, err error) - List(ctx context.Context, in sysin.CronGroupListInp) (list []*sysin.CronGroupListModel, totalCount int, err error) - Select(ctx context.Context, in sysin.CronGroupSelectInp) (res *sysin.CronGroupSelectModel, err error) - } - ISysDictData interface { - Delete(ctx context.Context, in sysin.DictDataDeleteInp) error - Edit(ctx context.Context, in sysin.DictDataEditInp) (err error) - List(ctx context.Context, in sysin.DictDataListInp) (list []*sysin.DictDataListModel, totalCount int, err error) - Select(ctx context.Context, in sysin.DataSelectInp) (list sysin.DataSelectModel, err error) - } ISysEmsLog interface { Delete(ctx context.Context, in sysin.EmsLogDeleteInp) (err error) Edit(ctx context.Context, in sysin.EmsLogEditInp) (err error) @@ -75,14 +146,17 @@ type ( AllowSend(ctx context.Context, models *entity.SysEmsLog, config *model.EmailConfig) (err error) VerifyCode(ctx context.Context, in sysin.VerifyEmsCodeInp) (err error) } - ISysLog interface { - Export(ctx context.Context, in sysin.LogListInp) (err error) - RealWrite(ctx context.Context, log entity.SysLog) (err error) - AutoLog(ctx context.Context) error - AnalysisLog(ctx context.Context) entity.SysLog - View(ctx context.Context, in sysin.LogViewInp) (res *sysin.LogViewModel, err error) - Delete(ctx context.Context, in sysin.LogDeleteInp) (err error) - List(ctx context.Context, in sysin.LogListInp) (list []*sysin.LogListModel, totalCount int, err error) + ISysProvinces interface { + Tree(ctx context.Context) (list []g.Map, err error) + Delete(ctx context.Context, in sysin.ProvincesDeleteInp) (err error) + Edit(ctx context.Context, in sysin.ProvincesEditInp) (err error) + Status(ctx context.Context, in sysin.ProvincesStatusInp) (err error) + MaxSort(ctx context.Context, in sysin.ProvincesMaxSortInp) (res *sysin.ProvincesMaxSortModel, err error) + View(ctx context.Context, in sysin.ProvincesViewInp) (res *sysin.ProvincesViewModel, err error) + List(ctx context.Context, in sysin.ProvincesListInp) (list []*sysin.ProvincesListModel, totalCount int, err error) + ChildrenList(ctx context.Context, in sysin.ProvincesChildrenListInp) (list []*sysin.ProvincesChildrenListModel, totalCount int, err error) + UniqueId(ctx context.Context, in sysin.ProvincesUniqueIdInp) (res *sysin.ProvincesUniqueIdModel, err error) + Select(ctx context.Context, in sysin.ProvincesSelectInp) (res *sysin.ProvincesSelectModel, err error) } ISysSmsLog interface { Delete(ctx context.Context, in sysin.SmsLogDeleteInp) (err error) @@ -104,142 +178,47 @@ type ( Upgrade(ctx context.Context, in sysin.AddonsUpgradeInp) (err error) UnInstall(ctx context.Context, in sysin.AddonsUnInstallInp) (err error) } - ISysConfig interface { - InitConfig(ctx context.Context) - GetLoadTCP(ctx context.Context) (conf *model.TCPConfig, err error) - GetLoadCache(ctx context.Context) (conf *model.CacheConfig, err error) - GetLoadGenerate(ctx context.Context) (conf *model.GenerateConfig, err error) - GetLoadToken(ctx context.Context) (conf *model.TokenConfig, err error) - GetWechat(ctx context.Context) (conf *model.WechatConfig, err error) - GetPay(ctx context.Context) (conf *model.PayConfig, err error) - GetSms(ctx context.Context) (conf *model.SmsConfig, err error) - GetGeo(ctx context.Context) (conf *model.GeoConfig, err error) - GetUpload(ctx context.Context) (conf *model.UploadConfig, err error) - GetSmtp(ctx context.Context) (conf *model.EmailConfig, err error) - GetBasic(ctx context.Context) (conf *model.BasicConfig, err error) - GetLoadSSL(ctx context.Context) (conf *model.SSLConfig, err error) - GetLoadLog(ctx context.Context) (conf *model.LogConfig, err error) - GetLoadServeLog(ctx context.Context) (conf *model.ServeLogConfig, err error) - GetConfigByGroup(ctx context.Context, in sysin.GetConfigInp) (res *sysin.GetConfigModel, err error) - ConversionType(ctx context.Context, models *entity.SysConfig) (value interface{}, err error) - UpdateConfigByGroup(ctx context.Context, in sysin.UpdateConfigInp) (err error) - } - ISysLoginLog interface { - Model(ctx context.Context) *gdb.Model - List(ctx context.Context, in sysin.LoginLogListInp) (list []*sysin.LoginLogListModel, totalCount int, err error) - Export(ctx context.Context, in sysin.LoginLogListInp) (err error) - Delete(ctx context.Context, in sysin.LoginLogDeleteInp) (err error) - View(ctx context.Context, in sysin.LoginLogViewInp) (res *sysin.LoginLogViewModel, err error) - Push(ctx context.Context, in sysin.LoginLogPushInp) - RealWrite(ctx context.Context, models entity.SysLoginLog) (err error) - } - ISysProvinces interface { - Tree(ctx context.Context) (list []g.Map, err error) - Delete(ctx context.Context, in sysin.ProvincesDeleteInp) (err error) - Edit(ctx context.Context, in sysin.ProvincesEditInp) (err error) - Status(ctx context.Context, in sysin.ProvincesStatusInp) (err error) - MaxSort(ctx context.Context, in sysin.ProvincesMaxSortInp) (res *sysin.ProvincesMaxSortModel, err error) - View(ctx context.Context, in sysin.ProvincesViewInp) (res *sysin.ProvincesViewModel, err error) - List(ctx context.Context, in sysin.ProvincesListInp) (list []*sysin.ProvincesListModel, totalCount int, err error) - ChildrenList(ctx context.Context, in sysin.ProvincesChildrenListInp) (list []*sysin.ProvincesChildrenListModel, totalCount int, err error) - UniqueId(ctx context.Context, in sysin.ProvincesUniqueIdInp) (res *sysin.ProvincesUniqueIdModel, err error) - Select(ctx context.Context, in sysin.ProvincesSelectInp) (res *sysin.ProvincesSelectModel, err error) - } - ISysServeLog interface { - Model(ctx context.Context) *gdb.Model - List(ctx context.Context, in sysin.ServeLogListInp) (list []*sysin.ServeLogListModel, totalCount int, err error) - Export(ctx context.Context, in sysin.ServeLogListInp) (err error) - Delete(ctx context.Context, in sysin.ServeLogDeleteInp) (err error) - View(ctx context.Context, in sysin.ServeLogViewInp) (res *sysin.ServeLogViewModel, err error) - RealWrite(ctx context.Context, models entity.SysServeLog) (err error) - } - ISysAttachment interface { - Model(ctx context.Context, option ...*handler.Option) *gdb.Model - Delete(ctx context.Context, in sysin.AttachmentDeleteInp) (err error) - Edit(ctx context.Context, in sysin.AttachmentEditInp) (err error) - Status(ctx context.Context, in sysin.AttachmentStatusInp) (err error) - MaxSort(ctx context.Context, in sysin.AttachmentMaxSortInp) (res *sysin.AttachmentMaxSortModel, err error) - View(ctx context.Context, in sysin.AttachmentViewInp) (res *sysin.AttachmentViewModel, err error) - List(ctx context.Context, in sysin.AttachmentListInp) (list []*sysin.AttachmentListModel, totalCount int, err error) - Add(ctx context.Context, meta *sysin.UploadFileMeta, fullPath, drive string) (models *entity.SysAttachment, err error) - } - ISysBlacklist interface { - Delete(ctx context.Context, in sysin.BlacklistDeleteInp) (err error) - Edit(ctx context.Context, in sysin.BlacklistEditInp) (err error) - Status(ctx context.Context, in sysin.BlacklistStatusInp) (err error) - MaxSort(ctx context.Context, in sysin.BlacklistMaxSortInp) (res *sysin.BlacklistMaxSortModel, err error) - View(ctx context.Context, in sysin.BlacklistViewInp) (res *sysin.BlacklistViewModel, err error) - List(ctx context.Context, in sysin.BlacklistListInp) (list []*sysin.BlacklistListModel, totalCount int, err error) - VariableLoad(ctx context.Context, err error) - Load(ctx context.Context) - } - ISysGenCodes interface { - Delete(ctx context.Context, in sysin.GenCodesDeleteInp) (err error) - Edit(ctx context.Context, in sysin.GenCodesEditInp) (res *sysin.GenCodesEditModel, err error) - Status(ctx context.Context, in sysin.GenCodesStatusInp) (err error) - MaxSort(ctx context.Context, in sysin.GenCodesMaxSortInp) (res *sysin.GenCodesMaxSortModel, err error) - View(ctx context.Context, in sysin.GenCodesViewInp) (res *sysin.GenCodesViewModel, err error) - List(ctx context.Context, in sysin.GenCodesListInp) (list []*sysin.GenCodesListModel, totalCount int, err error) - Selects(ctx context.Context, in sysin.GenCodesSelectsInp) (res *sysin.GenCodesSelectsModel, err error) - TableSelect(ctx context.Context, in sysin.GenCodesTableSelectInp) (res []*sysin.GenCodesTableSelectModel, err error) - ColumnSelect(ctx context.Context, in sysin.GenCodesColumnSelectInp) (res []*sysin.GenCodesColumnSelectModel, err error) - ColumnList(ctx context.Context, in sysin.GenCodesColumnListInp) (res []*sysin.GenCodesColumnListModel, err error) - Preview(ctx context.Context, in sysin.GenCodesPreviewInp) (res *sysin.GenCodesPreviewModel, err error) - Build(ctx context.Context, in sysin.GenCodesBuildInp) (err error) + ISysCron interface { + StartCron(ctx context.Context) + Delete(ctx context.Context, in sysin.CronDeleteInp) (err error) + Edit(ctx context.Context, in sysin.CronEditInp) (err error) + Status(ctx context.Context, in sysin.CronStatusInp) (err error) + MaxSort(ctx context.Context, in sysin.CronMaxSortInp) (res *sysin.CronMaxSortModel, err error) + View(ctx context.Context, in sysin.CronViewInp) (res *sysin.CronViewModel, err error) + List(ctx context.Context, in sysin.CronListInp) (list []*sysin.CronListModel, totalCount int, err error) + OnlineExec(ctx context.Context, in sysin.OnlineExecInp) (err error) } ) var ( - localSysEmsLog ISysEmsLog - localSysLog ISysLog - localSysSmsLog ISysSmsLog - localSysCronGroup ISysCronGroup localSysDictData ISysDictData - localSysLoginLog ISysLoginLog - localSysProvinces ISysProvinces + localSysDictType ISysDictType + localSysLog ISysLog localSysServeLog ISysServeLog + localSysProvinces ISysProvinces + localSysSmsLog ISysSmsLog localSysAddons ISysAddons - localSysConfig ISysConfig + localSysCron ISysCron + localSysCurdDemo ISysCurdDemo + localSysEmsLog ISysEmsLog localSysGenCodes ISysGenCodes + localSysLoginLog ISysLoginLog + localSysAddonsConfig ISysAddonsConfig localSysAttachment ISysAttachment localSysBlacklist ISysBlacklist - localSysCurdDemo ISysCurdDemo - localSysDictType ISysDictType - localSysAddonsConfig ISysAddonsConfig - localSysCron ISysCron + localSysCronGroup ISysCronGroup + localSysConfig ISysConfig ) -func SysAddonsConfig() ISysAddonsConfig { - if localSysAddonsConfig == nil { - panic("implement not found for interface ISysAddonsConfig, forgot register?") +func SysDictData() ISysDictData { + if localSysDictData == nil { + panic("implement not found for interface ISysDictData, forgot register?") } - return localSysAddonsConfig + return localSysDictData } -func RegisterSysAddonsConfig(i ISysAddonsConfig) { - localSysAddonsConfig = i -} - -func SysCron() ISysCron { - if localSysCron == nil { - panic("implement not found for interface ISysCron, forgot register?") - } - return localSysCron -} - -func RegisterSysCron(i ISysCron) { - localSysCron = i -} - -func SysCurdDemo() ISysCurdDemo { - if localSysCurdDemo == nil { - panic("implement not found for interface ISysCurdDemo, forgot register?") - } - return localSysCurdDemo -} - -func RegisterSysCurdDemo(i ISysCurdDemo) { - localSysCurdDemo = i +func RegisterSysDictData(i ISysDictData) { + localSysDictData = i } func SysDictType() ISysDictType { @@ -253,39 +232,6 @@ func RegisterSysDictType(i ISysDictType) { localSysDictType = i } -func SysCronGroup() ISysCronGroup { - if localSysCronGroup == nil { - panic("implement not found for interface ISysCronGroup, forgot register?") - } - return localSysCronGroup -} - -func RegisterSysCronGroup(i ISysCronGroup) { - localSysCronGroup = i -} - -func SysDictData() ISysDictData { - if localSysDictData == nil { - panic("implement not found for interface ISysDictData, forgot register?") - } - return localSysDictData -} - -func RegisterSysDictData(i ISysDictData) { - localSysDictData = i -} - -func SysEmsLog() ISysEmsLog { - if localSysEmsLog == nil { - panic("implement not found for interface ISysEmsLog, forgot register?") - } - return localSysEmsLog -} - -func RegisterSysEmsLog(i ISysEmsLog) { - localSysEmsLog = i -} - func SysLog() ISysLog { if localSysLog == nil { panic("implement not found for interface ISysLog, forgot register?") @@ -297,6 +243,28 @@ func RegisterSysLog(i ISysLog) { localSysLog = i } +func SysServeLog() ISysServeLog { + if localSysServeLog == nil { + panic("implement not found for interface ISysServeLog, forgot register?") + } + return localSysServeLog +} + +func RegisterSysServeLog(i ISysServeLog) { + localSysServeLog = i +} + +func SysProvinces() ISysProvinces { + if localSysProvinces == nil { + panic("implement not found for interface ISysProvinces, forgot register?") + } + return localSysProvinces +} + +func RegisterSysProvinces(i ISysProvinces) { + localSysProvinces = i +} + func SysSmsLog() ISysSmsLog { if localSysSmsLog == nil { panic("implement not found for interface ISysSmsLog, forgot register?") @@ -319,15 +287,48 @@ func RegisterSysAddons(i ISysAddons) { localSysAddons = i } -func SysConfig() ISysConfig { - if localSysConfig == nil { - panic("implement not found for interface ISysConfig, forgot register?") +func SysCron() ISysCron { + if localSysCron == nil { + panic("implement not found for interface ISysCron, forgot register?") } - return localSysConfig + return localSysCron } -func RegisterSysConfig(i ISysConfig) { - localSysConfig = i +func RegisterSysCron(i ISysCron) { + localSysCron = i +} + +func SysCurdDemo() ISysCurdDemo { + if localSysCurdDemo == nil { + panic("implement not found for interface ISysCurdDemo, forgot register?") + } + return localSysCurdDemo +} + +func RegisterSysCurdDemo(i ISysCurdDemo) { + localSysCurdDemo = i +} + +func SysEmsLog() ISysEmsLog { + if localSysEmsLog == nil { + panic("implement not found for interface ISysEmsLog, forgot register?") + } + return localSysEmsLog +} + +func RegisterSysEmsLog(i ISysEmsLog) { + localSysEmsLog = i +} + +func SysGenCodes() ISysGenCodes { + if localSysGenCodes == nil { + panic("implement not found for interface ISysGenCodes, forgot register?") + } + return localSysGenCodes +} + +func RegisterSysGenCodes(i ISysGenCodes) { + localSysGenCodes = i } func SysLoginLog() ISysLoginLog { @@ -341,26 +342,15 @@ func RegisterSysLoginLog(i ISysLoginLog) { localSysLoginLog = i } -func SysProvinces() ISysProvinces { - if localSysProvinces == nil { - panic("implement not found for interface ISysProvinces, forgot register?") +func SysAddonsConfig() ISysAddonsConfig { + if localSysAddonsConfig == nil { + panic("implement not found for interface ISysAddonsConfig, forgot register?") } - return localSysProvinces + return localSysAddonsConfig } -func RegisterSysProvinces(i ISysProvinces) { - localSysProvinces = i -} - -func SysServeLog() ISysServeLog { - if localSysServeLog == nil { - panic("implement not found for interface ISysServeLog, forgot register?") - } - return localSysServeLog -} - -func RegisterSysServeLog(i ISysServeLog) { - localSysServeLog = i +func RegisterSysAddonsConfig(i ISysAddonsConfig) { + localSysAddonsConfig = i } func SysAttachment() ISysAttachment { @@ -385,13 +375,24 @@ func RegisterSysBlacklist(i ISysBlacklist) { localSysBlacklist = i } -func SysGenCodes() ISysGenCodes { - if localSysGenCodes == nil { - panic("implement not found for interface ISysGenCodes, forgot register?") +func SysCronGroup() ISysCronGroup { + if localSysCronGroup == nil { + panic("implement not found for interface ISysCronGroup, forgot register?") } - return localSysGenCodes + return localSysCronGroup } -func RegisterSysGenCodes(i ISysGenCodes) { - localSysGenCodes = i +func RegisterSysCronGroup(i ISysCronGroup) { + localSysCronGroup = i +} + +func SysConfig() ISysConfig { + if localSysConfig == nil { + panic("implement not found for interface ISysConfig, forgot register?") + } + return localSysConfig +} + +func RegisterSysConfig(i ISysConfig) { + localSysConfig = i } diff --git a/server/manifest/config/config.example.yaml b/server/manifest/config/config.example.yaml index 43dbe04..55abb85 100644 --- a/server/manifest/config/config.example.yaml +++ b/server/manifest/config/config.example.yaml @@ -109,14 +109,11 @@ router: prefix: "/admin" # 不需要验证登录的路由地址 exceptLogin: [ - "/site/captcha", # 登录验证码 - "/site/login", # 登录 - "/site/ping", # ping + "/sms/send", # 短信验证码 "/wechat/authorizeCall", # 微信用户授权回调 ] # 不需要验证权限的路由地址 exceptAuth: [ - "/site/config", # 获取后台配置 "/member/info", # 登录用户信息 "/role/dynamic", # 获取动态路由 "/notice/pullMessages", # 拉取我的消息 diff --git a/server/resource/generate/default/curd/logic.go.template b/server/resource/generate/default/curd/logic.go.template index ad109d7..5e4c439 100644 --- a/server/resource/generate/default/curd/logic.go.template +++ b/server/resource/generate/default/curd/logic.go.template @@ -139,7 +139,7 @@ func (s *s@{.servFunName}) Status(ctx context.Context, in @{.templateGroup}in.@{ return } - if !validate.InSliceInt(consts.StatusMap, in.Status) { + if !validate.InSliceInt(consts.StatusSlice, in.Status) { err = gerror.New("状态不正确") return } diff --git a/server/storage/data/hotgo.sql b/server/storage/data/hotgo.sql index 9aabd20..bc1eff6 100644 --- a/server/storage/data/hotgo.sql +++ b/server/storage/data/hotgo.sql @@ -3,7 +3,7 @@ -- https://www.phpmyadmin.net/ -- -- 主机: localhost:3306 --- 生成日期: 2023-05-12 15:45:52 +-- 生成日期: 2023-05-15 10:04:47 -- 服务器版本: 5.7.38-log -- PHP 版本: 5.6.40 @@ -185,6 +185,7 @@ CREATE TABLE `hg_admin_member` ( `pid` bigint(20) NOT NULL COMMENT '上级管理员ID', `level` int(11) DEFAULT '1' COMMENT '关系树等级', `tree` varchar(512) NOT NULL COMMENT '关系树', + `invite_code` varchar(12) DEFAULT NULL COMMENT '邀请码', `cash` json DEFAULT NULL COMMENT '提现配置', `last_active_at` datetime DEFAULT NULL COMMENT '最后活跃时间', `remark` varchar(255) DEFAULT NULL COMMENT '备注', @@ -197,10 +198,10 @@ CREATE TABLE `hg_admin_member` ( -- 转存表中的数据 `hg_admin_member` -- -INSERT INTO `hg_admin_member` (`id`, `dept_id`, `role_id`, `real_name`, `username`, `password_hash`, `salt`, `password_reset_token`, `integral`, `balance`, `avatar`, `sex`, `qq`, `email`, `mobile`, `birthday`, `city_id`, `address`, `pid`, `level`, `tree`, `cash`, `last_active_at`, `remark`, `status`, `created_at`, `updated_at`) VALUES -(1, 100, 1, '孟帅', 'admin', 'a7c588fffeb2c1d99b29879d7fe97c78', '6541561', '', '89.00', '99391.78', 'http://bufanyun.cn-bj.ufileos.com/hotgo/attachment/2023-02-09/cqdq8er9nfkchdopav.png', 1, '133814250', '133814250@qq.com', '15303830571', '2016-04-16', 410172, '莲花街001号', 0, 1, '', '{\"name\": \"孟帅\", \"account\": \"15303830571\", \"payeeCode\": \"http://bufanyun.cn-bj.ufileos.com/hotgo/attachment/2023-02-09/cqdq8mqal5isvcb58g.jpg\"}', '2023-05-12 15:44:12', NULL, 1, '2021-02-12 17:59:45', '2023-05-12 15:44:12'), -(3, 100, 2, '测试账号', 'test', 'a7c588fffeb2c1d99b29879d7fe97c78', '6541561', '', '0.00', '4.00', 'http://alioss.qvnidaye.com//images/2021/03/12/image_1615529198_vMK4kwq2.jpg', 1, '', 'c@qq.cc', '15303888888', '2016-04-13', 371100, '大潮街道666号', 1, 2, 'tr_1 ', NULL, '2023-04-29 10:20:16', '', 1, '2022-02-11 17:59:45', '2023-04-29 10:20:16'), -(8, 101, 200, 'ameng', 'ameng', '382df3b083a27886edb94e669a857c33', 'hfuUEb', '', '11.00', '3.22', '', 1, '', '', '', NULL, 0, '', 1, 2, 'tr_1 ', NULL, '2023-04-30 20:04:06', '', 1, '2023-02-03 17:34:31', '2023-04-30 20:04:06'); +INSERT INTO `hg_admin_member` (`id`, `dept_id`, `role_id`, `real_name`, `username`, `password_hash`, `salt`, `password_reset_token`, `integral`, `balance`, `avatar`, `sex`, `qq`, `email`, `mobile`, `birthday`, `city_id`, `address`, `pid`, `level`, `tree`, `invite_code`, `cash`, `last_active_at`, `remark`, `status`, `created_at`, `updated_at`) VALUES +(1, 100, 1, '孟帅', 'admin', 'a7c588fffeb2c1d99b29879d7fe97c78', '6541561', '', '89.00', '99391.78', 'http://bufanyun.cn-bj.ufileos.com/hotgo/attachment/2023-02-09/cqdq8er9nfkchdopav.png', 1, '133814250', '133814250@qq.com', '15303830571', '2016-04-16', 410172, '莲花街001号', 0, 1, '', '111', '{\"name\": \"孟帅\", \"account\": \"15303830571\", \"payeeCode\": \"http://bufanyun.cn-bj.ufileos.com/hotgo/attachment/2023-02-09/cqdq8mqal5isvcb58g.jpg\"}', '2023-05-15 09:59:29', NULL, 1, '2021-02-12 17:59:45', '2023-05-15 09:59:29'), +(3, 100, 2, '测试账号', 'test', 'a7c588fffeb2c1d99b29879d7fe97c78', '6541561', '', '0.00', '4.00', 'http://alioss.qvnidaye.com//images/2021/03/12/image_1615529198_vMK4kwq2.jpg', 1, '', 'c@qq.cc', '15303888888', '2016-04-13', 371100, '大潮街道666号', 1, 2, 'tr_1 ', '222', NULL, '2023-05-14 12:29:15', '', 1, '2022-02-11 17:59:45', '2023-05-14 12:29:15'), +(8, 101, 200, 'ameng', 'ameng', '382df3b083a27886edb94e669a857c33', 'hfuUEb', '', '11.00', '3.22', '', 1, '', '', '', NULL, 0, '', 1, 2, 'tr_1 ', '333', NULL, '2023-05-14 12:25:24', '', 1, '2023-02-03 17:34:31', '2023-05-14 12:25:24'); -- -------------------------------------------------------- @@ -220,8 +221,7 @@ CREATE TABLE `hg_admin_member_post` ( INSERT INTO `hg_admin_member_post` (`member_id`, `post_id`) VALUES (1, 1), (3, 4), -(8, 2), -(9, 2); +(8, 2); -- -------------------------------------------------------- @@ -300,13 +300,12 @@ INSERT INTO `hg_admin_menu` (`id`, `pid`, `title`, `name`, `path`, `icon`, `type (2073, 2219, '个人设置', 'home_account', 'account', '', 2, '', '', '', '/home/account/account', 1, '', 0, 0, '', 0, 0, 0, 2, '', 10, '', 1, '2022-09-16 17:34:35', '2023-02-01 15:05:57'), (2074, 0, '日志管理', 'Logs', '/log', 'UnorderedListOutlined', 1, '', '', '', 'LAYOUT', 1, '', 0, 0, '', 0, 0, 0, 1, '', 60, '', 1, '2022-09-16 01:38:32', '2023-01-10 17:19:46'), (2075, 2074, '访问日志', 'log', 'log', '', 1, '/log/log/index', '', '', 'ParentLayout', 0, '', 0, 0, '', 0, 0, 0, 2, '', 10, '', 1, '2022-09-09 17:39:16', '2023-01-20 23:08:41'), -(2076, 2074, '登录日志', 'login_log', 'login', '', 1, '/log/login/index', '', '', 'ParentLayout', 0, '', 0, 0, '', 0, 0, 0, 2, '', 20, '', 1, '2022-09-15 20:04:20', '2023-01-20 23:08:43'), +(2076, 2074, '登录日志', 'login_log', 'login-log', '', 1, '/log/login-log/index', '', '', 'ParentLayout', 0, '', 0, 0, '', 0, 0, 0, 2, '', 20, '', 1, '2022-09-15 20:04:20', '2023-05-11 22:22:54'), (2077, 2075, '全局日志详情', 'log_view', 'view/:id?', '', 2, '', '/log/view', '', '/log/log/view', 0, 'log', 0, 0, '', 0, 1, 0, 3, '', 62, '', 1, '2022-09-14 20:07:04', '2022-11-23 22:12:27'), (2078, 2075, '全局日志列表', 'log_list', 'index', '', 2, '', '/log/list', '', '/log/log/index', 0, 'log', 0, 0, '', 0, 1, 0, 3, '', 61, '', 1, '2022-09-15 04:38:33', '2022-11-23 22:12:07'), (2082, 2076, '登录日志详情', 'loginLogView', 'view/:id?', '', 2, '', '/loginLog/view', '', '/log/login-log/view', 0, 'login_log', 0, 0, '', 0, 1, 0, 3, '', 62, '', 1, '2022-09-14 20:07:04', '2023-01-19 21:13:43'), -(2083, 2076, '登录列表', 'login_log_index', 'index', '', 2, '', '', '', '/log/login-log/index', 0, 'login_log', 0, 0, '', 0, 1, 0, 3, '', 61, '', 1, '2022-09-15 04:38:33', '2022-11-23 22:11:14'), -(2084, 2074, '短信记录', 'sms_log', 'sms', '', 1, '/log/sms/index', '', '', 'ParentLayout', 1, '', 0, 0, '', 0, 0, 0, 2, '', 70, '', 1, '2022-09-17 19:13:51', '2023-01-21 10:07:09'), -(2086, 2084, '日志列表', 'sms_log_index', 'index', '', 2, '', '', '', '/log/sms-log/index', 0, 'sms_log', 0, 0, '', 0, 1, 0, 3, '', 61, '', 1, '2022-09-15 04:38:33', '2023-01-21 10:08:31'), +(2083, 2076, '登录列表', 'login_log_index', 'index', '', 2, '', '', '', '/log/login-log/index', 0, 'login_log', 0, 0, '', 0, 1, 0, 3, '', 61, '', 1, '2022-09-15 04:38:33', '2023-05-11 22:23:46'), +(2084, 2074, '短信记录', 'sms_log', 'sms', '', 1, '', '', '', '/log/sms-log/index', 0, '', 0, 0, '', 0, 0, 0, 2, '', 70, '', 1, '2022-09-17 19:13:51', '2023-05-11 21:59:17'), (2087, 2074, '服务日志', 'monitor_serve_log', 'serve_log', '', 1, '/log/serve_log/index', '', '', 'ParentLayout', 1, '', 0, 0, '', 0, 0, 0, 2, '', 30, '', 1, '2022-09-18 20:59:28', '2023-01-20 23:08:50'), (2088, 2087, '服务日志详情', 'monitor_serve_log_view', 'view/:id?', '', 2, '', '/serve_log/view', '', '/monitor/serve-log/view', 0, 'monitor_serve_log', 0, 0, '', 0, 1, 0, 3, '', 62, '', 1, '2022-09-14 20:07:04', '2023-01-20 18:41:13'), (2089, 2087, '服务日志列表', 'monitor_serve_log_index', 'index', '', 2, '', '', '', '/monitor/serve-log/index', 0, 'monitor_serve_log', 0, 0, '', 0, 1, 0, 2, '', 61, '', 1, '2022-09-15 04:38:33', '2022-09-18 13:14:27'), @@ -346,8 +345,8 @@ INSERT INTO `hg_admin_menu` (`id`, `pid`, `title`, `name`, `path`, `icon`, `type (2204, 2199, '修改生成演示状态', 'curdDemoStatus', '', '', 3, '', '/curdDemo/status', '', '', 1, '', 0, 0, '', 0, 0, 0, 3, '', 10, '', 1, '2023-01-18 15:19:43', '2023-01-18 15:19:43'), (2205, 2199, '操作生成演示开关', 'curdDemoSwitch', '', '', 3, '', '/curdDemo/switch', '', '', 1, '', 0, 0, '', 0, 0, 0, 3, '', 10, '', 1, '2023-01-18 15:19:43', '2023-01-18 15:19:43'), (2206, 2199, '导出生成演示', 'curdDemoExport', '', '', 3, '', '/curdDemo/export', '', '', 1, '', 0, 0, '', 0, 0, 0, 3, '', 10, '', 1, '2023-01-18 15:19:43', '2023-01-18 15:19:43'), -(2207, 2083, '删除登录日志', 'loginLogDelete', '', '', 3, '', '/loginLog/delete', '', '', 1, '', 0, 0, '', 0, 0, 0, 3, '', 10, '', 1, '2023-01-19 21:06:45', '2023-01-19 21:06:45'), -(2208, 2083, '导出登录日志', 'loginLogExport', '', '', 3, '', '/loginLog/export', '', '', 1, '', 0, 0, '', 0, 0, 0, 3, '', 10, '', 1, '2023-01-19 21:06:45', '2023-01-19 21:06:45'), +(2207, 2076, '删除登录日志', 'loginLogDelete', '', '', 3, '', '/loginLog/delete', '', '', 1, '', 0, 0, '', 0, 0, 0, 3, '', 10, '', 1, '2023-01-19 21:06:45', '2023-05-11 22:12:05'), +(2208, 2076, '导出登录日志', 'loginLogExport', '', '', 3, '', '/loginLog/export', '', '', 1, '', 0, 0, '', 0, 0, 0, 3, '', 10, '', 1, '2023-01-19 21:06:45', '2023-05-11 22:12:21'), (2209, 2087, '删除服务日志', 'serveLogDelete', '', '', 3, '', '/serveLog/delete', '', '', 1, '', 0, 0, '', 0, 0, 0, 3, '', 10, '', 1, '2023-01-20 18:37:50', '2023-01-20 18:37:50'), (2210, 2087, '导出服务日志', 'serveLogExport', '', '', 3, '', '/serveLog/export', '', '', 1, '', 0, 0, '', 0, 0, 0, 3, '', 10, '', 1, '2023-01-20 18:37:50', '2023-01-20 18:37:50'), (2211, 2094, '获取公告最大排序', 'noticeMaxSort', '', '', 3, '', '/notice/maxSort', '', '', 1, '', 0, 0, '', 0, 0, 0, 3, '', 10, '', 1, '2023-01-18 15:19:43', '2023-01-18 15:19:43'), @@ -601,201 +600,201 @@ CREATE TABLE `hg_admin_role_casbin` ( -- INSERT INTO `hg_admin_role_casbin` (`id`, `p_type`, `v0`, `v1`, `v2`, `v3`, `v4`, `v5`) VALUES -(20042, 'p', 'manage', 'dashboard', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20043, 'p', 'manage', '/console/stat', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20044, 'p', 'manage', 'dashboard_workplace', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20045, 'p', 'manage', '/dept/list', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20046, 'p', 'manage', '/post/list', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20047, 'p', 'manage', '/role/list', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20048, 'p', 'manage', '/member/list', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20049, 'p', 'manage', '/dept/option', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20050, 'p', 'manage', '/post/list', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20051, 'p', 'manage', '/menu/list', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20052, 'p', 'manage', '/role/list', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20053, 'p', 'manage', '/log/view', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20054, 'p', 'manage', '/log/list', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20055, 'p', 'manage', '/loginLog/view', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20056, 'p', 'manage', '/serve_log/view', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20057, 'p', 'manage', '/notice/list', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20058, 'p', 'manage', '/attachment/list', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20059, 'p', 'manage', '/provinces/list', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20060, 'p', 'manage', '/member/edit', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20061, 'p', 'manage', '/member/view', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20062, 'p', 'manage', '/member/delete', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20063, 'p', 'manage', '/member/status', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20064, 'p', 'manage', '/dept/edit', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20065, 'p', 'manage', '/dept/delete', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20066, 'p', 'manage', '/dept/status', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20067, 'p', 'manage', '/post/edit', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20068, 'p', 'manage', '/post/delete', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20069, 'p', 'manage', '/post/status', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20070, 'p', 'manage', '/upload/image', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20071, 'p', 'manage', '/hgexample/table/list', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20072, 'p', 'manage', '/hgexample/table/view', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20073, 'p', 'manage', '/curdDemo/list', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20074, 'p', 'manage', '/curdDemo/view', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20075, 'p', 'manage', '/curdDemo/edit', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20076, 'p', 'manage', '/curdDemo/maxSort', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20077, 'p', 'manage', '/curdDemo/delete', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20078, 'p', 'manage', '/curdDemo/status', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20079, 'p', 'manage', '/curdDemo/switch', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20080, 'p', 'manage', '/curdDemo/export', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20081, 'p', 'manage', '/loginLog/delete', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20082, 'p', 'manage', '/loginLog/export', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20083, 'p', 'manage', '/serveLog/delete', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20084, 'p', 'manage', '/serveLog/export', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20085, 'p', 'manage', '/notice/maxSort', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20086, 'p', 'manage', '/notice/delete', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20087, 'p', 'manage', '/notice/status', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20088, 'p', 'manage', '/notice/switch', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20089, 'p', 'manage', '/notice/editNotify', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20090, 'p', 'manage', '/notice/editNotice', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20091, 'p', 'manage', '/notice/editLetter', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20092, 'p', 'manage', '/notice/edit', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20093, 'p', 'manage', '/test/maxSort', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20094, 'p', 'manage', '/test/export', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20095, 'p', 'manage', '/test/delete', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20096, 'p', 'manage', '/test/status', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20097, 'p', 'manage', '/test/switch', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20098, 'p', 'manage', '/test/edit', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20099, 'p', 'manage', '/order/create', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20100, 'p', 'manage', '/creditsLog/export', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20101, 'p', 'manage', '/creditsLog/list', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20102, 'p', 'manage', '/order/list', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20103, 'p', 'manage', '/order/acceptRefund', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20104, 'p', 'manage', '/order/applyRefund', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20105, 'p', 'manage', '/order/delete', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20106, 'p', 'manage', '/cash/list', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20107, 'p', 'manage', '/cash/apply', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20108, 'p', 'manage', '/cash/apply', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20109, 'p', 'manage', '/cash/payment', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20110, 'p', 'manage', '/cash/view', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20111, 'p', 'manage', '/member/addBalance', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20112, 'p', 'manage', '/member/addIntegral', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20113, 'p', 'manage', '/member/resetPwd', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20114, 'p', 'manage', '/dept/list', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20115, 'p', 'manage', '/post/list', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20116, 'p', 'manage', '/role/list', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20117, 'p', 'manage', '/member/list', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20118, 'p', 'manage', '/dept/option', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20119, 'p', 'manage', '/config/get', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20120, 'p', 'manage', '/config/update', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20121, 'p', 'manage', '/dictType/tree', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20122, 'p', 'manage', '/dictData/list', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20123, 'p', 'manage', '/config/typeSelect', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20124, 'p', 'manage', '/dictData/edit', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20125, 'p', 'manage', '/dictData/delete', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20126, 'p', 'manage', '/dictType/edit', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20127, 'p', 'manage', '/dictType/delete', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20128, 'p', 'manage', '/cron/list', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20129, 'p', 'manage', '/cronGroup/select', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20130, 'p', 'manage', '/cronGroup/list', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20131, 'p', 'manage', '/cron/edit', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20132, 'p', 'manage', '/cron/delete', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20133, 'p', 'manage', '/cron/status', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20134, 'p', 'manage', '/cron/onlineExec', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20135, 'p', 'manage', '/cronGroup/edit', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20136, 'p', 'manage', '/cronGroup/delete', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20137, 'p', 'manage', '/blacklist/list', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20138, 'p', 'manage', '/blacklist/edit', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20139, 'p', 'manage', '/blacklist/status', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20140, 'p', 'manage', '/blacklist/delete', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20141, 'p', 'gold_agent', 'dashboard', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20142, 'p', 'gold_agent', '/console/stat', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20143, 'p', 'gold_agent', 'dashboard_workplace', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20144, 'p', 'gold_agent', '/dept/list', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20145, 'p', 'gold_agent', '/post/list', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20146, 'p', 'gold_agent', '/role/list', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20147, 'p', 'gold_agent', '/member/list', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20148, 'p', 'gold_agent', '/dept/option', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20149, 'p', 'gold_agent', '/member/edit', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20150, 'p', 'gold_agent', '/member/view', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20151, 'p', 'gold_agent', '/member/delete', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20152, 'p', 'gold_agent', '/member/status', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20153, 'p', 'gold_agent', '/order/create', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20154, 'p', 'gold_agent', '/creditsLog/export', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20155, 'p', 'gold_agent', '/creditsLog/list', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20156, 'p', 'gold_agent', '/order/list', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20157, 'p', 'gold_agent', '/order/acceptRefund', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20158, 'p', 'gold_agent', '/order/applyRefund', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20159, 'p', 'gold_agent', '/order/delete', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20160, 'p', 'gold_agent', '/cash/list', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20161, 'p', 'gold_agent', '/cash/apply', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20162, 'p', 'gold_agent', '/cash/apply', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20163, 'p', 'gold_agent', '/cash/payment', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20164, 'p', 'gold_agent', '/cash/view', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20165, 'p', 'gold_agent', '/member/addBalance', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20166, 'p', 'gold_agent', '/member/addIntegral', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20167, 'p', 'gold_agent', '/member/resetPwd', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20168, 'p', 'gold_agent', '/dept/list', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20169, 'p', 'gold_agent', '/post/list', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20170, 'p', 'gold_agent', '/role/list', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20171, 'p', 'gold_agent', '/member/list', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20172, 'p', 'gold_agent', '/dept/option', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20173, 'p', 'gold_agent', '/member/updatePwd', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20174, 'p', 'gold_agent', '/member/updateMobile', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20175, 'p', 'gold_agent', '/member/updateEmail', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20176, 'p', 'silver_agent', 'dashboard', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20177, 'p', 'silver_agent', '/console/stat', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20178, 'p', 'silver_agent', 'dashboard_workplace', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20179, 'p', 'copper_agent', 'dashboard', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20180, 'p', 'copper_agent', '/console/stat', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20181, 'p', 'copper_agent', 'dashboard_workplace', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20182, 'p', 'finance', 'dashboard', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20183, 'p', 'finance', '/console/stat', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20184, 'p', 'finance', 'dashboard_workplace', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20185, 'p', 'finance', '/dept/list', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20186, 'p', 'finance', '/post/list', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20187, 'p', 'finance', '/role/list', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20188, 'p', 'finance', '/member/list', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20189, 'p', 'finance', '/dept/option', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20190, 'p', 'finance', '/post/list', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20191, 'p', 'finance', '/menu/list', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20192, 'p', 'finance', '/role/list', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20193, 'p', 'finance', '/log/view', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20194, 'p', 'finance', '/log/list', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20195, 'p', 'finance', '/loginLog/view', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20196, 'p', 'finance', '/serve_log/view', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20197, 'p', 'finance', '/notice/list', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20198, 'p', 'finance', '/attachment/list', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20199, 'p', 'finance', '/provinces/list', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20200, 'p', 'finance', '/member/edit', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20201, 'p', 'finance', '/member/view', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20202, 'p', 'finance', '/member/delete', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20203, 'p', 'finance', '/member/status', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20204, 'p', 'finance', '/dept/edit', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20205, 'p', 'finance', '/dept/delete', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20206, 'p', 'finance', '/dept/status', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20207, 'p', 'finance', '/post/edit', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20208, 'p', 'finance', '/post/delete', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20209, 'p', 'finance', '/post/status', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20210, 'p', 'finance', '/upload/image', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20211, 'p', 'finance', '/hgexample/table/list', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20212, 'p', 'finance', '/hgexample/table/view', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20213, 'p', 'finance', '/loginLog/delete', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20214, 'p', 'finance', '/loginLog/export', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20215, 'p', 'finance', '/serveLog/delete', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20216, 'p', 'finance', '/serveLog/export', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20217, 'p', 'finance', '/notice/maxSort', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20218, 'p', 'finance', '/notice/delete', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20219, 'p', 'finance', '/notice/status', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20220, 'p', 'finance', '/notice/switch', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20221, 'p', 'finance', '/notice/editNotify', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20222, 'p', 'finance', '/notice/editNotice', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20223, 'p', 'finance', '/notice/editLetter', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20224, 'p', 'finance', '/notice/edit', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20225, 'p', 'finance', '/test/maxSort', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20226, 'p', 'finance', '/test/export', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20227, 'p', 'finance', '/test/delete', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20228, 'p', 'finance', '/test/status', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20229, 'p', 'finance', '/test/switch', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20230, 'p', 'finance', '/test/edit', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20231, 'p', 'business', 'dashboard', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20232, 'p', 'business', '/console/stat', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20233, 'p', 'business', 'dashboard_workplace', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20234, 'p', 'science', 'dashboard', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20235, 'p', 'science', '/console/stat', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), -(20236, 'p', 'science', 'dashboard_workplace', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''); +(28037, 'p', 'manage', 'dashboard', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28038, 'p', 'manage', '/console/stat', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28039, 'p', 'manage', 'dashboard_workplace', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28040, 'p', 'manage', '/dept/list', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28041, 'p', 'manage', '/post/list', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28042, 'p', 'manage', '/role/list', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28043, 'p', 'manage', '/member/list', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28044, 'p', 'manage', '/dept/option', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28045, 'p', 'manage', '/post/list', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28046, 'p', 'manage', '/menu/list', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28047, 'p', 'manage', '/role/list', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28048, 'p', 'manage', '/log/view', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28049, 'p', 'manage', '/log/list', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28050, 'p', 'manage', '/loginLog/view', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28051, 'p', 'manage', '/serve_log/view', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28052, 'p', 'manage', '/notice/list', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28053, 'p', 'manage', '/attachment/list', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28054, 'p', 'manage', '/provinces/list', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28055, 'p', 'manage', '/member/edit', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28056, 'p', 'manage', '/member/view', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28057, 'p', 'manage', '/member/delete', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28058, 'p', 'manage', '/member/status', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28059, 'p', 'manage', '/dept/edit', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28060, 'p', 'manage', '/dept/delete', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28061, 'p', 'manage', '/dept/status', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28062, 'p', 'manage', '/post/edit', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28063, 'p', 'manage', '/post/delete', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28064, 'p', 'manage', '/post/status', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28065, 'p', 'manage', '/upload/image', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28066, 'p', 'manage', '/hgexample/table/list', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28067, 'p', 'manage', '/hgexample/table/view', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28068, 'p', 'manage', '/curdDemo/list', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28069, 'p', 'manage', '/curdDemo/view', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28070, 'p', 'manage', '/curdDemo/edit', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28071, 'p', 'manage', '/curdDemo/maxSort', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28072, 'p', 'manage', '/curdDemo/delete', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28073, 'p', 'manage', '/curdDemo/status', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28074, 'p', 'manage', '/curdDemo/switch', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28075, 'p', 'manage', '/curdDemo/export', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28076, 'p', 'manage', '/loginLog/delete', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28077, 'p', 'manage', '/loginLog/export', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28078, 'p', 'manage', '/serveLog/delete', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28079, 'p', 'manage', '/serveLog/export', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28080, 'p', 'manage', '/notice/maxSort', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28081, 'p', 'manage', '/notice/delete', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28082, 'p', 'manage', '/notice/status', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28083, 'p', 'manage', '/notice/switch', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28084, 'p', 'manage', '/notice/editNotify', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28085, 'p', 'manage', '/notice/editNotice', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28086, 'p', 'manage', '/notice/editLetter', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28087, 'p', 'manage', '/notice/edit', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28088, 'p', 'manage', '/test/maxSort', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28089, 'p', 'manage', '/test/export', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28090, 'p', 'manage', '/test/delete', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28091, 'p', 'manage', '/test/status', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28092, 'p', 'manage', '/test/switch', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28093, 'p', 'manage', '/test/edit', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28094, 'p', 'manage', '/order/create', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28095, 'p', 'manage', '/creditsLog/export', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28096, 'p', 'manage', '/creditsLog/list', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28097, 'p', 'manage', '/order/list', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28098, 'p', 'manage', '/order/acceptRefund', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28099, 'p', 'manage', '/order/applyRefund', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28100, 'p', 'manage', '/order/delete', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28101, 'p', 'manage', '/cash/list', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28102, 'p', 'manage', '/cash/apply', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28103, 'p', 'manage', '/cash/apply', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28104, 'p', 'manage', '/cash/payment', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28105, 'p', 'manage', '/cash/view', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28106, 'p', 'manage', '/member/addBalance', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28107, 'p', 'manage', '/member/addIntegral', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28108, 'p', 'manage', '/member/resetPwd', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28109, 'p', 'manage', '/dept/list', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28110, 'p', 'manage', '/post/list', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28111, 'p', 'manage', '/role/list', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28112, 'p', 'manage', '/member/list', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28113, 'p', 'manage', '/dept/option', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28114, 'p', 'manage', '/config/get', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28115, 'p', 'manage', '/config/update', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28116, 'p', 'manage', '/dictType/tree', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28117, 'p', 'manage', '/dictData/list', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28118, 'p', 'manage', '/config/typeSelect', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28119, 'p', 'manage', '/dictData/edit', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28120, 'p', 'manage', '/dictData/delete', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28121, 'p', 'manage', '/dictType/edit', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28122, 'p', 'manage', '/dictType/delete', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28123, 'p', 'manage', '/cron/list', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28124, 'p', 'manage', '/cronGroup/select', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28125, 'p', 'manage', '/cronGroup/list', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28126, 'p', 'manage', '/cron/edit', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28127, 'p', 'manage', '/cron/delete', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28128, 'p', 'manage', '/cron/status', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28129, 'p', 'manage', '/cron/onlineExec', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28130, 'p', 'manage', '/cronGroup/edit', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28131, 'p', 'manage', '/cronGroup/delete', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28132, 'p', 'manage', '/blacklist/list', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28133, 'p', 'manage', '/blacklist/edit', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28134, 'p', 'manage', '/blacklist/status', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28135, 'p', 'manage', '/blacklist/delete', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28136, 'p', 'gold_agent', 'dashboard', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28137, 'p', 'gold_agent', '/console/stat', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28138, 'p', 'gold_agent', 'dashboard_workplace', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28139, 'p', 'gold_agent', '/dept/list', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28140, 'p', 'gold_agent', '/post/list', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28141, 'p', 'gold_agent', '/role/list', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28142, 'p', 'gold_agent', '/member/list', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28143, 'p', 'gold_agent', '/dept/option', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28144, 'p', 'gold_agent', '/member/edit', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28145, 'p', 'gold_agent', '/member/view', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28146, 'p', 'gold_agent', '/member/delete', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28147, 'p', 'gold_agent', '/member/status', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28148, 'p', 'gold_agent', '/order/create', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28149, 'p', 'gold_agent', '/creditsLog/export', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28150, 'p', 'gold_agent', '/creditsLog/list', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28151, 'p', 'gold_agent', '/order/list', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28152, 'p', 'gold_agent', '/order/acceptRefund', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28153, 'p', 'gold_agent', '/order/applyRefund', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28154, 'p', 'gold_agent', '/order/delete', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28155, 'p', 'gold_agent', '/cash/list', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28156, 'p', 'gold_agent', '/cash/apply', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28157, 'p', 'gold_agent', '/cash/apply', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28158, 'p', 'gold_agent', '/cash/payment', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28159, 'p', 'gold_agent', '/cash/view', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28160, 'p', 'gold_agent', '/member/addBalance', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28161, 'p', 'gold_agent', '/member/addIntegral', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28162, 'p', 'gold_agent', '/member/resetPwd', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28163, 'p', 'gold_agent', '/dept/list', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28164, 'p', 'gold_agent', '/post/list', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28165, 'p', 'gold_agent', '/role/list', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28166, 'p', 'gold_agent', '/member/list', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28167, 'p', 'gold_agent', '/dept/option', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28168, 'p', 'gold_agent', '/member/updatePwd', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28169, 'p', 'gold_agent', '/member/updateMobile', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28170, 'p', 'gold_agent', '/member/updateEmail', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28171, 'p', 'silver_agent', 'dashboard', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28172, 'p', 'silver_agent', '/console/stat', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28173, 'p', 'silver_agent', 'dashboard_workplace', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28174, 'p', 'copper_agent', 'dashboard', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28175, 'p', 'copper_agent', '/console/stat', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28176, 'p', 'copper_agent', 'dashboard_workplace', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28177, 'p', 'finance', 'dashboard', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28178, 'p', 'finance', '/console/stat', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28179, 'p', 'finance', 'dashboard_workplace', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28180, 'p', 'finance', '/dept/list', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28181, 'p', 'finance', '/post/list', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28182, 'p', 'finance', '/role/list', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28183, 'p', 'finance', '/member/list', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28184, 'p', 'finance', '/dept/option', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28185, 'p', 'finance', '/post/list', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28186, 'p', 'finance', '/menu/list', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28187, 'p', 'finance', '/role/list', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28188, 'p', 'finance', '/log/view', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28189, 'p', 'finance', '/log/list', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28190, 'p', 'finance', '/loginLog/view', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28191, 'p', 'finance', '/serve_log/view', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28192, 'p', 'finance', '/notice/list', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28193, 'p', 'finance', '/attachment/list', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28194, 'p', 'finance', '/provinces/list', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28195, 'p', 'finance', '/member/edit', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28196, 'p', 'finance', '/member/view', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28197, 'p', 'finance', '/member/delete', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28198, 'p', 'finance', '/member/status', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28199, 'p', 'finance', '/dept/edit', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28200, 'p', 'finance', '/dept/delete', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28201, 'p', 'finance', '/dept/status', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28202, 'p', 'finance', '/post/edit', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28203, 'p', 'finance', '/post/delete', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28204, 'p', 'finance', '/post/status', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28205, 'p', 'finance', '/upload/image', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28206, 'p', 'finance', '/hgexample/table/list', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28207, 'p', 'finance', '/hgexample/table/view', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28208, 'p', 'finance', '/loginLog/delete', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28209, 'p', 'finance', '/loginLog/export', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28210, 'p', 'finance', '/serveLog/delete', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28211, 'p', 'finance', '/serveLog/export', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28212, 'p', 'finance', '/notice/maxSort', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28213, 'p', 'finance', '/notice/delete', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28214, 'p', 'finance', '/notice/status', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28215, 'p', 'finance', '/notice/switch', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28216, 'p', 'finance', '/notice/editNotify', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28217, 'p', 'finance', '/notice/editNotice', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28218, 'p', 'finance', '/notice/editLetter', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28219, 'p', 'finance', '/notice/edit', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28220, 'p', 'finance', '/test/maxSort', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28221, 'p', 'finance', '/test/export', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28222, 'p', 'finance', '/test/delete', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28223, 'p', 'finance', '/test/status', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28224, 'p', 'finance', '/test/switch', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28225, 'p', 'finance', '/test/edit', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28226, 'p', 'business', 'dashboard', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28227, 'p', 'business', '/console/stat', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28228, 'p', 'business', 'dashboard_workplace', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28229, 'p', 'science', 'dashboard', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28230, 'p', 'science', '/console/stat', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''), +(28231, 'p', 'science', 'dashboard_workplace', 'GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD', '', '', ''); -- -------------------------------------------------------- @@ -1216,6 +1215,13 @@ CREATE TABLE `hg_sys_attachment` ( `updated_at` datetime DEFAULT NULL COMMENT '修改时间' ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='系统_附件管理'; +-- +-- 转存表中的数据 `hg_sys_attachment` +-- + +INSERT INTO `hg_sys_attachment` (`id`, `app_id`, `member_id`, `cate_id`, `drive`, `name`, `kind`, `meta_type`, `naive_type`, `path`, `file_url`, `size`, `ext`, `md5`, `status`, `created_at`, `updated_at`) VALUES +(55, 'admin', 1, 0, 'local', 'logo.png', 'images', 'image/png', '', 'attachment/2023-05-14/csltf747yrr4gd4kc5.png', 'attachment/2023-05-14/csltf747yrr4gd4kc5.png', 38601, 'png', '492c0e0f0eb8e7e6c7b6901d32854d19', 1, '2023-05-14 15:17:25', '2023-05-14 15:17:25'); + -- -------------------------------------------------------- -- @@ -1273,8 +1279,6 @@ INSERT INTO `hg_sys_config` (`id`, `group`, `name`, `type`, `key`, `value`, `def (1, 'theme', '默认主题', 'string', 'themeDarkTheme', 'dark', 'dark', 50, '', 1, 1, '2021-01-30 13:27:43', '2022-09-05 20:29:05'), (2, 'theme', '默认系统主题', 'string', 'themeAppTheme', '#2d8cf0', '#2d8cf0', 60, '', 1, 1, '2021-01-30 13:27:43', '2022-09-05 20:29:05'), (3, 'theme', '默认侧边栏风格', 'string', 'themeNavTheme', 'light', 'dark', 70, '', 1, 1, '2021-01-30 13:27:43', '2022-09-05 20:29:05'), -(4, 'basic', '用户是否可注册开关', 'int', 'basicRegisterSwitch', '1', '1', 80, '', 1, 1, '2021-09-29 23:51:21', '2023-04-30 20:38:06'), -(5, 'basic', '验证码开关', 'int', 'basicCaptchaSwitch', '1', '1', 90, '', 1, 1, '2021-09-29 23:51:21', '2023-04-30 20:38:06'), (6, 'basic', '网站名称', 'string', 'basicName', 'HotGo', 'HotGo!', 10, '', 1, 1, '2021-01-30 13:27:43', '2023-04-30 20:38:06'), (7, 'basic', '网站logo', 'string', 'basicLogo', 'http://bufanyun.cn-bj.ufileos.com/hotgo/attachment/2023-02-09/cqdq8er9nfkchdopav.png', '', 20, '首页使用', 1, 1, '2021-01-30 13:27:43', '2023-04-30 20:38:06'), (8, 'basic', '网站备案号', 'string', 'basicIcpCode', '豫ICP备16035288号', '', 30, '', 1, 1, '2021-01-30 13:27:43', '2023-04-30 20:38:06'), @@ -1363,7 +1367,17 @@ INSERT INTO `hg_sys_config` (`id`, `group`, `name`, `type`, `key`, `value`, `def (108, 'wechat', '开放平台AppId', 'string', 'openPlatformAppId', '', '', 1040, '请填写微信开放平台平台后台的AppId', 1, 1, '2021-01-30 13:27:43', '2023-04-30 22:26:12'), (109, 'wechat', '开放平台AppSecret', 'string', 'openPlatformAppSecret', '', '', 1050, '请填写微信开放平台平台后台的AppSecret', 1, 1, '2021-01-30 13:27:43', '2023-04-30 22:26:12'), (110, 'wechat', '开放平台EncodingAESKey', 'string', 'openPlatformEncodingAESKey', '', '', 1060, '与开放平台接入设置值一致,必须为英文或者数字,长度为43个字符. 请妥善保管,EncodingAESKey 泄露将可能被窃取或篡改平台的操作数据', 1, 1, '2021-01-30 13:27:43', '2023-04-30 22:26:12'), -(111, 'wechat', '开放平台token', 'string', 'openPlatformToken', '', '', 1070, '', 1, 1, '2021-01-30 13:27:43', '2023-04-30 22:26:12'); +(111, 'wechat', '开放平台token', 'string', 'openPlatformToken', '', '', 1070, '', 1, 1, '2021-01-30 13:27:43', '2023-04-30 22:26:12'), +(112, 'login', '注册开关', 'int', 'loginRegisterSwitch', '1', '1', 1100, '', 1, 1, '2021-09-29 23:51:21', '2023-05-15 09:46:09'), +(113, 'login', '验证码开关', 'int', 'loginCaptchaSwitch', '1', '1', 1110, '', 1, 1, '2021-09-29 23:51:21', '2023-05-15 09:46:09'), +(114, 'login', '用户协议', 'string', 'loginProtocol', '

用户协议..

', '', 1120, '', 1, 1, '2021-09-29 23:51:21', '2023-05-15 09:46:09'), +(115, 'login', '隐私权政策', 'string', 'loginPolicy', '

隐私权政策..

', '', 1130, '', 1, 1, '2021-09-29 23:51:21', '2023-05-15 09:46:09'), +(116, 'login', '默认注册角色', 'int64', 'loginRoleId', '202', '', 1140, '', 1, 1, '2021-09-29 23:51:21', '2023-05-15 09:46:09'), +(117, 'login', '默认注册部门', 'int64', 'loginDeptId', '112', '', 1150, '', 1, 1, '2021-09-29 23:51:21', '2023-05-15 09:46:09'), +(118, 'login', '默认注册岗位', '[]int64', 'loginPostIds', '[6]', '', 1160, '', 1, 1, '2021-09-29 23:51:21', '2023-05-15 09:46:09'), +(119, 'login', '默认注册头像', 'string', 'loginAvatar', 'http://localhost:8000/attachment/2023-05-14/csltf747yrr4gd4kc5.png', '', 1170, '', 1, 1, '2021-09-29 23:51:21', '2023-05-15 09:46:09'), +(120, 'login', '强制邀请', 'int', 'loginForceInvite', '2', '1', 1190, '', 1, 1, '2021-09-29 23:51:21', '2023-05-15 09:46:09'), +(121, 'login', '自动获取openId', 'int', 'loginAutoOpenId', '2', '1', 1195, '', 1, 1, '2021-09-29 23:51:21', '2023-05-15 09:46:09'); -- -------------------------------------------------------- @@ -1715,13 +1729,6 @@ CREATE TABLE `hg_sys_login_log` ( `updated_at` datetime DEFAULT NULL COMMENT '修改时间' ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='系统_登录日志'; --- --- 转存表中的数据 `hg_sys_login_log` --- - -INSERT INTO `hg_sys_login_log` (`id`, `req_id`, `member_id`, `username`, `response`, `login_at`, `login_ip`, `err_msg`, `status`, `created_at`, `updated_at`) VALUES -(40, 'c043b70bb0045e17d7eafe258038334d', 1, 'admin', '{\"id\": 1, \"token\": \"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhcHAiOiJhZG1pbiIsImF2YXRhciI6Imh0dHA6Ly9idWZhbnl1bi5jbi1iai51ZmlsZW9zLmNvbS9ob3Rnby9hdHRhY2htZW50LzIwMjMtMDItMDkvY3FkcThlcjluZmtjaGRvcGF2LnBuZyIsImRlcHRJZCI6MTAwLCJlbWFpbCI6IjEzMzgxNDI1MEBxcS5jb20iLCJleHAiOjE2ODQ2NTI0NjQsImV4cGlyZXMiOjg2NDAwMCwiaWQiOjEsImlzUmVmcmVzaCI6ZmFsc2UsImp3dFZlcnNpb24iOiIxLjAiLCJtb2JpbGUiOiIxNTMwMzgzMDU3MSIsInBpZCI6MCwicmVhbE5hbWUiOiLlrZ_luIUiLCJyb2xlSWQiOjEsInJvbGVLZXkiOiJzdXBlciIsInVzZXJuYW1lIjoiYWRtaW4ifQ.66ppHKrI8QbIo4u_fH88BlI6NdiomqnuIVGkyDKy1-I\", \"expires\": 864000}', '2023-05-11 15:01:04', '127.0.0.1', '', 1, '2023-05-11 15:41:45', '2023-05-11 15:41:45'); - -- -------------------------------------------------------- -- @@ -5469,7 +5476,7 @@ CREATE TABLE `hg_sys_serve_license` ( -- INSERT INTO `hg_sys_serve_license` (`id`, `group`, `name`, `appid`, `secret_key`, `desc`, `remote_addr`, `online`, `online_limit`, `login_times`, `last_login_at`, `last_active_at`, `routes`, `allowed_ips`, `end_at`, `remark`, `status`, `created_at`, `updated_at`) VALUES -(1, 'cron', '默认的定时任务', '1002', 'hotgo', '这是默认的定时任务TCP客户端授权凭证。', '127.0.0.1:52537', 1, 1, 163, '2023-05-11 15:52:56', '2023-05-11 15:54:30', NULL, '127.0.0.1', '2033-03-09 00:00:00', '', 1, '2023-03-11 00:00:00', '2023-05-11 15:54:30'), +(1, 'cron', '默认的定时任务', '1002', 'hotgo', '这是默认的定时任务TCP客户端授权凭证。', '127.0.0.1:62905', 1, 1, 295, '2023-05-14 16:44:30', '2023-05-14 16:50:30', NULL, '127.0.0.1', '2033-03-09 00:00:00', '', 1, '2023-03-11 00:00:00', '2023-05-14 16:50:30'), (2, 'auth', '测试授权', 'mengshuai', '123456', '这是一个测试的授权服务,可以为第三方平台提供授权支持。', '127.0.0.1:51615', 1, 1, 0, '2023-05-04 23:23:52', '2023-05-04 23:23:52', NULL, '127.0.0.1', '2033-03-09 00:00:00', '', 1, '2023-03-11 00:00:00', '2023-05-04 23:23:52'); -- -------------------------------------------------------- @@ -5586,6 +5593,7 @@ ALTER TABLE `hg_admin_dept` -- ALTER TABLE `hg_admin_member` ADD PRIMARY KEY (`id`), + ADD UNIQUE KEY `invite_code` (`invite_code`), ADD KEY `dept_id` (`dept_id`), ADD KEY `pid` (`pid`); @@ -5846,7 +5854,7 @@ ALTER TABLE `hg_admin_dept` -- 使用表AUTO_INCREMENT `hg_admin_member` -- ALTER TABLE `hg_admin_member` - MODIFY `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '管理员ID', AUTO_INCREMENT=10; + MODIFY `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '管理员ID', AUTO_INCREMENT=14; -- -- 使用表AUTO_INCREMENT `hg_admin_menu` @@ -5894,7 +5902,7 @@ ALTER TABLE `hg_admin_role` -- 使用表AUTO_INCREMENT `hg_admin_role_casbin` -- ALTER TABLE `hg_admin_role_casbin` - MODIFY `id` bigint(20) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=20237; + MODIFY `id` bigint(20) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=28232; -- -- 使用表AUTO_INCREMENT `hg_pay_log` @@ -5924,7 +5932,7 @@ ALTER TABLE `hg_sys_addons_install` -- 使用表AUTO_INCREMENT `hg_sys_attachment` -- ALTER TABLE `hg_sys_attachment` - MODIFY `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '文件ID', AUTO_INCREMENT=55; + MODIFY `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '文件ID', AUTO_INCREMENT=56; -- -- 使用表AUTO_INCREMENT `hg_sys_blacklist` @@ -5936,7 +5944,7 @@ ALTER TABLE `hg_sys_blacklist` -- 使用表AUTO_INCREMENT `hg_sys_config` -- ALTER TABLE `hg_sys_config` - MODIFY `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '配置ID', AUTO_INCREMENT=112; + MODIFY `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '配置ID', AUTO_INCREMENT=122; -- -- 使用表AUTO_INCREMENT `hg_sys_cron` @@ -5990,7 +5998,7 @@ ALTER TABLE `hg_sys_log` -- 使用表AUTO_INCREMENT `hg_sys_login_log` -- ALTER TABLE `hg_sys_login_log` - MODIFY `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '日志ID', AUTO_INCREMENT=41; + MODIFY `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '日志ID'; -- -- 使用表AUTO_INCREMENT `hg_sys_serve_license` @@ -6008,7 +6016,7 @@ ALTER TABLE `hg_sys_serve_log` -- 使用表AUTO_INCREMENT `hg_sys_sms_log` -- ALTER TABLE `hg_sys_sms_log` - MODIFY `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键', AUTO_INCREMENT=3; + MODIFY `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键', AUTO_INCREMENT=6; -- -- 使用表AUTO_INCREMENT `hg_test_category` diff --git a/server/utility/file/mime.go b/server/utility/file/mime.go index b6f59ca..7857ba6 100644 --- a/server/utility/file/mime.go +++ b/server/utility/file/mime.go @@ -3,7 +3,6 @@ // @Copyright Copyright (c) 2023 HotGo CLI // @Author Ms <133814250@qq.com> // @License https://github.com/bufanyun/hotgo/blob/master/LICENSE -// package file import ( @@ -11,7 +10,7 @@ import ( "github.com/gogf/gf/v2/frame/g" "github.com/gogf/gf/v2/net/ghttp" "github.com/gogf/gf/v2/text/gstr" - "io/ioutil" + "io" "path" ) @@ -139,7 +138,7 @@ func UploadFileByte(file *ghttp.UploadFile) (b []byte, err error) { if err != nil { return } - all, err := ioutil.ReadAll(open) + all, err := io.ReadAll(open) if err != nil { return } diff --git a/web/.env b/web/.env index c7ac7a5..a55418a 100644 --- a/web/.env +++ b/web/.env @@ -2,10 +2,8 @@ VITE_PORT=8001 # spa-title -VITE_GLOB_APP_TITLE=HG后台管理系统 +VITE_GLOB_APP_TITLE=HotGo管理系统 # spa shortname VITE_GLOB_APP_SHORT_NAME=HG -# 生产环境 开启mock -VITE_GLOB_PROD_MOCK=false diff --git a/web/.env.development b/web/.env.development index 79c773f..6a1e227 100644 --- a/web/.env.development +++ b/web/.env.development @@ -3,9 +3,6 @@ # 网站根目录 VITE_PUBLIC_PATH=/ -# 是否开启mock -VITE_USE_MOCK=false - # 网站前缀 VITE_BASE_URL=/ diff --git a/web/.env.production b/web/.env.production index ab49e2e..7a6c774 100644 --- a/web/.env.production +++ b/web/.env.production @@ -3,9 +3,6 @@ # 网站根目录 VITE_PUBLIC_PATH=/admin -# 是否开启mock -VITE_USE_MOCK=false - # 网站前缀 VITE_BASE_URL=/ diff --git a/web/build/vite/plugin/index.ts b/web/build/vite/plugin/index.ts index 0f62f80..16cc8c7 100644 --- a/web/build/vite/plugin/index.ts +++ b/web/build/vite/plugin/index.ts @@ -4,13 +4,11 @@ import { NaiveUiResolver } from 'unplugin-vue-components/resolvers'; import topLevelAwait from 'vite-plugin-top-level-await'; import vue from '@vitejs/plugin-vue'; import vueJsx from '@vitejs/plugin-vue-jsx'; - import { configHtmlPlugin } from './html'; -import { configMockPlugin } from './mock'; import { configCompressPlugin } from './compress'; -export function createVitePlugins(viteEnv: ViteEnv, isBuild: boolean, prodMock) { - const { VITE_USE_MOCK, VITE_BUILD_COMPRESS, VITE_BUILD_COMPRESS_DELETE_ORIGIN_FILE } = viteEnv; +export function createVitePlugins(viteEnv: ViteEnv, isBuild: boolean) { + const { VITE_BUILD_COMPRESS, VITE_BUILD_COMPRESS_DELETE_ORIGIN_FILE } = viteEnv; const vitePlugins: (Plugin | Plugin[])[] = [ // have to @@ -36,9 +34,6 @@ export function createVitePlugins(viteEnv: ViteEnv, isBuild: boolean, prodMock) // vite-plugin-html vitePlugins.push(configHtmlPlugin(viteEnv, isBuild)); - // vite-plugin-mock - VITE_USE_MOCK && vitePlugins.push(configMockPlugin(isBuild, prodMock)); - if (isBuild) { // rollup-plugin-gzip vitePlugins.push( diff --git a/web/build/vite/plugin/mock.ts b/web/build/vite/plugin/mock.ts deleted file mode 100644 index 84bf144..0000000 --- a/web/build/vite/plugin/mock.ts +++ /dev/null @@ -1,19 +0,0 @@ -/** - * Mock plugin for development and production. - * https://github.com/anncwb/vite-plugin-mock - */ -import { viteMockServe } from 'vite-plugin-mock'; - -export function configMockPlugin(isBuild: boolean, prodMock: boolean) { - return viteMockServe({ - ignore: /^\_/, - mockPath: 'mock', - localEnabled: !isBuild, - prodEnabled: isBuild && prodMock, - injectCode: ` - import { setupProdMockServer } from '../mock/_createProductionServer'; - - setupProdMockServer(); - `, - }); -} diff --git a/web/mock/_createProductionServer.ts b/web/mock/_createProductionServer.ts deleted file mode 100644 index a44310b..0000000 --- a/web/mock/_createProductionServer.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { createProdMockServer } from 'vite-plugin-mock/es/createProdMockServer'; - -const modules = import.meta.globEager('./**/*.ts'); - -const mockModules: any[] = []; -Object.keys(modules).forEach((key) => { - if (key.includes('/_')) { - return; - } - mockModules.push(...modules[key].default); -}); - -/** - * Used in a production environment. Need to manually import all modules - */ -export function setupProdMockServer() { - createProdMockServer(mockModules); -} diff --git a/web/mock/_util.ts b/web/mock/_util.ts deleted file mode 100644 index 9e4b3b3..0000000 --- a/web/mock/_util.ts +++ /dev/null @@ -1,73 +0,0 @@ -import Mock from 'mockjs'; - -export function resultSuccess(data, { message = 'ok' } = {}) { - return Mock.mock({ - code: 0, - data, - message, - type: 'success', - }); -} - -export function resultPageSuccess( - page: number, - pageSize: number, - list: T[], - { message = 'ok' } = {} -) { - const pageData = pagination(page, pageSize, list); - - return { - ...resultSuccess({ - page, - pageSize, - pageCount: list.length, - list: pageData, - }), - message, - }; -} - -export function resultError(message = 'Request failed', { code = -1, result = null } = {}) { - return { - code, - result, - message, - type: 'error', - }; -} - -export function pagination(pageNo: number, pageSize: number, array: T[]): T[] { - const offset = (pageNo - 1) * Number(pageSize); - const ret = - offset + Number(pageSize) >= array.length - ? array.slice(offset, array.length) - : array.slice(offset, offset + Number(pageSize)); - return ret; -} - -/** - * @param {Number} times 回调函数需要执行的次数 - * @param {Function} callback 回调函数 - */ -export function doCustomTimes(times: number, callback: any) { - let i = -1; - while (++i < times) { - callback(i); - } -} - -export interface requestParams { - method: string; - body: any; - headers?: { token?: string }; - query: any; -} - -/** - * @description 本函数用于从request数据中获取token,请根据项目的实际情况修改 - * - */ -export function getRequestToken({ headers }: requestParams): string | undefined { - return headers?.token; -} diff --git a/web/mock/dashboard/console.ts b/web/mock/dashboard/console.ts deleted file mode 100644 index 8c788a6..0000000 --- a/web/mock/dashboard/console.ts +++ /dev/null @@ -1,44 +0,0 @@ -import { Random } from 'mockjs'; -import { resultSuccess } from '../_util'; - -const consoleInfo = { - //访问量 - visits: { - dayVisits: Random.float(10000, 99999, 2, 2), - rise: Random.float(10, 99), - decline: Random.float(10, 99), - amount: Random.float(99999, 999999, 3, 5), - }, - //销售额 - saleroom: { - weekSaleroom: Random.float(10000, 99999, 2, 2), - amount: Random.float(99999, 999999, 2, 2), - degree: Random.float(10, 99), - }, - //订单量 - orderLarge: { - weekLarge: Random.float(10000, 99999, 2, 2), - rise: Random.float(10, 99), - decline: Random.float(10, 99), - amount: Random.float(99999, 999999, 2, 2), - }, - //成交额度 - volume: { - weekLarge: Random.float(10000, 99999, 2, 2), - rise: Random.float(10, 99), - decline: Random.float(10, 99), - amount: Random.float(99999, 999999, 2, 2), - }, -}; - -export default [ - //主控台 卡片数据 - { - url: '/admin/dashboard/console', - timeout: 1000, - method: 'get', - response: () => { - return resultSuccess(consoleInfo); - }, - }, -]; diff --git a/web/mock/system/menu.ts b/web/mock/system/menu.ts deleted file mode 100644 index b32746a..0000000 --- a/web/mock/system/menu.ts +++ /dev/null @@ -1,89 +0,0 @@ -import { resultSuccess } from '../_util'; - -const menuList = () => { - const result: any[] = [ - { - label: 'Dashboard', - key: 'dashboard', - type: 1, - subtitle: 'dashboard', - openType: 1, - auth: 'dashboard', - path: '/dashboard', - children: [ - { - label: '主控台', - key: 'console', - type: 1, - subtitle: 'console', - openType: 1, - auth: 'console', - path: '/dashboard/console', - }, - { - label: '工作台', - key: 'workplace', - type: 1, - subtitle: 'workplace', - openType: 1, - auth: 'workplace', - path: '/dashboard/workplace', - }, - ], - }, - { - label: '表单管理', - key: 'form', - type: 1, - subtitle: 'form', - openType: 1, - auth: 'form', - path: '/form', - children: [ - { - label: '基础表单', - key: 'basic-form', - type: 1, - subtitle: 'basic-form', - openType: 1, - auth: 'basic-form', - path: '/form/basic-form', - }, - { - label: '分步表单', - key: 'step-form', - type: 1, - subtitle: 'step-form', - openType: 1, - auth: 'step-form', - path: '/form/step-form', - }, - { - label: '表单详情', - key: 'detail', - type: 1, - subtitle: 'detail', - openType: 1, - auth: 'detail', - path: '/form/detail', - }, - ], - }, - ]; - - return result; -}; - -export default [ - { - url: '/admin/menu/list', - timeout: 1000, - method: 'get', - response: () => { - const list = menuList(); - return resultSuccess({ - list, - }); - }, - }, -]; diff --git a/web/mock/system/role.ts b/web/mock/system/role.ts deleted file mode 100644 index fa3190a..0000000 --- a/web/mock/system/role.ts +++ /dev/null @@ -1,46 +0,0 @@ -import { doCustomTimes, resultSuccess } from '../_util'; - -function getMenuKeys() { - const keys = ['dashboard', 'console', 'workplace', 'basic-form', 'step-form', 'detail']; - const newKeys = []; - doCustomTimes(parseInt(Math.random() * 6), () => { - const key = keys[Math.floor(Math.random() * keys.length)]; - // @ts-ignore - newKeys.push(key); - }); - return Array.from(new Set(newKeys)); -} - -const roleList = (pageSize) => { - const result: any[] = []; - doCustomTimes(pageSize, () => { - result.push({ - id: '@integer(10,100)', - name: '@cname()', - explain: '@cname()', - isDefault: '@boolean()', - menu_keys: getMenuKeys(), - create_date: `@date('yyyy-MM-dd hh:mm:ss')`, - 'status|1': ['normal', 'enable', 'disable'], - }); - }); - return result; -}; - -export default [ - { - url: '/admin/role/list', - timeout: 1000, - method: 'get', - response: ({ query }) => { - const { page = 1, pageSize = 10 } = query; - const list = roleList(Number(pageSize)); - return resultSuccess({ - page: Number(page), - pageSize: Number(pageSize), - pageCount: 60, - list, - }); - }, - }, -]; diff --git a/web/mock/table/list.ts b/web/mock/table/list.ts deleted file mode 100644 index 2fa83bf..0000000 --- a/web/mock/table/list.ts +++ /dev/null @@ -1,40 +0,0 @@ -import { Random } from 'mockjs'; -import { doCustomTimes, resultSuccess } from '../_util'; - -const tableList = (pageSize) => { - const result: any[] = []; - doCustomTimes(pageSize, () => { - result.push({ - id: '@integer(10,999999)', - beginTime: '@datetime', - endTime: '@datetime', - address: '@city()', - name: '@cname()', - avatar: Random.image('400x400', Random.color(), Random.color(), Random.first()), - date: `@date('yyyy-MM-dd')`, - time: `@time('HH:mm')`, - 'no|100000-10000000': 100000, - 'status|1': [true, false], - }); - }); - return result; -}; - -export default [ - //表格数据列表 - { - url: '/admin/table/list', - timeout: 1000, - method: 'get', - response: ({ query }) => { - const { page = 1, pageSize = 10 } = query; - const list = tableList(Number(pageSize)); - return resultSuccess({ - page: Number(page), - pageSize: Number(pageSize), - pageCount: 60, - list, - }); - }, - }, -]; diff --git a/web/mock/user/menus.ts b/web/mock/user/menus.ts deleted file mode 100644 index acadde4..0000000 --- a/web/mock/user/menus.ts +++ /dev/null @@ -1,53 +0,0 @@ -import { resultSuccess } from '../_util'; -import { ApiEnum } from '@/enums/apiEnum'; - -const menusList = [ - { - path: '/dashboard', - name: 'Dashboard', - component: 'LAYOUT', - redirect: '/dashboard/console', - meta: { - icon: 'DashboardOutlined', - title: 'Dashboard', - }, - children: [ - { - path: 'console', - name: 'dashboard_console', - component: '/dashboard/console/console', - meta: { - title: '主控台', - }, - }, - { - path: 'monitor', - name: 'dashboard_monitor', - component: '/dashboard/monitor/monitor', - meta: { - title: '监控页', - }, - }, - { - path: 'workplace', - name: 'dashboard_workplace', - component: '/dashboard/workplace/workplace', - meta: { - hidden: true, - title: '工作台', - }, - }, - ], - }, -]; - -export default [ - { - url: ApiEnum.RoleDynamic, - timeout: 1000, - method: 'get', - response: () => { - return resultSuccess(menusList); - }, - }, -]; diff --git a/web/mock/user/user.ts b/web/mock/user/user.ts deleted file mode 100644 index 98efa6b..0000000 --- a/web/mock/user/user.ts +++ /dev/null @@ -1,60 +0,0 @@ -import Mock from 'mockjs'; -import { ApiEnum } from '@/enums/apiEnum'; -import { resultSuccess } from '../_util'; - -const Random = Mock.Random; - -const token = Random.string('upper', 32, 32); - -const adminInfo = { - userId: '1', - username: 'admin', - realName: 'Admin', - avatar: Random.image(), - desc: 'manager', - password: Random.string('upper', 4, 16), - token, - permissions: [ - { - label: '主控台', - value: 'dashboard_console', - }, - { - label: '监控页', - value: 'dashboard_monitor', - }, - { - label: '工作台', - value: 'dashboard_workplace', - }, - { - label: '基础列表', - value: 'basic_list', - }, - { - label: '基础列表删除', - value: 'basic_list_delete', - }, - ], -}; - -export default [ - { - url: ApiEnum.SiteLogin, - timeout: 1000, - method: 'post', - response: () => { - return resultSuccess({ token }); - }, - }, - { - url: ApiEnum.MemberInfo, //ApiEnum.Prefix + - timeout: 1000, - method: 'get', - response: () => { - // const token = getRequestToken(request); - // if (!token) return resultError('Invalid token'); - return resultSuccess(adminInfo); - }, - }, -]; diff --git a/web/package.json b/web/package.json index a7a3b36..dd9b5a7 100644 --- a/web/package.json +++ b/web/package.json @@ -1,6 +1,6 @@ { "name": "hotgo", - "version": "2.6.10", + "version": "2.7.3", "author": { "name": "MengShuai", "email": "133814250@qq.com", @@ -103,7 +103,6 @@ "vite": "^2.9.8", "vite-plugin-compression": "^0.3.6", "vite-plugin-html": "^2.1.2", - "vite-plugin-mock": "^2.9.6", "vite-plugin-require-transform": "^1.0.5", "vite-plugin-style-import": "^1.4.1", "vite-plugin-top-level-await": "^1.2.2", diff --git a/web/src/api/system/user.ts b/web/src/api/system/user.ts index 2cd2bab..d26c176 100644 --- a/web/src/api/system/user.ts +++ b/web/src/api/system/user.ts @@ -77,6 +77,14 @@ export function SendBindSms() { }); } +export function SendSms(params) { + return http.request({ + url: '/sms/send', + method: 'post', + params, + }); +} + export function updateMemberCash(params) { return http.request({ url: '/member/updateCash', @@ -85,13 +93,55 @@ export function updateMemberCash(params) { }); } +/** + * @description: 用户登录配置 + */ +export function getLoginConfig() { + return http.request({ + url: ApiEnum.SiteLoginConfig, + method: 'get', + }); +} + +/** + * @description: 用户注册 + */ +export function register(params) { + return http.request( + { + url: ApiEnum.SiteRegister, + method: 'POST', + params, + }, + { + isTransformResponse: false, + } + ); +} + /** * @description: 用户登录 */ export function login(params) { return http.request( { - url: ApiEnum.SiteLogin, + url: ApiEnum.SiteAccountLogin, + method: 'POST', + params, + }, + { + isTransformResponse: false, + } + ); +} + +/** + * @description: 手机号登录 + */ +export function mobileLogin(params) { + return http.request( + { + url: ApiEnum.SiteMobileLogin, method: 'POST', params, }, diff --git a/web/src/api/table/list.ts b/web/src/api/table/list.ts deleted file mode 100644 index 1e95565..0000000 --- a/web/src/api/table/list.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { http } from '@/utils/http/axios'; - -//获取table -export function getTableList(params) { - return http.request({ - url: '/table/list', - method: 'get', - params, - }); -} diff --git a/web/src/enums/apiEnum.ts b/web/src/enums/apiEnum.ts index d66c07f..13aa3a9 100644 --- a/web/src/enums/apiEnum.ts +++ b/web/src/enums/apiEnum.ts @@ -3,7 +3,10 @@ export enum ApiEnum { Prefix = '/api', // 基础 - SiteLogin = '/site/login', // 登录 + SiteRegister = '/site/register', // 账号注册 + SiteAccountLogin = '/site/accountLogin', // 账号登录 + SiteMobileLogin = '/site/mobileLogin', // 手机号登录 + SiteLoginConfig = '/site/loginConfig', // 登录配置 SiteLogout = '/site/logout', // 注销 SiteConfig = '/site/config', // 配置信息 diff --git a/web/src/hooks/setting/index.ts b/web/src/hooks/setting/index.ts index e6e008a..0c27b3f 100644 --- a/web/src/hooks/setting/index.ts +++ b/web/src/hooks/setting/index.ts @@ -1,5 +1,4 @@ import type { GlobConfig } from '/#/config'; - import { warn } from '@/utils/log'; import { getAppEnvConfig } from '@/utils/env'; @@ -10,7 +9,6 @@ export const useGlobSetting = (): Readonly => { VITE_GLOB_APP_SHORT_NAME, VITE_GLOB_API_URL_PREFIX, VITE_GLOB_UPLOAD_URL, - VITE_GLOB_PROD_MOCK, VITE_GLOB_IMG_URL, } = getAppEnvConfig(); @@ -27,7 +25,6 @@ export const useGlobSetting = (): Readonly => { shortName: VITE_GLOB_APP_SHORT_NAME, urlPrefix: VITE_GLOB_API_URL_PREFIX, uploadUrl: VITE_GLOB_UPLOAD_URL, - prodMock: VITE_GLOB_PROD_MOCK, imgUrl: VITE_GLOB_IMG_URL, }; return glob as Readonly; diff --git a/web/src/layout/components/Logo/index.vue b/web/src/layout/components/Logo/index.vue index 497885a..2a96f77 100644 --- a/web/src/layout/components/Logo/index.vue +++ b/web/src/layout/components/Logo/index.vue @@ -1,7 +1,7 @@ @@ -13,6 +13,12 @@ type: Boolean, }, }, + setup() { + const projectName = import.meta.env.VITE_GLOB_APP_TITLE; + return { + projectName, + }; + }, }; diff --git a/web/src/router/router-guards.ts b/web/src/router/router-guards.ts index 67888e5..52b33ce 100644 --- a/web/src/router/router-guards.ts +++ b/web/src/router/router-guards.ts @@ -1,13 +1,13 @@ import type { RouteRecordRaw } from 'vue-router'; import { isNavigationFailure, Router } from 'vue-router'; -import { UserInfoState, useUserStoreWidthOut } from '@/store/modules/user'; +import { useUserStoreWidthOut } from '@/store/modules/user'; import { useAsyncRouteStoreWidthOut } from '@/store/modules/asyncRoute'; import { ACCESS_TOKEN } from '@/store/mutation-types'; import { storage } from '@/utils/Storage'; import { PageEnum } from '@/enums/pageEnum'; import { ErrorPageRoute } from '@/router/base'; -import { isWechatBrowser } from '@/utils/is'; import { jump } from '@/utils/http/axios'; +import { getNowUrl } from '@/utils/urlUtils'; const LOGIN_PATH = PageEnum.BASE_LOGIN; const whitePathList = [LOGIN_PATH]; // no redirect whitelist @@ -18,6 +18,7 @@ export function createRouterGuards(router: Router) { router.beforeEach(async (to, from, next) => { const Loading = window['$loading'] || null; Loading && Loading.start(); + if (from.path === LOGIN_PATH && to.name === 'errorPage') { next(PageEnum.BASE_HOME); return; @@ -25,6 +26,7 @@ export function createRouterGuards(router: Router) { // Whitelist can be directly entered if (whitePathList.includes(to.path as PageEnum)) { + await userStore.LoadLoginConfig(); next(); return; } @@ -37,6 +39,7 @@ export function createRouterGuards(router: Router) { next(); return; } + // redirect login page const redirectData: { path: string; replace: boolean; query?: Recordable } = { path: LOGIN_PATH, @@ -61,16 +64,16 @@ export function createRouterGuards(router: Router) { const redirect = decodeURIComponent(redirectPath); const nextData = to.path === redirect ? { ...to, replace: true } : { path: redirect }; const userInfo = await userStore.GetInfo(); + await userStore.LoadLoginConfig(); - // 如果是微信访问,则记录本次登录的openid - if (isWechatBrowser() && (userInfo as UserInfoState).openId === '') { + // 是否允许获取微信openid + if (userStore.allowWxOpenId()) { let path = nextData.path; if (path === LOGIN_PATH) { path = PageEnum.BASE_HOME_REDIRECT; } - const w = window.location; - const URI = w.protocol + '//' + w.host + w.pathname + '#' + path; + const URI = getNowUrl() + '#' + path; jump('/wechat/authorize', { type: 'openId', syncRedirect: URI }); return; } diff --git a/web/src/store/modules/user.ts b/web/src/store/modules/user.ts index ceca865..ea4bdac 100644 --- a/web/src/store/modules/user.ts +++ b/web/src/store/modules/user.ts @@ -1,9 +1,23 @@ import { defineStore } from 'pinia'; import { createStorage, storage } from '@/utils/Storage'; import { store } from '@/store'; -import { ACCESS_TOKEN, CURRENT_CONFIG, CURRENT_USER, IS_LOCKSCREEN } from '@/store/mutation-types'; +import { + ACCESS_TOKEN, + CURRENT_CONFIG, + CURRENT_LOGIN_CONFIG, + CURRENT_USER, + IS_LOCKSCREEN, +} from '@/store/mutation-types'; import { ResultEnum } from '@/enums/httpEnum'; -import { getConfig, getUserInfo, login, logout } from '@/api/system/user'; +import { + getConfig, + getLoginConfig, + getUserInfo, + login, + logout, + mobileLogin, +} from '@/api/system/user'; +import { isWechatBrowser } from '@/utils/is'; const Storage = createStorage({ storage: localStorage }); export interface UserInfoState { @@ -34,6 +48,7 @@ export interface UserInfoState { lastLoginAt: string; lastLoginIp: string; openId: string; + inviteCode: string; } export interface ConfigState { @@ -42,6 +57,14 @@ export interface ConfigState { wsAddr: string; } +export interface LoginConfigState { + loginRegisterSwitch: number; + loginCaptchaSwitch: number; + loginAutoOpenId: number; + loginProtocol: string; + loginPolicy: string; +} + export interface IUserState { token: string; username: string; @@ -50,6 +73,7 @@ export interface IUserState { permissions: any[]; info: UserInfoState | null; config: ConfigState | null; + loginConfig: LoginConfigState | null; } export const useUserStore = defineStore({ @@ -62,6 +86,7 @@ export const useUserStore = defineStore({ permissions: [], info: Storage.get(CURRENT_USER, null), config: Storage.get(CURRENT_CONFIG, null), + loginConfig: Storage.get(CURRENT_LOGIN_CONFIG, null), }), getters: { getToken(): string { @@ -85,6 +110,9 @@ export const useUserStore = defineStore({ getConfig(): ConfigState | null { return this.config; }, + getLoginConfig(): LoginConfigState | null { + return this.loginConfig; + }, }, actions: { setToken(token: string) { @@ -108,10 +136,20 @@ export const useUserStore = defineStore({ setConfig(config: ConfigState | null) { this.config = config; }, - // 登录 + setLoginConfig(config: LoginConfigState | null) { + this.loginConfig = config; + }, + // 账号登录 async login(userInfo) { + return await this.handleLogin(login(userInfo)); + }, + // 手机号登录 + async mobileLogin(userInfo) { + return await this.handleLogin(mobileLogin(userInfo)); + }, + async handleLogin(request: Promise) { try { - const response = await login(userInfo); + const response = await request; const { data, code } = response; if (code === ResultEnum.SUCCESS) { const ex = 30 * 24 * 60 * 60 * 1000; @@ -150,7 +188,7 @@ export const useUserStore = defineStore({ }); }); }, - // 获取用户配置 + // 获取基础配置 GetConfig() { const that = this; return new Promise((resolve, reject) => { @@ -166,6 +204,34 @@ export const useUserStore = defineStore({ }); }); }, + // 获取登录配置 + LoadLoginConfig: function () { + const that = this; + return new Promise((resolve, reject) => { + getLoginConfig() + .then((res) => { + const result = res as unknown as LoginConfigState; + that.setLoginConfig(result); + storage.set(CURRENT_LOGIN_CONFIG, result); + resolve(res); + }) + .catch((error) => { + reject(error); + }); + }); + }, + // 是否允许获取微信openid + allowWxOpenId(): boolean { + if (!isWechatBrowser()) { + return false; + } + + if (this.loginConfig?.loginAutoOpenId !== 1) { + return false; + } + + return this.info?.openId === ''; + }, // 登出 async logout() { try { diff --git a/web/src/store/mutation-types.ts b/web/src/store/mutation-types.ts index 5092c4d..a1b9a42 100644 --- a/web/src/store/mutation-types.ts +++ b/web/src/store/mutation-types.ts @@ -1,5 +1,6 @@ export const ACCESS_TOKEN = 'ACCESS-TOKEN'; // 用户token export const CURRENT_USER = 'CURRENT-USER'; // 当前用户信息 -export const CURRENT_CONFIG = 'CURRENT-CONFIG'; // 当前用户信息 +export const CURRENT_CONFIG = 'CURRENT-CONFIG'; // 当前基础配置 +export const CURRENT_LOGIN_CONFIG = 'CURRENT-LOGIN-CONFIG'; // 当前登录配置 export const IS_LOCKSCREEN = 'IS-LOCKSCREEN'; // 是否锁屏 export const TABS_ROUTES = 'TABS-ROUTES'; // 标签页 diff --git a/web/src/utils/env.ts b/web/src/utils/env.ts index d53f2bd..67fe2bb 100644 --- a/web/src/utils/env.ts +++ b/web/src/utils/env.ts @@ -28,7 +28,6 @@ export function getAppEnvConfig() { VITE_GLOB_APP_SHORT_NAME, VITE_GLOB_API_URL_PREFIX, VITE_GLOB_UPLOAD_URL, - VITE_GLOB_PROD_MOCK, VITE_GLOB_IMG_URL, } = ENV; @@ -44,7 +43,6 @@ export function getAppEnvConfig() { VITE_GLOB_APP_SHORT_NAME, VITE_GLOB_API_URL_PREFIX, VITE_GLOB_UPLOAD_URL, - VITE_GLOB_PROD_MOCK, VITE_GLOB_IMG_URL, }; } diff --git a/web/src/utils/urlUtils.ts b/web/src/utils/urlUtils.ts index d0d6216..584b156 100644 --- a/web/src/utils/urlUtils.ts +++ b/web/src/utils/urlUtils.ts @@ -41,3 +41,11 @@ export function getFileExt(fileName: string) { } return fileName.substring(fileName.lastIndexOf('.') + 1); } + +/** + * 获取当访问的url,不含参数 + */ +export function getNowUrl(): string { + const w = window.location; + return w.protocol + '//' + w.host + w.pathname; +} diff --git a/web/src/views/curdDemo/edit.vue b/web/src/views/curdDemo/edit.vue index 9dbaabd..8217dcd 100644 --- a/web/src/views/curdDemo/edit.vue +++ b/web/src/views/curdDemo/edit.vue @@ -174,4 +174,4 @@ ); - \ No newline at end of file + diff --git a/web/src/views/login/components/form-other.vue b/web/src/views/login/components/form-other.vue new file mode 100644 index 0000000..dbe11ea --- /dev/null +++ b/web/src/views/login/components/form-other.vue @@ -0,0 +1,67 @@ + + + + + diff --git a/web/src/views/login/components/style.less b/web/src/views/login/components/style.less new file mode 100644 index 0000000..208df11 --- /dev/null +++ b/web/src/views/login/components/style.less @@ -0,0 +1,66 @@ + .view-account { + display: flex; + flex-direction: column; + height: 100vh; + overflow: auto; + + &-container { + flex: 1; + padding: 32px 12px; + max-width: 384px; + min-width: 320px; + margin: 0 auto; + } + + &-top { + padding: 32px 0; + text-align: center; + + &-desc { + font-size: 14px; + color: #808695; + } + } + + &-other { + width: 100%; + } + + .default-color { + color: #515a6e; + + .ant-checkbox-wrapper { + color: #515a6e; + } + } + } + + @media (min-width: 768px) { + .view-account { + background-image: url('~@/assets/images/login.svg'); + background-repeat: no-repeat; + background-position: 50%; + background-size: 100%; + } + + .page-account-container { + padding: 32px 0 24px 0; + } + } + + .justify-between { + justify-content: space-between; + } + + .flex-y-center { + display: flex; + align-items: center; + } + + .w-300px { + width: 300px; + } + + .w-12px { + width: 12px; + } diff --git a/web/src/views/login/index.vue b/web/src/views/login/index.vue index b3dc8b5..ad00d7e 100644 --- a/web/src/views/login/index.vue +++ b/web/src/views/login/index.vue @@ -1,224 +1,96 @@ diff --git a/web/src/views/login/login/demo-account.vue b/web/src/views/login/login/demo-account.vue new file mode 100644 index 0000000..371680c --- /dev/null +++ b/web/src/views/login/login/demo-account.vue @@ -0,0 +1,47 @@ + + + + + diff --git a/web/src/views/login/login/form.vue b/web/src/views/login/login/form.vue new file mode 100644 index 0000000..8e04603 --- /dev/null +++ b/web/src/views/login/login/form.vue @@ -0,0 +1,311 @@ + + + diff --git a/web/src/views/login/login/index.vue b/web/src/views/login/login/index.vue new file mode 100644 index 0000000..a6d09db --- /dev/null +++ b/web/src/views/login/login/index.vue @@ -0,0 +1,22 @@ + + + + + diff --git a/web/src/views/login/register/agreement.vue b/web/src/views/login/register/agreement.vue new file mode 100644 index 0000000..069e858 --- /dev/null +++ b/web/src/views/login/register/agreement.vue @@ -0,0 +1,50 @@ + + + + + diff --git a/web/src/views/login/register/index.vue b/web/src/views/login/register/index.vue new file mode 100644 index 0000000..cde5fa6 --- /dev/null +++ b/web/src/views/login/register/index.vue @@ -0,0 +1,279 @@ + + + + + diff --git a/web/src/views/monitor/serve-monitor/components/DataItem.vue b/web/src/views/monitor/serve-monitor/components/DataItem.vue index 3709f0e..cff9e6f 100644 --- a/web/src/views/monitor/serve-monitor/components/DataItem.vue +++ b/web/src/views/monitor/serve-monitor/components/DataItem.vue @@ -52,7 +52,7 @@ diff --git a/web/src/views/system/config/BasicSetting.vue b/web/src/views/system/config/BasicSetting.vue index 2c6851c..96f62c7 100644 --- a/web/src/views/system/config/BasicSetting.vue +++ b/web/src/views/system/config/BasicSetting.vue @@ -30,24 +30,6 @@ - - - - 开启 - 关闭 - - - - - - - - 开启 - 关闭 - - - - +
+ + + 开关配置 + + + + 开启 + 关闭 + + + + + + + + 开启 + 关闭 + + + + + + + + 开启 + 关闭 + + + + + + + + + 开启 + 关闭 + + + + + + 注册默认信息配置 + + + + + + + + + + + + + + + + + 协议配置 + + + + + + + + +
+ + 保存更新 + +
+
+
+
+ + + diff --git a/web/src/views/system/config/system.vue b/web/src/views/system/config/system.vue index 1888bb7..cf0763e 100644 --- a/web/src/views/system/config/system.vue +++ b/web/src/views/system/config/system.vue @@ -22,6 +22,7 @@ + @@ -44,6 +45,7 @@ import SmsSetting from './SmsSetting.vue'; import PaySetting from './PaySetting.vue'; import WechatSetting from './WechatSetting.vue'; + import LoginSetting from './LoginSetting.vue'; const typeTabList = [ { name: '基本设置', @@ -70,11 +72,11 @@ desc: '短信验证码平台', key: 5, }, - // { - // name: '管理员配置', - // desc: '默认设置和权限屏蔽', - // key: 6, - // }, + { + name: '登录注册', + desc: '登录注册配置', + key: 6, + }, { name: '提现配置', desc: '管理员提现规则配置', @@ -113,6 +115,7 @@ SmsSetting, PaySetting, WechatSetting, + LoginSetting, }, setup() { const state = reactive({ diff --git a/web/types/config.d.ts b/web/types/config.d.ts index 748df08..f326389 100644 --- a/web/types/config.d.ts +++ b/web/types/config.d.ts @@ -52,7 +52,6 @@ export interface GlobConfig { shortName: string; urlPrefix?: string; uploadUrl?: string; - prodMock: boolean; imgUrl?: string; } @@ -69,6 +68,4 @@ export interface GlobEnvConfig { VITE_GLOB_UPLOAD_URL?: string; //图片前缀地址 VITE_GLOB_IMG_URL?: string; - //生产环境开启mock - VITE_GLOB_PROD_MOCK: boolean; } diff --git a/web/types/global.d.ts b/web/types/global.d.ts index de4a77a..2506c61 100644 --- a/web/types/global.d.ts +++ b/web/types/global.d.ts @@ -59,12 +59,10 @@ declare global { declare interface ViteEnv { VITE_PORT: number; - VITE_USE_MOCK: boolean; VITE_PUBLIC_PATH: string; VITE_GLOB_APP_TITLE: string; VITE_GLOB_APP_SHORT_NAME: string; VITE_DROP_CONSOLE: boolean; - VITE_GLOB_PROD_MOCK: boolean; VITE_GLOB_IMG_URL: string; VITE_PROXY: [string, string][]; VITE_BUILD_COMPRESS: 'gzip' | 'brotli' | 'none'; diff --git a/web/vite.config.ts b/web/vite.config.ts index 2a237ba..80c5cf1 100644 --- a/web/vite.config.ts +++ b/web/vite.config.ts @@ -22,9 +22,8 @@ export default ({ command, mode }: ConfigEnv): UserConfig => { const root = process.cwd(); const env = loadEnv(mode, root); const viteEnv = wrapperEnv(env); - const { VITE_PUBLIC_PATH, VITE_DROP_CONSOLE, VITE_PORT, VITE_GLOB_PROD_MOCK, VITE_PROXY } = + const { VITE_PUBLIC_PATH, VITE_DROP_CONSOLE, VITE_PORT, VITE_PROXY } = viteEnv; - const prodMock = VITE_GLOB_PROD_MOCK; const isBuild = command === 'build'; return { base: VITE_PUBLIC_PATH, @@ -42,7 +41,7 @@ export default ({ command, mode }: ConfigEnv): UserConfig => { ], dedupe: ['vue'], }, - plugins: createVitePlugins(viteEnv, isBuild, prodMock), + plugins: createVitePlugins(viteEnv, isBuild), define: { __APP_INFO__: JSON.stringify(__APP_INFO__), },