|
@@ -356,6 +356,23 @@ func (b *BaseApi) SetUserInfo(c *gin.Context) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+func (b *BaseApi) SetUserName(c *gin.Context) {
|
|
|
+ var user system.SysUser
|
|
|
+ _ = c.ShouldBindJSON(&user)
|
|
|
+ if err := utils.Verify(user, utils.IdVerify); err != nil {
|
|
|
+ response.FailWithMessage(err.Error(), c)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ _, userNow := userService.FindUserById(int(user.ID))
|
|
|
+ userNow.Username = user.Username
|
|
|
+ if err, ReqUser := userService.SetUserName(userNow); err != nil {
|
|
|
+ global.GVA_LOG.Error("设置失败!", zap.Any("err", err))
|
|
|
+ response.FailWithMessage("设置失败", c)
|
|
|
+ } else {
|
|
|
+ response.OkWithDetailed(gin.H{"userInfo": ReqUser}, "设置成功", c)
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
// @Tags SysUser
|
|
|
// @Summary 获取用户信息
|
|
|
// @Security ApiKeyAuth
|