format🥚 代码格式化
This commit is contained in:
1 parent
a7cc943b8e
commit
a54d4ba0c1
96 files changed
+143
-151
No files matched your search
@@ -37,7 +37,7 @@ func (e SysApi) GetSysApiList(c *gin.Context) {
|
||||
d := new(dto.SysApiSearch)
|
||||
err := e.MakeContext(c).
|
||||
MakeOrm().
|
||||
Bind(d,binding.Form).
|
||||
Bind(d, binding.Form).
|
||||
MakeService(&s.Service).
|
||||
Errors
|
||||
if err != nil {
|
||||
@@ -71,7 +71,7 @@ func (e SysApi) GetSysApi(c *gin.Context) {
|
||||
s := new(service.SysApi)
|
||||
err := e.MakeContext(c).
|
||||
MakeOrm().
|
||||
Bind(control,nil).
|
||||
Bind(control, nil).
|
||||
MakeService(&s.Service).
|
||||
Errors
|
||||
if err != nil {
|
||||
@@ -166,4 +166,4 @@ func (e SysApi) DeleteSysApi(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
e.OK(control.GetId(), "删除成功")
|
||||
}
|
||||
}
|
||||
@@ -291,4 +291,4 @@ func (e SysConfig) GetSysConfigByKEYForService(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
e.OK(control, s.Msg)
|
||||
}
|
||||
}
|
||||
@@ -247,4 +247,4 @@ func (e SysDept) GetDeptTreeRoleSelect(c *gin.Context) {
|
||||
"depts": result,
|
||||
"checkedKeys": menuIds,
|
||||
}, "")
|
||||
}
|
||||
}
|
||||
@@ -212,7 +212,7 @@ func (e SysDictData) GetSysDictDataAll(c *gin.Context) {
|
||||
d := &dto.SysDictDataSearch{}
|
||||
err := e.MakeContext(c).
|
||||
MakeOrm().
|
||||
Bind(d,binding.Form).
|
||||
Bind(d, binding.Form).
|
||||
MakeService(&s.Service).
|
||||
Errors
|
||||
if err != nil {
|
||||
|
||||
@@ -222,4 +222,4 @@ func (e SysDictType) GetSysDictTypeAll(c *gin.Context) {
|
||||
}
|
||||
|
||||
e.OK(list, "查询成功")
|
||||
}
|
||||
}
|
||||
@@ -90,4 +90,4 @@ func (e SysLoginLog) DeleteSysLoginLog(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
e.OK(control.GetId(), "删除成功")
|
||||
}
|
||||
}
|
||||
@@ -292,4 +292,4 @@ func (e SysMenu) GetMenuTreeSelect(c *gin.Context) {
|
||||
"menus": result,
|
||||
"checkedKeys": menuIds,
|
||||
}, "获取成功")
|
||||
}
|
||||
}
|
||||
@@ -89,4 +89,4 @@ func (e SysOperaLog) DeleteSysOperaLog(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
e.OK(req.GetId(), "删除成功")
|
||||
}
|
||||
}
|
||||
@@ -188,4 +188,4 @@ func (e SysPost) DeleteSysPost(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
e.OK(req.GetId(), "删除成功")
|
||||
}
|
||||
}
|
||||
@@ -555,4 +555,4 @@ func (e Gen) GenMenuAndApi(c *gin.Context) {
|
||||
//ADelete.Id, err = ADelete.Create(db)
|
||||
|
||||
e.OK("", "数据生成成功!")
|
||||
}
|
||||
}
|
||||
@@ -348,4 +348,4 @@ func (e *SysTable) DeleteSysTables(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
e.OK(nil, "删除成功")
|
||||
}
|
||||
}
|
||||
@@ -13,4 +13,4 @@ type CasbinRule struct {
|
||||
|
||||
func (CasbinRule) TableName() string {
|
||||
return "sys_casbin_rule"
|
||||
}
|
||||
}
|
||||
@@ -78,4 +78,4 @@ func DataScopes(tableName string, userId int) func(db *gorm.DB) *gorm.DB {
|
||||
}
|
||||
return db
|
||||
}
|
||||
}
|
||||
}
|
||||
+24
-24
@@ -9,29 +9,29 @@ import (
|
||||
)
|
||||
|
||||
type Menu struct {
|
||||
MenuId int `json:"menuId" gorm:"primaryKey;autoIncrement"`
|
||||
MenuName string `json:"menuName" gorm:"size:128;"`
|
||||
Title string `json:"title" gorm:"size:128;"`
|
||||
Icon string `json:"icon" gorm:"size:128;"`
|
||||
Path string `json:"path" gorm:"size:128;"`
|
||||
Paths string `json:"paths" gorm:"size:128;"`
|
||||
MenuType string `json:"menuType" gorm:"size:1;"`
|
||||
Action string `json:"action" gorm:"size:16;"`
|
||||
Permission string `json:"permission" gorm:"size:255;"`
|
||||
ParentId int `json:"parentId" gorm:"size:11;"`
|
||||
NoCache bool `json:"noCache" gorm:"size:8;"`
|
||||
Breadcrumb string `json:"breadcrumb" gorm:"size:255;"`
|
||||
Component string `json:"component" gorm:"size:255;"`
|
||||
Sort int `json:"sort" gorm:"size:4;"`
|
||||
Visible string `json:"visible" gorm:"size:1;"`
|
||||
CreateBy string `json:"createBy" gorm:"size:128;"`
|
||||
UpdateBy string `json:"updateBy" gorm:"size:128;"`
|
||||
IsFrame string `json:"isFrame" gorm:"size:1;DEFAULT:0;"`
|
||||
DataScope string `json:"dataScope" gorm:"-"`
|
||||
Params string `json:"params" gorm:"-"`
|
||||
RoleId int `gorm:"-"`
|
||||
Children []Menu `json:"children" gorm:"-"`
|
||||
IsSelect bool `json:"is_select" gorm:"-"`
|
||||
MenuId int `json:"menuId" gorm:"primaryKey;autoIncrement"`
|
||||
MenuName string `json:"menuName" gorm:"size:128;"`
|
||||
Title string `json:"title" gorm:"size:128;"`
|
||||
Icon string `json:"icon" gorm:"size:128;"`
|
||||
Path string `json:"path" gorm:"size:128;"`
|
||||
Paths string `json:"paths" gorm:"size:128;"`
|
||||
MenuType string `json:"menuType" gorm:"size:1;"`
|
||||
Action string `json:"action" gorm:"size:16;"`
|
||||
Permission string `json:"permission" gorm:"size:255;"`
|
||||
ParentId int `json:"parentId" gorm:"size:11;"`
|
||||
NoCache bool `json:"noCache" gorm:"size:8;"`
|
||||
Breadcrumb string `json:"breadcrumb" gorm:"size:255;"`
|
||||
Component string `json:"component" gorm:"size:255;"`
|
||||
Sort int `json:"sort" gorm:"size:4;"`
|
||||
Visible string `json:"visible" gorm:"size:1;"`
|
||||
CreateBy string `json:"createBy" gorm:"size:128;"`
|
||||
UpdateBy string `json:"updateBy" gorm:"size:128;"`
|
||||
IsFrame string `json:"isFrame" gorm:"size:1;DEFAULT:0;"`
|
||||
DataScope string `json:"dataScope" gorm:"-"`
|
||||
Params string `json:"params" gorm:"-"`
|
||||
RoleId int `gorm:"-"`
|
||||
Children []Menu `json:"children" gorm:"-"`
|
||||
IsSelect bool `json:"is_select" gorm:"-"`
|
||||
|
||||
models.ModelTime
|
||||
}
|
||||
@@ -159,4 +159,4 @@ func InitPaths(tx *gorm.DB, menu *Menu) (err error) {
|
||||
}
|
||||
tx.Table("sys_menu").Where("menu_id = ?", menu.MenuId).Update("paths", menu.Paths)
|
||||
return
|
||||
}
|
||||
}
|
||||
@@ -238,4 +238,4 @@ type MenuIdList struct {
|
||||
// }
|
||||
//
|
||||
// return true, nil
|
||||
//}
|
||||
//}
|
||||
@@ -8,4 +8,4 @@ type SysRoleDept struct {
|
||||
|
||||
func (SysRoleDept) TableName() string {
|
||||
return "sys_role_dept"
|
||||
}
|
||||
}
|
||||
@@ -168,4 +168,4 @@ func (rm *RoleMenu) Delete(tx *gorm.DB, RoleId string, MenuID string) (bool, err
|
||||
}
|
||||
return true, nil
|
||||
|
||||
}
|
||||
}
|
||||
@@ -27,4 +27,4 @@ func (e *SysConfig) Generate() models.ActiveRecord {
|
||||
|
||||
func (e *SysConfig) GetId() interface{} {
|
||||
return e.Id
|
||||
}
|
||||
}
|
||||
@@ -30,4 +30,4 @@ func (e *SysDept) Generate() models.ActiveRecord {
|
||||
|
||||
func (e *SysDept) GetId() interface{} {
|
||||
return e.DeptId
|
||||
}
|
||||
}
|
||||
@@ -32,4 +32,4 @@ func (e *SysDictData) Generate() models.ActiveRecord {
|
||||
|
||||
func (e *SysDictData) GetId() interface{} {
|
||||
return e.DictCode
|
||||
}
|
||||
}
|
||||
@@ -26,4 +26,4 @@ func (e *SysDictType) Generate() models.ActiveRecord {
|
||||
|
||||
func (e *SysDictType) GetId() interface{} {
|
||||
return e.ID
|
||||
}
|
||||
}
|
||||
@@ -69,4 +69,4 @@ func SaveLoginLog(message storage.Messager) (err error) {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
}
|
||||
@@ -63,4 +63,4 @@ func (e *SysMenu) Generate() models.ActiveRecord {
|
||||
|
||||
func (e *SysMenu) GetId() interface{} {
|
||||
return e.MenuId
|
||||
}
|
||||
}
|
||||
@@ -82,4 +82,4 @@ func SaveOperaLog(message storage.Messager) (err error) {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
}
|
||||
@@ -27,4 +27,4 @@ func (e *SysPost) Generate() models.ActiveRecord {
|
||||
|
||||
func (e *SysPost) GetId() interface{} {
|
||||
return e.PostId
|
||||
}
|
||||
}
|
||||
@@ -31,4 +31,4 @@ func (e *SysRole) Generate() models.ActiveRecord {
|
||||
|
||||
func (e *SysRole) GetId() interface{} {
|
||||
return e.RoleId
|
||||
}
|
||||
}
|
||||
@@ -74,4 +74,4 @@ func (e *SysUser) AfterFind(_ *gorm.DB) error {
|
||||
e.PostIds = []int{e.PostId}
|
||||
e.RoleIds = []int{e.RoleId}
|
||||
return nil
|
||||
}
|
||||
}
|
||||
@@ -21,4 +21,4 @@ func registerSysApiRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddlew
|
||||
r.GET("/:id", api.GetSysApi)
|
||||
r.PUT("/:id", api.UpdateSysApi)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -21,4 +21,4 @@ func registerSysLoginLogRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMi
|
||||
r.GET("/:id", api.GetSysLoginLog)
|
||||
r.DELETE("", api.DeleteSysLoginLog)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -20,4 +20,4 @@ func registerSysOperaLogRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMi
|
||||
r.GET("/:id", api.GetSysOperaLog)
|
||||
r.DELETE("", api.DeleteSysOperaLog)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -16,8 +16,8 @@ type SysApiSearch struct {
|
||||
}
|
||||
|
||||
type SysApiOrder struct {
|
||||
TitleOrder string `search:"type:order;column:title;table:sys_api" form:"titleOrder"`
|
||||
PathOrder string `search:"type:order;column:path;table:sys_api" form:"pathOrder"`
|
||||
TitleOrder string `search:"type:order;column:title;table:sys_api" form:"titleOrder"`
|
||||
PathOrder string `search:"type:order;column:path;table:sys_api" form:"pathOrder"`
|
||||
CreatedAtOrder string `search:"type:order;column:created_at;table:sys_api" form:"createdAtOrder"`
|
||||
}
|
||||
|
||||
@@ -25,7 +25,6 @@ func (m *SysApiSearch) GetNeedSearch() interface{} {
|
||||
return *m
|
||||
}
|
||||
|
||||
|
||||
type SysApiControl struct {
|
||||
Id int `uri:"id" comment:"编码"` // 编码
|
||||
Handle string `json:"handle" comment:"handle"`
|
||||
@@ -64,7 +63,6 @@ func (s *SysApiById) GetId() interface{} {
|
||||
return s.Id
|
||||
}
|
||||
|
||||
|
||||
func (s *SysApiById) Generate() dto.Control {
|
||||
o := *s
|
||||
return &o
|
||||
@@ -72,4 +70,4 @@ func (s *SysApiById) Generate() dto.Control {
|
||||
|
||||
func (s *SysApiById) GenerateM() (common.ActiveRecord, error) {
|
||||
return &models.SysApi{}, nil
|
||||
}
|
||||
}
|
||||
@@ -61,7 +61,7 @@ func (s *SysConfigControl) GetId() interface{} {
|
||||
|
||||
// GetSetSysConfigReq 增、改使用的结构体
|
||||
type GetSetSysConfigReq struct {
|
||||
ConfigKey string `json:"configKey" comment:""`
|
||||
ConfigKey string `json:"configKey" comment:""`
|
||||
ConfigValue string `json:"configValue" comment:""`
|
||||
}
|
||||
|
||||
@@ -69,6 +69,7 @@ type GetSetSysConfigReq struct {
|
||||
func (s *GetSetSysConfigReq) Generate(model *models.SysConfig) {
|
||||
model.ConfigValue = s.ConfigValue
|
||||
}
|
||||
|
||||
type UpdateSetSysConfigReq map[string]string
|
||||
|
||||
// SysConfigByKeyReq 根据Key获取配置
|
||||
@@ -98,4 +99,4 @@ func (s *SysConfigById) GetId() interface{} {
|
||||
return s.Ids
|
||||
}
|
||||
return s.Id
|
||||
}
|
||||
}
|
||||
@@ -99,7 +99,6 @@ func (s *SysDeptById) GetId() interface{} {
|
||||
return s.Id
|
||||
}
|
||||
|
||||
|
||||
func (s *SysDeptById) GenerateM() (*models.SysDept, error) {
|
||||
return &models.SysDept{}, nil
|
||||
}
|
||||
@@ -108,4 +107,4 @@ type DeptLabel struct {
|
||||
Id int `gorm:"-" json:"id"`
|
||||
Label string `gorm:"-" json:"label"`
|
||||
Children []DeptLabel `gorm:"-" json:"children"`
|
||||
}
|
||||
}
|
||||
@@ -106,4 +106,4 @@ func (s *SysDictDataById) Generate() dto.Control {
|
||||
|
||||
func (s *SysDictDataById) GenerateM() (common.ActiveRecord, error) {
|
||||
return &models.SysDictData{}, nil
|
||||
}
|
||||
}
|
||||
@@ -83,4 +83,4 @@ func (s *SysDictTypeById) GetId() interface{} {
|
||||
|
||||
func (s *SysDictTypeById) GenerateM() (common.ActiveRecord, error) {
|
||||
return &models.SysDictType{}, nil
|
||||
}
|
||||
}
|
||||
@@ -115,4 +115,4 @@ func (s *SysLoginLogById) Generate() *SysLoginLogById {
|
||||
|
||||
func (s *SysLoginLogById) GenerateM() (*models.SysLoginLog, error) {
|
||||
return &models.SysLoginLog{}, nil
|
||||
}
|
||||
}
|
||||
@@ -24,7 +24,6 @@ func (m *SysMenuSearch) GetNeedSearch() interface{} {
|
||||
return *m
|
||||
}
|
||||
|
||||
|
||||
// SysMenuControl 增、改使用的结构体
|
||||
type SysMenuControl struct {
|
||||
MenuId int `uri:"id" comment:"编码"` // 编码
|
||||
@@ -97,7 +96,6 @@ type SysMenuById struct {
|
||||
common.ControlBy
|
||||
}
|
||||
|
||||
|
||||
func (s *SysMenuById) Generate() *SysMenuById {
|
||||
cp := *s
|
||||
return &cp
|
||||
@@ -128,4 +126,4 @@ type MenuRole struct {
|
||||
|
||||
type SelectRole struct {
|
||||
RoleId int `uri:"roleId"`
|
||||
}
|
||||
}
|
||||
@@ -120,4 +120,4 @@ func (s *SysOperaLogById) Bind(ctx *gin.Context) error {
|
||||
|
||||
func (s *SysOperaLogById) SetUpdateBy(id int) {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -31,7 +31,7 @@ type SysRoleOrder struct {
|
||||
RoleIdOrder string `search:"type:order;column:role_id;table:sys_role" form:"roleIdOrder"`
|
||||
RoleNameOrder string `search:"type:order;column:role_name;table:sys_role" form:"roleNameOrder"`
|
||||
RoleSortOrder string `search:"type:order;column:role_sort;table:sys_role" form:"usernameOrder"`
|
||||
StatusOrder string `search:"type:order;column:status;table:sys_role" form:"statusOrder"`
|
||||
StatusOrder string `search:"type:order;column:status;table:sys_role" form:"statusOrder"`
|
||||
CreatedAtOrder string `search:"type:order;column:created_at;table:sys_role" form:"createdAtOrder"`
|
||||
}
|
||||
|
||||
@@ -147,4 +147,4 @@ type RoleDataScopeReq struct {
|
||||
|
||||
type DeptIdList struct {
|
||||
DeptId int `json:"DeptId"`
|
||||
}
|
||||
}
|
||||
@@ -89,4 +89,4 @@ func (s *SysSettingById) Bind(ctx *gin.Context) error {
|
||||
|
||||
func (s *SysSettingById) GenerateM() (*models.SysSetting, error) {
|
||||
return &models.SysSetting{}, nil
|
||||
}
|
||||
}
|
||||
@@ -25,7 +25,7 @@ type SysUserSearch struct {
|
||||
type SysUserOrder struct {
|
||||
UserIdOrder string `search:"type:order;column:user_id;table:sys_user" form:"userIdOrder"`
|
||||
UsernameOrder string `search:"type:order;column:username;table:sys_user" form:"usernameOrder"`
|
||||
StatusOrder string `search:"type:order;column:status;table:sys_user" form:"statusOrder"`
|
||||
StatusOrder string `search:"type:order;column:status;table:sys_user" form:"statusOrder"`
|
||||
CreatedAtOrder string `search:"type:order;column:created_at;table:sys_user" form:"createdAtOrder"`
|
||||
}
|
||||
|
||||
@@ -93,4 +93,4 @@ func (s *SysUserById) GenerateM() (common.ActiveRecord, error) {
|
||||
type PassWord struct {
|
||||
NewPassword string `json:"newPassword" binding:"required"`
|
||||
OldPassword string `json:"oldPassword" binding:"required"`
|
||||
}
|
||||
}
|
||||
@@ -107,4 +107,4 @@ func (e *SysApi) RemoveSysApi(d *dto.SysApiById, p *actions.DataPermission) erro
|
||||
return errors.New("无权删除该数据")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
}
|
||||
@@ -138,16 +138,14 @@ func (e *SysConfig) UpdateSetSysConfig(c *[]dto.GetSetSysConfigReq) error {
|
||||
for _, req := range m {
|
||||
var data models.SysConfig
|
||||
if err := e.Orm.Where("config_key = ?", req.ConfigKey).
|
||||
First(&data).Error;
|
||||
err != nil {
|
||||
First(&data).Error; err != nil {
|
||||
e.Log.Errorf("Service GetSysConfigPage error:%s", err)
|
||||
return err
|
||||
}
|
||||
if data.ConfigValue != req.ConfigValue {
|
||||
data.ConfigValue = req.ConfigValue
|
||||
|
||||
if err := e.Orm.Save(&data).Error;
|
||||
err != nil {
|
||||
if err := e.Orm.Save(&data).Error; err != nil {
|
||||
e.Log.Errorf("Service GetSysConfigPage error:%s", err)
|
||||
return err
|
||||
}
|
||||
@@ -188,4 +186,4 @@ func (e *SysConfig) GetSysConfigByKEY(c *dto.SysConfigByKeyReq) error {
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
}
|
||||
@@ -282,4 +282,4 @@ func digitDeptLabel(deptList *[]models.SysDept, dept dto.DeptLabel) dto.DeptLabe
|
||||
}
|
||||
dept.Children = min
|
||||
return dept
|
||||
}
|
||||
}
|
||||
@@ -118,4 +118,4 @@ func (e *SysDictData) GetAll(c *dto.SysDictDataSearch, list *[]models.SysDictDat
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
}
|
||||
@@ -116,4 +116,4 @@ func (e *SysDictType) GetAll(c *dto.SysDictTypeSearch, list *[]models.SysDictTyp
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,7 @@ package service
|
||||
|
||||
import (
|
||||
"errors"
|
||||
|
||||
|
||||
"go-admin/app/admin/models"
|
||||
"go-admin/app/admin/service/dto"
|
||||
cDto "go-admin/common/dto"
|
||||
@@ -97,4 +97,4 @@ func (e *SysOperaLog) RemoveSysOperaLog(d *dto.SysOperaLogById) error {
|
||||
return errors.New("无权删除该数据")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
}
|
||||
@@ -103,4 +103,4 @@ func (e *SysPost) RemoveSysPost(d *dto.SysPostById) error {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
}
|
||||
@@ -224,4 +224,4 @@ func (e *SysRole) UpdateDataScope(c *models.SysRole) (err error) {
|
||||
}
|
||||
}
|
||||
return err
|
||||
}
|
||||
}
|
||||
@@ -110,4 +110,4 @@ func (e *SysRoleMenu) GetIDS(tx *gorm.DB, roleName string) ([]models.MenuPath, e
|
||||
return nil, err
|
||||
}
|
||||
return r, nil
|
||||
}
|
||||
}
|
||||
@@ -49,4 +49,4 @@ func (e *SysSetting) UpdateSysSetting(c *models.SysSetting) error {
|
||||
|
||||
}
|
||||
return nil
|
||||
}
|
||||
}
|
||||
@@ -176,4 +176,4 @@ func (e *SysUser) GetSysUserProfile(c *dto.SysUserById, user *models.SysUser, ro
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
}
|
||||
@@ -30,4 +30,4 @@ func (e *SysContent) Generate() models.ActiveRecord {
|
||||
|
||||
func (e *SysContent) GetId() interface{} {
|
||||
return e.Id
|
||||
}
|
||||
}
|
||||
@@ -37,4 +37,4 @@ func InitRouter() {
|
||||
// 注册业务路由
|
||||
// TODO: 这里可存放业务路由,里边并无实际路由只有演示代码
|
||||
initRouter(r, authMiddleware)
|
||||
}
|
||||
}
|
||||
@@ -28,4 +28,4 @@ func registerSysContentRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMid
|
||||
r.PUT("/:id", actions.PermissionAction(), actions.UpdateAction(new(dto.SysContentControl)))
|
||||
r.DELETE("", actions.PermissionAction(), actions.DeleteAction(new(dto.SysContentById)))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -91,4 +91,4 @@ func (s *SysContentById) Generate() dto.Control {
|
||||
|
||||
func (s *SysContentById) GenerateM() (common.ActiveRecord, error) {
|
||||
return &models.SysContent{}, nil
|
||||
}
|
||||
}
|
||||
@@ -71,4 +71,4 @@ func (e SysJob) StartJobForService(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
e.OK(nil, s.Msg)
|
||||
}
|
||||
}
|
||||
@@ -37,4 +37,4 @@ func InitRouter() {
|
||||
// 注册业务路由
|
||||
// TODO: 这里可存放业务路由,里边并无实际路由只有演示代码
|
||||
initRouter(r, authMiddleware)
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,5 @@
|
||||
package router
|
||||
|
||||
|
||||
import (
|
||||
"github.com/gin-gonic/gin"
|
||||
jwt "github.com/go-admin-team/go-admin-core/sdk/pkg/jwtauth"
|
||||
@@ -40,4 +39,4 @@ func checkRoleRouter(r *gin.Engine, authMiddleware *jwt.GinJWTMiddleware) {
|
||||
for _, f := range routerCheckRole {
|
||||
f(v1, authMiddleware)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -35,4 +35,4 @@ func registerSysJobRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddlew
|
||||
|
||||
v1.GET("/job/remove/:id", sysJob.RemoveJobForService)
|
||||
v1.GET("/job/start/:id", sysJob.StartJobForService)
|
||||
}
|
||||
}
|
||||
@@ -84,4 +84,4 @@ func (e *SysJob) StartJob(c *dto.GeneralGetDto) error {
|
||||
e.Log.Errorf("db error: %s", err)
|
||||
}
|
||||
return err
|
||||
}
|
||||
}
|
||||
@@ -200,4 +200,4 @@ func ossUpload(name string, path string) error {
|
||||
func qiniuUpload(name string, path string) error {
|
||||
oss := file_store.ALiYunOSS{}
|
||||
return oss.UpLoad(name, path)
|
||||
}
|
||||
}
|
||||
@@ -192,4 +192,4 @@ func (e SysChinaAreaData) DeleteSysChinaAreaData(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
e.OK(control.GetId(), "删除成功")
|
||||
}
|
||||
}
|
||||
@@ -195,4 +195,4 @@ func (e SysFileDir) DeleteSysFileDir(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
e.OK(control.Id, "删除成功")
|
||||
}
|
||||
}
|
||||
@@ -206,4 +206,4 @@ func (e SysFileInfo) DeleteSysFileInfo(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
e.OK(control.Id, "删除成功")
|
||||
}
|
||||
}
|
||||
@@ -73,4 +73,4 @@ func (e ServerMonitor) ServerInfo(c *gin.Context) {
|
||||
"cpu": cpuDic,
|
||||
"disk": diskDic,
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -6,8 +6,8 @@ import (
|
||||
|
||||
type SysChinaAreaData struct {
|
||||
models.Model
|
||||
PId string `json:"p_id" gorm:"size:11;comment:上级编码"`
|
||||
Name string `json:"name" gorm:"size:128;comment:名称"`
|
||||
PId string `json:"p_id" gorm:"size:11;comment:上级编码"`
|
||||
Name string `json:"name" gorm:"size:128;comment:名称"`
|
||||
models.ControlBy
|
||||
models.ModelTime
|
||||
}
|
||||
@@ -23,4 +23,4 @@ func (e *SysChinaAreaData) Generate() models.ActiveRecord {
|
||||
|
||||
func (e *SysChinaAreaData) GetId() interface{} {
|
||||
return e.Id
|
||||
}
|
||||
}
|
||||
@@ -6,12 +6,12 @@ import (
|
||||
|
||||
type SysFileInfo struct {
|
||||
models.Model
|
||||
Type string `json:"type" gorm:"size:255;comment:类型"` //
|
||||
Name string `json:"name" gorm:"size:255;comment:名称"` //
|
||||
Size string `json:"size" gorm:"size:11;comment:大小"` //
|
||||
PId int `json:"p_id" gorm:"size:11;comment:目录"` //
|
||||
Source string `json:"source" gorm:"size:255;comment:来源"` //
|
||||
Url string `json:"url" gorm:"size:255;comment:地址"` //
|
||||
Type string `json:"type" gorm:"size:255;comment:类型"` //
|
||||
Name string `json:"name" gorm:"size:255;comment:名称"` //
|
||||
Size string `json:"size" gorm:"size:11;comment:大小"` //
|
||||
PId int `json:"p_id" gorm:"size:11;comment:目录"` //
|
||||
Source string `json:"source" gorm:"size:255;comment:来源"` //
|
||||
Url string `json:"url" gorm:"size:255;comment:地址"` //
|
||||
FullUrl string `json:"full_url" gorm:"size:255;comment:全地址"` //
|
||||
models.ControlBy
|
||||
models.ModelTime
|
||||
|
||||
@@ -13,4 +13,4 @@ func init() {
|
||||
func registerFileRouter(v1 *gin.RouterGroup) {
|
||||
var api = apis.File{}
|
||||
v1.POST("/public/uploadFile", api.UploadFile)
|
||||
}
|
||||
}
|
||||
@@ -37,4 +37,4 @@ func InitRouter() {
|
||||
// 注册业务路由
|
||||
// TODO: 这里可存放业务路由,里边并无实际路由只有演示代码
|
||||
initRouter(r, authMiddleware)
|
||||
}
|
||||
}
|
||||
@@ -22,4 +22,4 @@ func registerMonitorRouter(v1 *gin.RouterGroup) {
|
||||
c.Status(http.StatusOK)
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -39,4 +39,4 @@ func checkRoleRouter(r *gin.Engine, authMiddleware *jwt.GinJWTMiddleware) {
|
||||
for _, f := range routerCheckRole {
|
||||
f(v1, authMiddleware)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -18,4 +18,4 @@ func registerSysServerMonitorRouter(v1 *gin.RouterGroup, authMiddleware *jwt.Gin
|
||||
{
|
||||
r.GET("", api.ServerInfo)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -55,9 +55,9 @@ func (s *SysChinaAreaDataControl) Bind(ctx *gin.Context) error {
|
||||
|
||||
func (s *SysChinaAreaDataControl) Generate() (*models2.SysChinaAreaData, error) {
|
||||
return &models2.SysChinaAreaData{
|
||||
Model: common.Model{Id: s.Id},
|
||||
PId: s.PId,
|
||||
Name: s.Name,
|
||||
Model: common.Model{Id: s.Id},
|
||||
PId: s.PId,
|
||||
Name: s.Name,
|
||||
}, nil
|
||||
}
|
||||
|
||||
@@ -94,4 +94,4 @@ func (s *SysChinaAreaDataById) Bind(ctx *gin.Context) error {
|
||||
|
||||
func (s *SysChinaAreaDataById) SetUpdateBy(id int) {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -103,4 +103,4 @@ func (e *SysChinaAreaData) RemoveSysChinaAreaData(d *dto.SysChinaAreaDataById, p
|
||||
return errors.New("无权删除该数据")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
}
|
||||
@@ -165,4 +165,4 @@ func SysFileDirCall(list *[]models.SysFileDir, m models.SysFileDir) models.SysFi
|
||||
}
|
||||
|
||||
return m
|
||||
}
|
||||
}
|
||||
@@ -123,4 +123,4 @@ func (e *SysFileInfo) RemoveSysFileInfo(d *dto.SysFileInfoById, p *actions.DataP
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -5,4 +5,4 @@ import "go-admin/app/cms/router"
|
||||
func init() {
|
||||
//注册路由 fixme 其他应用的路由,在本目录新建文件放在init方法
|
||||
AppRouters = append(AppRouters, router.InitRouter)
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -5,4 +5,4 @@ import "go-admin/app/jobs/router"
|
||||
func init() {
|
||||
//注册路由 fixme 其他应用的路由,在本目录新建文件放在init方法
|
||||
AppRouters = append(AppRouters, router.InitRouter)
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -5,4 +5,4 @@ import "go-admin/app/other/router"
|
||||
func init() {
|
||||
//注册路由 fixme 其他应用的路由,在本目录新建文件放在init方法
|
||||
AppRouters = append(AppRouters, router.InitRouter)
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -52,4 +52,4 @@ func Execute() {
|
||||
if err := rootCmd.Execute(); err != nil {
|
||||
os.Exit(-1)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -27,4 +27,4 @@ func (e *SysApi) Generate() models.ActiveRecord {
|
||||
|
||||
func (e *SysApi) GetId() interface{} {
|
||||
return e.Id
|
||||
}
|
||||
}
|
||||
@@ -26,4 +26,4 @@ type SysMenu struct {
|
||||
|
||||
func (SysMenu) TableName() string {
|
||||
return "sys_menu"
|
||||
}
|
||||
}
|
||||
@@ -34,4 +34,4 @@ type SysTables struct {
|
||||
|
||||
func (SysTables) TableName() string {
|
||||
return "sys_tables"
|
||||
}
|
||||
}
|
||||
@@ -4595,7 +4595,7 @@ func _1614270163879Test(db *gorm.DB, version string) error {
|
||||
"820007": "路氹填海區",
|
||||
"820008": "聖方濟各堂區"
|
||||
}
|
||||
}` )
|
||||
}`)
|
||||
return db.Transaction(func(tx *gorm.DB) error {
|
||||
|
||||
err := tx.Migrator().AutoMigrate(models.SysChinaAreaData{})
|
||||
@@ -4617,7 +4617,7 @@ func _1614270163879Test(db *gorm.DB, version string) error {
|
||||
fmt.Println(k, k1, v1)
|
||||
var id = 0
|
||||
id, _ = pkg.StringToInt(k1)
|
||||
list = append(list, models.SysChinaAreaData{PId: k, Model: common.Model{Id: id}, Name: v1.(string),ModelTime:common.ModelTime{CreatedAt: time.Now(),UpdatedAt: time.Now()}})
|
||||
list = append(list, models.SysChinaAreaData{PId: k, Model: common.Model{Id: id}, Name: v1.(string), ModelTime: common.ModelTime{CreatedAt: time.Now(), UpdatedAt: time.Now()}})
|
||||
}
|
||||
}
|
||||
err = tx.Create(list).Error
|
||||
@@ -4629,4 +4629,4 @@ func _1614270163879Test(db *gorm.DB, version string) error {
|
||||
Version: version,
|
||||
}).Error
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -47,4 +47,4 @@ func _1599190683659Tables(db *gorm.DB, version string) error {
|
||||
return db.Create(&common.Migration{
|
||||
Version: version,
|
||||
}).Error
|
||||
}
|
||||
}
|
||||
@@ -46,4 +46,4 @@ func CreateAction(control dto.Control) gin.HandlerFunc {
|
||||
response.OK(c, object.GetId(), "创建成功")
|
||||
c.Next()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -62,4 +62,4 @@ func setupSimpleDatabase(host string, c *toolsConfig.Database) {
|
||||
|
||||
sdk.Runtime.SetDb(host, db)
|
||||
sdk.Runtime.SetCasbin(host, e)
|
||||
}
|
||||
}
|
||||
@@ -71,4 +71,4 @@ type Field struct {
|
||||
|
||||
type Style struct {
|
||||
Width string `json:"width"`
|
||||
}
|
||||
}
|
||||
@@ -52,4 +52,4 @@ func (e *ALiYunOSS) UpLoad(yourObjectName string, localFile string) error {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
}
|
||||
@@ -9,4 +9,4 @@ var (
|
||||
Source string
|
||||
Driver string
|
||||
DBName string
|
||||
)
|
||||
)
|
||||
@@ -4,4 +4,4 @@ const (
|
||||
LoginLog = "login_log_queue"
|
||||
OperateLog = "operate_log_queue"
|
||||
ApiCheck = "api_check_queue"
|
||||
)
|
||||
)
|
||||
@@ -177,4 +177,4 @@ func Unauthorized(c *gin.Context, code int, message string) {
|
||||
"code": code,
|
||||
"msg": message,
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -39,7 +39,7 @@ func LoggerToFile() gin.HandlerFunc {
|
||||
}
|
||||
rb, _ := ioutil.ReadAll(bf)
|
||||
c.Request.Body = ioutil.NopCloser(bytes.NewBuffer(rb))
|
||||
body =string(rb)
|
||||
body = string(rb)
|
||||
}
|
||||
|
||||
c.Next()
|
||||
@@ -53,7 +53,6 @@ func LoggerToFile() gin.HandlerFunc {
|
||||
if c.Request.Method == http.MethodOptions {
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
rt, bl := c.Get("result")
|
||||
var result = ""
|
||||
@@ -129,4 +128,4 @@ func SetDBOperLog(c *gin.Context, clientIP string, statusCode int, reqUri string
|
||||
log.Errorf("Append message error, %s", err.Error())
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -10,7 +10,7 @@ import (
|
||||
"github.com/go-admin-team/go-admin-core/sdk/pkg/response"
|
||||
)
|
||||
|
||||
//权限检查中间件
|
||||
// AuthCheckRole 权限检查中间件
|
||||
func AuthCheckRole() gin.HandlerFunc {
|
||||
return func(c *gin.Context) {
|
||||
log := api.GetRequestLogger(c)
|
||||
|
||||
+1
-1
@@ -13,4 +13,4 @@ type Extend struct {
|
||||
|
||||
type Demo struct {
|
||||
Name string
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user