|
|
@@ -17,6 +17,7 @@ func (c *UserController) BeforeActivation(b mvc.BeforeActivation) {
|
|
|
b.Handle("GET", "/{groupId:int64}/{accountId:int64}", "GetById" )
|
|
|
b.Handle("POST", "/add", "Create" )
|
|
|
b.Handle("PUT", "/update", "Update" )
|
|
|
+ b.Handle("PUT", "/updatePassword/{pwd: string}", "UpdatePassword" )
|
|
|
b.Handle("PUT", "/resetPassword/{userId:int64}", "ResetPassword" )
|
|
|
b.Handle("PUT", "/updateStatus/{userId:int64}/{status:int64}", "UpdateStatus" )
|
|
|
b.Handle("DELETE", "/{accountId:int64}", "DeleteById" )
|
|
|
@@ -27,7 +28,7 @@ func (c *UserController) BeforeActivation(b mvc.BeforeActivation) {
|
|
|
b.Handle("GET", "/select", "SelectUser" )
|
|
|
}
|
|
|
|
|
|
-func (c *UserController) GetPage() *JsonResult {
|
|
|
+func (c *UserController) GetPage()*JsonResult {
|
|
|
params := c.buildParams()
|
|
|
data, err := c.Service.GetPage(params)
|
|
|
if err != nil {
|
|
|
@@ -47,7 +48,7 @@ func (c *UserController) GetList() *JsonResult {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-func (c *UserController) GetById(groupId, accountId int64) *JsonResult {
|
|
|
+func (c *UserController) GetById(groupId, accountId int64)*JsonResult {
|
|
|
ocId := c.GetCurOcId()
|
|
|
data, err := c.Service.GetById(ocId, groupId, accountId)
|
|
|
if err != nil {
|
|
|
@@ -89,6 +90,17 @@ func (c *UserController) Update() *JsonResult {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+func (c *UserController) UpdatePassword(psw string)*JsonResult{
|
|
|
+ ocId := c.GetCurOcId()
|
|
|
+ userId := c.GetCurUserId()
|
|
|
+ err := c.Service.UpdatePassword(ocId, userId, psw)
|
|
|
+ if err != nil {
|
|
|
+ return ResultErr(err.Error(), nil)
|
|
|
+ } else {
|
|
|
+ return ResultOk("密码更新成功", nil)
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
func (c *UserController) ResetPassword(userId int64)*JsonResult{
|
|
|
ocId := c.GetCurOcId()
|
|
|
err := c.Service.ResetPassword(ocId, userId)
|
|
|
@@ -99,7 +111,7 @@ func (c *UserController) ResetPassword(userId int64)*JsonResult{
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-func (c *UserController) UpdateStatus(userId, status int64) *JsonResult{
|
|
|
+func (c *UserController) UpdateStatus(userId, status int64)*JsonResult{
|
|
|
ocId := c.GetCurOcId()
|
|
|
err := c.Service.ChangeStatus(ocId, userId, status)
|
|
|
if err != nil {
|
|
|
@@ -109,7 +121,7 @@ func (c *UserController) UpdateStatus(userId, status int64) *JsonResult{
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-func (c *UserController) DeleteById(accountId int64) *JsonResult {
|
|
|
+func (c *UserController) DeleteById(accountId int64)*JsonResult {
|
|
|
ocId := c.GetCurOcId()
|
|
|
userId := c.GetCurUserId()
|
|
|
|