format🥚 代码格式化

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

No files matched your search

+2 -2
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 {
+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 {
-2
View File
@@ -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
+1
View File
@@ -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获取配置
-1
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
} }
-2
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
+2 -4
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
} }
-1
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"
@@ -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
+1 -2
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()
@@ -54,7 +54,6 @@ func LoggerToFile() gin.HandlerFunc {
return return
} }
rt, bl := c.Get("result") rt, bl := c.Get("result")
var result = "" var result = ""
if bl { if bl {
+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)