Skip to content

Commit

Permalink
style: linker
Browse files Browse the repository at this point in the history
  • Loading branch information
songzhibin97 committed Dec 6, 2021
1 parent 79f8954 commit a116ce6
Show file tree
Hide file tree
Showing 95 changed files with 208 additions and 235 deletions.
3 changes: 1 addition & 2 deletions server/api/v1/autocode/auto_code_example.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ import (
"go.uber.org/zap"
)

type AutoCodeExampleApi struct {
}
type AutoCodeExampleApi struct{}

var autoCodeExampleService = service.ServiceGroupApp.AutoCodeServiceGroup.AutoCodeExampleService

Expand Down
8 changes: 5 additions & 3 deletions server/api/v1/example/enter.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ type ApiGroup struct {
FileUploadAndDownloadApi
}

var excelService = service.ServiceGroupApp.ExampleServiceGroup.ExcelService
var customerService = service.ServiceGroupApp.ExampleServiceGroup.CustomerService
var fileUploadAndDownloadService = service.ServiceGroupApp.ExampleServiceGroup.FileUploadAndDownloadService
var (
excelService = service.ServiceGroupApp.ExampleServiceGroup.ExcelService
customerService = service.ServiceGroupApp.ExampleServiceGroup.CustomerService
fileUploadAndDownloadService = service.ServiceGroupApp.ExampleServiceGroup.FileUploadAndDownloadService
)
3 changes: 1 addition & 2 deletions server/api/v1/example/exa_customer.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ import (
"go.uber.org/zap"
)

type CustomerApi struct {
}
type CustomerApi struct{}

// @Tags ExaCustomer
// @Summary 创建客户
Expand Down
3 changes: 1 addition & 2 deletions server/api/v1/example/exa_excel.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ import (
"go.uber.org/zap"
)

type ExcelApi struct {
}
type ExcelApi struct{}

// /excel/importExcel 接口,与upload接口作用类似,只是把文件存到resource/excel目录下,用于导入Excel时存放Excel文件(ExcelImport.xlsx)
// /excel/loadExcel接口,用于读取resource/excel目录下的文件((ExcelImport.xlsx)并加载为[]model.SysBaseMenu类型的示例数据
Expand Down
3 changes: 1 addition & 2 deletions server/api/v1/example/exa_file_upload_download.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ import (
"go.uber.org/zap"
)

type FileUploadAndDownloadApi struct {
}
type FileUploadAndDownloadApi struct{}

// @Tags ExaFileUploadAndDownload
// @Summary 上传文件示例
Expand Down
30 changes: 16 additions & 14 deletions server/api/v1/system/enter.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,19 @@ type ApiGroup struct {
DictionaryDetailApi
}

var apiService = service.ServiceGroupApp.SystemServiceGroup.ApiService
var jwtService = service.ServiceGroupApp.SystemServiceGroup.JwtService
var menuService = service.ServiceGroupApp.SystemServiceGroup.MenuService
var userService = service.ServiceGroupApp.SystemServiceGroup.UserService
var initDBService = service.ServiceGroupApp.SystemServiceGroup.InitDBService
var casbinService = service.ServiceGroupApp.SystemServiceGroup.CasbinService
var autoCodeService = service.ServiceGroupApp.SystemServiceGroup.AutoCodeService
var baseMenuService = service.ServiceGroupApp.SystemServiceGroup.BaseMenuService
var authorityService = service.ServiceGroupApp.SystemServiceGroup.AuthorityService
var dictionaryService = service.ServiceGroupApp.SystemServiceGroup.DictionaryService
var systemConfigService = service.ServiceGroupApp.SystemServiceGroup.SystemConfigService
var operationRecordService = service.ServiceGroupApp.SystemServiceGroup.OperationRecordService
var autoCodeHistoryService = service.ServiceGroupApp.SystemServiceGroup.AutoCodeHistoryService
var dictionaryDetailService = service.ServiceGroupApp.SystemServiceGroup.DictionaryDetailService
var (
apiService = service.ServiceGroupApp.SystemServiceGroup.ApiService
jwtService = service.ServiceGroupApp.SystemServiceGroup.JwtService
menuService = service.ServiceGroupApp.SystemServiceGroup.MenuService
userService = service.ServiceGroupApp.SystemServiceGroup.UserService
initDBService = service.ServiceGroupApp.SystemServiceGroup.InitDBService
casbinService = service.ServiceGroupApp.SystemServiceGroup.CasbinService
autoCodeService = service.ServiceGroupApp.SystemServiceGroup.AutoCodeService
baseMenuService = service.ServiceGroupApp.SystemServiceGroup.BaseMenuService
authorityService = service.ServiceGroupApp.SystemServiceGroup.AuthorityService
dictionaryService = service.ServiceGroupApp.SystemServiceGroup.DictionaryService
systemConfigService = service.ServiceGroupApp.SystemServiceGroup.SystemConfigService
operationRecordService = service.ServiceGroupApp.SystemServiceGroup.OperationRecordService
autoCodeHistoryService = service.ServiceGroupApp.SystemServiceGroup.AutoCodeHistoryService
dictionaryDetailService = service.ServiceGroupApp.SystemServiceGroup.DictionaryDetailService
)
3 changes: 1 addition & 2 deletions server/api/v1/system/sys_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ import (
"go.uber.org/zap"
)

