🎨 优化model和日志,完善配置文件

This commit is contained in:
2022-05-26 23:53:18 +08:00
parent 8c5fa60081
commit 6945e6db93
13 changed files with 65 additions and 44 deletions

View File

@@ -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
}