Files
乘风 2645212d47 feat: update API base URLs and enhance icon designs
- Updated the API base URLs in app.js to point to local development server for testing.
- Enhanced SVG icons with gradient fills for improved visual appeal across various components.
- Refactored the avatar upload functionality in avatar-nickname.js and profile-edit.js to utilize a new upload utility for better code maintainability.
- Improved the layout and styling of the my page and super article editor for a more user-friendly interface.

This update aims to streamline development processes and enhance the overall user experience in the application.
2026-05-09 16:00:16 +08:00

82 lines
5.9 KiB
Go
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package model
import (
"time"
"gorm.io/gorm"
)
// User 对应表 usersJSON 输出与现网接口 1:1小写驼峰
// 软删除:管理端删除仅设置 deleted_at用户再次登录会创建新账号
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"`
// H5/开发登录bcrypt 哈希;微信登录用户可为空,首次 H5 登录时写入
PasswordHash *string `gorm:"column:password_hash;size:128" json:"-"`
WechatID *string `gorm:"column:wechat_id;size:100" json:"wechatId,omitempty"`
Tags *string `gorm:"column:tags;type:text" json:"tags,omitempty"`
// P3 资料扩展stitch_soul
Mbti *string `gorm:"column:mbti;size:16" json:"mbti,omitempty"`
Disc *string `gorm:"column:disc;size:64" json:"disc,omitempty"` // DISC 等测评(开放平台可回写)
Pdp *string `gorm:"column:pdp;size:64" json:"pdp,omitempty"` // PDP 等测评
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"`
// 用户标签(管理端编辑、神射手回填共用 ckb_tags 列JSON 数组字符串)
CkbTags *string `gorm:"column:ckb_tags;type:text" json:"ckbTags,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"`
// 软删除:管理端假删除,用户再次登录会新建账号
DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;index" json:"-"`
// 以下为接口返回时从订单/绑定表实时计算的字段,不入库
PurchasedSectionCount int `gorm:"-" json:"purchasedSectionCount,omitempty"`
WalletBalance *float64 `gorm:"-" json:"walletBalance,omitempty"`
RFMScore *float64 `gorm:"-" json:"rfmScore,omitempty"`
RFMLevel *string `gorm:"-" json:"rfmLevel,omitempty"`
// 分销获客链接点击次数referral_visits与绑定/转化人数bindings/订单/users.referral_count 取大);不用 omitempty 以便前端稳定显示 0
ReferralClickCount int `gorm:"-" json:"referralClickCount"`
ReferralBindCount int `gorm:"-" json:"referralBindCount"`
// 管理端用户列表当前用户作为「被推荐人」时的有效绑定推荐人referral_bindings.active
ReferredById *string `gorm:"-" json:"referredById,omitempty"`
ReferredByName *string `gorm:"-" json:"referredByName,omitempty"`
ReferredByAvatar *string `gorm:"-" json:"referredByAvatar,omitempty"`
ReferredByPhone *string `gorm:"-" json:"referredByPhone,omitempty"`
}
func (User) TableName() string { return "users" }