Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
nbya
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
haoyanbin
nbya
Commits
1d055d5f
Commit
1d055d5f
authored
3 years ago
by
haoyanbin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reset
parent
0ea76144
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
31 additions
and
26 deletions
+31
-26
org_user.go
app/operate/apis/org_user.go
+27
-22
org_user.go
app/operate/router/org_user.go
+1
-1
org_user.go
app/operate/service/dto/org_user.go
+3
-3
No files found.
app/operate/apis/org_user.go
View file @
1d055d5f
...
...
@@ -276,29 +276,34 @@ func (e OrgUser) UpdateStatus(c *gin.Context) {
// @Router /api/v1/org-user/pwd/reset [put]
// @Security Bearer
func
(
e
OrgUser
)
ResetPwd
(
c
*
gin
.
Context
)
{
//
s := service.OrgUser{}
s
:=
service
.
OrgUser
{}
req
:=
dto
.
ResetPwdReq
{}
fmt
.
Println
(
req
)
// err := e.MakeContext(c).
// MakeOrm().
// Bind(&req, binding.JSON).
// MakeService(&s.Service).
// Errors
// if err != nil {
// e.Logger.Error(err)
// e.Error(500, err, err.Error())
// return
// }
//
// req.SetUpdateBy(user.GetUserId(c))
//
// //数据权限检查
// p := actions.GetPermissionFromContext(c)
//
// err = s.ResetPwd(&req, p)
// if err != nil {
// e.Logger.Error(err)
// return
// }
err
:=
e
.
MakeContext
(
c
)
.
MakeOrm
()
.
Bind
(
&
req
,
binding
.
JSON
)
.
MakeService
(
&
s
.
Service
)
.
Errors
if
err
!=
nil
{
e
.
Logger
.
Error
(
err
)
e
.
Error
(
500
,
err
,
err
.
Error
())
return
}
req
.
SetUpdateBy
(
user
.
GetUserId
(
c
))
//数据权限检查
p
:=
actions
.
GetPermissionFromContext
(
c
)
reqUpdate
:=
dto
.
OrgUserUpdateReq
{}
reqUpdate
.
UserId
=
req
.
UserId
reqUpdate
.
Password
=
"123456"
reqUpdate
.
UpdateBy
=
user
.
GetUserId
(
c
)
err
=
s
.
Update
(
&
reqUpdate
,
p
)
if
err
!=
nil
{
e
.
Logger
.
Error
(
err
)
return
}
e
.
OK
(
""
,
"更新成功"
)
}
This diff is collapsed.
Click to expand it.
app/operate/router/org_user.go
View file @
1d055d5f
...
...
@@ -22,11 +22,11 @@ func registerOrgUserRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddle
r
.
POST
(
""
,
api
.
Insert
)
r
.
PUT
(
"/:userId"
,
api
.
Update
)
r
.
DELETE
(
""
,
api
.
Delete
)
r
.
PUT
(
"/reset"
,
api
.
ResetPwd
)
}
user
:=
v1
.
Group
(
"/org-user"
)
.
Use
(
authMiddleware
.
MiddlewareFunc
())
.
Use
(
middleware
.
AuthCheckRole
())
.
Use
(
actions
.
PermissionAction
())
{
user
.
PUT
(
"/pwd/reset"
,
api
.
ResetPwd
)
user
.
PUT
(
"/status"
,
api
.
UpdateStatus
)
}
}
This diff is collapsed.
Click to expand it.
app/operate/service/dto/org_user.go
View file @
1d055d5f
...
...
@@ -60,6 +60,7 @@ type OrgUserUpdateReq struct {
NickName
string
`json:"nickName" comment:"姓名"`
NickNameEn
string
`json:"nickNameEn" comment:"姓名"`
Username
string
`json:"username" comment:"账号"`
Password
string
`json:"password" comment:"密码"`
Status
string
`json:"status" comment:"状态" default:"2"`
common
.
ControlBy
}
...
...
@@ -71,8 +72,7 @@ type OrgUserUpdateStatusReq struct {
}
type
ResetPwdReq
struct
{
UserId
int
`json:"userId" comment:""`
//
Status
string
`json:"status" comment:"状态 1 离职 2 在职"`
//状态 1 离职 2 在职
UserId
int
`json:"userId" comment:""`
//
common
.
ControlBy
}
...
...
@@ -81,9 +81,9 @@ func (s *OrgUserUpdateReq) Generate(model *models.SysUser) {
model
.
NickName
=
s
.
NickName
model
.
NickNameEn
=
s
.
NickNameEn
model
.
Username
=
s
.
Username
model
.
Password
=
Pwd
(
s
.
Password
)
model
.
RoleId
,
_
=
strconv
.
Atoi
(
s
.
RoleId
)
model
.
Status
=
s
.
Status
model
.
Password
=
Pwd
(
"123456"
)
}
func
(
s
*
OrgUserUpdateReq
)
GetId
()
interface
{}
{
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment