新增了 问答题库管理

This commit is contained in:
2024-06-28 17:46:31 +08:00
parent 989ae25809
commit c87c7076df
20 changed files with 1313 additions and 11 deletions
-1
View File
@@ -72,7 +72,6 @@ func GetQuestionListDto(m []*model.Question) []*QuestionDto {
response = response.LoadFirstLabel(v.FirstLabel)
}
fmt.Println(v.SecondLabel)
// 加载二级标签
if v.SecondLabel != nil {
response = response.LoadSecondLabel(v.SecondLabel)
+52
View File
@@ -0,0 +1,52 @@
package dto
import (
"fmt"
"knowledge/api/model"
)
// QuestionQaDto 问答题库
type QuestionQaDto struct {
QaId string `json:"qa_id"` // 主键id
QaName string `json:"qa_name"` // 名称
QaQuantity int `json:"qa_quantity"` // 题目数量
QaStatus int `json:"qa_status"` // 状态(1:正常 2:无效)
QaRuleContent string `json:"qa_rule_content"` // 规则解释
QaDisplayType int `json:"qa_display_type"` // 展示类型(1:常规 2:飞花令)
QaExpireTime model.LocalTime `json:"qa_expire_time"` // 过期时间
QaLink string `json:"qa_link"` // 分享链接
QaPassword string `json:"qa_password"` // 分享密码
OpenNumber int `json:"open_number"` // 打开的次数
Image string `json:"image"` // 背景图
CreatedAt model.LocalTime `json:"created_at"` // 创建时间
UpdatedAt model.LocalTime `json:"updated_at"` // 更新时间
}
// GetQuestionQaListDto 问答题库列表
func GetQuestionQaListDto(m []*model.QuestionQa) []*QuestionQaDto {
// 处理返回值
responses := make([]*QuestionQaDto, len(m))
if len(m) > 0 {
for i, v := range m {
response := &QuestionQaDto{
QaId: fmt.Sprintf("%d", v.QaId),
QaName: v.QaName,
QaQuantity: v.QaQuantity,
QaStatus: v.QaStatus,
QaRuleContent: v.QaRuleContent,
QaDisplayType: v.QaDisplayType,
QaExpireTime: v.QaExpireTime,
QaLink: v.QaLink,
OpenNumber: v.OpenNumber,
CreatedAt: v.CreatedAt,
UpdatedAt: v.UpdatedAt,
}
// 将转换后的结构体添加到新切片中
responses[i] = response
}
}
return responses
}