Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
weixin_54624550
gin-vue-admin
提交
dda3f7a8
G
gin-vue-admin
项目概览
weixin_54624550
/
gin-vue-admin
与 Fork 源项目一致
Fork自
FLIPPED-AURORA / gin-vue-admin
通知
3
Star
0
Fork
0
代码
文件
提交
分支
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,发现更多精彩内容 >>
提交
dda3f7a8
编写于
8月 31, 2020
作者:
Mr.奇淼(
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
用户头像由上传模式改为 媒体库选择模式
上级
ad17cb82
变更
13
展开全部
显示空白变更内容
内联
并排
Showing
13 changed file
with
109 addition
and
661 deletion
+109
-661
server/GORMV2接口测试文档.md
server/GORMV2接口测试文档.md
+0
-1
server/api/v1/sys_user.go
server/api/v1/sys_user.go
+22
-45
server/db/qmplus.sql
server/db/qmplus.sql
+25
-109
server/db/sqlite/casbin_rule.sql
server/db/sqlite/casbin_rule.sql
+0
-6
server/db/sqlite/sys_apis.sql
server/db/sqlite/sys_apis.sql
+0
-2
server/docs/docs.go
server/docs/docs.go
+20
-177
server/docs/swagger.json
server/docs/swagger.json
+19
-176
server/docs/swagger.yaml
server/docs/swagger.yaml
+13
-130
server/go.mod
server/go.mod
+2
-1
server/model/sys_api.go
server/model/sys_api.go
+0
-1
server/model/sys_casbin.go
server/model/sys_casbin.go
+0
-3
server/router/sys_user.go
server/router/sys_user.go
+1
-1
server/service/sys_user.go
server/service/sys_user.go
+7
-9
未找到文件。
server/GORMV2接口测试文档.md
浏览文件 @
dda3f7a8
...
...
@@ -21,7 +21,6 @@
| /menu/updateBaseMenu | 更新菜单 | √ | SliverHorn |
| /menu/getBaseMenuById | 根据id获取菜单 | √ | SliverHorn |
| /user/changePassword | 修改密码 | √ | SliverHorn |
| /user/uploadHeaderImg | 上传头像 | √ | SliverHorn |
| /user/getUserList | 获取用户列表 | √ | SliverHorn |
| /user/setUserAuthority | 修改用户角色 | √ | SliverHorn |
| /fileUploadAndDownload/upload | 文件上传示例 | √ | SliverHorn |
...
...
server/api/v1/sys_user.go
浏览文件 @
dda3f7a8
...
...
@@ -90,7 +90,7 @@ func tokenNext(c *gin.Context, user model.SysUser) {
NickName
:
user
.
NickName
,
Username
:
user
.
Username
,
AuthorityId
:
user
.
AuthorityId
,
BufferTime
:
60
*
60
*
24
,
// 缓冲时间1天 缓冲时间内会获得新的token刷新令牌 此时一个用户会存在两个有效令牌 但是前端只留一个 另一个会丢失
BufferTime
:
60
*
60
*
24
,
// 缓冲时间1天 缓冲时间内会获得新的token刷新令牌 此时一个用户会存在两个有效令牌 但是前端只留一个 另一个会丢失
StandardClaims
:
jwt
.
StandardClaims
{
NotBefore
:
time
.
Now
()
.
Unix
()
-
1000
,
// 签名生效时间
ExpiresAt
:
time
.
Now
()
.
Unix
()
+
60
*
60
*
24
*
7
,
// 过期时间 7天
...
...
@@ -174,50 +174,6 @@ type UserHeaderImg struct {
HeaderImg
multipart
.
File
`json:"headerImg"`
}
// @Tags SysUser
// @Summary 用户上传头像
// @Security ApiKeyAuth
// @accept multipart/form-data
// @Produce application/json
// @Param headerImg formData file true "用户上传头像"
// @Param username formData string true "用户上传头像"
// @Success 200 {string} string "{"success":true,"data":{},"msg":"上传成功"}"
// @Router /user/uploadHeaderImg [post]
func
UploadHeaderImg
(
c
*
gin
.
Context
)
{
claims
,
_
:=
c
.
Get
(
"claims"
)
// 获取头像文件
// 这里我们通过断言获取 claims内的所有内容
waitUse
:=
claims
.
(
*
request
.
CustomClaims
)
uuid
:=
waitUse
.
UUID
_
,
header
,
err
:=
c
.
Request
.
FormFile
(
"headerImg"
)
// 便于找到用户 以后从jwt中取
if
err
!=
nil
{
response
.
FailWithMessage
(
fmt
.
Sprintf
(
"上传文件失败,%v"
,
err
),
c
)
}
else
{
// 文件上传后拿到文件路径
var
uploadErr
error
var
filePath
string
if
global
.
GVA_CONFIG
.
LocalUpload
.
Local
{
// 本地上传
uploadErr
,
filePath
,
_
=
utils
.
UploadAvatarLocal
(
header
)
}
else
{
// 七牛云上传
uploadErr
,
filePath
,
_
=
utils
.
UploadRemote
(
header
)
}
if
uploadErr
!=
nil
{
response
.
FailWithMessage
(
fmt
.
Sprintf
(
"接收返回值失败,%v"
,
err
),
c
)
}
else
{
// 修改数据库后得到修改后的user并且返回供前端使用
err
,
user
:=
service
.
UploadHeaderImg
(
uuid
,
filePath
)
if
err
!=
nil
{
response
.
FailWithMessage
(
fmt
.
Sprintf
(
"修改数据库链接失败,%v"
,
err
),
c
)
}
else
{
response
.
OkWithData
(
resp
.
SysUserResponse
{
User
:
*
user
},
c
)
}
}
}
}
// @Tags SysUser
// @Summary 分页获取用户列表
// @Security ApiKeyAuth
...
...
@@ -298,3 +254,24 @@ func DeleteUser(c *gin.Context) {
response
.
OkWithMessage
(
"删除成功"
,
c
)
}
}
// @Tags SysUser
// @Summary 删除用户
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data body model.SysUser true "删除用户"
// @Success 200 {string} string "{"success":true,"data":{},"msg":"修改成功"}"
// @Router /user/setUserInfo [put]
func
SetUserInfo
(
c
*
gin
.
Context
)
{
var
user
model
.
SysUser
c
.
ShouldBindJSON
(
&
user
)
err
,
ReqUser
:=
service
.
SetUserInfo
(
user
)
if
err
!=
nil
{
response
.
FailWithMessage
(
fmt
.
Sprintf
(
"更新失败,%v"
,
err
),
c
)
}
else
{
response
.
OkWithData
(
gin
.
H
{
"userInfo"
:
ReqUser
,
},
c
)
}
}
server/db/qmplus.sql
浏览文件 @
dda3f7a8
此差异已折叠。
点击以展开。
server/db/sqlite/casbin_rule.sql
浏览文件 @
dda3f7a8
...
...
@@ -43,8 +43,6 @@ INSERT INTO casbin_rule (p_type,v0,v1,v2,v3,v4,v5) VALUES (
INSERT
INTO
casbin_rule
(
p_type
,
v0
,
v1
,
v2
,
v3
,
v4
,
v5
)
VALUES
(
'p'
,
'8881'
,
'/user/changePassword'
,
'POST'
,
''
,
''
,
''
);
INSERT
INTO
casbin_rule
(
p_type
,
v0
,
v1
,
v2
,
v3
,
v4
,
v5
)
VALUES
(
'p'
,
'8881'
,
'/user/uploadHeaderImg'
,
'POST'
,
''
,
''
,
''
);
INSERT
INTO
casbin_rule
(
p_type
,
v0
,
v1
,
v2
,
v3
,
v4
,
v5
)
VALUES
(
'p'
,
'8881'
,
'/user/getInfoList'
,
'POST'
,
''
,
''
,
''
);
INSERT
INTO
casbin_rule
(
p_type
,
v0
,
v1
,
v2
,
v3
,
v4
,
v5
)
VALUES
(
'p'
,
'8881'
,
'/user/getUserList'
,
'POST'
,
''
,
''
,
''
);
...
...
@@ -121,8 +119,6 @@ INSERT INTO casbin_rule (p_type,v0,v1,v2,v3,v4,v5) VALUES (
INSERT
INTO
casbin_rule
(
p_type
,
v0
,
v1
,
v2
,
v3
,
v4
,
v5
)
VALUES
(
'p'
,
'9528'
,
'/user/changePassword'
,
'POST'
,
''
,
''
,
''
);
INSERT
INTO
casbin_rule
(
p_type
,
v0
,
v1
,
v2
,
v3
,
v4
,
v5
)
VALUES
(
'p'
,
'9528'
,
'/user/uploadHeaderImg'
,
'POST'
,
''
,
''
,
''
);
INSERT
INTO
casbin_rule
(
p_type
,
v0
,
v1
,
v2
,
v3
,
v4
,
v5
)
VALUES
(
'p'
,
'9528'
,
'/user/getInfoList'
,
'POST'
,
''
,
''
,
''
);
INSERT
INTO
casbin_rule
(
p_type
,
v0
,
v1
,
v2
,
v3
,
v4
,
v5
)
VALUES
(
'p'
,
'9528'
,
'/user/getUserList'
,
'POST'
,
''
,
''
,
''
);
...
...
@@ -201,8 +197,6 @@ INSERT INTO casbin_rule (p_type,v0,v1,v2,v3,v4,v5) VALUES (
INSERT
INTO
casbin_rule
(
p_type
,
v0
,
v1
,
v2
,
v3
,
v4
,
v5
)
VALUES
(
'p'
,
'888'
,
'/user/changePassword'
,
'POST'
,
''
,
''
,
''
);
INSERT
INTO
casbin_rule
(
p_type
,
v0
,
v1
,
v2
,
v3
,
v4
,
v5
)
VALUES
(
'p'
,
'888'
,
'/user/uploadHeaderImg'
,
'POST'
,
''
,
''
,
''
);
INSERT
INTO
casbin_rule
(
p_type
,
v0
,
v1
,
v2
,
v3
,
v4
,
v5
)
VALUES
(
'p'
,
'888'
,
'/user/getInfoList'
,
'POST'
,
''
,
''
,
''
);
INSERT
INTO
casbin_rule
(
p_type
,
v0
,
v1
,
v2
,
v3
,
v4
,
v5
)
VALUES
(
'p'
,
'888'
,
'/user/getUserList'
,
'POST'
,
''
,
''
,
''
);
...
...
server/db/sqlite/sys_apis.sql
浏览文件 @
dda3f7a8
...
...
@@ -41,8 +41,6 @@ INSERT INTO sys_apis (id,created_at,updated_at,deleted_at,authority_id,"path",de
INSERT
INTO
sys_apis
(
id
,
created_at
,
updated_at
,
deleted_at
,
authority_id
,
"path"
,
description
,
api_group
,
"method"
)
VALUES
(
23
,
1569828559000
,
1569828559000
,
NULL
,
NULL
,
'/user/changePassword'
,
'修改密码'
,
'user'
,
'POST'
);
INSERT
INTO
sys_apis
(
id
,
created_at
,
updated_at
,
deleted_at
,
authority_id
,
"path"
,
description
,
api_group
,
"method"
)
VALUES
(
24
,
1569828573000
,
1569828573000
,
NULL
,
NULL
,
'/user/uploadHeaderImg'
,
'上传头像'
,
'user'
,
'POST'
);
INSERT
INTO
sys_apis
(
id
,
created_at
,
updated_at
,
deleted_at
,
authority_id
,
"path"
,
description
,
api_group
,
"method"
)
VALUES
(
25
,
1569828600000
,
1569828600000
,
NULL
,
NULL
,
'/user/getInfoList'
,
'分页获取用户列表'
,
'user'
,
'POST'
);
INSERT
INTO
sys_apis
(
id
,
created_at
,
updated_at
,
deleted_at
,
authority_id
,
"path"
,
description
,
api_group
,
"method"
)
VALUES
(
28
,
1570605317000
,
1570605427000
,
NULL
,
NULL
,
'/user/getUserList'
,
'获取用户列表'
,
'user'
,
'POST'
);
...
...
server/docs/docs.go
浏览文件 @
dda3f7a8
此差异已折叠。
点击以展开。
server/docs/swagger.json
浏览文件 @
dda3f7a8
此差异已折叠。
点击以展开。
server/docs/swagger.yaml
浏览文件 @
dda3f7a8
...
...
@@ -19,6 +19,15 @@ definitions:
signingKey
:
type
:
string
type
:
object
config.LocalUpload
:
properties
:
avatarPath
:
type
:
string
filePath
:
type
:
string
local
:
type
:
boolean
type
:
object
config.Log
:
properties
:
file
:
...
...
@@ -80,6 +89,9 @@ definitions:
jwt
:
$ref
:
'
#/definitions/config.JWT'
type
:
object
localUpload
:
$ref
:
'
#/definitions/config.LocalUpload'
type
:
object
log
:
$ref
:
'
#/definitions/config.Log'
type
:
object
...
...
@@ -267,7 +279,7 @@ definitions:
properties
:
key
:
type
:
string
sysBaseMenuI
d
:
sysBaseMenuI
D
:
type
:
integer
type
:
type
:
string
...
...
@@ -575,7 +587,6 @@ paths:
required
:
true
schema
:
$ref
:
'
#/definitions/model.SysApi'
type
:
object
produces
:
-
application/json
responses
:
...
...
@@ -599,7 +610,6 @@ paths:
required
:
true
schema
:
$ref
:
'
#/definitions/model.SysApi'
type
:
object
produces
:
-
application/json
responses
:
...
...
@@ -639,7 +649,6 @@ paths:
required
:
true
schema
:
$ref
:
'
#/definitions/request.GetById'
type
:
object
produces
:
-
application/json
responses
:
...
...
@@ -663,7 +672,6 @@ paths:
required
:
true
schema
:
$ref
:
'
#/definitions/request.SearchApiParams'
type
:
object
produces
:
-
application/json
responses
:
...
...
@@ -687,7 +695,6 @@ paths:
required
:
true
schema
:
$ref
:
'
#/definitions/model.SysApi'
type
:
object
produces
:
-
application/json
responses
:
...
...
@@ -711,7 +718,6 @@ paths:
required
:
true
schema
:
$ref
:
'
#/definitions/response.SysAuthorityCopyResponse'
type
:
object
produces
:
-
application/json
responses
:
...
...
@@ -735,7 +741,6 @@ paths:
required
:
true
schema
:
$ref
:
'
#/definitions/model.SysAuthority'
type
:
object
produces
:
-
application/json
responses
:
...
...
@@ -759,7 +764,6 @@ paths:
required
:
true
schema
:
$ref
:
'
#/definitions/model.SysAuthority'
type
:
object
produces
:
-
application/json
responses
:
...
...
@@ -783,7 +787,6 @@ paths:
required
:
true
schema
:
$ref
:
'
#/definitions/request.PageInfo'
type
:
object
produces
:
-
application/json
responses
:
...
...
@@ -807,7 +810,6 @@ paths:
required
:
true
schema
:
$ref
:
'
#/definitions/model.SysAuthority'
type
:
object
produces
:
-
application/json
responses
:
...
...
@@ -831,7 +833,6 @@ paths:
required
:
true
schema
:
$ref
:
'
#/definitions/model.SysAuthority'
type
:
object
produces
:
-
application/json
responses
:
...
...
@@ -855,7 +856,6 @@ paths:
required
:
true
schema
:
$ref
:
'
#/definitions/model.AutoCodeStruct'
type
:
object
produces
:
-
application/json
responses
:
...
...
@@ -909,7 +909,6 @@ paths:
required
:
true
schema
:
$ref
:
'
#/definitions/request.RegisterAndLoginStruct'
type
:
object
produces
:
-
application/json
responses
:
...
...
@@ -929,7 +928,6 @@ paths:
required
:
true
schema
:
$ref
:
'
#/definitions/model.SysUser'
type
:
object
produces
:
-
application/json
responses
:
...
...
@@ -940,30 +938,6 @@ paths:
summary
:
用户注册账号
tags
:
-
Base
/casbin/CasbinTest
:
get
:
consumes
:
-
application/json
parameters
:
-
description
:
获取权限列表
in
:
body
name
:
data
required
:
true
schema
:
$ref
:
'
#/definitions/request.CasbinInReceive'
type
:
object
produces
:
-
application/json
responses
:
"
200"
:
description
:
'
{"success":true,"data":{},"msg":"获取成功"}'
schema
:
type
:
string
security
:
-
ApiKeyAuth
:
[]
summary
:
casb RBAC RESTFUL测试路由
tags
:
-
casbin
/casbin/UpdateCasbin
:
post
:
consumes
:
...
...
@@ -975,7 +949,6 @@ paths:
required
:
true
schema
:
$ref
:
'
#/definitions/request.CasbinInReceive'
type
:
object
produces
:
-
application/json
responses
:
...
...
@@ -999,7 +972,6 @@ paths:
required
:
true
schema
:
$ref
:
'
#/definitions/request.CasbinInReceive'
type
:
object
produces
:
-
application/json
responses
:
...
...
@@ -1023,7 +995,6 @@ paths:
required
:
true
schema
:
$ref
:
'
#/definitions/model.ExaCustomer'
type
:
object
produces
:
-
application/json
responses
:
...
...
@@ -1046,7 +1017,6 @@ paths:
required
:
true
schema
:
$ref
:
'
#/definitions/model.ExaCustomer'
type
:
object
produces
:
-
application/json
responses
:
...
...
@@ -1069,7 +1039,6 @@ paths:
required
:
true
schema
:
$ref
:
'
#/definitions/model.ExaCustomer'
type
:
object
produces
:
-
application/json
responses
:
...
...
@@ -1092,7 +1061,6 @@ paths:
required
:
true
schema
:
$ref
:
'
#/definitions/model.ExaCustomer'
type
:
object
produces
:
-
application/json
responses
:
...
...
@@ -1116,7 +1084,6 @@ paths:
required
:
true
schema
:
$ref
:
'
#/definitions/request.PageInfo'
type
:
object
produces
:
-
application/json
responses
:
...
...
@@ -1160,7 +1127,6 @@ paths:
required
:
true
schema
:
$ref
:
'
#/definitions/model.ExaFileUploadAndDownload'
type
:
object
produces
:
-
application/json
responses
:
...
...
@@ -1206,7 +1172,6 @@ paths:
required
:
true
schema
:
$ref
:
'
#/definitions/request.PageInfo'
type
:
object
produces
:
-
application/json
responses
:
...
...
@@ -1290,7 +1255,6 @@ paths:
required
:
true
schema
:
$ref
:
'
#/definitions/request.AuthorityIdInfo'
type
:
object
produces
:
-
application/json
responses
:
...
...
@@ -1314,7 +1278,6 @@ paths:
required
:
true
schema
:
$ref
:
'
#/definitions/model.SysBaseMenu'
type
:
object
produces
:
-
application/json
responses
:
...
...
@@ -1338,7 +1301,6 @@ paths:
required
:
true
schema
:
$ref
:
'
#/definitions/request.AddMenuAuthorityInfo'
type
:
object
produces
:
-
application/json
responses
:
...
...
@@ -1362,7 +1324,6 @@ paths:
required
:
true
schema
:
$ref
:
'
#/definitions/request.GetById'
type
:
object
produces
:
-
application/json
responses
:
...
...
@@ -1386,7 +1347,6 @@ paths:
required
:
true
schema
:
$ref
:
'
#/definitions/request.GetById'
type
:
object
produces
:
-
application/json
responses
:
...
...
@@ -1408,7 +1368,6 @@ paths:
required
:
true
schema
:
$ref
:
'
#/definitions/request.RegisterAndLoginStruct'
type
:
object
produces
:
-
application/json
responses
:
...
...
@@ -1430,7 +1389,6 @@ paths:
required
:
true
schema
:
$ref
:
'
#/definitions/request.RegisterAndLoginStruct'
type
:
object
produces
:
-
application/json
responses
:
...
...
@@ -1454,7 +1412,6 @@ paths:
required
:
true
schema
:
$ref
:
'
#/definitions/request.PageInfo'
type
:
object
produces
:
-
application/json
responses
:
...
...
@@ -1478,7 +1435,6 @@ paths:
required
:
true
schema
:
$ref
:
'
#/definitions/model.SysBaseMenu'
type
:
object
produces
:
-
application/json
responses
:
...
...
@@ -1559,7 +1515,6 @@ paths:
required
:
true
schema
:
$ref
:
'
#/definitions/model.SysDictionary'
type
:
object
produces
:
-
application/json
responses
:
...
...
@@ -1583,7 +1538,6 @@ paths:
required
:
true
schema
:
$ref
:
'
#/definitions/model.SysDictionary'
type
:
object
produces
:
-
application/json
responses
:
...
...
@@ -1607,7 +1561,6 @@ paths:
required
:
true
schema
:
$ref
:
'
#/definitions/model.SysDictionary'
type
:
object
produces
:
-
application/json
responses
:
...
...
@@ -1631,7 +1584,6 @@ paths:
required
:
true
schema
:
$ref
:
'
#/definitions/request.SysDictionarySearch'
type
:
object
produces
:
-
application/json
responses
:
...
...
@@ -1655,7 +1607,6 @@ paths:
required
:
true
schema
:
$ref
:
'
#/definitions/model.SysDictionary'
type
:
object
produces
:
-
application/json
responses
:
...
...
@@ -1679,7 +1630,6 @@ paths:
required
:
true
schema
:
$ref
:
'
#/definitions/model.SysDictionaryDetail'
type
:
object
produces
:
-
application/json
responses
:
...
...
@@ -1703,7 +1653,6 @@ paths:
required
:
true
schema
:
$ref
:
'
#/definitions/model.SysDictionaryDetail'
type
:
object
produces
:
-
application/json
responses
:
...
...
@@ -1727,7 +1676,6 @@ paths:
required
:
true
schema
:
$ref
:
'
#/definitions/model.SysDictionaryDetail'
type
:
object
produces
:
-
application/json
responses
:
...
...
@@ -1751,7 +1699,6 @@ paths:
required
:
true
schema
:
$ref
:
'
#/definitions/request.SysDictionaryDetailSearch'
type
:
object
produces
:
-
application/json
responses
:
...
...
@@ -1775,7 +1722,6 @@ paths:
required
:
true
schema
:
$ref
:
'
#/definitions/model.SysDictionaryDetail'
type
:
object
produces
:
-
application/json
responses
:
...
...
@@ -1799,7 +1745,6 @@ paths:
required
:
true
schema
:
$ref
:
'
#/definitions/model.SysOperationRecord'
type
:
object
produces
:
-
application/json
responses
:
...
...
@@ -1823,7 +1768,6 @@ paths:
required
:
true
schema
:
$ref
:
'
#/definitions/model.SysOperationRecord'
type
:
object
produces
:
-
application/json
responses
:
...
...
@@ -1847,7 +1791,6 @@ paths:
required
:
true
schema
:
$ref
:
'
#/definitions/request.IdsReq'
type
:
object
produces
:
-
application/json
responses
:
...
...
@@ -1871,7 +1814,6 @@ paths:
required
:
true
schema
:
$ref
:
'
#/definitions/model.SysOperationRecord'
type
:
object
produces
:
-
application/json
responses
:
...
...
@@ -1895,7 +1837,6 @@ paths:
required
:
true
schema
:
$ref
:
'
#/definitions/request.SysOperationRecordSearch'
type
:
object
produces
:
-
application/json
responses
:
...
...
@@ -1908,30 +1849,6 @@ paths:
summary
:
分页获取SysOperationRecord列表
tags
:
-
SysOperationRecord
/sysOperationRecord/updateSysOperationRecord
:
put
:
consumes
:
-
application/json
parameters
:
-
description
:
更新SysOperationRecord
in
:
body
name
:
data
required
:
true
schema
:
$ref
:
'
#/definitions/model.SysOperationRecord'
type
:
object
produces
:
-
application/json
responses
:
"
200"
:
description
:
'
{"success":true,"data":{},"msg":"更新成功"}'
schema
:
type
:
string
security
:
-
ApiKeyAuth
:
[]
summary
:
更新SysOperationRecord
tags
:
-
SysOperationRecord
/system/ReloadSystem
:
post
:
parameters
:
...
...
@@ -1941,7 +1858,6 @@ paths:
required
:
true
schema
:
$ref
:
'
#/definitions/model.System'
type
:
object
produces
:
-
application/json
responses
:
...
...
@@ -1977,7 +1893,6 @@ paths:
required
:
true
schema
:
$ref
:
'
#/definitions/model.System'
type
:
object
produces
:
-
application/json
responses
:
...
...
@@ -1999,7 +1914,6 @@ paths:
required
:
true
schema
:
$ref
:
'
#/definitions/request.ChangePasswordStruct'
type
:
object
produces
:
-
application/json
responses
:
...
...
@@ -2023,7 +1937,6 @@ paths:
required
:
true
schema
:
$ref
:
'
#/definitions/request.GetById'
type
:
object
produces
:
-
application/json
responses
:
...
...
@@ -2047,7 +1960,6 @@ paths:
required
:
true
schema
:
$ref
:
'
#/definitions/request.PageInfo'
type
:
object
produces
:
-
application/json
responses
:
...
...
@@ -2071,7 +1983,6 @@ paths:
required
:
true
schema
:
$ref
:
'
#/definitions/request.SetUserAuth'
type
:
object
produces
:
-
application/json
responses
:
...
...
@@ -2084,33 +1995,6 @@ paths:
summary
:
设置用户权限
tags
:
-
SysUser
/user/uploadHeaderImg
:
post
:
consumes
:
-
multipart/form-data
parameters
:
-
description
:
用户上传头像
in
:
formData
name
:
headerImg
required
:
true
type
:
file
-
description
:
用户上传头像
in
:
formData
name
:
username
required
:
true
type
:
string
produces
:
-
application/json
responses
:
"
200"
:
description
:
'
{"success":true,"data":{},"msg":"上传成功"}'
schema
:
type
:
string
security
:
-
ApiKeyAuth
:
[]
summary
:
用户上传头像
tags
:
-
SysUser
/workflow/createWorkFlow
:
post
:
parameters
:
...
...
@@ -2120,7 +2004,6 @@ paths:
required
:
true
schema
:
$ref
:
'
#/definitions/model.SysWorkflow'
type
:
object
produces
:
-
application/json
responses
:
...
...
server/go.mod
浏览文件 @
dda3f7a8
...
...
@@ -39,9 +39,10 @@ require (
github.com/spf13/pflag v1.0.5 // indirect
github.com/spf13/viper v1.6.2
github.com/swaggo/gin-swagger v1.2.0
github.com/swaggo/swag v1.6.
5
github.com/swaggo/swag v1.6.
7
github.com/tebeka/strftime v0.1.3 // indirect
github.com/unrolled/secure v1.0.7
github.com/urfave/cli v1.22.2 // indirect
golang.org/x/net v0.0.0-20200320220750-118fecf932d8 // indirect
golang.org/x/sys v0.0.0-20200610111108-226ff32320da // indirect
golang.org/x/tools v0.0.0-20200324003944-a576cf524670 // indirect
...
...
server/model/sys_api.go
浏览文件 @
dda3f7a8
...
...
@@ -36,7 +36,6 @@ func SysApiData() []SysApi {
{
gorm
.
Model
{
ID
:
19
,
CreatedAt
:
time
.
Now
(),
UpdatedAt
:
time
.
Now
()},
"/menu/updateBaseMenu"
,
"更新菜单"
,
"menu"
,
"POST"
},
{
gorm
.
Model
{
ID
:
20
,
CreatedAt
:
time
.
Now
(),
UpdatedAt
:
time
.
Now
()},
"/menu/getBaseMenuById"
,
"根据id获取菜单"
,
"menu"
,
"POST"
},
{
gorm
.
Model
{
ID
:
21
,
CreatedAt
:
time
.
Now
(),
UpdatedAt
:
time
.
Now
()},
"/user/changePassword"
,
"修改密码"
,
"user"
,
"POST"
},
{
gorm
.
Model
{
ID
:
22
,
CreatedAt
:
time
.
Now
(),
UpdatedAt
:
time
.
Now
()},
"/user/uploadHeaderImg"
,
"上传头像"
,
"user"
,
"POST"
},
{
gorm
.
Model
{
ID
:
23
,
CreatedAt
:
time
.
Now
(),
UpdatedAt
:
time
.
Now
()},
"/user/getUserList"
,
"获取用户列表"
,
"user"
,
"POST"
},
{
gorm
.
Model
{
ID
:
24
,
CreatedAt
:
time
.
Now
(),
UpdatedAt
:
time
.
Now
()},
"/user/setUserAuthority"
,
"修改用户角色"
,
"user"
,
"POST"
},
{
gorm
.
Model
{
ID
:
25
,
CreatedAt
:
time
.
Now
(),
UpdatedAt
:
time
.
Now
()},
"/fileUploadAndDownload/upload"
,
"文件上传示例"
,
"fileUploadAndDownload"
,
"POST"
},
...
...
server/model/sys_casbin.go
浏览文件 @
dda3f7a8
...
...
@@ -33,7 +33,6 @@ func CasbinModelData() []CasbinModel {
{
"p"
,
"888"
,
"/menu/updateBaseMenu"
,
"POST"
},
{
"p"
,
"888"
,
"/menu/getBaseMenuById"
,
"POST"
},
{
"p"
,
"888"
,
"/user/changePassword"
,
"POST"
},
{
"p"
,
"888"
,
"/user/uploadHeaderImg"
,
"POST"
},
{
"p"
,
"888"
,
"/user/getUserList"
,
"POST"
},
{
"p"
,
"888"
,
"/user/setUserAuthority"
,
"POST"
},
{
"p"
,
"888"
,
"/user/deleteUser"
,
"DELETE"
},
...
...
@@ -93,7 +92,6 @@ func CasbinModelData() []CasbinModel {
{
"p"
,
"8881"
,
"/menu/updateBaseMenu"
,
"POST"
},
{
"p"
,
"8881"
,
"/menu/getBaseMenuById"
,
"POST"
},
{
"p"
,
"8881"
,
"/user/changePassword"
,
"POST"
},
{
"p"
,
"8881"
,
"/user/uploadHeaderImg"
,
"POST"
},
{
"p"
,
"8881"
,
"/user/getUserList"
,
"POST"
},
{
"p"
,
"8881"
,
"/user/setUserAuthority"
,
"POST"
},
{
"p"
,
"8881"
,
"/fileUploadAndDownload/upload"
,
"POST"
},
...
...
@@ -131,7 +129,6 @@ func CasbinModelData() []CasbinModel {
{
"p"
,
"9528"
,
"/menu/updateBaseMenu"
,
"POST"
},
{
"p"
,
"9528"
,
"/menu/getBaseMenuById"
,
"POST"
},
{
"p"
,
"9528"
,
"/user/changePassword"
,
"POST"
},
{
"p"
,
"9528"
,
"/user/uploadHeaderImg"
,
"POST"
},
{
"p"
,
"9528"
,
"/user/getUserList"
,
"POST"
},
{
"p"
,
"9528"
,
"/user/setUserAuthority"
,
"POST"
},
{
"p"
,
"9528"
,
"/fileUploadAndDownload/upload"
,
"POST"
},
...
...
server/router/sys_user.go
浏览文件 @
dda3f7a8
...
...
@@ -13,9 +13,9 @@ func InitUserRouter(Router *gin.RouterGroup) {
Use
(
middleware
.
OperationRecord
())
{
UserRouter
.
POST
(
"changePassword"
,
v1
.
ChangePassword
)
// 修改密码
UserRouter
.
POST
(
"uploadHeaderImg"
,
v1
.
UploadHeaderImg
)
// 上传头像
UserRouter
.
POST
(
"getUserList"
,
v1
.
GetUserList
)
// 分页获取用户列表
UserRouter
.
POST
(
"setUserAuthority"
,
v1
.
SetUserAuthority
)
// 设置用户权限
UserRouter
.
DELETE
(
"deleteUser"
,
v1
.
DeleteUser
)
// 删除用户
UserRouter
.
PUT
(
"setUserInfo"
,
v1
.
SetUserInfo
)
// 设置用户信息
}
}
server/service/sys_user.go
浏览文件 @
dda3f7a8
...
...
@@ -19,7 +19,7 @@ import (
func
Register
(
u
model
.
SysUser
)
(
err
error
,
userInter
model
.
SysUser
)
{
var
user
model
.
SysUser
if
!
errors
.
Is
(
global
.
GVA_DB
.
Where
(
"username = ?"
,
u
.
Username
)
.
First
(
&
user
)
.
Error
,
gorm
.
ErrRecordNotFound
){
// 判断用户名是否注册
if
!
errors
.
Is
(
global
.
GVA_DB
.
Where
(
"username = ?"
,
u
.
Username
)
.
First
(
&
user
)
.
Error
,
gorm
.
ErrRecordNotFound
)
{
// 判断用户名是否注册
return
errors
.
New
(
"用户名已注册"
),
userInter
}
// 否则 附加uuid 密码md5简单加密 注册
...
...
@@ -101,16 +101,14 @@ func DeleteUser(id float64) (err error) {
return
err
}
// @title
UploadHeaderImg
// @description
upload avatar, 用户头像上传更新地址
// @title
SetUserInfo
// @description
set the authority of a certain user, 设置用户信息
// @auth (2020/04/05 20:22)
// @param uuid UUID
// @param
filePath
string
// @param
authorityId
string
// @return err error
// @return userInter *SysUser
func
UploadHeaderImg
(
uuid
uuid
.
UUID
,
filePath
string
)
(
err
error
,
userInter
*
model
.
SysUser
)
{
var
user
model
.
SysUser
err
=
global
.
GVA_DB
.
Where
(
"uuid = ?"
,
uuid
)
.
First
(
&
user
)
.
Update
(
"header_img"
,
filePath
)
.
First
(
&
user
)
.
Error
return
err
,
&
user
func
SetUserInfo
(
reqUser
model
.
SysUser
)
(
err
error
,
user
model
.
SysUser
)
{
err
=
global
.
GVA_DB
.
Updates
(
&
reqUser
)
.
Error
return
err
,
reqUser
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录