|
@@ -12,16 +12,18 @@ type UserController struct {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
func (c *UserController) BeforeActivation(b mvc.BeforeActivation) {
|
|
func (c *UserController) BeforeActivation(b mvc.BeforeActivation) {
|
|
|
- b.Handle("GET", "/page", "GetPage" )
|
|
|
|
|
- b.Handle("GET", "/{groupId:int64}/{accountId:int64}", "GetById" )
|
|
|
|
|
- b.Handle("POST", "/add", "Create" )
|
|
|
|
|
- b.Handle("PUT", "/update", "Update" )
|
|
|
|
|
- b.Handle("DELETE", "/{accountId:int64}", "DeleteById" )
|
|
|
|
|
- b.Handle("GET", "/IsUserNameExist/{userName: string}", "IsUserNameExist" )
|
|
|
|
|
- b.Handle("GET", "/IsUserPhoneExist/{userPhone: string}", "IsUserPhoneExist")
|
|
|
|
|
- b.Handle("GET", "/IsStaffNoExist/{staffNo: string}", "IsStaffNoExist" )
|
|
|
|
|
- b.Handle("GET", "/IsEmailExist/{email: string}", "IsEmailExist" )
|
|
|
|
|
- b.Handle("GET", "/select", "SelectUser" )
|
|
|
|
|
|
|
+ b.Handle("GET", "/page", "GetPage" )
|
|
|
|
|
+ b.Handle("GET", "/{groupId:int64}/{accountId:int64}", "GetById" )
|
|
|
|
|
+ b.Handle("POST", "/add", "Create" )
|
|
|
|
|
+ b.Handle("PUT", "/update", "Update" )
|
|
|
|
|
+ b.Handle("PUT", "/resetPassword/{userId:int64}", "ResetPassword" )
|
|
|
|
|
+ b.Handle("PUT", "/updateStatus/{userId:int64}/{status:int64}", "UpdateStatus" )
|
|
|
|
|
+ b.Handle("DELETE", "/{accountId:int64}", "DeleteById" )
|
|
|
|
|
+ b.Handle("GET", "/IsUserNameExist/{userName: string}", "IsUserNameExist" )
|
|
|
|
|
+ b.Handle("GET", "/IsUserPhoneExist/{userPhone: string}", "IsUserPhoneExist")
|
|
|
|
|
+ b.Handle("GET", "/IsStaffNoExist/{staffNo: string}", "IsStaffNoExist" )
|
|
|
|
|
+ b.Handle("GET", "/IsEmailExist/{email: string}", "IsEmailExist" )
|
|
|
|
|
+ b.Handle("GET", "/select", "SelectUser" )
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
func (c *UserController) GetPage() *JsonResult {
|
|
func (c *UserController) GetPage() *JsonResult {
|
|
@@ -76,6 +78,26 @@ func (c *UserController) Update() *JsonResult {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+func (c *UserController) ResetPassword(userId int64)*JsonResult{
|
|
|
|
|
+ ocId := c.GetCurOcId()
|
|
|
|
|
+ err := c.Service.ResetPassword(ocId, userId)
|
|
|
|
|
+ if err != nil {
|
|
|
|
|
+ return ResultErr(err.Error(), nil)
|
|
|
|
|
+ } else {
|
|
|
|
|
+ return ResultOk("密码重置成功", nil)
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+func (c *UserController) UpdateStatus(userId, status int64) *JsonResult{
|
|
|
|
|
+ ocId := c.GetCurOcId()
|
|
|
|
|
+ err := c.Service.ChangeStatus(ocId, userId, status)
|
|
|
|
|
+ if err != nil {
|
|
|
|
|
+ return ResultErr(err.Error(), nil)
|
|
|
|
|
+ } else {
|
|
|
|
|
+ return ResultOk("状态变更成功", nil)
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
func (c *UserController) DeleteById(accountId int64) *JsonResult {
|
|
func (c *UserController) DeleteById(accountId int64) *JsonResult {
|
|
|
ocId := c.GetCurOcId()
|
|
ocId := c.GetCurOcId()
|
|
|
userId := c.GetCurUserId()
|
|
userId := c.GetCurUserId()
|