新增了飞花令数量1
This commit is contained in:
@@ -18,6 +18,7 @@ type QuestionQaDto struct {
|
||||
RoundNum *int `json:"round_num"` // 轮次数量(当题库类型为3时存在)
|
||||
QaRuleContent string `json:"qa_rule_content"` // 规则解释
|
||||
QaDisplayType int `json:"qa_display_type"` // 展示类型(1:常规 2:飞花令)
|
||||
IsTurnTimer int `json:"is_turn_timer"` // 是否开启计时(0:否 1:是)
|
||||
QaExpireTime *model.LocalTime `json:"qa_expire_time"` // 过期时间
|
||||
QaShareId string `json:"qa_share_id"` // 分享标识
|
||||
QaPassword string `json:"qa_password"` // 分享密码
|
||||
@@ -28,6 +29,7 @@ type QuestionQaDto struct {
|
||||
TokenQuestionContent []*TokenQuestionContentDto `json:"token_question_content"` // 飞花令题目数量规则(当题库类型为2、3时存在。2表示飞花令后固定题目数量,3表示飞花令后单个类型题目数量)
|
||||
CreatedAt model.LocalTime `json:"created_at"` // 创建时间
|
||||
UpdatedAt model.LocalTime `json:"updated_at"` // 更新时间
|
||||
QuestionQaTimer []*QuestionQaTimerDto `json:"question_qa_timer"` // 计时设置
|
||||
}
|
||||
|
||||
// QuestionQaBaseTokenItem 问答题库-飞花令明细
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
package dto
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"knowledge/api/model"
|
||||
)
|
||||
|
||||
type QuestionQaTimerDto struct {
|
||||
TimerId string `json:"timer_id"` // 主键id
|
||||
QaId string `json:"qa_id"` // 知识问答id
|
||||
QuestionType int `json:"question_type"` // 题目类型(1:单选 2:多选 3:问答 4:判断)
|
||||
TimerRule int `json:"timer_rule"` // 计时规则(1:正计时 2:倒计时)
|
||||
Duration int `json:"duration"` // 时长(秒)
|
||||
CreatedAt model.LocalTime `json:"created_at"` // 创建时间
|
||||
UpdatedAt model.LocalTime `json:"updated_at"` // 更新时间
|
||||
}
|
||||
|
||||
// GetQuestionQaTimerDto 详情
|
||||
func GetQuestionQaTimerDto(m *model.QuestionQaTimer) *QuestionQaTimerDto {
|
||||
return &QuestionQaTimerDto{
|
||||
TimerId: fmt.Sprintf("%d", m.TimerId),
|
||||
QaId: fmt.Sprintf("%d", m.QaId),
|
||||
QuestionType: m.QuestionType,
|
||||
TimerRule: m.TimerRule,
|
||||
Duration: m.Duration,
|
||||
CreatedAt: m.CreatedAt,
|
||||
UpdatedAt: m.UpdatedAt,
|
||||
}
|
||||
}
|
||||
|
||||
// GetQuestionQaTimerListDto 列表
|
||||
func GetQuestionQaTimerListDto(m []*model.QuestionQaTimer) []*QuestionQaTimerDto {
|
||||
// 处理返回值
|
||||
responses := make([]*QuestionQaTimerDto, len(m))
|
||||
|
||||
if len(m) > 0 {
|
||||
for i, v := range m {
|
||||
response := &QuestionQaTimerDto{
|
||||
TimerId: fmt.Sprintf("%d", v.TimerId),
|
||||
QaId: fmt.Sprintf("%d", v.QaId),
|
||||
QuestionType: v.QuestionType,
|
||||
TimerRule: v.TimerRule,
|
||||
Duration: v.Duration,
|
||||
CreatedAt: v.CreatedAt,
|
||||
UpdatedAt: v.UpdatedAt,
|
||||
}
|
||||
|
||||
// 将转换后的结构体添加到新切片中
|
||||
responses[i] = response
|
||||
}
|
||||
}
|
||||
|
||||
return responses
|
||||
}
|
||||
Reference in New Issue
Block a user