|
@@ -12,21 +12,21 @@ 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", "/", "GetList" )
|
|
|
|
|
- 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" )
|
|
|
|
|
- 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", "/permit", "GetPermit" )
|
|
|
|
|
|
|
+ b.Handle("GET", "/page", "GetPage" )
|
|
|
|
|
+ b.Handle("GET", "/", "GetList" )
|
|
|
|
|
+ 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" )
|
|
|
|
|
+ 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", "/permit", "GetPermit" )
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
func (c *UserController) GetPage() *JsonResult {
|
|
func (c *UserController) GetPage() *JsonResult {
|
|
@@ -60,7 +60,7 @@ func (c *UserController) GetById(groupId, accountId int64) *JsonResult {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
func (c *UserController) Create() *JsonResult {
|
|
func (c *UserController) Create() *JsonResult {
|
|
|
- ocId := c.GetCurOcId()
|
|
|
|
|
|
|
+ ocId := c.GetCurOcId()
|
|
|
ocTypeId := c.GetOcTypeId()
|
|
ocTypeId := c.GetOcTypeId()
|
|
|
|
|
|
|
|
user := &viewmodel.UserInfo{}
|
|
user := &viewmodel.UserInfo{}
|
|
@@ -69,7 +69,6 @@ func (c *UserController) Create() *JsonResult {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
user.OcId = ocId
|
|
user.OcId = ocId
|
|
|
-
|
|
|
|
|
if err := c.Service.Create(ocTypeId, user); err != nil {
|
|
if err := c.Service.Create(ocTypeId, user); err != nil {
|
|
|
return ResultErr(err.Error(), nil)
|
|
return ResultErr(err.Error(), nil)
|
|
|
} else {
|
|
} else {
|
|
@@ -91,7 +90,7 @@ func (c *UserController) Update() *JsonResult {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
func (c *UserController) UpdatePassword(psw string) *JsonResult {
|
|
func (c *UserController) UpdatePassword(psw string) *JsonResult {
|
|
|
- ocId := c.GetCurOcId()
|
|
|
|
|
|
|
+ ocId := c.GetCurOcId()
|
|
|
userId := c.GetCurUserId()
|
|
userId := c.GetCurUserId()
|
|
|
|
|
|
|
|
if err := c.Service.UpdatePassword(ocId, userId, psw); err != nil {
|
|
if err := c.Service.UpdatePassword(ocId, userId, psw); err != nil {
|
|
@@ -103,7 +102,6 @@ func (c *UserController) UpdatePassword(psw string) *JsonResult {
|
|
|
|
|
|
|
|
func (c *UserController) ResetPassword(userId int64) *JsonResult {
|
|
func (c *UserController) ResetPassword(userId int64) *JsonResult {
|
|
|
ocId := c.GetCurOcId()
|
|
ocId := c.GetCurOcId()
|
|
|
-
|
|
|
|
|
if err := c.Service.ResetPassword(ocId, userId); err != nil {
|
|
if err := c.Service.ResetPassword(ocId, userId); err != nil {
|
|
|
return ResultErr(err.Error(), nil)
|
|
return ResultErr(err.Error(), nil)
|
|
|
} else {
|
|
} else {
|
|
@@ -113,7 +111,6 @@ 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()
|
|
ocId := c.GetCurOcId()
|
|
|
-
|
|
|
|
|
if err := c.Service.ChangeStatus(ocId, userId, status); err != nil {
|
|
if err := c.Service.ChangeStatus(ocId, userId, status); err != nil {
|
|
|
return ResultErr(err.Error(), nil)
|
|
return ResultErr(err.Error(), nil)
|
|
|
} else {
|
|
} else {
|
|
@@ -122,7 +119,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()
|
|
|
|
|
|
|
+ ocId := c.GetCurOcId()
|
|
|
userId := c.GetCurUserId()
|
|
userId := c.GetCurUserId()
|
|
|
|
|
|
|
|
m := make(map[string]interface{})
|
|
m := make(map[string]interface{})
|