Browse Source

增加风险测评字段

kobe6258 6 months ago
parent
commit
69173ad9e6

+ 6 - 4
controllers/user/user_controller.go

@@ -313,8 +313,9 @@ func (u *UserController) FollowingAnalysts(analystId int) {
 }
 
 type UserProfileReq struct {
-	UserName string `json:"userName"`
-	Mobile   string `json:"mobile"`
+	UserName  string `json:"userName"`
+	RiskLevel string `json:"riskLevel"`
+	Mobile    string `json:"mobile"`
 }
 
 // Profile  获取用户信息
@@ -431,8 +432,9 @@ func (u *UserController) ReadMessages() {
 }
 func covertToUserProfile(user user.User) UserProfileReq {
 	return UserProfileReq{
-		UserName: user.Username,
-		Mobile:   user.Mobile,
+		UserName:  user.Username,
+		RiskLevel: user.RiskLevel,
+		Mobile:    user.Mobile,
 	}
 }
 

+ 2 - 0
domian/user/user_serivce.go

@@ -21,6 +21,7 @@ type UserDTO struct {
 	Mobile       string
 	OpenId       string
 	UnionId      string
+	RiskLevel    string
 	LoginStatus  userDao.LogType
 	FollowingGzh int
 	GzhOpenId    string
@@ -39,6 +40,7 @@ func convertUserDTO(user userDao.TemplateUser) UserDTO {
 		Mobile:       user.Mobile,
 		OpenId:       user.OpenId,
 		LoginStatus:  user.LoginStatus,
+		RiskLevel:    user.RiskLevel,
 		FollowingGzh: user.FollowingGzh,
 	}
 }

+ 2 - 1
models/user/template_user.go

@@ -23,7 +23,8 @@ type TemplateUser struct {
 	LastReadTime   time.Time `gorm:"column:last_read_time;type:timestamps;comment:最后阅读时间"`
 	LastLoginTime  time.Time `gorm:"column:last_login_time;type:timestamps;comment:最后登录时间"`
 	LastLogoutTime time.Time `gorm:"column:last_logout_time;type:timestamps;comment:最后登出时间"`
-	LoginStatus    LogType   `gorm:"column:login_status;type:enum('login','logout');default:null;comment:登录`
+	LoginStatus    LogType   `gorm:"column:login_status;type:enum('login','logout');comment:登录"`
+	RiskLevel      string    `gorm:"column:risk_level;type:varchar(255);comment:风险等级"`
 	IsDeleted      int       `gorm:"column:is_deleted;type:int(11);comment:是否删除"`
 	CreatedTime    time.Time `gorm:"column:created_time;type:timestamps;comment:创建时间"`
 	UpdatedTime    time.Time `gorm:"column:updated_time;type:timestamps;comment:更新时间"`

+ 9 - 7
service/user/user_service.go

@@ -11,10 +11,11 @@ import (
 )
 
 type User struct {
-	Id       int    `json:"id"`
-	Username string `json:"username"`
-	Mobile   string `json:"mobile"`
-	OpenId   string `json:"openId,omitempty"`
+	Id        int    `json:"id"`
+	Username  string `json:"username"`
+	Mobile    string `json:"mobile"`
+	RiskLevel string `json:"riskLevel"`
+	OpenId    string `json:"openId,omitempty"`
 }
 
 type AnalystDetail struct {
@@ -233,8 +234,9 @@ func GetUserByOpenId(openId string) (user User, err error) {
 
 func convertToUser(userDTO userService.UserDTO) User {
 	return User{
-		Id:       userDTO.Id,
-		Username: userDTO.Username,
-		Mobile:   userDTO.Mobile,
+		Id:        userDTO.Id,
+		Username:  userDTO.Username,
+		RiskLevel: userDTO.RiskLevel,
+		Mobile:    userDTO.Mobile,
 	}
 }