Skip to content

Commit 75799b8

Browse files
author
pixel
committed
Merge branch 'gva_gormv2_dev' of https://github.com/flipped-aurora/gin-vue-admin into gva_gormv2_dev
2 parents 511a187 + 01ecfcd commit 75799b8

File tree

8 files changed

+38
-33
lines changed

8 files changed

+38
-33
lines changed

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,14 @@
1212

1313
[English](./README-en.md) | 简体中文
1414

15-
[gitee地址](https://gitee.com/pixelmax/gin-vue-admin)
15+
[gitee地址](https://gitee.com/pixelmax/gin-vue-admin)|
1616
[github地址](https://github.com/flipped-aurora/gin-vue-admin)
1717

1818
# 项目文档
1919
[在线文档](https://www.gin-vue-admin.com/) : https://www.gin-vue-admin.com/
2020

21+
[从环境到部署教学视频](https://www.bilibili.com/video/BV1fV411y7dT)
22+
2123
[开发教学](https://www.gin-vue-admin.com/docs/help) (贡献者: <a href="https://github.com/LLemonGreen">LLemonGreen</a> And <a href="https://github.com/fkk0509">Fann</a>)
2224
- 前端UI框架:[element-ui](https://github.com/ElemeFE/element)
2325
- 后台框架:[gin](https://github.com/gin-gonic/gin)

server/middleware/cors.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ func Cors() gin.HandlerFunc {
1111
method := c.Request.Method
1212
origin := c.Request.Header.Get("Origin")
1313
c.Header("Access-Control-Allow-Origin", origin)
14-
c.Header("Access-Control-Allow-Headers", "Content-Type,AccessToken,X-CSRF-Token, Authorization, Token,X-Token,X-User-Id\"")
14+
c.Header("Access-Control-Allow-Headers", "Content-Type,AccessToken,X-CSRF-Token, Authorization, Token,X-Token,X-User-Id")
1515
c.Header("Access-Control-Allow-Methods", "POST, GET, OPTIONS,DELETE,PUT")
1616
c.Header("Access-Control-Expose-Headers", "Content-Length, Access-Control-Allow-Origin, Access-Control-Allow-Headers, Content-Type")
1717
c.Header("Access-Control-Allow-Credentials", "true")

server/middleware/jwt.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import (
1616

1717
func JWTAuth() gin.HandlerFunc {
1818
return func(c *gin.Context) {
19-
// 我们这里jwt鉴权取头部信息 x-token 登录时回返回token信息 这里前端需要把token存储到cookie或者本地localSstorage中 不过需要跟后端协商过期时间 可以约定刷新令牌或者重新登录
19+
// 我们这里jwt鉴权取头部信息 x-token 登录时回返回token信息 这里前端需要把token存储到cookie或者本地localStorage中 不过需要跟后端协商过期时间 可以约定刷新令牌或者重新登录
2020
token := c.Request.Header.Get("x-token")
2121
if token == "" {
2222
response.Result(response.ERROR, gin.H{
@@ -66,7 +66,7 @@ func JWTAuth() gin.HandlerFunc {
6666
if err!=nil {
6767
global.GVA_LOG.Error("get redis jwt failed", zap.Any("err", err))
6868
}else{
69-
service.JsonInBlacklist(model.JwtBlacklist{Jwt: RedisJwtToken})
69+
_ = service.JsonInBlacklist(model.JwtBlacklist{Jwt: RedisJwtToken})
7070
//当之前的取成功时才进行拉黑操作
7171
}
7272
// 无论如何都要记录当前的活跃状态

server/resource/template/fe/table.vue.tpl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767
{{ end }}
6868
<el-table-column label="按钮组">
6969
<template slot-scope="scope">
70-
<el-button @click="update{{.StructName}}(scope.row)" size="small" type="primary">变更</el-button>
70+
<el-button class="table-button" @click="update{{.StructName}}(scope.row)" size="small" type="primary" icon="el-icon-edit">变更</el-button>
7171
<el-popover placement="top" width="160" v-model="scope.row.visible">
7272
<p>确定要删除吗?</p>
7373
<div style="text-align: right; margin: 0">
@@ -136,7 +136,7 @@ import {
136136
find{{.StructName}},
137137
get{{.StructName}}List
138138
} from "@/api/{{.PackageName}}"; // 此处请自行替换地址
139-
import { formatTimeToStr } from "@/utils/data";
139+
import { formatTimeToStr } from "@/utils/date";
140140
import infoList from "@/mixins/infoList";
141141
export default {
142142
name: "{{.StructName}}",

server/resource/template/te/model.go.tpl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ import (
99
type {{.StructName}} struct {
1010
global.GVA_MODEL {{- range .Fields}}
1111
{{- if eq .FieldType "bool" }}
12-
{{.FieldName}} *{{.FieldType}} `json:"{{.FieldJson}}" form:"{{.FieldJson}}" gorm:"column:{{.ColumnName}};comment:{{.Comment}}{{- if .DataType -}};type:{{.DataType}}{{- if .DataTypeLong -}}({{.DataTypeLong}}){{- end -}};{{- if .DataTypeLong -}}size:{{.DataTypeLong}};{{- end -}}{{- end -}}"`
12+
{{.FieldName}} *{{.FieldType}} `json:"{{.FieldJson}}" form:"{{.FieldJson}}" gorm:"column:{{.ColumnName}};comment:{{.Comment}}{{- if .DataType -}};type:{{.DataType}}{{- if eq .FieldType "string" -}}{{- if .DataTypeLong -}}({{.DataTypeLong}}){{- end -}}{{- end -}};{{- if .DataTypeLong -}}size:{{.DataTypeLong}};{{- end -}}{{- end -}}"`
1313
{{- else }}
14-
{{.FieldName}} {{.FieldType}} `json:"{{.FieldJson}}" form:"{{.FieldJson}}" gorm:"column:{{.ColumnName}};comment:{{.Comment}}{{- if .DataType -}};type:{{.DataType}}{{- if .DataTypeLong -}}({{.DataTypeLong}}){{- end -}};{{- if .DataTypeLong -}}size:{{.DataTypeLong}};{{- end -}}{{- end -}}"`
15-
{{- end }} {{- end }}
14+
{{.FieldName}} {{.FieldType}} `json:"{{.FieldJson}}" form:"{{.FieldJson}}" gorm:"column:{{.ColumnName}};comment:{{.Comment}}{{- if .DataType -}};type:{{.DataType}}{{- if eq .FieldType "string" -}}{{- if .DataTypeLong -}}({{.DataTypeLong}}){{- end -}}{{- end -}};{{- if .DataTypeLong -}}size:{{.DataTypeLong}};{{- end -}}{{- end -}}"`
15+
{{- end }} {{- end }}
1616
}
1717

1818
{{ if .TableName }}

server/service/exa_simple_uploader.go

Lines changed: 22 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -51,27 +51,26 @@ func MergeFileMd5(md5 string, fileName string) (err error) {
5151
if err != nil {
5252
return err
5353
}
54-
//创建事务
55-
tx := global.GVA_DB.Begin()
56-
//删除切片信息
57-
err = tx.Delete(&model.ExaSimpleUploader{}, "identifier = ? AND is_done = ?", md5, false).Error
58-
// 添加文件信息
59-
if err != nil {
60-
fmt.Println(err)
61-
tx.Rollback()
62-
}
63-
err = tx.Create(&model.ExaSimpleUploader{
64-
Identifier: md5,
65-
IsDone: true,
66-
FilePath: finishDir + fileName,
67-
Filename: fileName,
68-
}).Error
69-
if err != nil {
70-
fmt.Println(err)
71-
tx.Rollback()
72-
}
73-
tx.Commit()
74-
//清除切片
75-
err = os.RemoveAll(dir)
76-
return
54+
err = global.GVA_DB.Transaction(func(tx *gorm.DB) error {
55+
//删除切片信息
56+
if err = tx.Delete(&model.ExaSimpleUploader{}, "identifier = ? AND is_done = ?", md5, false).Error; err != nil {
57+
fmt.Println(err)
58+
return err
59+
}
60+
data := model.ExaSimpleUploader{
61+
Identifier: md5,
62+
IsDone: true,
63+
FilePath: finishDir + fileName,
64+
Filename: fileName,
65+
}
66+
// 添加文件信息
67+
if err = tx.Create(&data).Error; err != nil {
68+
fmt.Println(err)
69+
return err
70+
}
71+
return nil
72+
})
73+
74+
err = os.RemoveAll(dir) //清除切片
75+
return err
7776
}

web/src/style/main.scss

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1026,4 +1026,9 @@ li {
10261026
color: #606266;
10271027
cursor: pointer;
10281028
font-size: 13px;
1029+
}
1030+
1031+
1032+
.table-button{
1033+
margin-right:8px !important;
10291034
}

web/src/view/systemTools/autoCode/component/fieldDialog.vue

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,6 @@ export default {
195195
}
196196
},
197197
async created() {
198-
this.getDbfdOptions();
199198
const dictRes = await getSysDictionaryList({
200199
page: 1,
201200
pageSize: 999999

0 commit comments

Comments
 (0)