feat: phone validation
Some checks failed
build quyun / Build (push) Failing after 1m25s

This commit is contained in:
2025-12-20 11:47:45 +08:00
parent fdbf26d751
commit 0e4af79b53
31 changed files with 1130 additions and 984 deletions

View File

@@ -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 {