|
@@ -61,15 +61,15 @@ 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 := &viewmodels.UserInfo{}
|
|
user := &viewmodels.UserInfo{}
|
|
|
- err := c.Ctx.ReadJSON(user)
|
|
|
|
|
- if err != nil {
|
|
|
|
|
|
|
+ if err := c.Ctx.ReadJSON(user); err != nil {
|
|
|
return ResultErr("读取数据失败", nil)
|
|
return ResultErr("读取数据失败", nil)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
user.OcId = ocId
|
|
user.OcId = ocId
|
|
|
- err = c.Service.Create(ocTypeId, user)
|
|
|
|
|
- if err != nil {
|
|
|
|
|
|
|
+
|
|
|
|
|
+ if err := c.Service.Create(ocTypeId, user); err != nil {
|
|
|
return ResultErr(err.Error(), nil)
|
|
return ResultErr(err.Error(), nil)
|
|
|
} else {
|
|
} else {
|
|
|
return ResultOk("新增成功", nil)
|
|
return ResultOk("新增成功", nil)
|
|
@@ -78,12 +78,12 @@ func (c *UserController) Create() *JsonResult {
|
|
|
|
|
|
|
|
func (c *UserController) Update() *JsonResult {
|
|
func (c *UserController) Update() *JsonResult {
|
|
|
user := &viewmodels.UserInfo{}
|
|
user := &viewmodels.UserInfo{}
|
|
|
- err := c.Ctx.ReadJSON(user)
|
|
|
|
|
- if err != nil {
|
|
|
|
|
|
|
+
|
|
|
|
|
+ if err := c.Ctx.ReadJSON(user); err != nil {
|
|
|
return ResultErr("读取数据失败", nil)
|
|
return ResultErr("读取数据失败", nil)
|
|
|
}
|
|
}
|
|
|
- err = c.Service.Update(user)
|
|
|
|
|
- if err != nil {
|
|
|
|
|
|
|
+
|
|
|
|
|
+ if err := c.Service.Update(user); err != nil {
|
|
|
return ResultErr(err.Error(), nil)
|
|
return ResultErr(err.Error(), nil)
|
|
|
} else {
|
|
} else {
|
|
|
return ResultOk("更新成功", nil)
|
|
return ResultOk("更新成功", nil)
|
|
@@ -93,8 +93,8 @@ 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()
|
|
|
- err := c.Service.UpdatePassword(ocId, userId, psw)
|
|
|
|
|
- if err != nil {
|
|
|
|
|
|
|
+
|
|
|
|
|
+ if err := c.Service.UpdatePassword(ocId, userId, psw); err != nil {
|
|
|
return ResultErr(err.Error(), nil)
|
|
return ResultErr(err.Error(), nil)
|
|
|
} else {
|
|
} else {
|
|
|
return ResultOk("密码更新成功", nil)
|
|
return ResultOk("密码更新成功", nil)
|
|
@@ -103,8 +103,8 @@ 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()
|
|
|
- err := c.Service.ResetPassword(ocId, userId)
|
|
|
|
|
- if err != nil {
|
|
|
|
|
|
|
+
|
|
|
|
|
+ if err := c.Service.ResetPassword(ocId, userId); err != nil {
|
|
|
return ResultErr(err.Error(), nil)
|
|
return ResultErr(err.Error(), nil)
|
|
|
} else {
|
|
} else {
|
|
|
return ResultOk("密码重置成功", nil)
|
|
return ResultOk("密码重置成功", nil)
|
|
@@ -113,8 +113,8 @@ 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()
|
|
|
- err := c.Service.ChangeStatus(ocId, userId, status)
|
|
|
|
|
- if err != nil {
|
|
|
|
|
|
|
+
|
|
|
|
|
+ if err := c.Service.ChangeStatus(ocId, userId, status); err != nil {
|
|
|
return ResultErr(err.Error(), nil)
|
|
return ResultErr(err.Error(), nil)
|
|
|
} else {
|
|
} else {
|
|
|
return ResultOk("状态变更成功", nil)
|
|
return ResultOk("状态变更成功", nil)
|
|
@@ -129,8 +129,8 @@ func (c *UserController) DeleteById(accountId int64)*JsonResult {
|
|
|
m["ocId"] = ocId
|
|
m["ocId"] = ocId
|
|
|
m["accountId"] = accountId
|
|
m["accountId"] = accountId
|
|
|
m["deletedBy"] = userId
|
|
m["deletedBy"] = userId
|
|
|
- err := c.Service.Delete(m)
|
|
|
|
|
- if err != nil {
|
|
|
|
|
|
|
+
|
|
|
|
|
+ if err := c.Service.Delete(m); err != nil {
|
|
|
return ResultErr(err.Error(), nil)
|
|
return ResultErr(err.Error(), nil)
|
|
|
} else {
|
|
} else {
|
|
|
return ResultOk("删除成功", nil)
|
|
return ResultOk("删除成功", nil)
|