format🥚 代码格式化
This commit is contained in:
1 parent
a7cc943b8e
commit
a54d4ba0c1
17 files changed
+49
-57
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 {
|
||||
|
||||
@@ -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 {
|
||||
|
||||
+23
-23
@@ -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
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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获取配置
|
||||
|
||||
@@ -99,7 +99,6 @@ func (s *SysDeptById) GetId() interface{} {
|
||||
return s.Id
|
||||
}
|
||||
|
||||
|
||||
func (s *SysDeptById) GenerateM() (*models.SysDept, error) {
|
||||
return &models.SysDept{}, 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
|
||||
|
||||
@@ -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"`
|
||||
}
|
||||
|
||||
|
||||
@@ -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"`
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package router
|
||||
|
||||
|
||||
import (
|
||||
"github.com/gin-gonic/gin"
|
||||
jwt "github.com/go-admin-team/go-admin-core/sdk/pkg/jwtauth"
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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()
|
||||
@@ -54,7 +54,6 @@ func LoggerToFile() gin.HandlerFunc {
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
rt, bl := c.Get("result")
|
||||
var result = ""
|
||||
if bl {
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in new issue
Block a user