⚡ 修改ci文件
parent
05f8043672
commit
23261f0af5
@ -1,23 +0,0 @@
|
|||||||
package client
|
|
||||||
|
|
||||||
import (
|
|
||||||
"gitee.ltd/lxh/logger"
|
|
||||||
"gitee.ltd/lxh/logger/log"
|
|
||||||
"gorm.io/driver/mysql"
|
|
||||||
"gorm.io/gorm"
|
|
||||||
)
|
|
||||||
|
|
||||||
var MySQL *gorm.DB
|
|
||||||
|
|
||||||
// InitMySQLClient 初始化MySQL客户端
|
|
||||||
func InitMySQLClient() {
|
|
||||||
// 创建连接对象
|
|
||||||
conn, err := gorm.Open(mysql.Open("root:Tw2022!@#@tcp(47.109.17.77:3306)/tuowei?charset=utf8mb4&parseTime=True&loc=Local&timeout=1000ms"), &gorm.Config{Logger: logger.DefaultGormLogger()})
|
|
||||||
if err != nil {
|
|
||||||
log.Panicf("初始化MySQL连接失败, 错误信息: %v", err)
|
|
||||||
} else {
|
|
||||||
log.Debug("[MySQL] 连接成功")
|
|
||||||
}
|
|
||||||
|
|
||||||
MySQL = conn
|
|
||||||
}
|
|
@ -1,30 +0,0 @@
|
|||||||
package model
|
|
||||||
|
|
||||||
import (
|
|
||||||
"gorm.io/gorm"
|
|
||||||
"mime/multipart"
|
|
||||||
"time"
|
|
||||||
)
|
|
||||||
|
|
||||||
type Question struct {
|
|
||||||
Id int `json:"id" gorm:"primaryKey;autoIncrement;comment:主键编码" comment:"主键ID"`
|
|
||||||
KnowledgePointId int `json:"knowledge_point_id" comment:"知识点ID"`
|
|
||||||
SubjectType string `json:"subject_type" gorm:"type:varchar(10);comment:题目类型 1-大学英语/2-大学英语/3-大学数学/4-大学计算机"`
|
|
||||||
Content string `json:"content" gorm:"type:text;comment:题目内容"`
|
|
||||||
Answer string `json:"answer" gorm:"type:text;not null;comment:答案"`
|
|
||||||
CorrectAnswer string `json:"correct_answer" gorm:"type:text;comment:正确答案"`
|
|
||||||
Analysis string `json:"analysis" gorm:"type:text;comment:题目解析"`
|
|
||||||
Score float64 `json:"score"`
|
|
||||||
Subject string `json:"subject" gorm:"type:varchar(10);comment:科目类型 大学英语/大学数学/大学语文"`
|
|
||||||
CreatedAt time.Time `json:"createdAt" gorm:"comment:创建时间"`
|
|
||||||
UpdatedAt time.Time `json:"updatedAt" gorm:"comment:最后更新时间"`
|
|
||||||
DeletedAt gorm.DeletedAt `json:"-" gorm:"index;comment:删除时间"`
|
|
||||||
}
|
|
||||||
|
|
||||||
func (Question) TableName() string {
|
|
||||||
return "sys_question_bank"
|
|
||||||
}
|
|
||||||
|
|
||||||
type AddQuestion struct {
|
|
||||||
File *multipart.FileHeader `json:"file" form:"file" binding:"required"`
|
|
||||||
}
|
|
Loading…
Reference in New Issue