format🥚 代码格式化

This commit is contained in:
zhangwenjian committed 2021-05-31 18:10:23 +08:00
1 parent a7cc943b8e
commit a54d4ba0c1
96 files changed
+143 -151

No files matched your search

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