修改了新增了题库类型2、3 1
This commit is contained in:
parent
b61ede1a03
commit
c95aaf9cb8
@ -352,5 +352,23 @@ func (r *QuestionQa) GetQuestionQa(c *gin.Context) {
|
||||
g = g.LoadQuestionQaToken(questionQaTokens)
|
||||
}
|
||||
|
||||
if questionQa.QaType == 2 {
|
||||
// 加载飞花令数量(当题库类型为2、3时存在)
|
||||
g = g.LoadTokenNum(questionQa.TokenNum)
|
||||
}
|
||||
|
||||
if questionQa.QaType == 3 {
|
||||
// 加载飞花令数量(当题库类型为2、3时存在)
|
||||
g = g.LoadTokenNum(questionQa.TokenNum)
|
||||
|
||||
// 加载轮次数量(当题库类型为3时存在)
|
||||
g = g.LoadRoundNum(questionQa.RoundNum)
|
||||
}
|
||||
|
||||
if questionQa.QaType == 2 || questionQa.QaType == 3 {
|
||||
// 加载飞花令题目数量规则(当题库类型为2、3时存在。2表示飞花令后固定题目数量,3表示飞花令后单个类型题目数量)
|
||||
g = g.LoadQaQuestionQuantityContent(questionQa.TokenQuestionContent)
|
||||
}
|
||||
|
||||
responses.OkWithData(g, c)
|
||||
}
|
||||
|
||||
@ -46,11 +46,8 @@ type ItemContentDto struct {
|
||||
|
||||
// TokenQuestionContentDto 问答题库-飞花令题目数量规则
|
||||
type TokenQuestionContentDto struct {
|
||||
QuestionType int `json:"question_type"` // 题目类型(1:单选 2:多选 3:问答 4:判断)
|
||||
FirstLabelId string `json:"first_label_id"` // 一级标签id
|
||||
SecondLabelId string `json:"second_label_id"` // 二级标签id
|
||||
Difficulty int `json:"difficulty"` // 难度(0:未知 1:低 2:中 3:高)
|
||||
Quantity int `json:"quantity"` // 数量
|
||||
QuestionType int `json:"question_type"` // 题目类型(1:单选 2:多选 3:问答 4:判断)
|
||||
Quantity int `json:"quantity"` // 数量
|
||||
}
|
||||
|
||||
// GetQuestionQaListDto 问答题库列表
|
||||
@ -100,6 +97,7 @@ func GetQuestionQaDto(m *model.QuestionQa) *QuestionQaDto {
|
||||
return &QuestionQaDto{
|
||||
QaId: fmt.Sprintf("%d", m.QaId),
|
||||
QaName: m.QaName,
|
||||
QaType: m.QaType,
|
||||
QaQuantity: m.QaQuantity,
|
||||
QaStatus: m.QaStatus,
|
||||
QaRuleContent: m.QaRuleContent,
|
||||
|
||||
@ -37,7 +37,7 @@ type AddQuestionQa struct {
|
||||
QaName string `json:"qa_name" form:"qa_name" label:"名称" validate:"required"`
|
||||
QaType int `json:"qa_type" form:"qa_type" label:"题库类型" validate:"required,oneof=1 2 3"` // (1:常规模式 2:固定套题模式 3:多轮固定题型模式)
|
||||
QaRuleContent string `json:"qa_rule_content" form:"qa_rule_content" label:"规则解释" validate:"required"`
|
||||
QaQuantity int `json:"qa_quantity" form:"qa_quantity" label:"题目数量" validate:"required,number,min=1"`
|
||||
QaQuantity int `json:"qa_quantity" form:"qa_quantity" label:"题目数量" validate:"omitempty,number,min=1"`
|
||||
TokenNum *int `json:"token_num" form:"token_num" label:"飞花令数量" validate:"omitempty,number,min=1"` // (当题库类型为2、3时存在)
|
||||
RoundNum *int `json:"round_num" form:"round_num" label:"轮次数量" validate:"omitempty,number,min=1"` // (当题库类型为3时存在)
|
||||
QaDisplayType int `json:"qa_display_type" form:"qa_display_type" label:"展示类型" validate:"required,oneof=1 2"` // (1:常规 2:飞花令)
|
||||
|
||||
@ -130,9 +130,12 @@ func (r *QuestionQaService) AddQuestionQa(req requests.AddQuestionQa) (bool, err
|
||||
// 新增题目
|
||||
questionQa := &model.QuestionQa{
|
||||
QaName: req.QaName,
|
||||
QaType: req.QaType,
|
||||
QaQuantity: qaQuantity,
|
||||
QaStatus: 1,
|
||||
QaRuleContent: req.QaRuleContent,
|
||||
TokenNum: nil,
|
||||
RoundNum: nil,
|
||||
QaDisplayType: req.QaDisplayType,
|
||||
QaExpireTime: model.LocalTime(qaExpireTime),
|
||||
QaPassword: req.QaPassword,
|
||||
@ -144,17 +147,12 @@ func (r *QuestionQaService) AddQuestionQa(req requests.AddQuestionQa) (bool, err
|
||||
// 固定套题模式-飞花令数量
|
||||
if req.QaType == 2 {
|
||||
questionQa.TokenNum = req.TokenNum
|
||||
} else {
|
||||
questionQa.TokenNum = nil
|
||||
}
|
||||
|
||||
// 多轮固定题型模式-飞花令数量、轮次数量
|
||||
if req.QaType == 3 {
|
||||
questionQa.TokenNum = req.TokenNum
|
||||
questionQa.RoundNum = req.RoundNum
|
||||
} else {
|
||||
questionQa.TokenNum = nil
|
||||
questionQa.RoundNum = nil
|
||||
}
|
||||
|
||||
if req.QaType == 2 || req.QaType == 3 {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user