updates
This commit is contained in:
parent
94a0578f7b
commit
9b72804e7b
|
|
@ -282,38 +282,6 @@ const docTemplate = `{
|
|||
}
|
||||
}
|
||||
},
|
||||
"/user//major/list": {
|
||||
"get": {
|
||||
"tags": [
|
||||
"用户专业"
|
||||
],
|
||||
"summary": "获取当前用户可检索列表",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "integer",
|
||||
"default": 1,
|
||||
"description": "页码",
|
||||
"name": "page",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "integer",
|
||||
"default": 10,
|
||||
"description": "每页数量",
|
||||
"name": "size",
|
||||
"in": "query"
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/common.Response"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/user/auth/info": {
|
||||
"get": {
|
||||
"tags": [
|
||||
|
|
@ -379,6 +347,52 @@ const docTemplate = `{
|
|||
}
|
||||
}
|
||||
},
|
||||
"/user/major/list": {
|
||||
"get": {
|
||||
"tags": [
|
||||
"用户专业"
|
||||
],
|
||||
"summary": "获取当前用户可检索列表",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "integer",
|
||||
"default": 1,
|
||||
"description": "页码",
|
||||
"name": "page",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "integer",
|
||||
"default": 10,
|
||||
"description": "每页数量",
|
||||
"name": "size",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"default": "\"\"",
|
||||
"description": "批次(本科提前批/本科A段/本科B段/本科/高职高专)",
|
||||
"name": "batch",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"default": "\"\"",
|
||||
"description": "录取概率类型(难录取/可冲击/较稳妥/可保底)",
|
||||
"name": "probability",
|
||||
"in": "query"
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/common.Response"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/user/score": {
|
||||
"get": {
|
||||
"tags": [
|
||||
|
|
|
|||
|
|
@ -276,38 +276,6 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"/user//major/list": {
|
||||
"get": {
|
||||
"tags": [
|
||||
"用户专业"
|
||||
],
|
||||
"summary": "获取当前用户可检索列表",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "integer",
|
||||
"default": 1,
|
||||
"description": "页码",
|
||||
"name": "page",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "integer",
|
||||
"default": 10,
|
||||
"description": "每页数量",
|
||||
"name": "size",
|
||||
"in": "query"
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/common.Response"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/user/auth/info": {
|
||||
"get": {
|
||||
"tags": [
|
||||
|
|
@ -373,6 +341,52 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"/user/major/list": {
|
||||
"get": {
|
||||
"tags": [
|
||||
"用户专业"
|
||||
],
|
||||
"summary": "获取当前用户可检索列表",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "integer",
|
||||
"default": 1,
|
||||
"description": "页码",
|
||||
"name": "page",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "integer",
|
||||
"default": 10,
|
||||
"description": "每页数量",
|
||||
"name": "size",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"default": "\"\"",
|
||||
"description": "批次(本科提前批/本科A段/本科B段/本科/高职高专)",
|
||||
"name": "batch",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"default": "\"\"",
|
||||
"description": "录取概率类型(难录取/可冲击/较稳妥/可保底)",
|
||||
"name": "probability",
|
||||
"in": "query"
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/common.Response"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/user/score": {
|
||||
"get": {
|
||||
"tags": [
|
||||
|
|
|
|||
|
|
@ -710,27 +710,6 @@ paths:
|
|||
summary: Sys用户登出
|
||||
tags:
|
||||
- 认证
|
||||
/user//major/list:
|
||||
get:
|
||||
parameters:
|
||||
- default: 1
|
||||
description: 页码
|
||||
in: query
|
||||
name: page
|
||||
type: integer
|
||||
- default: 10
|
||||
description: 每页数量
|
||||
in: query
|
||||
name: size
|
||||
type: integer
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
$ref: '#/definitions/common.Response'
|
||||
summary: 获取当前用户可检索列表
|
||||
tags:
|
||||
- 用户专业
|
||||
/user/auth/info:
|
||||
get:
|
||||
responses:
|
||||
|
|
@ -772,6 +751,37 @@ paths:
|
|||
summary: 用户登出
|
||||
tags:
|
||||
- 认证
|
||||
/user/major/list:
|
||||
get:
|
||||
parameters:
|
||||
- default: 1
|
||||
description: 页码
|
||||
in: query
|
||||
name: page
|
||||
type: integer
|
||||
- default: 10
|
||||
description: 每页数量
|
||||
in: query
|
||||
name: size
|
||||
type: integer
|
||||
- default: '""'
|
||||
description: 批次(本科提前批/本科A段/本科B段/本科/高职高专)
|
||||
in: query
|
||||
name: batch
|
||||
type: string
|
||||
- default: '""'
|
||||
description: 录取概率类型(难录取/可冲击/较稳妥/可保底)
|
||||
in: query
|
||||
name: probability
|
||||
type: string
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
$ref: '#/definitions/common.Response'
|
||||
summary: 获取当前用户可检索列表
|
||||
tags:
|
||||
- 用户专业
|
||||
/user/score:
|
||||
get:
|
||||
responses:
|
||||
|
|
|
|||
|
|
@ -39,14 +39,19 @@ func (ctrl *UserMajorController) RegisterRoutes(rg *gin.RouterGroup) {
|
|||
// @Tags 用户专业
|
||||
// @Param page query int false "页码" default(1)
|
||||
// @Param size query int false "每页数量" default(10)
|
||||
// @Param batch query string false "批次(本科提前批/本科A段/本科B段/本科/高职高专)" default("")
|
||||
// @Param probability query string false "录取概率类型(难录取/可冲击/较稳妥/可保底)" default("")
|
||||
// @Success 200 {object} common.Response
|
||||
// @Router /user/major/list [get]
|
||||
func (ctrl *UserMajorController) List(c *gin.Context) {
|
||||
page, _ := strconv.Atoi(c.DefaultQuery("page", "1"))
|
||||
size, _ := strconv.Atoi(c.DefaultQuery("size", "10"))
|
||||
schoolMajorQuery := yxDto.SchoolMajorQuery{
|
||||
Keyword: c.DefaultQuery("keyword", ""),
|
||||
Page: page,
|
||||
Size: size,
|
||||
Batch: c.DefaultQuery("batch", ""),
|
||||
Probability: c.DefaultQuery("probability", ""),
|
||||
LoginUserId: common.GetLoginUser(c).ID,
|
||||
}
|
||||
userScoreVO, err := ctrl.userScoreService.GetActiveByID(schoolMajorQuery.LoginUserId)
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ func (s *UserScoreService) GetUserScoreByUserId(id string) {
|
|||
// GetActiveByID 获取当前激活的成绩
|
||||
func (s *UserScoreService) GetActiveByID(userID string) (vo.UserScoreVO, error) {
|
||||
var score entity.YxUserScore
|
||||
|
||||
// 先从Redis获取是否存在
|
||||
scoreRedisData, err := config.RDB.Get(context.Background(), common.RedisUserScorePrefix+userID).Result()
|
||||
if err != nil {
|
||||
// 明确指定字段,提高可读性
|
||||
|
|
@ -217,7 +217,6 @@ func (s *UserScoreService) convertEntityToVo(item entity.YxUserScore) vo.UserSco
|
|||
Type: item.Type,
|
||||
EducationalLevel: item.EducationalLevel,
|
||||
CognitioPolyclinic: item.CognitioPolyclinic,
|
||||
SubjectList: strings.Split(item.Subjects, ","),
|
||||
ProfessionalCategory: item.ProfessionalCategory,
|
||||
ProfessionalCategoryChildren: []string{},
|
||||
ProfessionalCategoryChildrenScore: make(map[string]float64),
|
||||
|
|
@ -228,6 +227,11 @@ func (s *UserScoreService) convertEntityToVo(item entity.YxUserScore) vo.UserSco
|
|||
Province: item.Province,
|
||||
State: item.State,
|
||||
}
|
||||
if item.Subjects == "" {
|
||||
voItem.SubjectList = []string{}
|
||||
} else {
|
||||
voItem.SubjectList = strings.Split(item.Subjects, ",")
|
||||
}
|
||||
|
||||
if item.ProfessionalCategoryChildren == "" {
|
||||
voItem.ProfessionalCategoryChildren = []string{}
|
||||
|
|
|
|||
|
|
@ -57,17 +57,19 @@ type YxHistoryMajorEnrollDTO struct {
|
|||
type SchoolMajorQuery struct {
|
||||
Page int `json:"page"`
|
||||
Size int `json:"size"`
|
||||
Keyword string `json:"keyword"` // 对应 keyword
|
||||
MajorType string `json:"majorType"` // 对应 major_type
|
||||
Category string `json:"category"` // 对应 category
|
||||
Batch string `json:"batch"` // 对应 batch
|
||||
Batch string `json:"batch"` // 对应 批次
|
||||
MajorTypeChildren []string `json:"majorTypeChildren"` // 对应 major_type_child in (...)
|
||||
MainSubjects string `json:"mainSubjects"` // 对应 main_subjects
|
||||
Probability string `json:"probability"` // 对应 录取概率类型
|
||||
ScoreId string `json:"scoreId"` // 对应 score_id
|
||||
TagList []string `json:"tagList"` // 对应 tags in (...)
|
||||
SchoolNatureList []string `json:"schoolNatureList"` // 对应 school_nature in (...)
|
||||
AddressList []string `json:"addressList"` // 对应 address in (...)
|
||||
KyjxList []string `json:"kyjxList"` // 对应 kyjx in (...)
|
||||
RulesEnrollProbabilityList []string `json:"rulesEnrollProbabilityList"` // 对应 rules_enroll_probability in (...)
|
||||
RulesEnrollProbabilityList []string `json:"rulesEnrollProbabilityList"` // 录取方式,对应 rules_enroll_probability in (...)
|
||||
LoginUserId string `json:"loginUserId"` // 登录用户 ID
|
||||
UserScoreVO userVO.UserScoreVO `json:"userScoreVO"` // 用户成绩 VO
|
||||
CalculationTableName string `json:"calculationTableName"` // 对应 calculation_table_name
|
||||
|
|
|
|||
Loading…
Reference in New Issue