2
This commit is contained in:
parent
51af306add
commit
529de0728d
@ -370,5 +370,15 @@ func (r *QuestionQa) GetQuestionQa(c *gin.Context) {
|
||||
g = g.LoadQaQuestionQuantityContent(questionQa.TokenQuestionContent)
|
||||
}
|
||||
|
||||
// 加载题目计时
|
||||
questionQaTimerDao := dao.QuestionQaTimerDao{}
|
||||
questionQaTimers, err := questionQaTimerDao.GetQuestionQaTimerListByQaId(questionQa.QaId)
|
||||
if err != nil {
|
||||
responses.FailWithMessage("题库存在错误", c)
|
||||
return
|
||||
}
|
||||
|
||||
g = g.LoadQuestionQaTimerDto(questionQaTimers)
|
||||
|
||||
responses.OkWithData(g, c)
|
||||
}
|
||||
|
||||
@ -163,3 +163,11 @@ func (r *QuestionQaDto) LoadQaQuestionQuantityContent(s string) *QuestionQaDto {
|
||||
}
|
||||
return r
|
||||
}
|
||||
|
||||
// LoadQuestionQaTimerDto 加载计时设置
|
||||
func (r *QuestionQaDto) LoadQuestionQaTimerDto(m []*model.QuestionQaTimer) *QuestionQaDto {
|
||||
if len(m) > 0 {
|
||||
r.QuestionQaTimer = GetQuestionQaTimerListDto(m)
|
||||
}
|
||||
return r
|
||||
}
|
||||
|
||||
@ -5,6 +5,7 @@ import (
|
||||
"knowledge/api/model"
|
||||
)
|
||||
|
||||
// QuestionQaTimerDto 知识问答-计时设置
|
||||
type QuestionQaTimerDto struct {
|
||||
TimerId string `json:"timer_id"` // 主键id
|
||||
QaId string `json:"qa_id"` // 知识问答id
|
||||
|
||||
@ -333,7 +333,6 @@ func (r *QuestionQaService) PutQuestionQa(qaId int64, req requests.PutQuestionQa
|
||||
return false, err
|
||||
}
|
||||
|
||||
fmt.Println(1111)
|
||||
// 题目数量
|
||||
if qaQuantity != questionQa.QaQuantity {
|
||||
if req.Action == 1 {
|
||||
@ -342,6 +341,15 @@ func (r *QuestionQaService) PutQuestionQa(qaId int64, req requests.PutQuestionQa
|
||||
}
|
||||
|
||||
questionQaData["qa_quantity"] = req.QaQuantity
|
||||
|
||||
if req.QaType == 2 {
|
||||
questionQaData["token_num"] = req.TokenNum
|
||||
}
|
||||
|
||||
if req.QaType == 3 {
|
||||
questionQaData["token_num"] = req.TokenNum
|
||||
questionQaData["round_num"] = req.RoundNum
|
||||
}
|
||||
}
|
||||
|
||||
// 处理题库明细-需重新生成时才会检测明细
|
||||
@ -802,10 +810,6 @@ func (r *QuestionQaService) CheckPutQaQuestionQuantity(req requests.PutQuestionQ
|
||||
|
||||
quantity := content.Quantity * *req.TokenNum * *req.RoundNum
|
||||
|
||||
fmt.Println(utils.QuestionType(content.QuestionType))
|
||||
fmt.Println(quantity)
|
||||
fmt.Println(req.QuestionQaItem)
|
||||
fmt.Println(itemQuantity)
|
||||
if quantity > itemQuantity {
|
||||
return qaQuantity, errors.New(utils.QuestionType(content.QuestionType) + "数量不足")
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user