328 lines
13 KiB
Go
328 lines
13 KiB
Go
package model
|
|
|
|
import (
|
|
"sundynix-micro-go/common/model"
|
|
"time"
|
|
)
|
|
|
|
// ========== 用户扩展表(plant业务特有字段) ==========
|
|
|
|
// SundynixPlantUserProfile 植物服务用户扩展表
|
|
type SundynixPlantUserProfile struct {
|
|
model.BaseModel
|
|
UserID string `gorm:"size:50;uniqueIndex;column:user_id" json:"userId"`
|
|
NickName string `gorm:"size:100;column:nick_name" json:"nickName"`
|
|
AvatarID string `gorm:"size:50;column:avatar_id" json:"avatarId"`
|
|
LevelID string `gorm:"size:50;column:level_id" json:"levelId"`
|
|
CurrentSunlight int64 `gorm:"not null;default:0;column:current_sunlight" json:"currentSunlight"`
|
|
TotalSunlight int64 `gorm:"not null;default:0;column:total_sunlight" json:"totalSunlight"`
|
|
PlantCount int64 `gorm:"not null;default:0;column:plant_count" json:"plantCount"`
|
|
CareCount int64 `gorm:"not null;default:0;column:care_count" json:"careCount"`
|
|
PostCount int64 `gorm:"not null;default:0;column:post_count" json:"postCount"`
|
|
WaterCount int64 `gorm:"not null;default:0;column:water_count" json:"waterCount"`
|
|
FertilizeCount int64 `gorm:"not null;default:0;column:fertilize_count" json:"fertilizeCount"`
|
|
RepotCount int64 `gorm:"not null;default:0;column:repot_count" json:"repotCount"`
|
|
PruneCount int64 `gorm:"not null;default:0;column:prune_count" json:"pruneCount"`
|
|
PhotoCount int64 `gorm:"not null;default:0;column:photo_count" json:"photoCount"`
|
|
}
|
|
|
|
func (SundynixPlantUserProfile) TableName() string {
|
|
return "sundynix_plant_user_profile"
|
|
}
|
|
|
|
// ========== 我的植物 ==========
|
|
|
|
// SundynixMyPlant 我的植物
|
|
type SundynixMyPlant struct {
|
|
model.BaseModel
|
|
UserID string `gorm:"size:50;index;column:user_id" json:"userId"`
|
|
Name string `gorm:"size:20;column:name" json:"name"`
|
|
PlantTime time.Time `gorm:"column:plant_time" json:"plantTime"`
|
|
Status int `gorm:"column:status" json:"status"`
|
|
Placement string `gorm:"size:50;column:placement" json:"placement"`
|
|
PotMaterial string `gorm:"size:50;column:pot_material" json:"potMaterial"`
|
|
PotSize string `gorm:"size:50;column:pot_size" json:"potSize"`
|
|
Sunlight string `gorm:"size:50;column:sunlight" json:"sunlight"`
|
|
PlantingMaterial string `gorm:"size:50;column:planting_material" json:"plantingMaterial"`
|
|
}
|
|
|
|
func (SundynixMyPlant) TableName() string {
|
|
return "sundynix_my_plant"
|
|
}
|
|
|
|
// SundynixMyPlantOss 植物图片关联表
|
|
type SundynixMyPlantOss struct {
|
|
MyPlantID string `gorm:"size:50;primaryKey;column:sundynix_my_plant_id" json:"myPlantId"`
|
|
OssID string `gorm:"size:50;primaryKey;column:sundynix_oss_id" json:"ossId"`
|
|
}
|
|
|
|
func (SundynixMyPlantOss) TableName() string {
|
|
return "sundynix_my_plant_oss"
|
|
}
|
|
|
|
// ========== 养护计划/记录 ==========
|
|
|
|
// SundynixCarePlan 养护计划
|
|
type SundynixCarePlan struct {
|
|
model.BaseModel
|
|
UserID string `gorm:"size:50;column:user_id" json:"userId"`
|
|
PlantID string `gorm:"size:50;index;column:plant_id" json:"plantId"`
|
|
Icon string `gorm:"type:text;column:icon" json:"icon"`
|
|
Name string `gorm:"size:50;column:name" json:"name"`
|
|
Period int `gorm:"column:period" json:"period"`
|
|
TargetAction string `gorm:"size:32;index;column:target_action" json:"targetAction"`
|
|
}
|
|
|
|
func (SundynixCarePlan) TableName() string {
|
|
return "sundynix_care_plan"
|
|
}
|
|
|
|
// SundynixCareRecord 养护记录
|
|
type SundynixCareRecord struct {
|
|
model.BaseModel
|
|
UserID string `gorm:"size:50;column:user_id" json:"userId"`
|
|
PlantID string `gorm:"size:50;index;column:plant_id" json:"plantId"`
|
|
PlanID string `gorm:"size:50;index;column:plan_id" json:"planId"`
|
|
Name string `gorm:"size:50;column:name" json:"name"`
|
|
Remark string `gorm:"size:200;column:remark" json:"remark"`
|
|
Icon string `gorm:"type:text;column:icon" json:"icon"`
|
|
}
|
|
|
|
func (SundynixCareRecord) TableName() string {
|
|
return "sundynix_care_record"
|
|
}
|
|
|
|
// SundynixCareTask 养护任务
|
|
type SundynixCareTask struct {
|
|
model.BaseModel
|
|
UserID string `gorm:"size:50;column:user_id" json:"userId"`
|
|
PlantID string `gorm:"size:50;index;column:plant_id" json:"plantId"`
|
|
PlanID string `gorm:"size:50;index;column:plan_id" json:"planId"`
|
|
Name string `gorm:"size:50;column:name" json:"name"`
|
|
Icon string `gorm:"type:text;column:icon" json:"icon"`
|
|
TargetAction string `gorm:"size:32;column:target_action" json:"targetAction"`
|
|
DueDate time.Time `gorm:"column:due_date" json:"dueDate"`
|
|
Status int `gorm:"default:1;column:status" json:"status"`
|
|
}
|
|
|
|
func (SundynixCareTask) TableName() string {
|
|
return "sundynix_care_task"
|
|
}
|
|
|
|
// SundynixGrowthRecord 成长记录
|
|
type SundynixGrowthRecord struct {
|
|
model.BaseModel
|
|
PlantID string `gorm:"size:50;index;column:plant_id" json:"plantId"`
|
|
UserID string `gorm:"size:50;index;column:user_id" json:"userId"`
|
|
Name string `gorm:"size:50;column:name" json:"name"`
|
|
Tag string `gorm:"size:50;column:tag" json:"tag"`
|
|
Desc string `gorm:"size:200;column:desc" json:"desc"`
|
|
Content string `gorm:"size:200;column:content" json:"content"`
|
|
}
|
|
|
|
func (SundynixGrowthRecord) TableName() string {
|
|
return "sundynix_growth_record"
|
|
}
|
|
|
|
// ========== 百科 ==========
|
|
|
|
// SundynixWiki 植物百科
|
|
type SundynixWiki struct {
|
|
model.BaseModel
|
|
IsHot int `gorm:"column:is_hot" json:"isHot"`
|
|
Name string `gorm:"size:50;column:name" json:"name"`
|
|
LatinName string `gorm:"size:100;column:latin_name" json:"latinName"`
|
|
Aliases string `gorm:"size:100;column:aliases" json:"aliases"`
|
|
DistributionArea string `gorm:"type:text;column:distribution_area" json:"distributionArea"`
|
|
Genus string `gorm:"size:20;column:genus" json:"genus"`
|
|
Difficulty int `gorm:"column:difficulty" json:"difficulty"`
|
|
LifeCycle string `gorm:"type:text;column:life_cycle" json:"lifeCycle"`
|
|
GrowthHabit string `gorm:"type:text;column:growth_habit" json:"growthHabit"`
|
|
ReproductionMethod string `gorm:"size:200;column:reproduction_method" json:"reproductionMethod"`
|
|
PestsDiseases string `gorm:"size:200;column:pests_diseases" json:"pestsDiseases"`
|
|
LightIntensity string `gorm:"size:50;column:light_intensity" json:"lightIntensity"`
|
|
LightType string `gorm:"size:50;column:light_type" json:"lightType"`
|
|
OptimalTempPeriod string `gorm:"size:30;column:optimal_temp_period" json:"optimalTempPeriod"`
|
|
Stem string `gorm:"size:200;column:stem" json:"stem"`
|
|
FoliageType string `gorm:"size:200;column:foliage_type" json:"foliageType"`
|
|
FoliageColor string `gorm:"size:200;column:foliage_color" json:"foliageColor"`
|
|
FoliageShape string `gorm:"size:200;column:foliage_shape" json:"foliageShape"`
|
|
Height int `gorm:"column:height" json:"height"`
|
|
FloweringPeriod string `gorm:"size:100;column:flowering_period" json:"floweringPeriod"`
|
|
FloweringColor string `gorm:"size:100;column:flowering_color" json:"floweringColor"`
|
|
FloweringShape string `gorm:"size:100;column:flowering_shape" json:"floweringShape"`
|
|
FlowerDiameter int `gorm:"column:flower_diameter" json:"flowerDiameter"`
|
|
Fruit string `gorm:"size:200;column:fruit" json:"fruit"`
|
|
}
|
|
|
|
func (SundynixWiki) TableName() string {
|
|
return "sundynix_wiki"
|
|
}
|
|
|
|
// SundynixWikiClass 百科分类
|
|
type SundynixWikiClass struct {
|
|
model.BaseModel
|
|
Name string `gorm:"size:50;column:name" json:"name"`
|
|
OssID string `gorm:"size:50;column:oss_id" json:"ossId"`
|
|
}
|
|
|
|
func (SundynixWikiClass) TableName() string {
|
|
return "sundynix_wiki_class"
|
|
}
|
|
|
|
// SundynixUserStar 用户收藏
|
|
type SundynixUserStar struct {
|
|
model.BaseModel
|
|
UserID string `gorm:"size:50;index;column:user_id" json:"userId"`
|
|
TargetID string `gorm:"size:50;index;column:target_id" json:"targetId"`
|
|
Type string `gorm:"size:20;column:type" json:"type"` // wiki/post
|
|
}
|
|
|
|
func (SundynixUserStar) TableName() string {
|
|
return "sundynix_user_star"
|
|
}
|
|
|
|
// ========== 社区 ==========
|
|
|
|
// SundynixPost 社区帖子
|
|
type SundynixPost struct {
|
|
model.BaseModel
|
|
UserID string `gorm:"size:50;index;column:user_id" json:"userId"`
|
|
Title string `gorm:"size:100;column:title" json:"title"`
|
|
Content string `gorm:"size:500;column:content" json:"content"`
|
|
ViewCount int `gorm:"default:0;column:view_count" json:"viewCount"`
|
|
CommentCount int `gorm:"default:0;column:comment_count" json:"commentCount"`
|
|
LikeCount int `gorm:"default:0;column:like_count" json:"likeCount"`
|
|
StarCount int `gorm:"default:0;column:star_count" json:"starCount"`
|
|
Location string `gorm:"size:100;column:location" json:"location"`
|
|
HasReviewed int `gorm:"default:0;column:has_reviewed" json:"hasReviewed"`
|
|
}
|
|
|
|
func (SundynixPost) TableName() string {
|
|
return "sundynix_post"
|
|
}
|
|
|
|
// SundynixPostComment 帖子评论
|
|
type SundynixPostComment struct {
|
|
model.BaseModel
|
|
PostID string `gorm:"size:50;index;column:post_id" json:"postId"`
|
|
UserID string `gorm:"size:50;column:user_id" json:"userId"`
|
|
Content string `gorm:"size:500;column:content" json:"content"`
|
|
ParentID string `gorm:"size:50;column:parent_id" json:"parentId"`
|
|
}
|
|
|
|
func (SundynixPostComment) TableName() string {
|
|
return "sundynix_post_comment"
|
|
}
|
|
|
|
// SundynixPostLike 帖子点赞
|
|
type SundynixPostLike struct {
|
|
model.BaseModel
|
|
PostID string `gorm:"size:50;index;column:post_id" json:"postId"`
|
|
UserID string `gorm:"size:50;index;column:user_id" json:"userId"`
|
|
}
|
|
|
|
func (SundynixPostLike) TableName() string {
|
|
return "sundynix_post_like"
|
|
}
|
|
|
|
// SundynixPostTopic 话题
|
|
type SundynixPostTopic struct {
|
|
model.BaseModel
|
|
Name string `gorm:"size:50;column:name" json:"name"`
|
|
PostCount int `gorm:"default:0;column:post_count" json:"postCount"`
|
|
}
|
|
|
|
func (SundynixPostTopic) TableName() string {
|
|
return "sundynix_post_topic"
|
|
}
|
|
|
|
// ========== 积分商城 ==========
|
|
|
|
// SundynixExchangeItem 兑换商品
|
|
type SundynixExchangeItem struct {
|
|
model.BaseModel
|
|
Name string `gorm:"size:100;column:name" json:"name"`
|
|
Desc string `gorm:"size:200;column:desc" json:"desc"`
|
|
ImgID string `gorm:"size:50;column:img_id" json:"imgId"`
|
|
Cost int64 `gorm:"column:cost" json:"cost"`
|
|
Stock int `gorm:"column:stock" json:"stock"`
|
|
Status int `gorm:"default:1;column:status" json:"status"`
|
|
}
|
|
|
|
func (SundynixExchangeItem) TableName() string {
|
|
return "sundynix_exchange_item"
|
|
}
|
|
|
|
// SundynixExchangeOrder 兑换订单
|
|
type SundynixExchangeOrder struct {
|
|
model.BaseModel
|
|
UserID string `gorm:"size:50;index;column:user_id" json:"userId"`
|
|
ItemID string `gorm:"size:50;column:item_id" json:"itemId"`
|
|
Cost int64 `gorm:"column:cost" json:"cost"`
|
|
Status int `gorm:"default:0;column:status" json:"status"`
|
|
Address string `gorm:"size:200;column:address" json:"address"`
|
|
}
|
|
|
|
func (SundynixExchangeOrder) TableName() string {
|
|
return "sundynix_exchange_order"
|
|
}
|
|
|
|
// ========== 等级/徽章配置 ==========
|
|
|
|
// SundynixLevelConfig 等级配置
|
|
type SundynixLevelConfig struct {
|
|
model.BaseModel
|
|
Level int `gorm:"column:level" json:"level"`
|
|
Title string `gorm:"size:50;column:title" json:"title"`
|
|
MinSunlight int64 `gorm:"column:min_sunlight" json:"minSunlight"`
|
|
Perks string `gorm:"size:200;column:perks" json:"perks"`
|
|
}
|
|
|
|
func (SundynixLevelConfig) TableName() string {
|
|
return "sundynix_level_config"
|
|
}
|
|
|
|
// SundynixBadgeConfig 徽章配置
|
|
type SundynixBadgeConfig struct {
|
|
model.BaseModel
|
|
Name string `gorm:"size:64;column:name" json:"name"`
|
|
Description string `gorm:"size:255;column:description" json:"description"`
|
|
IconID string `gorm:"size:50;column:icon_id" json:"iconId"`
|
|
Dimension string `gorm:"size:32;index;column:dimension" json:"dimension"`
|
|
GroupID string `gorm:"size:64;index;column:group_id" json:"groupId"`
|
|
Tier int `gorm:"default:1;column:tier" json:"tier"`
|
|
TargetAction string `gorm:"size:32;index;column:target_action" json:"targetAction"`
|
|
Threshold int64 `gorm:"column:threshold" json:"threshold"`
|
|
Comparator string `gorm:"size:10;default:'>=';column:comparator" json:"comparator"`
|
|
RewardSunlight int64 `gorm:"column:reward_sunlight" json:"rewardSunlight"`
|
|
Sort int `gorm:"default:1;column:sort" json:"sort"`
|
|
}
|
|
|
|
func (SundynixBadgeConfig) TableName() string {
|
|
return "sundynix_badge_config"
|
|
}
|
|
|
|
// SundynixUserBadge 用户徽章
|
|
type SundynixUserBadge struct {
|
|
model.BaseModel
|
|
UserID string `gorm:"size:50;index;column:user_id" json:"userId"`
|
|
BadgeID string `gorm:"size:50;index;column:badge_id" json:"badgeId"`
|
|
}
|
|
|
|
func (SundynixUserBadge) TableName() string {
|
|
return "sundynix_user_badge"
|
|
}
|
|
|
|
// SundynixAiChatHistory AI聊天历史
|
|
type SundynixAiChatHistory struct {
|
|
model.BaseModel
|
|
UserID string `gorm:"size:50;index;column:user_id" json:"userId"`
|
|
Role string `gorm:"size:20;column:role" json:"role"`
|
|
Content string `gorm:"type:text;column:content" json:"content"`
|
|
}
|
|
|
|
func (SundynixAiChatHistory) TableName() string {
|
|
return "sundynix_ai_chat_history"
|
|
}
|