Skip to content

Commit ecd7112

Browse files
authored
Revert "fix:修复文件上传进度显示bug&按钮样式优化 (#1979)"
This reverts commit d4c2ba5.
1 parent d4c2ba5 commit ecd7112

File tree

32 files changed

+402
-753
lines changed

32 files changed

+402
-753
lines changed

.gitignore

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
.idea/
12
/web/node_modules
23
/web/dist
34

@@ -32,11 +33,3 @@ server/uploads/
3233
*.iml
3334
web/.pnpm-debug.log
3435
web/pnpm-lock.yaml
35-
36-
# binary files
37-
*.exe
38-
39-
# SQLite database files
40-
*.db
41-
*.sqlite
42-
*.sqlite3

Makefile

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,16 @@ CONFIG_FILE = config.yaml
1313
IMAGE_NAME = gva
1414
#镜像地址
1515
REPOSITORY = registry.cn-hangzhou.aliyuncs.com/${IMAGE_NAME}
16-
#镜像版本
17-
TAGS_OPT ?= latest
18-
PLUGIN ?= email
16+
17+
ifeq ($(TAGS_OPT),)
18+
TAGS_OPT = latest
19+
else
20+
endif
21+
22+
ifeq ($(PLUGIN),)
23+
PLUGIN = email
24+
else
25+
endif
1926

2027
#容器环境前后端共同打包
2128
build: build-web build-server
@@ -41,7 +48,7 @@ build-image-server:
4148
build-local:
4249
if [ -d "build" ];then rm -rf build; else echo "OK!"; fi \
4350
&& if [ -f "/.dockerenv" ];then echo "OK!"; else make build-web-local && make build-server-local; fi \
44-
&& mkdir build && cp -r web/dist build/ && cp server/server build/ && cp -r server/resource build/resource
51+
&& mkdir build && cp -r web/dist build/ && cp server/server build/ && cp -r server/resource build/resource
4552

4653
#本地环境打包前端
4754
build-web-local:
@@ -56,17 +63,13 @@ build-server-local:
5663
&& go build -ldflags "-B 0x$(shell head -c20 /dev/urandom|od -An -tx1|tr -d ' \n') -X main.Version=${TAGS_OPT}" -v
5764

5865
#打包前后端二合一镜像
59-
image: build
66+
image: build
6067
docker build -t ${REPOSITORY}/gin-vue-admin:${TAGS_OPT} -f deploy/docker/Dockerfile .
6168

6269
#尝鲜版
6370
images: build build-image-web build-image-server
6471
docker build -t ${REPOSITORY}/all:${TAGS_OPT} -f deploy/docker/Dockerfile .
65-
66-
#swagger 文档生成
67-
doc:
68-
@cd server && swag init
69-
72+
7073
#插件快捷打包: make plugin PLUGIN="这里是插件文件夹名称,默认为email"
7174
plugin:
7275
if [ -d ".plugin" ];then rm -rf .plugin ; else echo "OK!"; fi && mkdir -p .plugin/${PLUGIN}/{server/plugin,web/plugin} \

