56 lines
4.2 KiB
Go
56 lines
4.2 KiB
Go
package model
|
||
|
||
import "time"
|
||
|
||
// User 对应表 users,JSON 输出与现网接口 1:1(小写驼峰)
|
||
type User struct {
|
||
ID string `gorm:"column:id;primaryKey;size:50" json:"id"`
|
||
OpenID *string `gorm:"column:open_id;size:100" json:"openId,omitempty"`
|
||
SessionKey *string `gorm:"column:session_key;size:200" json:"-"` // 微信 session_key,不输出到 JSON
|
||
Nickname *string `gorm:"column:nickname;size:100" json:"nickname,omitempty"`
|
||
Avatar *string `gorm:"column:avatar;size:500" json:"avatar,omitempty"`
|
||
Phone *string `gorm:"column:phone;size:20" json:"phone,omitempty"`
|
||
WechatID *string `gorm:"column:wechat_id;size:100" json:"wechatId,omitempty"`
|
||
// P3 资料扩展(stitch_soul)
|
||
Mbti *string `gorm:"column:mbti;size:16" json:"mbti,omitempty"`
|
||
Region *string `gorm:"column:region;size:100" json:"region,omitempty"`
|
||
Industry *string `gorm:"column:industry;size:100" json:"industry,omitempty"`
|
||
Position *string `gorm:"column:position;size:100" json:"position,omitempty"`
|
||
BusinessScale *string `gorm:"column:business_scale;size:100" json:"businessScale,omitempty"`
|
||
Skills *string `gorm:"column:skills;size:500" json:"skills,omitempty"`
|
||
StoryBestMonth *string `gorm:"column:story_best_month;type:text" json:"storyBestMonth,omitempty"`
|
||
StoryAchievement *string `gorm:"column:story_achievement;type:text" json:"storyAchievement,omitempty"`
|
||
StoryTurning *string `gorm:"column:story_turning;type:text" json:"storyTurning,omitempty"`
|
||
HelpOffer *string `gorm:"column:help_offer;size:500" json:"helpOffer,omitempty"`
|
||
HelpNeed *string `gorm:"column:help_need;size:500" json:"helpNeed,omitempty"`
|
||
ProjectIntro *string `gorm:"column:project_intro;type:text" json:"projectIntro,omitempty"`
|
||
ReferralCode *string `gorm:"column:referral_code;size:20" json:"referralCode,omitempty"`
|
||
HasFullBook *bool `gorm:"column:has_full_book" json:"hasFullBook,omitempty"`
|
||
PurchasedSections *string `gorm:"column:purchased_sections;type:json" json:"-"` // 内部字段,实际数据从 orders 表查
|
||
Earnings *float64 `gorm:"column:earnings;type:decimal(10,2)" json:"earnings,omitempty"`
|
||
PendingEarnings *float64 `gorm:"column:pending_earnings;type:decimal(10,2)" json:"pendingEarnings,omitempty"`
|
||
ReferralCount *int `gorm:"column:referral_count" json:"referralCount,omitempty"`
|
||
CreatedAt time.Time `gorm:"column:created_at" json:"createdAt"`
|
||
UpdatedAt time.Time `gorm:"column:updated_at" json:"updatedAt"`
|
||
IsAdmin *bool `gorm:"column:is_admin" json:"isAdmin,omitempty"`
|
||
WithdrawnEarnings *float64 `gorm:"column:withdrawn_earnings;type:decimal(10,2)" json:"withdrawnEarnings,omitempty"`
|
||
Source *string `gorm:"column:source;size:50" json:"source,omitempty"`
|
||
|
||
// VIP 相关(与 next-project 线上 users 表一致,支持手动设置;管理端需读写)
|
||
IsVip *bool `gorm:"column:is_vip" json:"isVip,omitempty"`
|
||
VipExpireDate *time.Time `gorm:"column:vip_expire_date" json:"vipExpireDate,omitempty"`
|
||
VipActivatedAt *time.Time `gorm:"column:vip_activated_at" json:"vipActivatedAt,omitempty"` // 成为 VIP 时间,排序用:付款=pay_time,手动=now
|
||
VipSort *int `gorm:"column:vip_sort" json:"vipSort,omitempty"` // 手动排序,越小越前,NULL 按 vip_activated_at
|
||
VipRole *string `gorm:"column:vip_role;size:50" json:"vipRole,omitempty"` // 角色:从 vip_roles 选或手动填写
|
||
VipName *string `gorm:"column:vip_name;size:100" json:"vipName,omitempty"`
|
||
VipAvatar *string `gorm:"column:vip_avatar;size:500" json:"vipAvatar,omitempty"`
|
||
VipProject *string `gorm:"column:vip_project;size:200" json:"vipProject,omitempty"`
|
||
VipContact *string `gorm:"column:vip_contact;size:100" json:"vipContact,omitempty"`
|
||
VipBio *string `gorm:"column:vip_bio;type:text" json:"vipBio,omitempty"`
|
||
|
||
// 以下为接口返回时从订单/绑定表实时计算的字段,不入库
|
||
PurchasedSectionCount int `gorm:"-" json:"purchasedSectionCount,omitempty"`
|
||
}
|
||
|
||
func (User) TableName() string { return "users" }
|