🎨 优化model和日志,完善配置文件
This commit is contained in:
@@ -13,8 +13,8 @@ func ProblemService() *problemService {
|
||||
}
|
||||
|
||||
// GetList 获取题目列表
|
||||
func (problemService) GetList(p param.GetProblemList) (records entity.Problem, count int64, err error) {
|
||||
sel := client.MySQL.Scopes(page(p.Current, p.Size))
|
||||
func (problemService) GetList(p param.GetProblemList) (records entity.ProblemBasic, count int64, err error) {
|
||||
sel := client.MySQL.Scopes(page(p.Current, p.Size)).Preload("ProblemCategories").Preload("ProblemCategories.CategoryBasic")
|
||||
|
||||
if p.Keyword != "" {
|
||||
sel.Where("title LIKE ? OR content like ?", "%"+p.Keyword+"%", "%"+p.Keyword+"%")
|
||||
@@ -29,7 +29,7 @@ func (problemService) GetList(p param.GetProblemList) (records entity.Problem, c
|
||||
}
|
||||
|
||||
// GetProblemInfo 获取题目详情
|
||||
func (problemService) GetProblemInfo(id int) (problem entity.Problem, err error) {
|
||||
func (problemService) GetProblemInfo(id int) (problem entity.ProblemBasic, err error) {
|
||||
err = client.MySQL.Where("id = ?", id).Find(&problem).Error
|
||||
return
|
||||
}
|
||||
|
Reference in New Issue
Block a user