urbanu 1 mesiac pred
rodič
commit
0840296677
2 zmenil súbory, kde vykonal 15 pridanie a 0 odobranie
  1. 12 0
      apis/daytask/user.go
  2. 3 0
      commons/model/entity/dt_user.go

+ 12 - 0
apis/daytask/user.go

@@ -37,6 +37,9 @@ func (s *Server) UserUpdate(c *gin.Context) {
 	type UpdateRequest struct {
 		Nickname string `json:"nickname"`
 		Avatar   string `json:"avatar"`
+		Gender   *int8  `json:"gender"`
+		Age      *int   `json:"age"`
+		Region   string `json:"region"`
 		RealName string `json:"realName"`
 		IdCard   string `json:"idCard"`
 	}
@@ -54,6 +57,15 @@ func (s *Server) UserUpdate(c *gin.Context) {
 	if req.Avatar != "" {
 		updates["avatar"] = req.Avatar
 	}
+	if req.Gender != nil {
+		updates["gender"] = *req.Gender
+	}
+	if req.Age != nil {
+		updates["age"] = *req.Age
+	}
+	if req.Region != "" {
+		updates["region"] = req.Region
+	}
 
 	// 实名信息只能设置一次
 	user := &entity.DtUser{}

+ 3 - 0
commons/model/entity/dt_user.go

@@ -32,6 +32,9 @@ type DtUser struct {
 	RegisterDevice   string  `json:"registerDevice" gorm:"type:varchar(255);comment:注册设备"`
 	LastLoginTime      int64   `json:"lastLoginTime" gorm:"comment:最后登录时间"`
 	LastLoginIp        string  `json:"lastLoginIp" gorm:"type:varchar(64);comment:最后登录IP"`
+	Gender             int8    `json:"gender" gorm:"default:0;comment:性别: 0=未知 1=男 2=女"`
+	Age                int     `json:"age" gorm:"default:0;comment:年龄"`
+	Region             string  `json:"region" gorm:"type:varchar(128);comment:地区"`
 	Remark             string  `json:"remark" gorm:"type:varchar(255);comment:备注"`
 	ContinuousSignDays int     `json:"continuousSignDays" gorm:"default:0;comment:连续签到天数"`
 	TotalSignDays      int     `json:"totalSignDays" gorm:"default:0;comment:累计签到天数"`