Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
FLIPPED-AURORA
gin-vue-admin
提交
e2d0c62e
G
gin-vue-admin
项目概览
FLIPPED-AURORA
/
gin-vue-admin
大约 1 年 前同步成功
通知
332
Star
18154
Fork
5505
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
gin-vue-admin
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
e2d0c62e
编写于
8月 31, 2020
作者:
Mr.奇淼(
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
errors.Is相关代码嵌套层级简化
上级
3677e93d
变更
5
显示空白变更内容
内联
并排
Showing
5 changed file
with
14 addition
and
21 deletion
+14
-21
server/service/exa_breakpoint_continue.go
server/service/exa_breakpoint_continue.go
+6
-7
server/service/exa_simple_uploader.go
server/service/exa_simple_uploader.go
+1
-2
server/service/sys_authority.go
server/service/sys_authority.go
+4
-8
server/service/sys_base_menu.go
server/service/sys_base_menu.go
+1
-2
server/service/sys_dictionary.go
server/service/sys_dictionary.go
+2
-2
未找到文件。
server/service/exa_breakpoint_continue.go
浏览文件 @
e2d0c62e
...
...
@@ -22,16 +22,15 @@ func FindOrCreateFile(fileMd5 string, fileName string, chunkTotal int) (err erro
cfile
.
FileMd5
=
fileMd5
cfile
.
FileName
=
fileName
cfile
.
ChunkTotal
=
chunkTotal
notHaveSameMd5Finish
:=
errors
.
Is
(
global
.
GVA_DB
.
Where
(
"file_md5 = ? AND is_finish = ?"
,
fileMd5
,
true
)
.
First
(
&
file
)
.
Error
,
gorm
.
ErrRecordNotFound
)
if
notHaveSameMd5Finish
{
if
errors
.
Is
(
global
.
GVA_DB
.
Where
(
"file_md5 = ? AND is_finish = ?"
,
fileMd5
,
true
)
.
First
(
&
file
)
.
Error
,
gorm
.
ErrRecordNotFound
)
{
err
=
global
.
GVA_DB
.
Where
(
"file_md5 = ? AND file_name = ?"
,
fileMd5
,
fileName
)
.
Preload
(
"ExaFileChunk"
)
.
FirstOrCreate
(
&
file
,
cfile
)
.
Error
return
err
,
file
}
else
{
}
cfile
.
IsFinish
=
true
cfile
.
FilePath
=
file
.
FilePath
err
=
global
.
GVA_DB
.
Create
(
&
cfile
)
.
Error
return
err
,
cfile
}
}
// @title CreateFileChunk
...
...
server/service/exa_simple_uploader.go
浏览文件 @
e2d0c62e
...
...
@@ -28,8 +28,7 @@ func MergeFileMd5(md5 string, fileName string) (err error) {
finishDir
:=
"./finish/"
dir
:=
"./chunk/"
+
md5
//如果文件上传成功 不做后续操作 通知成功即可
notFinish
:=
errors
.
Is
(
global
.
GVA_DB
.
First
(
&
model
.
ExaSimpleUploader
{},
"identifier = ? AND is_done = ?"
,
md5
,
true
)
.
Error
,
gorm
.
ErrRecordNotFound
)
if
!
notFinish
{
if
!
errors
.
Is
(
global
.
GVA_DB
.
First
(
&
model
.
ExaSimpleUploader
{},
"identifier = ? AND is_done = ?"
,
md5
,
true
)
.
Error
,
gorm
.
ErrRecordNotFound
)
{
return
nil
}
...
...
server/service/sys_authority.go
浏览文件 @
e2d0c62e
...
...
@@ -19,8 +19,7 @@ import (
func
CreateAuthority
(
auth
model
.
SysAuthority
)
(
err
error
,
authority
model
.
SysAuthority
)
{
var
authorityBox
model
.
SysAuthority
notHas
:=
errors
.
Is
(
global
.
GVA_DB
.
Where
(
"authority_id = ?"
,
auth
.
AuthorityId
)
.
First
(
&
authorityBox
)
.
Error
,
gorm
.
ErrRecordNotFound
)
if
!
notHas
{
if
!
errors
.
Is
(
global
.
GVA_DB
.
Where
(
"authority_id = ?"
,
auth
.
AuthorityId
)
.
First
(
&
authorityBox
)
.
Error
,
gorm
.
ErrRecordNotFound
)
{
return
errors
.
New
(
"存在相同角色id"
),
auth
}
err
=
global
.
GVA_DB
.
Create
(
&
auth
)
.
Error
...
...
@@ -36,8 +35,7 @@ func CreateAuthority(auth model.SysAuthority) (err error, authority model.SysAut
func
CopyAuthority
(
copyInfo
response
.
SysAuthorityCopyResponse
)
(
err
error
,
authority
model
.
SysAuthority
)
{
var
authorityBox
model
.
SysAuthority
notHas
:=
errors
.
Is
(
global
.
GVA_DB
.
Where
(
"authority_id = ?"
,
copyInfo
.
Authority
.
AuthorityId
)
.
First
(
&
authorityBox
)
.
Error
,
gorm
.
ErrRecordNotFound
)
if
!
notHas
{
if
!
errors
.
Is
(
global
.
GVA_DB
.
Where
(
"authority_id = ?"
,
copyInfo
.
Authority
.
AuthorityId
)
.
First
(
&
authorityBox
)
.
Error
,
gorm
.
ErrRecordNotFound
)
{
return
errors
.
New
(
"存在相同角色id"
),
authority
}
copyInfo
.
Authority
.
Children
=
[]
model
.
SysAuthority
{}
...
...
@@ -79,12 +77,10 @@ func UpdateAuthority(auth model.SysAuthority) (err error, authority model.SysAut
// 删除角色
func
DeleteAuthority
(
auth
*
model
.
SysAuthority
)
(
err
error
)
{
notHas
:=
errors
.
Is
(
global
.
GVA_DB
.
Where
(
"authority_id = ?"
,
auth
.
AuthorityId
)
.
First
(
&
model
.
SysUser
{})
.
Error
,
gorm
.
ErrRecordNotFound
)
if
!
notHas
{
if
!
errors
.
Is
(
global
.
GVA_DB
.
Where
(
"authority_id = ?"
,
auth
.
AuthorityId
)
.
First
(
&
model
.
SysUser
{})
.
Error
,
gorm
.
ErrRecordNotFound
)
{
return
errors
.
New
(
"此角色有用户正在使用禁止删除"
)
}
notHas
=
errors
.
Is
(
global
.
GVA_DB
.
Where
(
"parent_id = ?"
,
auth
.
AuthorityId
)
.
First
(
&
model
.
SysAuthority
{})
.
Error
,
gorm
.
ErrRecordNotFound
)
if
!
notHas
{
if
!
errors
.
Is
(
global
.
GVA_DB
.
Where
(
"parent_id = ?"
,
auth
.
AuthorityId
)
.
First
(
&
model
.
SysAuthority
{})
.
Error
,
gorm
.
ErrRecordNotFound
)
{
return
errors
.
New
(
"此角色存在子角色不允许删除"
)
}
db
:=
global
.
GVA_DB
.
Preload
(
"SysBaseMenus"
)
.
Where
(
"authority_id = ?"
,
auth
.
AuthorityId
)
.
First
(
auth
)
...
...
server/service/sys_base_menu.go
浏览文件 @
e2d0c62e
...
...
@@ -52,8 +52,7 @@ func UpdateBaseMenu(menu model.SysBaseMenu) (err error) {
db
:=
global
.
GVA_DB
.
Where
(
"id = ?"
,
menu
.
ID
)
.
Find
(
&
oldMenu
)
if
oldMenu
.
Name
!=
menu
.
Name
{
notSame
:=
errors
.
Is
(
global
.
GVA_DB
.
Where
(
"id <> ? AND name = ?"
,
menu
.
ID
,
menu
.
Name
)
.
First
(
&
model
.
SysBaseMenu
{})
.
Error
,
gorm
.
ErrRecordNotFound
)
if
!
notSame
{
if
!
errors
.
Is
(
global
.
GVA_DB
.
Where
(
"id <> ? AND name = ?"
,
menu
.
ID
,
menu
.
Name
)
.
First
(
&
model
.
SysBaseMenu
{})
.
Error
,
gorm
.
ErrRecordNotFound
)
{
global
.
GVA_LOG
.
Debug
(
"存在相同name修改失败"
)
return
errors
.
New
(
"存在相同name修改失败"
)
}
...
...
server/service/sys_dictionary.go
浏览文件 @
e2d0c62e
...
...
@@ -53,9 +53,9 @@ func UpdateSysDictionary(sysDictionary *model.SysDictionary) (err error) {
}
else
{
if
(
!
errors
.
Is
(
global
.
GVA_DB
.
First
(
&
model
.
SysDictionary
{},
"type = ?"
,
sysDictionary
.
Type
)
.
Error
,
gorm
.
ErrRecordNotFound
))
{
return
errors
.
New
(
"存在相同的type,不允许创建"
)
}
else
{
err
=
db
.
Updates
(
sysDictionaryMap
)
.
Error
}
err
=
db
.
Updates
(
sysDictionaryMap
)
.
Error
}
return
err
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录