Browse Source

修复 go fmt 问题

main
Leonard Wang 5 years ago
parent
commit
de757504cc
  1. 10
      server/api/v1/sys_auto_code.go
  2. 10
      server/api/v1/sys_work_flow.go
  3. 4
      server/config/config.go
  4. 4
      server/global/response/response.go
  5. 2
      server/model/exa_breakpoint_continue.go
  6. 2
      server/model/exa_customer.go
  7. 2
      server/model/exa_file_upload_download.go
  8. 2
      server/model/request/jwt.go
  9. 2
      server/model/request/sys_menu.go
  10. 2
      server/model/request/sys_user.go
  11. 2
      server/model/response/exa_breakpoint_continue.go
  12. 2
      server/model/sys_api.go
  13. 2
      server/model/sys_authority.go
  14. 2
      server/model/sys_authority_menu.go
  15. 2
      server/model/sys_casbin.go
  16. 2
      server/model/sys_jwt_blacklist.go
  17. 2
      server/model/sys_system.go
  18. 2
      server/model/sys_user.go
  19. 2
      server/model/sys_workflow.go
  20. 4
      server/router/exp_customer.go
  21. 30
      server/service/sys_menu.go

10
server/api/v1/sys_auto_code.go

@ -23,13 +23,13 @@ func CreateTemp(c *gin.Context) {
var a model.AutoCodeStruct
_ = c.ShouldBindJSON(&a)
AutoCodeVerify := utils.Rules{
"Abbreviation": {utils.NotEmpty()},
"StructName": {utils.NotEmpty()},
"PackageName": {utils.NotEmpty()},
"Fields": {utils.NotEmpty()},
"Abbreviation": {utils.NotEmpty()},
"StructName": {utils.NotEmpty()},
"PackageName": {utils.NotEmpty()},
"Fields": {utils.NotEmpty()},
}
WKVerifyErr := utils.Verify(a, AutoCodeVerify)
if WKVerifyErr!=nil {
if WKVerifyErr != nil {
response.FailWithMessage(WKVerifyErr.Error(), c)
return
}

10
server/api/v1/sys_work_flow.go

@ -19,13 +19,13 @@ func CreateWorkFlow(c *gin.Context) {
var wk model.SysWorkflow
_ = c.ShouldBindJSON(&wk)
WKVerify := utils.Rules{
"WorkflowNickName": {utils.NotEmpty()},
"WorkflowName": {utils.NotEmpty()},
"WorkflowDescription": {utils.NotEmpty()},
"WorkflowStepInfo": {utils.NotEmpty()},
"WorkflowNickName": {utils.NotEmpty()},
"WorkflowName": {utils.NotEmpty()},
"WorkflowDescription": {utils.NotEmpty()},
"WorkflowStepInfo": {utils.NotEmpty()},
}
WKVerifyErr := utils.Verify(wk, WKVerify)
if WKVerifyErr!=nil {
if WKVerifyErr != nil {
response.FailWithMessage(WKVerifyErr.Error(), c)
return
}

4
server/config/config.go

@ -46,8 +46,8 @@ type Redis struct {
type Qiniu struct {
AccessKey string `mapstructure:"access-key" json:"accessKey" yaml:"access-key"`
SecretKey string `mapstructure:"secret-key" json:"secretKey" yaml:"secret-key"`
Bucket string `mapstructure:"bucket" json:"bucket" yaml:"bucket"`
ImgPath string `mapstructure:"img-path" json:"imgPath" yaml:"img-path"`
Bucket string `mapstructure:"bucket" json:"bucket" yaml:"bucket"`
ImgPath string `mapstructure:"img-path" json:"imgPath" yaml:"img-path"`
}
type Captcha struct {

4
server/global/response/response.go

@ -50,5 +50,5 @@ func FailWithMessage(message string, c *gin.Context) {
}
func FailWithDetailed(code int, data interface{}, message string, c *gin.Context) {
Result(code, data, message, c )
}
Result(code, data, message, c)
}

2
server/model/exa_breakpoint_continue.go

@ -21,4 +21,4 @@ type ExaFileChunk struct {
ExaFileId uint
FileChunkNumber int
FileChunkPath string
}
}

2
server/model/exa_customer.go

@ -11,4 +11,4 @@ type ExaCustomer struct {
SysUserID uint `json:"sysUserId" form:"sysUserId"`
SysUserAuthorityID string `json:"sysUserAuthorityID" form:"sysUserAuthorityID"`
SysUser SysUser `json:"sysUser" form:"sysUser"`
}
}

2
server/model/exa_file_upload_download.go

@ -10,4 +10,4 @@ type ExaFileUploadAndDownload struct {
Url string `json:"url"`
Tag string `json:"tag"`
Key string `json:"key"`
}
}

2
server/model/request/jwt.go

@ -12,4 +12,4 @@ type CustomClaims struct {
NickName string
AuthorityId string
jwt.StandardClaims
}
}

2
server/model/request/sys_menu.go

@ -11,4 +11,4 @@ type AddMenuAuthorityInfo struct {
// Get role by id structure
type AuthorityIdInfo struct {
AuthorityId string
}
}

2
server/model/request/sys_user.go

@ -30,4 +30,4 @@ type ChangePasswordStruct struct {
type SetUserAuth struct {
UUID uuid.UUID `json:"uuid"`
AuthorityId string `json:"authorityId"`
}
}

2
server/model/response/exa_breakpoint_continue.go

@ -8,4 +8,4 @@ type FilePathResponse struct {
type FileResponse struct {
File model.ExaFile `json:"file"`
}
}

2
server/model/sys_api.go

@ -10,4 +10,4 @@ type SysApi struct {
Description string `json:"description"`
ApiGroup string `json:"apiGroup"`
Method string `json:"method" gorm:"default:'POST'"`
}
}