type SystemApiApi struct {
}
type SystemApiApi struct{}

// @Tags SysApi
// @Summary 创建基础api
Expand Down
3 changes: 1 addition & 2 deletions server/api/v1/system/sys_authority.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ import (
"go.uber.org/zap"
)

type AuthorityApi struct {
}
type AuthorityApi struct{}

// @Tags Authority
// @Summary 创建角色
Expand Down
7 changes: 3 additions & 4 deletions server/api/v1/system/sys_captcha.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,10 @@ import (
)

// 当开启多服务器部署时,替换下面的配置,使用redis共享存储验证码
//var store = captcha.NewDefaultRedisStore()
// var store = captcha.NewDefaultRedisStore()
var store = base64Captcha.DefaultMemStore

type BaseApi struct {
}
type BaseApi struct{}

// @Tags Base
// @Summary 生成验证码
Expand All @@ -27,7 +26,7 @@ func (b *BaseApi) Captcha(c *gin.Context) {
// 字符,公式,验证码配置
// 生成默认数字的driver
driver := base64Captcha.NewDriverDigit(global.GVA_CONFIG.Captcha.ImgHeight, global.GVA_CONFIG.Captcha.ImgWidth, global.GVA_CONFIG.Captcha.KeyLong, 0.7, 80)
//cp := base64Captcha.NewCaptcha(driver, store.UseWithCtx(c)) // v8下使用redis
// cp := base64Captcha.NewCaptcha(driver, store.UseWithCtx(c)) // v8下使用redis
cp := base64Captcha.NewCaptcha(driver, store)
if id, b64s, err := cp.Generate(); err != nil {
global.GVA_LOG.Error("验证码获取失败!", zap.Error(err))
Expand Down
3 changes: 1 addition & 2 deletions server/api/v1/system/sys_casbin.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ import (
"go.uber.org/zap"
)

type CasbinApi struct {
}
type CasbinApi struct{}

// @Tags Casbin
// @Summary 更新角色api权限
Expand Down
3 changes: 1 addition & 2 deletions server/api/v1/system/sys_dictionary.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ import (
"go.uber.org/zap"
)

type DictionaryApi struct {
}
type DictionaryApi struct{}

// @Tags SysDictionary
// @Summary 创建SysDictionary
Expand Down
3 changes: 1 addition & 2 deletions server/api/v1/system/sys_dictionary_detail.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ import (
"go.uber.org/zap"
)

type DictionaryDetailApi struct {
}
type DictionaryDetailApi struct{}

// @Tags SysDictionaryDetail
// @Summary 创建SysDictionaryDetail
Expand Down
3 changes: 1 addition & 2 deletions server/api/v1/system/sys_jwt_blacklist.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ import (
"go.uber.org/zap"
)

type JwtApi struct {
}
type JwtApi struct{}

// @Tags Jwt
// @Summary jwt加入黑名单
Expand Down
3 changes: 1 addition & 2 deletions server/api/v1/system/sys_menu.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ import (
"go.uber.org/zap"
)

type AuthorityMenuApi struct {
}
type AuthorityMenuApi struct{}

// @Tags AuthorityMenu
// @Summary 获取用户动态路由
Expand Down
3 changes: 1 addition & 2 deletions server/api/v1/system/sys_operation_record.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ import (
"go.uber.org/zap"
)

type OperationRecordApi struct {
}
type OperationRecordApi struct{}

// @Tags SysOperationRecord
// @Summary 创建SysOperationRecord
Expand Down
3 changes: 1 addition & 2 deletions server/api/v1/system/sys_system.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ import (
"go.uber.org/zap"
)

type SystemApi struct {
}
type SystemApi struct{}

// @Tags System
// @Summary 获取配置文件内容
Expand Down
3 changes: 2 additions & 1 deletion server/api/v1/system/sys_user.go
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
package system

import (
"strconv"

"github.com/flipped-aurora/gin-vue-admin/server/global"
"github.com/flipped-aurora/gin-vue-admin/server/model/common/request"
"github.com/flipped-aurora/gin-vue-admin/server/model/common/response"
"github.com/flipped-aurora/gin-vue-admin/server/model/system"
systemReq "github.com/flipped-aurora/gin-vue-admin/server/model/system/request"
systemRes "github.com/flipped-aurora/gin-vue-admin/server/model/system/response"
"github.com/flipped-aurora/gin-vue-admin/server/utils"
"strconv"

"github.com/gin-gonic/gin"
"github.com/go-redis/redis/v8"
Expand Down
1 change: 1 addition & 0 deletions server/config/oss.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ type AliyunOSS struct {
BucketUrl string `mapstructure:"bucket-url" json:"bucketUrl" yaml:"bucket-url"`
BasePath string `mapstructure:"base-path" json:"basePath" yaml:"base-path"`
}

type TencentCOS struct {
Bucket string `mapstructure:"bucket" json:"bucket" yaml:"bucket"`
Region string `mapstructure:"region" json:"region" yaml:"region"`
Expand Down
3 changes: 2 additions & 1 deletion server/core/server_win.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@
package core

import (
"github.com/gin-gonic/gin"
"net/http"
"time"

"github.com/gin-gonic/gin"
)

func initServer(address string, router *gin.Engine) server {
Expand Down
2 changes: 1 addition & 1 deletion server/global/global.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ var (
GVA_REDIS *redis.Client
GVA_CONFIG config.Server
GVA_VP *viper.Viper
//GVA_LOG *oplogging.Logger
// GVA_LOG *oplogging.Logger
GVA_LOG *zap.Logger
GVA_Timer timer.Timer = timer.NewTimerTask()
GVA_Concurrency_Control = &singleflight.Group{}
Expand Down
3 changes: 2 additions & 1 deletion server/global/model.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package global

import (
"gorm.io/gorm"
"time"

"gorm.io/gorm"
)

type GVA_MODEL struct {
Expand Down
4 changes: 2 additions & 2 deletions server/initialize/gorm.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
package initialize

import (
"os"

"github.com/flipped-aurora/gin-vue-admin/server/global"
"github.com/flipped-aurora/gin-vue-admin/server/model/autocode"
"github.com/flipped-aurora/gin-vue-admin/server/model/example"
"github.com/flipped-aurora/gin-vue-admin/server/model/system"
"os"

"go.uber.org/zap"
"gorm.io/gorm"
Expand Down Expand Up @@ -51,7 +52,6 @@ func RegisterTables(db *gorm.DB) {
autocode.AutoCodeExample{},
// Code generated by github.com/flipped-aurora/gin-vue-admin/server End; DO NOT EDIT.
)

if err != nil {
global.GVA_LOG.Error("register table failed", zap.Error(err))
os.Exit(0)
Expand Down
7 changes: 4 additions & 3 deletions server/initialize/internal/gorm.go
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
package internal

import (
"github.com/flipped-aurora/gin-vue-admin/server/global"
"gorm.io/gorm"
"gorm.io/gorm/logger"
"log"
"os"
"time"

"github.com/flipped-aurora/gin-vue-admin/server/global"
"gorm.io/gorm"
"gorm.io/gorm/logger"
)

var Gorm = new(_gorm)
Expand Down
1 change: 1 addition & 0 deletions server/initialize/internal/logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package internal

import (
"fmt"

"github.com/flipped-aurora/gin-vue-admin/server/global"
"gorm.io/gorm/logger"
)
Expand Down
1 change: 0 additions & 1 deletion server/initialize/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,4 @@ func InstallPlugin(PublicGroup *gin.RouterGroup, PrivateGroup *gin.RouterGroup)
global.GVA_CONFIG.Email.Port,
global.GVA_CONFIG.Email.IsSSL,
))

}
14 changes: 7 additions & 7 deletions server/initialize/router.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,28 +15,28 @@ import (
// 初始化总路由

func Routers() *gin.Engine {
var Router = gin.Default()
Router := gin.Default()

// 如果想要不使用nginx代理前端网页,可以修改 web/.env.production 下的
// VUE_APP_BASE_API = /
// VUE_APP_BASE_PATH = http://localhost
// 然后执行打包命令 npm run build。在打开下面4行注释
//Router.LoadHTMLGlob("./dist/*.html") // npm打包成dist的路径
//Router.Static("/favicon.ico", "./dist/favicon.ico")
//Router.Static("/static", "./dist/assets") // dist里面的静态资源
//Router.StaticFile("/", "./dist/index.html") // 前端网页入口页面
// Router.LoadHTMLGlob("./dist/*.html") // npm打包成dist的路径
// Router.Static("/favicon.ico", "./dist/favicon.ico")
// Router.Static("/static", "./dist/assets") // dist里面的静态资源
// Router.StaticFile("/", "./dist/index.html") // 前端网页入口页面

Router.StaticFS(global.GVA_CONFIG.Local.Path, http.Dir(global.GVA_CONFIG.Local.Path)) // 为用户头像和文件提供静态地址
// Router.Use(middleware.LoadTls()) // 打开就能玩https了
global.GVA_LOG.Info("use middleware logger")
// 跨域
//Router.Use(middleware.Cors()) // 如需跨域可以打开
// Router.Use(middleware.Cors()) // 如需跨域可以打开
global.GVA_LOG.Info("use middleware cors")
Router.GET("/swagger/*any", ginSwagger.WrapHandler(swaggerFiles.Handler))
global.GVA_LOG.Info("register swagger handler")
// 方便统一添加路由组前缀 多服务器上线使用

//获取路由组实例
// 获取路由组实例
systemRouter := router.RouterGroupApp.System
exampleRouter := router.RouterGroupApp.Example
autocodeRouter := router.RouterGroupApp.Autocode
Expand Down
3 changes: 2 additions & 1 deletion server/middleware/cors.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package middleware

import (
"github.com/gin-gonic/gin"
"net/http"

"github.com/gin-gonic/gin"
)

// 处理跨域请求,支持options访问
Expand Down
5 changes: 3 additions & 2 deletions server/middleware/email.go
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
package middleware

import (
"github.com/flipped-aurora/gin-vue-admin/server/plugin/email/utils"
utils2 "github.com/flipped-aurora/gin-vue-admin/server/utils"
"io/ioutil"
"strconv"
"time"

"github.com/flipped-aurora/gin-vue-admin/server/plugin/email/utils"
utils2 "github.com/flipped-aurora/gin-vue-admin/server/utils"

"github.com/flipped-aurora/gin-vue-admin/server/global"
"github.com/flipped-aurora/gin-vue-admin/server/model/system"
"github.com/flipped-aurora/gin-vue-admin/server/service"
Expand Down
3 changes: 2 additions & 1 deletion server/middleware/jwt.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
package middleware

import (
"github.com/flipped-aurora/gin-vue-admin/server/utils"
"strconv"
"time"

"github.com/flipped-aurora/gin-vue-admin/server/utils"

"github.com/flipped-aurora/gin-vue-admin/server/global"
"github.com/flipped-aurora/gin-vue-admin/server/model/common/response"
"github.com/flipped-aurora/gin-vue-admin/server/model/system"
Expand Down
Loading

0 comments on commit a116ce6

Please sign in to comment.