init: 第一次提交
- 以实现登录获取个人信息和课程 - 实现了获取视频记录 - 实现了学习接口
This commit is contained in:
56
internal/dto/ckwk.go
Normal file
56
internal/dto/ckwk.go
Normal file
@@ -0,0 +1,56 @@
|
||||
package dto
|
||||
|
||||
import (
|
||||
"ckwk/internal/ckwk"
|
||||
)
|
||||
|
||||
type Resp[T any] struct {
|
||||
Code int `json:"code"`
|
||||
Message string `json:"message"`
|
||||
Data T `json:"data,omitempty"`
|
||||
}
|
||||
|
||||
func Success[T any](data T) Resp[T] {
|
||||
return Resp[T]{
|
||||
Code: 0,
|
||||
Message: "success",
|
||||
Data: data,
|
||||
}
|
||||
}
|
||||
|
||||
func Ok() Resp[any] {
|
||||
return Resp[any]{
|
||||
Code: 0,
|
||||
Message: "success",
|
||||
Data: nil,
|
||||
}
|
||||
}
|
||||
|
||||
func Error(code int, msg string) Resp[any] {
|
||||
return Resp[any]{
|
||||
Code: code,
|
||||
Message: msg,
|
||||
Data: nil,
|
||||
}
|
||||
}
|
||||
|
||||
type LoginReq struct {
|
||||
Username string `json:"username"`
|
||||
Password string `json:"password"`
|
||||
Token string `json:"token"`
|
||||
Status ckwk.CourseKind `json:"status"`
|
||||
Host string `json:"host" binding:"required"`
|
||||
}
|
||||
|
||||
type StudyReq struct {
|
||||
NodeID string `json:"node_id"`
|
||||
StudyID string `json:"study_id"`
|
||||
StudyTime string `json:"study_time"`
|
||||
Status ckwk.StudyStatus `json:"status"`
|
||||
}
|
||||
|
||||
type AllRecordReq struct {
|
||||
CourseID string `json:"course_id"`
|
||||
Page int `json:"page"`
|
||||
RecordType ckwk.RecordType `json:"record_type"`
|
||||
}
|
||||
Reference in New Issue
Block a user