mirror of
https://github.com/bufanyun/hotgo.git
synced 2025-12-30 03:56:02 +08:00
更新2.1.1版本,优化代码提示
This commit is contained in:
@@ -32,5 +32,4 @@ func signalListen(ctx context.Context, handler ...gproc.SigHandler) {
|
||||
gproc.AddSigHandlerShutdown(handler...)
|
||||
gproc.Listen()
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
@@ -74,6 +74,5 @@ func ConvType(val interface{}, t string) interface{} {
|
||||
default:
|
||||
val = gconv.String(val)
|
||||
}
|
||||
|
||||
return val
|
||||
}
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
// Package consts
|
||||
// @Link https://github.com/bufanyun/hotgo
|
||||
// @Copyright Copyright (c) 2022 HotGo CLI
|
||||
// @Author Ms <133814250@qq.com>
|
||||
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
|
||||
//
|
||||
package consts
|
||||
|
||||
// 开放API
|
||||
const (
|
||||
OpenAPITitle = `HotGo`
|
||||
OpenAPIDescription = `这是一个使用HotGo的简单演示HTTP服务器项目。 `
|
||||
OpenAPIName = `HotGo`
|
||||
OpenAPIURL = `https://github.com/bufanyun/hotgo`
|
||||
)
|
||||
@@ -8,5 +8,5 @@ package consts
|
||||
|
||||
// VersionApp HotGo版本
|
||||
const (
|
||||
VersionApp = "2.1.0"
|
||||
VersionApp = "2.1.1"
|
||||
)
|
||||
|
||||
@@ -31,14 +31,6 @@ var (
|
||||
// Fill with you ideas below.
|
||||
|
||||
// IsUniqueName 判断用户名是否唯一
|
||||
// @Description:
|
||||
// @receiver dao
|
||||
// @param ctx
|
||||
// @param id
|
||||
// @param name
|
||||
// @return bool
|
||||
// @return error
|
||||
//
|
||||
func (dao *adminMemberDao) IsUniqueName(ctx context.Context, id int64, name string) (bool, error) {
|
||||
var data *entity.AdminDept
|
||||
m := dao.Ctx(ctx).Where("username", name)
|
||||
@@ -60,14 +52,6 @@ func (dao *adminMemberDao) IsUniqueName(ctx context.Context, id int64, name stri
|
||||
}
|
||||
|
||||
// IsUniqueEmail 判断邮箱是否唯一
|
||||
// @Description:
|
||||
// @receiver dao
|
||||
// @param ctx
|
||||
// @param id
|
||||
// @param email
|
||||
// @return bool
|
||||
// @return error
|
||||
//
|
||||
func (dao *adminMemberDao) IsUniqueEmail(ctx context.Context, id int64, email string) (bool, error) {
|
||||
var data *entity.AdminMember
|
||||
m := dao.Ctx(ctx).Where("email", email)
|
||||
@@ -89,14 +73,6 @@ func (dao *adminMemberDao) IsUniqueEmail(ctx context.Context, id int64, email st
|
||||
}
|
||||
|
||||
// IsUniqueMobile 判断手机号是否唯一
|
||||
// @Description:
|
||||
// @receiver dao
|
||||
// @param ctx
|
||||
// @param id
|
||||
// @param mobile
|
||||
// @return bool
|
||||
// @return error
|
||||
//
|
||||
func (dao *adminMemberDao) IsUniqueMobile(ctx context.Context, id int64, mobile string) (bool, error) {
|
||||
var data *entity.AdminMember
|
||||
m := dao.Ctx(ctx).Where("mobile", mobile)
|
||||
@@ -116,4 +92,3 @@ func (dao *adminMemberDao) IsUniqueMobile(ctx context.Context, id int64, mobile
|
||||
|
||||
return false, nil
|
||||
}
|
||||
|
||||
|
||||
@@ -71,7 +71,6 @@ func (dao *adminMenuDao) IsUniqueName(ctx context.Context, id int64, name string
|
||||
return false, nil
|
||||
}
|
||||
|
||||
// GenLabelTreeList
|
||||
func (dao *adminMenuDao) GenLabelTreeList(ctx context.Context, pid int64) ([]*model.LabelTreeMenu, error) {
|
||||
|
||||
var (
|
||||
@@ -100,16 +99,7 @@ func (dao *adminMenuDao) GenLabelTreeList(ctx context.Context, pid int64) ([]*mo
|
||||
return newLst, nil
|
||||
}
|
||||
|
||||
//
|
||||
// @Title 生成树列表
|
||||
// @Description
|
||||
// @Author Ms <133814250@qq.com>
|
||||
// @Param ctx
|
||||
// @Param pid
|
||||
// @Param lists
|
||||
// @Return []*model.TreeMenu
|
||||
// @Return error
|
||||
//
|
||||
// GenTreeList 生成树列表
|
||||
func (dao *adminMenuDao) GenTreeList(ctx context.Context, pid int64, ids []int64) ([]*model.TreeMenu, error) {
|
||||
|
||||
var (
|
||||
@@ -131,25 +121,7 @@ func (dao *adminMenuDao) GenTreeList(ctx context.Context, pid int64, ids []int64
|
||||
return newLst, nil
|
||||
}
|
||||
|
||||
//
|
||||
// @Title 获取最上级pid
|
||||
// @Description
|
||||
// @Author Ms <133814250@qq.com>
|
||||
// @Param ctx
|
||||
// @Param data
|
||||
// @Return int64
|
||||
// @Return error
|
||||
//
|
||||
|
||||
//
|
||||
// TopPid
|
||||
// @Description:
|
||||
// @receiver dao
|
||||
// @param ctx
|
||||
// @param data
|
||||
// @return int64
|
||||
// @return error
|
||||
//
|
||||
// TopPid 获取最上级pid
|
||||
func (dao *adminMenuDao) TopPid(ctx context.Context, data *entity.AdminMenu) (int64, error) {
|
||||
var pidData *entity.AdminMenu
|
||||
if data.Pid == 0 {
|
||||
|
||||
@@ -57,6 +57,7 @@ func HandlerFilterAuth(m *gdb.Model) *gdb.Model {
|
||||
panic(fmt.Sprintf("HandlerFilterAuth Failed to role information err2:%+v", err))
|
||||
}
|
||||
|
||||
// TODO 当前不是完整功能,预计在下个版本中完善
|
||||
switch roleModel.DataScope {
|
||||
case consts.RoleDataAll: // 全部权限
|
||||
// ...
|
||||
|
||||
@@ -18,9 +18,11 @@ import (
|
||||
)
|
||||
|
||||
func Admin(ctx context.Context, group *ghttp.RouterGroup) {
|
||||
// 兼容后台登录入口
|
||||
group.ALL("/login", func(r *ghttp.Request) {
|
||||
r.Response.RedirectTo("/admin")
|
||||
})
|
||||
|
||||
prefix := g.Cfg().MustGet(ctx, "router.admin.prefix", "/admin")
|
||||
group.Group(prefix.String(), func(group *ghttp.RouterGroup) {
|
||||
group.Middleware(service.Middleware().AdminAuth)
|
||||
|
||||
Reference in New Issue
Block a user