feat: 19 张表 entity 映射

This commit is contained in:
2026-08-13 11:58:27 +08:00
parent c371fa746e
commit 62b331744a
19 changed files with 273 additions and 0 deletions
+12
View File
@@ -0,0 +1,12 @@
package entity
import "github.com/gogf/gf/v2/os/gtime"
// AdminUser 后台管理员账号。
type AdminUser struct {
Id int64 `json:"id" orm:"id"`
Username string `json:"username" orm:"username"`
Password string `json:"-" orm:"password"`
Status int `json:"status" orm:"status"`
CreatedAt *gtime.Time `json:"created_at" orm:"created_at"`
}
+11
View File
@@ -0,0 +1,11 @@
package entity
// Badge 徽章定义与解锁条件。
type Badge struct {
Id int64 `json:"id" orm:"id"`
Name string `json:"name" orm:"name"`
Icon string `json:"icon" orm:"icon"`
CondType int `json:"cond_type" orm:"cond_type"`
CondValue int `json:"cond_value" orm:"cond_value"`
Status int `json:"status" orm:"status"`
}
+13
View File
@@ -0,0 +1,13 @@
package entity
import "github.com/gogf/gf/v2/os/gtime"
// ChapterReview 章末温故:每章完美后抽旧关复习,完成解锁下一章。
type ChapterReview struct {
Id int64 `json:"id" orm:"id"`
ChildId int64 `json:"child_id" orm:"child_id"`
StrategyId int64 `json:"strategy_id" orm:"strategy_id"`
LevelIds string `json:"level_ids" orm:"level_ids"`
Status int `json:"status" orm:"status"`
CreatedAt *gtime.Time `json:"created_at" orm:"created_at"`
}
+17
View File
@@ -0,0 +1,17 @@
package entity
import "github.com/gogf/gf/v2/os/gtime"
// Child 孩子档案:学习主体,进度/积分/兑换均按孩子维度。
type Child struct {
Id int64 `json:"id" orm:"id"`
ParentId int64 `json:"parent_id" orm:"parent_id"`
Nickname string `json:"nickname" orm:"nickname"`
Avatar string `json:"avatar" orm:"avatar"`
AgeGroup string `json:"age_group" orm:"age_group"`
Points int `json:"points" orm:"points"`
DailyLimitMinutes int `json:"daily_limit_minutes" orm:"daily_limit_minutes"`
Status int `json:"status" orm:"status"`
CreatedAt *gtime.Time `json:"created_at" orm:"created_at"`
UpdatedAt *gtime.Time `json:"updated_at" orm:"updated_at"`
}
+13
View File
@@ -0,0 +1,13 @@
package entity
// Element 元素库:场景(环境)/ 人物 / 道具,决策树的结构性骨架。
type Element struct {
Id int64 `json:"id" orm:"id"`
EType int `json:"e_type" orm:"e_type"`
Name string `json:"name" orm:"name"`
Image string `json:"image" orm:"image"`
Audio string `json:"audio" orm:"audio"`
Description string `json:"description" orm:"description"`
Status int `json:"status" orm:"status"`
SortOrder int `json:"sort_order" orm:"sort_order"`
}
+16
View File
@@ -0,0 +1,16 @@
package entity
// Level 情境关卡:每计 1-5 关,关联环境场景元素,带内容版本号。
type Level struct {
Id int64 `json:"id" orm:"id"`
StrategyId int64 `json:"strategy_id" orm:"strategy_id"`
Title string `json:"title" orm:"title"`
SceneId int64 `json:"scene_id" orm:"scene_id"`
SceneContent string `json:"scene_content" orm:"scene_content"`
SceneImage string `json:"scene_image" orm:"scene_image"`
SceneAudio string `json:"scene_audio" orm:"scene_audio"`
AgeGroup string `json:"age_group" orm:"age_group"`
ContentVersion int `json:"content_version" orm:"content_version"`
SortOrder int `json:"sort_order" orm:"sort_order"`
Status int `json:"status" orm:"status"`
}
+12
View File
@@ -0,0 +1,12 @@
package entity
// LifeTask 生活践行任务:关联计策,章完美后下发,家长确认为权威入口。
type LifeTask struct {
Id int64 `json:"id" orm:"id"`
StrategyId int64 `json:"strategy_id" orm:"strategy_id"`
Title string `json:"title" orm:"title"`
Description string `json:"description" orm:"description"`
Guide string `json:"guide" orm:"guide"`
RewardPoints int `json:"reward_points" orm:"reward_points"`
Status int `json:"status" orm:"status"`
}
+14
View File
@@ -0,0 +1,14 @@
package entity
import "github.com/gogf/gf/v2/os/gtime"
// LifeTaskLog 生活任务完成记录:孩子 × 任务,家长确认状态流转。
type LifeTaskLog struct {
Id int64 `json:"id" orm:"id"`
ChildId int64 `json:"child_id" orm:"child_id"`
TaskId int64 `json:"task_id" orm:"task_id"`
Status int `json:"status" orm:"status"`
ConfirmPhoto string `json:"confirm_photo" orm:"confirm_photo"`
ConfirmedAt *gtime.Time `json:"confirmed_at" orm:"confirmed_at"`
CreatedAt *gtime.Time `json:"created_at" orm:"created_at"`
}
+15
View File
@@ -0,0 +1,15 @@
package entity
// NodeOption 分支选项:行为文本 + 使用道具 + 指向下一节点 + 即时点评。
type NodeOption struct {
Id int64 `json:"id" orm:"id"`
NodeId int64 `json:"node_id" orm:"node_id"`
Text string `json:"text" orm:"text"`
PropId int64 `json:"prop_id" orm:"prop_id"`
Audio string `json:"audio" orm:"audio"`
NextNodeId int64 `json:"next_node_id" orm:"next_node_id"`
Feedback string `json:"feedback" orm:"feedback"`
FeedbackAudio string `json:"feedback_audio" orm:"feedback_audio"`
SortOrder int `json:"sort_order" orm:"sort_order"`
Status int `json:"status" orm:"status"`
}
+16
View File
@@ -0,0 +1,16 @@
package entity
import "github.com/gogf/gf/v2/os/gtime"
// Parent 家长账号:微信 openid 或手机号注册。
type Parent struct {
Id int64 `json:"id" orm:"id"`
Openid string `json:"openid" orm:"openid"`
Phone string `json:"phone" orm:"phone"`
Password string `json:"-" orm:"password"`
Nickname string `json:"nickname" orm:"nickname"`
Avatar string `json:"avatar" orm:"avatar"`
Status int `json:"status" orm:"status"`
CreatedAt *gtime.Time `json:"created_at" orm:"created_at"`
UpdatedAt *gtime.Time `json:"updated_at" orm:"updated_at"`
}
+14
View File
@@ -0,0 +1,14 @@
package entity
import "github.com/gogf/gf/v2/os/gtime"
// PointLog 积分流水:变动、原因类型、余额快照。
type PointLog struct {
Id int64 `json:"id" orm:"id"`
UserId int64 `json:"user_id" orm:"user_id"`
Change int `json:"change" orm:"change"`
ReasonType int `json:"reason_type" orm:"reason_type"`
RefId int64 `json:"ref_id" orm:"ref_id"`
BalanceAfter int `json:"balance_after" orm:"balance_after"`
CreatedAt *gtime.Time `json:"created_at" orm:"created_at"`
}
+14
View File
@@ -0,0 +1,14 @@
package entity
// Prize 奖品:积分价格、库存、类型(虚拟/实物)。
type Prize struct {
Id int64 `json:"id" orm:"id"`
Name string `json:"name" orm:"name"`
Description string `json:"description" orm:"description"`
Icon string `json:"icon" orm:"icon"`
PType int `json:"p_type" orm:"p_type"`
PointsCost int `json:"points_cost" orm:"points_cost"`
Stock int `json:"stock" orm:"stock"`
Status int `json:"status" orm:"status"`
SortOrder int `json:"sort_order" orm:"sort_order"`
}
+15
View File
@@ -0,0 +1,15 @@
package entity
import "github.com/gogf/gf/v2/os/gtime"
// Redemption 兑换记录:孩子 × 奖品,状态流转(1 待领取/2 待发货/3 已发货/4 已取消/5 已领取)。
type Redemption struct {
Id int64 `json:"id" orm:"id"`
UserId int64 `json:"user_id" orm:"user_id"`
PrizeId int64 `json:"prize_id" orm:"prize_id"`
PointsCost int `json:"points_cost" orm:"points_cost"`
Status int `json:"status" orm:"status"`
Code string `json:"code" orm:"code"`
CreatedAt *gtime.Time `json:"created_at" orm:"created_at"`
UpdatedAt *gtime.Time `json:"updated_at" orm:"updated_at"`
}
+19
View File
@@ -0,0 +1,19 @@
package entity
// SceneNode 情境节点:决策节点或终局节点,构成关卡决策树。
type SceneNode struct {
Id int64 `json:"id" orm:"id"`
LevelId int64 `json:"level_id" orm:"level_id"`
Title string `json:"title" orm:"title"`
CharacterId int64 `json:"character_id" orm:"character_id"`
Content string `json:"content" orm:"content"`
Image string `json:"image" orm:"image"`
Audio string `json:"audio" orm:"audio"`
NodeType int `json:"node_type" orm:"node_type"`
InteractionType int `json:"interaction_type" orm:"interaction_type"`
Config string `json:"config" orm:"config"`
ResultType int `json:"result_type" orm:"result_type"`
IsEntry int `json:"is_entry" orm:"is_entry"`
SortOrder int `json:"sort_order" orm:"sort_order"`
Status int `json:"status" orm:"status"`
}
+21
View File
@@ -0,0 +1,21 @@
package entity
// Strategy 计策:六套分组,含计策学堂与智慧总结内容。
type Strategy struct {
Id int64 `json:"id" orm:"id"`
Name string `json:"name" orm:"name"`
Pinyin string `json:"pinyin" orm:"pinyin"`
GroupNo int `json:"group_no" orm:"group_no"`
GroupName string `json:"group_name" orm:"group_name"`
Meaning string `json:"meaning" orm:"meaning"`
TeachContent string `json:"teach_content" orm:"teach_content"`
TeachImage string `json:"teach_image" orm:"teach_image"`
TeachAudio string `json:"teach_audio" orm:"teach_audio"`
SummaryQ string `json:"summary_q" orm:"summary_q"`
SummaryOptions string `json:"summary_options" orm:"summary_options"`
SummaryAudio string `json:"summary_audio" orm:"summary_audio"`
Icon string `json:"icon" orm:"icon"`
SortOrder int `json:"sort_order" orm:"sort_order"`
UnlockBefore int64 `json:"unlock_before" orm:"unlock_before"`
Status int `json:"status" orm:"status"`
}
+11
View File
@@ -0,0 +1,11 @@
package entity
import "github.com/gogf/gf/v2/os/gtime"
// UserBadge 孩子已获徽章。
type UserBadge struct {
Id int64 `json:"id" orm:"id"`
UserId int64 `json:"user_id" orm:"user_id"`
BadgeId int64 `json:"badge_id" orm:"badge_id"`
EarnedAt *gtime.Time `json:"earned_at" orm:"earned_at"`
}
@@ -0,0 +1,11 @@
package entity
import "github.com/gogf/gf/v2/os/gtime"
// UserCollection 计策卡收集:孩子 × 计策,计策单元全关卡通关后解锁。
type UserCollection struct {
Id int64 `json:"id" orm:"id"`
UserId int64 `json:"user_id" orm:"user_id"`
StrategyId int64 `json:"strategy_id" orm:"strategy_id"`
UnlockedAt *gtime.Time `json:"unlocked_at" orm:"unlocked_at"`
}
+15
View File
@@ -0,0 +1,15 @@
package entity
import "github.com/gogf/gf/v2/os/gtime"
// UserProgress 闯关进度:孩子 × 关卡,星星/完美/内容版本。
type UserProgress struct {
Id int64 `json:"id" orm:"id"`
ChildId int64 `json:"child_id" orm:"child_id"`
LevelId int64 `json:"level_id" orm:"level_id"`
Stars int `json:"stars" orm:"stars"`
Score int `json:"score" orm:"score"`
Perfect int `json:"perfect" orm:"perfect"`
ContentVersion int `json:"content_version" orm:"content_version"`
CompletedAt *gtime.Time `json:"completed_at" orm:"completed_at"`
}
+14
View File
@@ -0,0 +1,14 @@
package entity
import "github.com/gogf/gf/v2/os/gtime"
// UserRouteLog 决策路径流水:孩子每步选择一条,终局一条,支撑学习报告与内容优化。
type UserRouteLog struct {
Id int64 `json:"id" orm:"id"`
ChildId int64 `json:"child_id" orm:"child_id"`
LevelId int64 `json:"level_id" orm:"level_id"`
NodeId int64 `json:"node_id" orm:"node_id"`
OptionId int64 `json:"option_id" orm:"option_id"`
ResultType int `json:"result_type" orm:"result_type"`
CreatedAt *gtime.Time `json:"created_at" orm:"created_at"`
}