server/api/v1/system/sys_export_template.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ func (sysExportTemplateApi *SysExportTemplateApi) ExportExcel(c *gin.Context) {
213213
// @Security ApiKeyAuth
214214
// @accept application/json
215215
// @Produce application/json
216-
// @Router /sysExportTemplate/ExportTemplate [get]
216+
// @Router /sysExportTemplate/exportExcel [get]
217217
func (sysExportTemplateApi *SysExportTemplateApi) ExportTemplate(c *gin.Context) {
218218
templateID := c.Query("templateID")
219219
if templateID == "" {

server/core/server.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ func RunWindowsServer() {
3939

4040
fmt.Printf(`
4141
欢迎使用 gin-vue-admin
42-
当前版本:v2.7.8
43-
加群方式:微信号:shouzi_1994 QQ群:470239250
42+
当前版本:v2.7.8-beta1
43+
加群方式:微信号:shouzi_1994 QQ群:470239250
4444
项目地址:https://github.com/flipped-aurora/gin-vue-admin
4545
插件市场:https://plugin.gin-vue-admin.com
4646
GVA讨论社区:https://support.qq.com/products/371961

server/docs/docs.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

server/initialize/internal/gorm.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ import (
66
"gorm.io/gorm"
77
"gorm.io/gorm/logger"
88
"gorm.io/gorm/schema"
9+
"log"
10+
"os"
911
"time"
1012
)
1113

@@ -32,7 +34,7 @@ func (g *_gorm) Config(prefix string, singular bool) *gorm.Config {
3234
general = global.GVA_CONFIG.Mysql.GeneralDB
3335
}
3436
return &gorm.Config{
35-
Logger: logger.New(NewWriter(general), logger.Config{
37+
Logger: logger.New(NewWriter(general, log.New(os.Stdout, "\r\n", log.LstdFlags)), logger.Config{
3638
SlowThreshold: 200 * time.Millisecond,
3739
LogLevel: general.LogLevel(),
3840
Colorful: true,

server/initialize/internal/gorm_logger_writer.go

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package internal
33
import (
44
"fmt"
55
"github.com/flipped-aurora/gin-vue-admin/server/config"
6-
"github.com/flipped-aurora/gin-vue-admin/server/global"
6+
"go.uber.org/zap"
77
"gorm.io/gorm/logger"
88
)
99

@@ -12,30 +12,26 @@ type Writer struct {
1212
writer logger.Writer
1313
}
1414

15-
func NewWriter(config config.GeneralDB) *Writer {
16-
return &Writer{config: config}
15+
func NewWriter(config config.GeneralDB, writer logger.Writer) *Writer {
16+
return &Writer{config: config, writer: writer}
1717
}
1818

1919
// Printf 格式化打印日志
2020
func (c *Writer) Printf(message string, data ...any) {
21-
22-
// 当有日志时候均需要输出到控制台
23-
fmt.Printf(message, data...)
24-
25-
// 当开启了zap的情况,会打印到日志记录
2621
if c.config.LogZap {
2722
switch c.config.LogLevel() {
2823
case logger.Silent:
29-
global.GVA_LOG.Debug(fmt.Sprintf(message, data...))
24+
zap.L().Debug(fmt.Sprintf(message, data...))
3025
case logger.Error:
31-
global.GVA_LOG.Error(fmt.Sprintf(message, data...))
26+
zap.L().Error(fmt.Sprintf(message, data...))
3227
case logger.Warn:
33-
global.GVA_LOG.Warn(fmt.Sprintf(message, data...))
28+
zap.L().Warn(fmt.Sprintf(message, data...))
3429
case logger.Info:
35-
global.GVA_LOG.Info(fmt.Sprintf(message, data...))
30+
zap.L().Info(fmt.Sprintf(message, data...))
3631
default:
37-
global.GVA_LOG.Info(fmt.Sprintf(message, data...))
32+
zap.L().Info(fmt.Sprintf(message, data...))
3833
}
3934
return
4035
}
36+
c.writer.Printf(message, data...)
4137
}

server/main.go

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,8 @@ import (
1313
//go:generate go mod tidy
1414
//go:generate go mod download
1515

16-
// 这部分 @Tag 设置用于排序, 需要排序的接口请按照下面的格式添加
17-
// swag init 对 @Tag 只会从入口文件解析, 默认 main.go
18-
// 也可通过 --generalInfo flag 指定其他文件
19-
// @Tag.Name Base
20-
// @Tag.Name SysUser
21-
// @Tag.Description 用户
22-
2316
// @title Gin-Vue-Admin Swagger API接口文档
24-
// @version v2.7.8
17+
// @version v2.7.8-beta1
2518
// @description 使用gin+vue进行极速开发的全栈开发基础平台
2619
// @securityDefinitions.apikey ApiKeyAuth
2720
// @in header

server/middleware/limit_ip.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ type LimitConfig struct {
2727
func (l LimitConfig) LimitWithTime() gin.HandlerFunc {
2828
return func(c *gin.Context) {
2929
if err := l.CheckOrMark(l.GenerationKey(c), l.Expire, l.Limit); err != nil {
30-
c.JSON(http.StatusOK, gin.H{"code": response.ERROR, "msg": err.Error()})
30+
c.JSON(http.StatusOK, gin.H{"code": response.ERROR, "msg": err})
3131
c.Abort()
3232
return
3333
} else {

server/plugin/announcement/model/info.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ import (
88
// Info 公告 结构体
99
type Info struct {
1010
global.GVA_MODEL
11-
Title string `json:"title" form:"title" gorm:"column:title;comment:公告标题;"` //标题
12-
Content string `json:"content" form:"content" gorm:"column:content;comment:公告内容;type:text;"` //内容
13-
UserID *int `json:"userID" form:"userID" gorm:"column:user_id;comment:发布者;"` //作者
14-
Attachments datatypes.JSON `json:"attachments" form:"attachments" gorm:"column:attachments;comment:相关附件;" swaggertype:"array,object"` //附件
11+
Title string `json:"title" form:"title" gorm:"column:title;comment:公告标题;"` //标题
12+
Content string `json:"content" form:"content" gorm:"column:content;comment:公告内容;type:text;"` //内容
13+
UserID *int `json:"userID" form:"userID" gorm:"column:user_id;comment:发布者;"` //作者
14+
Attachments datatypes.JSON `json:"attachments" form:"attachments" gorm:"column:attachments;comment:相关附件;"swaggertype:"array,object"` //附件
1515
}
1616

1717
// TableName 公告 Info自定义表名 gva_announcements_info

server/resource/function/api.go.tpl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// {{.FuncName}} {{.FuncDesc}}
33
// @Tags {{.StructName}}
44
// @Summary {{.FuncDesc}}
5-
// @Accept application/json
5+
// @accept application/json
66
// @Produce application/json
77
// @Success 200 {object} response.Response{data=object,msg=string} "获取成功"
88
// @Router /{{.Abbreviation}}/{{.Router}} [{{.Method}}]
@@ -22,7 +22,7 @@ func (a *{{.Abbreviation}}) {{.FuncName}}(c *gin.Context) {
2222
// {{.FuncName}} {{.FuncDesc}}
2323
// @Tags {{.StructName}}
2424
// @Summary {{.FuncDesc}}
25-
// @Accept application/json
25+
// @accept application/json
2626
// @Produce application/json
2727
// @Param data query {{.Package}}Req.{{.StructName}}Search true "成功"
2828
// @Success 200 {object} response.Response{data=object,msg=string} "成功"
@@ -37,4 +37,4 @@ func ({{.Abbreviation}}Api *{{.StructName}}Api){{.FuncName}}(c *gin.Context) {
3737
}
3838
response.OkWithData("返回数据",c)
3939
}
40-
{{end}}
40+
{{end}}

server/resource/function/api.js.tpl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// {{.FuncName}} {{.FuncDesc}}
33
// @Tags {{.StructName}}
44
// @Summary {{.FuncDesc}}
5-
// @Accept application/json
5+
// @accept application/json
66
// @Produce application/json
77
// @Success 200 {object} response.Response{data=object,msg=string} "获取成功"
88
// @Router /{{.Abbreviation}}/{{.Router}} [{{.Method}}]
@@ -18,7 +18,7 @@ export const {{.Router}} = () => {
1818
// {{.FuncName}} {{.FuncDesc}}
1919
// @Tags {{.StructName}}
2020
// @Summary {{.FuncDesc}}
21-
// @Accept application/json
21+
// @accept application/json
2222
// @Produce application/json
2323
// @Success 200 {object} response.Response{data=object,msg=string} "成功"
2424
// @Router /{{.Abbreviation}}/{{.Router}} [{{.Method}}]
@@ -29,4 +29,4 @@ export const {{.Router}} = () => {
2929
})
3030
}
3131

32-
{{- end -}}
32+
{{- end -}}

server/resource/package/server/api/api.go.tpl

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ type {{.StructName}}Api struct {}
2727
// @Tags {{.StructName}}
2828
// @Summary 创建{{.Description}}
2929
// @Security ApiKeyAuth
30-
// @Accept application/json
30+
// @accept application/json
3131
// @Produce application/json
3232
// @Param data body {{.Package}}.{{.StructName}} true "创建{{.Description}}"
3333
// @Success 200 {object} response.Response{msg=string} "创建成功"
@@ -55,7 +55,7 @@ func ({{.Abbreviation}}Api *{{.StructName}}Api) Create{{.StructName}}(c *gin.Con
5555
// @Tags {{.StructName}}
5656
// @Summary 删除{{.Description}}
5757
// @Security ApiKeyAuth
58-
// @Accept application/json
58+
// @accept application/json
5959
// @Produce application/json
6060
// @Param data body {{.Package}}.{{.StructName}} true "删除{{.Description}}"
6161
// @Success 200 {object} response.Response{msg=string} "删除成功"
@@ -78,7 +78,7 @@ func ({{.Abbreviation}}Api *{{.StructName}}Api) Delete{{.StructName}}(c *gin.Con
7878
// @Tags {{.StructName}}
7979
// @Summary 批量删除{{.Description}}
8080
// @Security ApiKeyAuth
81-
// @Accept application/json
81+
// @accept application/json
8282
// @Produce application/json
8383
// @Success 200 {object} response.Response{msg=string} "批量删除成功"
8484
// @Router /{{.Abbreviation}}/delete{{.StructName}}ByIds [delete]
@@ -100,7 +100,7 @@ func ({{.Abbreviation}}Api *{{.StructName}}Api) Delete{{.StructName}}ByIds(c *gi
100100
// @Tags {{.StructName}}
101101
// @Summary 更新{{.Description}}
102102
// @Security ApiKeyAuth
103-
// @Accept application/json
103+
// @accept application/json
104104
// @Produce application/json
105105
// @Param data body {{.Package}}.{{.StructName}} true "更新{{.Description}}"
106106
// @Success 200 {object} response.Response{msg=string} "更新成功"
@@ -128,9 +128,9 @@ func ({{.Abbreviation}}Api *{{.StructName}}Api) Update{{.StructName}}(c *gin.Con
128128
// @Tags {{.StructName}}
129129
// @Summary 用id查询{{.Description}}
130130
// @Security ApiKeyAuth
131-
// @Accept application/json
131+
// @accept application/json
132132
// @Produce application/json
133-
// @Param {{.PrimaryField.FieldJson}} query {{.PrimaryField.FieldType}} true "用id查询{{.Description}}"
133+
// @Param data query {{.Package}}.{{.StructName}} true "用id查询{{.Description}}"
134134
// @Success 200 {object} response.Response{data={{.Package}}.{{.StructName}},msg=string} "查询成功"
135135
// @Router /{{.Abbreviation}}/find{{.StructName}} [get]
136136
func ({{.Abbreviation}}Api *{{.StructName}}Api) Find{{.StructName}}(c *gin.Context) {
@@ -149,7 +149,7 @@ func ({{.Abbreviation}}Api *{{.StructName}}Api) Find{{.StructName}}(c *gin.Conte
149149
// @Tags {{.StructName}}
150150
// @Summary 分页获取{{.Description}}列表
151151
// @Security ApiKeyAuth
152-
// @Accept application/json
152+
// @accept application/json
153153
// @Produce application/json
154154
// @Success 200 {object} response.Response{data=response.PageResult,msg=string} "获取成功"
155155
// @Router /{{.Abbreviation}}/get{{.StructName}}List [get]
@@ -167,7 +167,7 @@ func ({{.Abbreviation}}Api *{{.StructName}}Api) Get{{.StructName}}List(c *gin.Co
167167
// @Tags {{.StructName}}
168168
// @Summary 分页获取{{.Description}}列表
169169
// @Security ApiKeyAuth
170-
// @Accept application/json
170+
// @accept application/json
171171
// @Produce application/json
172172
// @Param data query {{.Package}}Req.{{.StructName}}Search true "分页获取{{.Description}}列表"
173173
// @Success 200 {object} response.Response{data=response.PageResult,msg=string} "获取成功"
@@ -198,7 +198,7 @@ func ({{.Abbreviation}}Api *{{.StructName}}Api) Get{{.StructName}}List(c *gin.Co
198198
// Get{{.StructName}}DataSource 获取{{.StructName}}的数据源
199199
// @Tags {{.StructName}}
200200
// @Summary 获取{{.StructName}}的数据源
201-
// @Accept application/json
201+
// @accept application/json
202202
// @Produce application/json
203203
// @Success 200 {object} response.Response{data=object,msg=string} "查询成功"
204204
// @Router /{{.Abbreviation}}/get{{.StructName}}DataSource [get]
@@ -219,7 +219,7 @@ func ({{.Abbreviation}}Api *{{.StructName}}Api) Get{{.StructName}}DataSource(c *
219219
// Get{{.StructName}}Public 不需要鉴权的{{.Description}}接口
220220
// @Tags {{.StructName}}
221221
// @Summary 不需要鉴权的{{.Description}}接口
222-
// @Accept application/json
222+
// @accept application/json
223223
// @Produce application/json
224224
// @Success 200 {object} response.Response{data=object,msg=string} "获取成功"
225225
// @Router /{{.Abbreviation}}/get{{.StructName}}Public [get]

0 commit comments

Comments
 (0)