This commit is contained in:
@@ -23,12 +23,12 @@ type UserInfo struct {
|
||||
|
||||
// Profile 获取当前登录用户的基础信息。
|
||||
//
|
||||
// @Summary 获取个人信息
|
||||
// @Tags Users
|
||||
// @Produce json
|
||||
// @Success 200 {object} UserInfo "成功"
|
||||
// @Router /v1/users/profile [get]
|
||||
// @Bind user local
|
||||
// @Summary 获取个人信息
|
||||
// @Tags Users
|
||||
// @Produce json
|
||||
// @Success 200 {object} UserInfo "成功"
|
||||
// @Router /v1/users/profile [get]
|
||||
// @Bind user local
|
||||
func (ctl *users) Profile(ctx fiber.Ctx, user *models.User) (*UserInfo, error) {
|
||||
return &UserInfo{
|
||||
ID: user.ID,
|
||||
@@ -45,15 +45,15 @@ type ProfileForm struct {
|
||||
|
||||
// Update 修改当前登录用户的用户名。
|
||||
//
|
||||
// @Summary 修改用户名
|
||||
// @Tags Users
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param form body ProfileForm true "请求体"
|
||||
// @Success 200 {object} any "成功"
|
||||
// @Router /v1/users/username [put]
|
||||
// @Bind user local
|
||||
// @Bind form body
|
||||
// @Summary 修改用户名
|
||||
// @Tags Users
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param form body ProfileForm true "请求体"
|
||||
// @Success 200 {object} any "成功"
|
||||
// @Router /v1/users/username [put]
|
||||
// @Bind user local
|
||||
// @Bind form body
|
||||
func (ctl *users) Update(ctx fiber.Ctx, user *models.User, form *ProfileForm) error {
|
||||
username := strings.TrimSpace(form.Username)
|
||||
if len([]rune(username)) > 12 {
|
||||
|
||||
Reference in New Issue
Block a user