2
server/model/sys_authority.go

@ -14,4 +14,4 @@ type SysAuthority struct {
DataAuthorityId []SysAuthority `json:"dataAuthorityId" gorm:"many2many:sys_data_authority_id;association_jointable_foreignkey:data_authority_id"`
Children []SysAuthority `json:"children"`
SysBaseMenus []SysBaseMenu `json:"menus" gorm:"many2many:sys_authority_menus;"`
}
}

2
server/model/sys_authority_menu.go

@ -5,4 +5,4 @@ type SysMenu struct {
MenuId string `json:"menuId"`
AuthorityId string `json:"-"`
Children []SysMenu `json:"children"`
}
}

2
server/model/sys_casbin.go

@ -6,4 +6,4 @@ type CasbinModel struct {
AuthorityId string `json:"rolename" gorm:"column:v0"`
Path string `json:"path" gorm:"column:v1"`
Method string `json:"method" gorm:"column:v2"`
}
}

2
server/model/sys_jwt_blacklist.go

@ -7,4 +7,4 @@ import (
type JwtBlacklist struct {
gorm.Model
Jwt string `gorm:"type:text"`
}
}

2
server/model/sys_system.go

@ -7,4 +7,4 @@ import (
//配置文件结构体
type System struct {
Config config.Server
}
}

2
server/model/sys_user.go

@ -14,4 +14,4 @@ type SysUser struct {
HeaderImg string `json:"headerImg" gorm:"default:'http://www.henrongyi.top/avatar/lufu.jpg'"`
Authority SysAuthority `json:"authority" gorm:"ForeignKey:AuthorityId;AssociationForeignKey:AuthorityId"`
AuthorityId string `json:"authorityId" gorm:"default:888"`
}
}

2
server/model/sys_workflow.go

@ -22,4 +22,4 @@ type SysWorkflowStepInfo struct {
StepNo float64 `json:"stepNo"` // 步骤id (第几步)
StepAuthorityID string `json:"stepAuthorityID"` // 操作者级别id
IsEnd bool `json:"isEnd"` // 是否是完结流节点
}
}

4
server/router/exp_customer.go

