完善基础架构,新增部分问题接口

This commit is contained in:
2022-05-26 00:39:39 +08:00
parent 761c24efbf
commit 326118eefb
16 changed files with 251 additions and 4 deletions

18
models/cache/user.go vendored Normal file
View File

@@ -0,0 +1,18 @@
package cache
import "encoding/json"
// UserInfo 登录用的用户信息结构体
type UserInfo struct {
UserType string `json:"userType"` // 用户类型
UserId string `json:"userId"` // 用户Id
}
// String 实现Stringer接口
func (i UserInfo) String() (string, error) {
b, err := json.Marshal(i)
if err != nil {
return "", err
}
return string(b), nil
}

View File

@@ -4,7 +4,7 @@ import (
"online_code/common/types"
)
// ProblemCategory 问题分类表
// ProblemCategory 问题分类关联
type ProblemCategory struct {
types.BaseDbModel
ProblemId uint `json:"problem_id" gorm:"column:problem_id;type:int(11);comment:'问题的ID'" ` // 问题的ID

7
models/param/base.go Normal file
View File

@@ -0,0 +1,7 @@
package param
// 分页通用参数
type page struct {
Current int `json:"current" form:"current" binding:"required"` // 页码
Size int `json:"size" form:"size" binding:"required"` // 每页数量
}

6
models/param/problem.go Normal file
View File

@@ -0,0 +1,6 @@
package param
type GetProblemList struct {
page
Keyword string `json:"keyword" form:"keyword"` // 问题关键字
}