1. Bug修复: - 修复Markdown星号/下划线在小程序端原样显示问题(markdownToHtml增加__和_支持,contentParser增加Markdown格式剥离) - 修复@提及无反应(MentionSuggestion使用ref保持persons最新值,解决闭包捕获空数组问题) - 修复#链接标签点击"未找到小程序配置"(增加appId直接跳转降级路径) 2. 分享功能优化: - "分享到朋友圈"改为"分享给好友"(open-type从shareTimeline改为share) - 90%收益提示移到分享按钮下方 - 阅读20%后向上滑动弹出分享浮层提示(4秒自动消失) 3. 代付功能: - 后端:新增UserBalance/BalanceTransaction/GiftUnlock三个模型 - 后端:新增8个余额相关API(查询/充值/充值确认/代付/领取/退款/交易记录/礼物信息) - 小程序:阅读页新增"代付分享"按钮,支持用余额为好友解锁章节 - 分享链接携带gift参数,好友打开自动领取解锁 Made-with: Cursor
45 lines
2.4 KiB
Go
45 lines
2.4 KiB
Go
package model
|
|
|
|
import "time"
|
|
|
|
type UserBalance struct {
|
|
UserID string `gorm:"column:user_id;primaryKey;size:50" json:"userId"`
|
|
Balance float64 `gorm:"column:balance;type:decimal(10,2);default:0" json:"balance"`
|
|
TotalRecharged float64 `gorm:"column:total_recharged;type:decimal(10,2);default:0" json:"totalRecharged"`
|
|
TotalGifted float64 `gorm:"column:total_gifted;type:decimal(10,2);default:0" json:"totalGifted"`
|
|
TotalRefunded float64 `gorm:"column:total_refunded;type:decimal(10,2);default:0" json:"totalRefunded"`
|
|
CreatedAt time.Time `gorm:"column:created_at" json:"createdAt"`
|
|
UpdatedAt time.Time `gorm:"column:updated_at" json:"updatedAt"`
|
|
}
|
|
|
|
func (UserBalance) TableName() string { return "user_balances" }
|
|
|
|
type BalanceTransaction struct {
|
|
ID uint `gorm:"primaryKey;autoIncrement" json:"id"`
|
|
UserID string `gorm:"column:user_id;size:50;index" json:"userId"`
|
|
Type string `gorm:"column:type;size:20" json:"type"`
|
|
Amount float64 `gorm:"column:amount;type:decimal(10,2)" json:"amount"`
|
|
BalanceAfter float64 `gorm:"column:balance_after;type:decimal(10,2)" json:"balanceAfter"`
|
|
RelatedOrder *string `gorm:"column:related_order;size:50" json:"relatedOrder,omitempty"`
|
|
TargetUserID *string `gorm:"column:target_user_id;size:50" json:"targetUserId,omitempty"`
|
|
SectionID *string `gorm:"column:section_id;size:50" json:"sectionId,omitempty"`
|
|
Description string `gorm:"column:description;size:200" json:"description"`
|
|
CreatedAt time.Time `gorm:"column:created_at" json:"createdAt"`
|
|
}
|
|
|
|
func (BalanceTransaction) TableName() string { return "balance_transactions" }
|
|
|
|
type GiftUnlock struct {
|
|
ID uint `gorm:"primaryKey;autoIncrement" json:"id"`
|
|
GiftCode string `gorm:"column:gift_code;uniqueIndex;size:32" json:"giftCode"`
|
|
GiverID string `gorm:"column:giver_id;size:50;index" json:"giverId"`
|
|
SectionID string `gorm:"column:section_id;size:50" json:"sectionId"`
|
|
ReceiverID *string `gorm:"column:receiver_id;size:50" json:"receiverId,omitempty"`
|
|
Amount float64 `gorm:"column:amount;type:decimal(10,2)" json:"amount"`
|
|
Status string `gorm:"column:status;size:20;default:pending" json:"status"`
|
|
CreatedAt time.Time `gorm:"column:created_at" json:"createdAt"`
|
|
RedeemedAt *time.Time `gorm:"column:redeemed_at" json:"redeemedAt,omitempty"`
|
|
}
|
|
|
|
func (GiftUnlock) TableName() string { return "gift_unlocks" }
|