@ -9,8 +9,8 @@ import (
func InitCustomerRouter(Router *gin.RouterGroup) {
ApiRouter := Router.Group("customer").Use(middleware.JWTAuth()).Use(middleware.CasbinHandler())
{
ApiRouter.POST("customer", v1.CreateExaCustomer) // 创建客户
ApiRouter.PUT("customer", v1.UpdateExaCustomer) // 更新客户
ApiRouter.POST("customer", v1.CreateExaCustomer) // 创建客户
ApiRouter.PUT("customer", v1.UpdateExaCustomer) // 更新客户
ApiRouter.DELETE("customer", v1.DeleteExaCustomer) // 删除客户
ApiRouter.GET("customer", v1.GetExaCustomer) // 获取单一客户信息
ApiRouter.GET("customerList", v1.GetExaCustomerList) // 获取客户列表

30
server/service/sys_menu.go

@ -13,15 +13,15 @@ import (
// @return err error
// @return menusMsp map{string}[]SysBaseMenu
func getMenuTreeMap(authorityId string)(err error,treeMap map[string][]model.SysMenu){
func getMenuTreeMap(authorityId string) (err error, treeMap map[string][]model.SysMenu) {
var allMenus []model.SysMenu
treeMap = make(map[string][]model.SysMenu)
sql := "SELECT authority_menu.keep_alive,authority_menu.default_menu,authority_menu.created_at,authority_menu.updated_at,authority_menu.deleted_at,authority_menu.menu_level,authority_menu.parent_id,authority_menu.path,authority_menu.`name`,authority_menu.hidden,authority_menu.component,authority_menu.title,authority_menu.icon,authority_menu.sort,authority_menu.menu_id,authority_menu.authority_id FROM authority_menu WHERE authority_menu.authority_id = ? ORDER BY authority_menu.sort ASC"
err = global.GVA_DB.Raw(sql,authorityId).Scan(&allMenus).Error
for _,v := range allMenus{
err = global.GVA_DB.Raw(sql, authorityId).Scan(&allMenus).Error
for _, v := range allMenus {
treeMap[v.ParentId] = append(treeMap[v.ParentId], v)
}
return err,treeMap
return err, treeMap
}
// @title GetMenuTree
@ -32,7 +32,7 @@ func getMenuTreeMap(authorityId string)(err error,treeMap map[string][]model.Sys
// @return menus []model.SysMenu
func GetMenuTree(authorityId string) (err error, menus []model.SysMenu) {
err,menuTree := getMenuTreeMap(authorityId)
err, menuTree := getMenuTreeMap(authorityId)
menus = menuTree["0"]
for i := 0; i < len(menus); i++ {
err = getChildrenList(&menus[i], menuTree)
@ -47,7 +47,7 @@ func GetMenuTree(authorityId string) (err error, menus []model.SysMenu) {
// @param sql string
// @return err error
func getChildrenList(menu *model.SysMenu,treeMap map[string][]model.SysMenu) (err error) {
func getChildrenList(menu *model.SysMenu, treeMap map[string][]model.SysMenu) (err error) {
menu.Children = treeMap[menu.MenuId]
for i := 0; i < len(menu.Children); i++ {
err = getChildrenList(&menu.Children[i], treeMap)
@ -65,10 +65,10 @@ func getChildrenList(menu *model.SysMenu,treeMap map[string][]model.SysMenu) (er
func GetInfoList() (err error, list interface{}, total int) {
var menuList []model.SysBaseMenu
err,treeMap := getBaseMenuTreeMap()
err, treeMap := getBaseMenuTreeMap()
menuList = treeMap["0"]
for i := 0; i < len(menuList); i++ {
err = getBaseChildrenList(&menuList[i],treeMap)
err = getBaseChildrenList(&menuList[i], treeMap)
}
return err, menuList, total
}
@ -79,10 +79,10 @@ func GetInfoList() (err error, list interface{}, total int) {
// @param menu *model.SysBaseMenu
// @return err error
func getBaseChildrenList(menu *model.SysBaseMenu ,treeMap map[string][]model.SysBaseMenu) (err error) {
func getBaseChildrenList(menu *model.SysBaseMenu, treeMap map[string][]model.SysBaseMenu) (err error) {
menu.Children = treeMap[strconv.Itoa(int(menu.ID))]
for i := 0; i < len(menu.Children); i++ {
err = getBaseChildrenList(&menu.Children[i],treeMap)
err = getBaseChildrenList(&menu.Children[i], treeMap)
}
return err
}
@ -110,14 +110,14 @@ func AddBaseMenu(menu model.SysBaseMenu) (err error) {
// @return err error
// @return menusMsp map{string}[]SysBaseMenu
func getBaseMenuTreeMap()(err error,treeMap map[string][]model.SysBaseMenu){
func getBaseMenuTreeMap() (err error, treeMap map[string][]model.SysBaseMenu) {
var allMenus []model.SysBaseMenu
treeMap = make(map[string][]model.SysBaseMenu)
err = global.GVA_DB.Order("sort", true).Find(&allMenus).Error
for _,v := range allMenus{
for _, v := range allMenus {
treeMap[v.ParentId] = append(treeMap[v.ParentId], v)
}
return err,treeMap
return err, treeMap
}
// @title GetBaseMenuTree
@ -127,10 +127,10 @@ func getBaseMenuTreeMap()(err error,treeMap map[string][]model.SysBaseMenu){
// @return menus []SysBaseMenu
func GetBaseMenuTree() (err error, menus []model.SysBaseMenu) {
err,treeMap := getBaseMenuTreeMap()
err, treeMap := getBaseMenuTreeMap()
menus = treeMap["0"]
for i := 0; i < len(menus); i++ {
err = getBaseChildrenList(&menus[i],treeMap)
err = getBaseChildrenList(&menus[i], treeMap)
}
return err, menus
}

Loading…
Cancel
Save