🎨 优化用户和分类相关接口,新增banner接口

This commit is contained in:
2025-06-23 17:04:44 +08:00
parent a5ae680f94
commit cf0f60d221
29 changed files with 695 additions and 299 deletions

16
model/app/banner.go Normal file
View File

@@ -0,0 +1,16 @@
package app
import "git.echol.cn/loser/lckt/global"
type Banner struct {
global.GVA_MODEL
Title string `json:"title" gorm:"comment:标题"` // 标题
Link string `json:"link" gorm:"comment:链接"` // 链接
Img string `json:"img" gorm:"comment:图片"` // 图片
Status int `json:"status" gorm:"comment:状态"` // 状态 0:禁用 1:启用
}
// TableName Banner 表名
func (Banner) TableName() string {
return "lckt_banner"
}

17
model/app/vo/user.go Normal file
View File

@@ -0,0 +1,17 @@
package vo
type UserInfo struct {
ID uint `json:"id" form:"id"`
NickName string `json:"nick_name" form:"nick_name"`
Phone string `json:"phone" form:"phone" `
UnionId string `json:"union_id" form:"union_id"`
OpenId string `json:"open_id" form:"open_id"`
Avatar string `json:"avatar" form:"avatar"`
InviteCode *string `json:"invite_code" form:"invite_code" gorm:"type:varchar(255) comment '用户专属邀请码'"` // 用户专属邀请码
Balance float32 `json:"balance" form:"balance" gorm:"type:decimal(10,2);comment:学员余额"` // 学员余额
CommenderId int `json:"commender_id" form:"commender_id" gorm:"comment:推荐人ID"` // 推荐人ID
UserLabel int64 `json:"user_label" form:"user_label" gorm:"comment:用户标签 1 普通用户 2 Vip 3 Svip"` // 用户标签 1 普通用户 2 Vip 3 Svip
UserType int8 `json:"user_type" form:"user_type" ` //用户类型 1 用户 2 讲师
IsVip int8 `json:"is_vip" form:"is_vip"` //是否是VIP 0 否 1 是
VipExpireTime string `json:"vip_expire_time" form:"vip_expire_time"` // VIP过期时间
}

View File

@@ -6,12 +6,13 @@ import (
type Article struct {
global.GVA_MODEL
Title string `json:"title" gorm:"comment:文章标题"`
Desc string `json:"desc" gorm:"comment:文章描述"`
Content string `json:"content" gorm:"comment:文章内容"`
CoverImg string `json:"coverImg" gorm:"comment:文章封面图"`
TeacherId int `json:"teacherId" gorm:"comment:讲师ID"`
Price int64 `json:"price" gorm:"comment:文章价格(单位为分)"`
Title string `json:"title" gorm:"comment:文章标题"`
Desc string `json:"desc" gorm:"comment:文章描述"`
Content string `json:"content" gorm:"comment:文章内容;type:longtext"`
CoverImg string `json:"coverImg" gorm:"comment:文章封面图"`
TeacherId int `json:"teacherId" gorm:"comment:讲师ID"`
Price int64 `json:"price" gorm:"comment:文章价格(单位为分)"`
TeacherName string `json:"teacherName" gorm:"comment:讲师名称"`
}
// TableName 文章表

View File

@@ -5,13 +5,15 @@ import (
"git.echol.cn/loser/lckt/global"
)
// 类别 结构体 Category
// Category 分类
type Category struct {
global.GVA_MODEL
Name *string `json:"name" form:"name" gorm:"column:name;comment:类别名称;" binding:"required"` //名称
Order *int `json:"order" form:"order" gorm:"column:order;comment:排序字段;"` //排序
Active *bool `json:"active" form:"active" gorm:"column:active;comment:是否激活;"` //状态
ParentId *int `json:"parentId" form:"parentId" gorm:"column:parent_id;comment:父类别ID;"` //父ID
Name *string `json:"name" form:"name" gorm:"column:name;comment:类别名称;" binding:"required"` //名称
Order *int `json:"order" form:"order" gorm:"column:order;comment:排序字段;"` //排序
Active *bool `json:"active" form:"active" gorm:"column:active;comment:是否激活;"` //状态
ParentId *int `json:"parentId" form:"parentId" gorm:"column:parent_id;comment:父类别ID;"` //父ID
Icon *string `json:"icon" form:"icon" gorm:"column:icon;comment:类别图标;"` //图标
IndexTrue *bool `json:"index" form:"index" gorm:"column:index;comment:是否首页显示;"` //是否首页显示
}
// TableName 类别 Category自定义表名 categories