This commit is contained in:
2026-08-15 01:12:04 +08:00
parent f63acae353
commit 6698e59c3a
45 changed files with 725 additions and 415 deletions
+9 -9
View File
@@ -54,7 +54,7 @@ func (h *User) Update(c *gin.Context) {
httpx.Fail(c, "修改失败")
return
}
httpx.OK(c)
httpx.Write(c, httpx.CodeSuccess, gin.H{}, "设置成功")
}
func (h *User) UpdateSelf(c *gin.Context) {
@@ -73,7 +73,7 @@ func (h *User) UpdateSelf(c *gin.Context) {
httpx.Fail(c, "修改失败")
return
}
httpx.OK(c)
httpx.Write(c, httpx.CodeSuccess, gin.H{}, "设置成功")
}
func (h *User) Delete(c *gin.Context) {
@@ -91,7 +91,7 @@ func (h *User) Delete(c *gin.Context) {
httpx.Fail(c, "删除失败")
return
}
httpx.OK(c)
httpx.Write(c, httpx.CodeSuccess, gin.H{}, "删除成功")
}
func (h *User) ResetPassword(c *gin.Context) {
@@ -101,10 +101,10 @@ func (h *User) ResetPassword(c *gin.Context) {
return
}
if err := h.service.ResetPassword(c.Request.Context(), req.ID, req.Password); err != nil {
httpx.Fail(c, "重置失败")
httpx.Fail(c, "重置失败"+err.Error())
return
}
httpx.OK(c)
httpx.Write(c, httpx.CodeSuccess, gin.H{}, "重置成功")
}
func (h *User) ChangePassword(c *gin.Context) {
@@ -118,7 +118,7 @@ func (h *User) ChangePassword(c *gin.Context) {
httpx.Fail(c, "修改失败,原密码与当前账户不符")
return
}
httpx.OK(c)
httpx.Write(c, httpx.CodeSuccess, gin.H{}, "修改成功")
}
func (h *User) SetSelfSetting(c *gin.Context) {
@@ -132,7 +132,7 @@ func (h *User) SetSelfSetting(c *gin.Context) {
httpx.Fail(c, "设置失败")
return
}
httpx.OK(c)
httpx.Write(c, httpx.CodeSuccess, gin.H{}, "设置成功")
}
func (h *User) SetAuthorities(c *gin.Context) {
@@ -145,7 +145,7 @@ func (h *User) SetAuthorities(c *gin.Context) {
httpx.Fail(c, "修改失败")
return
}
httpx.OK(c)
httpx.Write(c, httpx.CodeSuccess, gin.H{}, "修改成功")
}
func (h *User) SwitchAuthority(c *gin.Context) {
@@ -164,7 +164,7 @@ func (h *User) SwitchAuthority(c *gin.Context) {
c.Header("new-expires-at", strconv.FormatInt(login.ExpiresAt/1000, 10))
maxAge := int(time.Until(time.UnixMilli(login.ExpiresAt)).Seconds())
httpx.SetTokenCookie(c, login.Token, maxAge)
httpx.OK(c)
httpx.Write(c, httpx.CodeSuccess, gin.H{}, "修改成功")
}
func (h *User) Get(c *gin.Context) {