diff --git a/backend/pkg/models/asset_registry.go b/backend/pkg/models/asset_registry.go
index e3aad81..2dcb7f2 100644
--- a/backend/pkg/models/asset_registry.go
+++ b/backend/pkg/models/asset_registry.go
@@ -23,6 +23,7 @@ type AssetRegistry struct {
// 公共字段
Status int32 `gorm:"default:0;column:status"`
LikeCount int32 `gorm:"default:0;column:like_count"`
+ DisplayStatus int32 `gorm:"default:0;column:display_status"` // 展示状态:0=待展示, 1=已展示
CreatedAt int64 `gorm:"not null;column:created_at"`
UpdatedAt int64 `gorm:"not null;column:updated_at"`
}
diff --git a/backend/pkg/proto/starbook/starbook.pb.go b/backend/pkg/proto/starbook/starbook.pb.go
index 9c908c7..bb79bf1 100644
--- a/backend/pkg/proto/starbook/starbook.pb.go
+++ b/backend/pkg/proto/starbook/starbook.pb.go
@@ -329,8 +329,9 @@ type AssetItem struct {
CoverUrlSigned string `protobuf:"bytes,3,opt,name=cover_url_signed,json=coverUrlSigned,proto3" json:"cover_url_signed,omitempty"` // 预签名封面URL
LikeCount int32 `protobuf:"varint,4,opt,name=like_count,json=likeCount,proto3" json:"like_count,omitempty"`
CreatedAt int64 `protobuf:"varint,5,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"`
- Category string `protobuf:"bytes,6,opt,name=category,proto3" json:"category,omitempty"` // regular: 'castlove' / collection: category / activity: activity_type
- Grade int32 `protobuf:"varint,7,opt,name=grade,proto3" json:"grade,omitempty"` // 仅 regular 时有效(1/2/3...),其他类型为 0
+ Category string `protobuf:"bytes,6,opt,name=category,proto3" json:"category,omitempty"` // regular: 'castlove' / collection: category / activity: activity_type
+ Grade int32 `protobuf:"varint,7,opt,name=grade,proto3" json:"grade,omitempty"` // 仅 regular 时有效(1/2/3...),其他类型为 0
+ DisplayStatus int32 `protobuf:"varint,8,opt,name=display_status,json=displayStatus,proto3" json:"display_status,omitempty"` // 展示状态:0=待展示, 1=已展示
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
@@ -414,6 +415,13 @@ func (x *AssetItem) GetGrade() int32 {
return 0
}
+func (x *AssetItem) GetDisplayStatus() int32 {
+ if x != nil {
+ return x.DisplayStatus
+ }
+ return 0
+}
+
// 藏品列表请求
type GetStarbookItemsRequest struct {
state protoimpl.MessageState `protogen:"open.v1"`
@@ -647,7 +655,7 @@ const file_starbook_proto_rawDesc = "" +
"\x05items\x18\x02 \x03(\v2\x1b.topfans.starbook.AssetItemR\x05items\x12\x1f\n" +
"\vtotal_count\x18\x03 \x01(\x05R\n" +
"totalCount\x12\x19\n" +
- "\bhas_more\x18\x04 \x01(\bR\ahasMore\"\xd4\x01\n" +
+ "\bhas_more\x18\x04 \x01(\bR\ahasMore\"\xfb\x01\n" +
"\tAssetItem\x12\x19\n" +
"\basset_id\x18\x01 \x01(\x03R\aassetId\x12\x12\n" +
"\x04name\x18\x02 \x01(\tR\x04name\x12(\n" +
@@ -657,7 +665,8 @@ const file_starbook_proto_rawDesc = "" +
"\n" +
"created_at\x18\x05 \x01(\x03R\tcreatedAt\x12\x1a\n" +
"\bcategory\x18\x06 \x01(\tR\bcategory\x12\x14\n" +
- "\x05grade\x18\a \x01(\x05R\x05grade\"\x90\x01\n" +
+ "\x05grade\x18\a \x01(\x05R\x05grade\x12%\n" +
+ "\x0edisplay_status\x18\b \x01(\x05R\rdisplayStatus\"\x90\x01\n" +
"\x17GetStarbookItemsRequest\x12\x12\n" +
"\x04type\x18\x01 \x01(\tR\x04type\x12\x1a\n" +
"\bcategory\x18\x02 \x01(\tR\bcategory\x12\x14\n" +
diff --git a/backend/proto/starbook.proto b/backend/proto/starbook.proto
index 578c132..5954299 100644
--- a/backend/proto/starbook.proto
+++ b/backend/proto/starbook.proto
@@ -70,6 +70,7 @@ message AssetItem {
int64 created_at = 5;
string category = 6; // regular: 'castlove' / collection: category / activity: activity_type
int32 grade = 7; // 仅 regular 时有效(1/2/3...),其他类型为 0
+ int32 display_status = 8; // 展示状态:0=待展示, 1=已展示
}
// ==================== 藏品列表(分页) ====================
diff --git a/backend/scripts/compile-proto.sh b/backend/scripts/compile-proto.sh
index 3022577..4797312 100755
--- a/backend/scripts/compile-proto.sh
+++ b/backend/scripts/compile-proto.sh
@@ -53,7 +53,7 @@ echo ""
# 预先创建目标目录
echo "📁 创建目标目录..."
-for name in common user social asset gallery ranking activity task; do
+for name in common user social asset gallery ranking activity task starbook; do
mkdir -p "pkg/proto/$name"
done
echo ""
@@ -159,6 +159,19 @@ protoc --proto_path=proto \
echo "✅ task.proto 编译完成"
echo ""
+# 编译 starbook.proto
+echo "📦 编译 starbook.proto ..."
+protoc --proto_path=proto \
+ --proto_path=. \
+ --go_out=pkg/proto/starbook \
+ --go_opt=paths=source_relative \
+ --go-triple_out=pkg/proto/starbook \
+ --go-triple_opt=paths=source_relative \
+ starbook.proto
+
+echo "✅ starbook.proto 编译完成"
+echo ""
+
# 清理可能存在的冗余目录和文件
echo "🔄 清理冗余文件..."
@@ -169,7 +182,7 @@ if [ -d "github.com" ]; then
fi
# 删除 proto 目录下的生成文件(如果存在)
-for name in common user social asset gallery ranking activity task; do
+for name in common user social asset gallery ranking activity task starbook; do
if [ -f "proto/$name.pb.go" ]; then
rm "proto/$name.pb.go"
echo " ✅ proto/$name.pb.go 已清理"
diff --git a/backend/scripts/migrate_create_collection_activity_registry_tables.sql b/backend/scripts/migrate_create_collection_activity_registry_tables.sql
index b339c0a..6b73d6d 100644
--- a/backend/scripts/migrate_create_collection_activity_registry_tables.sql
+++ b/backend/scripts/migrate_create_collection_activity_registry_tables.sql
@@ -71,6 +71,7 @@ CREATE TABLE IF NOT EXISTS asset_registry (
-- 公共字段
status SMALLINT NOT NULL DEFAULT 0,
like_count INT NOT NULL DEFAULT 0,
+ display_status SMALLINT NOT NULL DEFAULT 0, -- 展示状态:0=待展示, 1=已展示
created_at BIGINT NOT NULL,
updated_at BIGINT NOT NULL,
diff --git a/backend/services/galleryService/repository/gallery_repository.go b/backend/services/galleryService/repository/gallery_repository.go
index 00ebfa7..9a929b9 100644
--- a/backend/services/galleryService/repository/gallery_repository.go
+++ b/backend/services/galleryService/repository/gallery_repository.go
@@ -28,6 +28,9 @@ type GalleryRepository interface {
DeleteExhibition(exhibitionID int64) error
DeleteExhibitionByAsset(assetID int64) error
GetExpiredExhibitions(beforeTime int64) ([]*models.Exhibition, error)
+
+ // 资产注册表相关
+ UpdateAssetRegistryDisplayStatus(assetID int64, displayStatus int32) error
}
// galleryRepository Repository实现
@@ -192,6 +195,13 @@ func (r *galleryRepository) GetExpiredExhibitions(beforeTime int64) ([]*models.E
return exhibitions, err
}
+// UpdateAssetRegistryDisplayStatus 更新资产注册表的展示状态
+func (r *galleryRepository) UpdateAssetRegistryDisplayStatus(assetID int64, displayStatus int32) error {
+ return r.db.Model(&models.AssetRegistry{}).
+ Where("asset_id = ?", assetID).
+ Update("display_status", displayStatus).Error
+}
+
// ==================== 辅助函数 ====================
// generateHostProfileID 生成 host_profile_id
diff --git a/backend/services/starbookService/service/starbook_service.go b/backend/services/starbookService/service/starbook_service.go
index f191337..d17ec5c 100644
--- a/backend/services/starbookService/service/starbook_service.go
+++ b/backend/services/starbookService/service/starbook_service.go
@@ -321,11 +321,12 @@ func (s *starbookService) buildAssetItemsFromRegistries(registries []*models.Ass
// 构建 items
for _, reg := range registries {
item := &pb.AssetItem{
- AssetId: reg.AssetID,
- LikeCount: reg.LikeCount,
- CreatedAt: reg.CreatedAt,
- Category: CastloveCategory,
- Grade: 0,
+ AssetId: reg.AssetID,
+ LikeCount: reg.LikeCount,
+ CreatedAt: reg.CreatedAt,
+ Category: CastloveCategory,
+ Grade: 0,
+ DisplayStatus: reg.DisplayStatus,
}
// grade 处理
diff --git a/frontend/pages/components/StarbookContent.vue b/frontend/pages/components/StarbookContent.vue
index 34af902..d5f6a1e 100644
--- a/frontend/pages/components/StarbookContent.vue
+++ b/frontend/pages/components/StarbookContent.vue
@@ -69,6 +69,9 @@
:src="item.coverUrl"
mode="aspectFill"
/>
+
+ {{ item.display_status === 1 ? '已展示' : '待展示' }}
+
{{ item.name }}
@@ -108,6 +111,9 @@
:src="item.coverUrl"
mode="aspectFill"
/>
+
+ {{ item.display_status === 1 ? '已展示' : '待展示' }}
+
{{ item.name }}
★{{ item.like_count }}
@@ -147,6 +153,9 @@
:src="item.coverUrl"
mode="aspectFill"
/>
+
+ {{ item.display_status === 1 ? '已展示' : '待展示' }}
+
{{ item.name }}
★{{ item.like_count }}
@@ -550,6 +559,28 @@ watch(() => props.isActive, (newVal) => {
text-align: center;
}
+/* 展示状态标签 */
+.status-badge {
+ position: absolute;
+ top: 8rpx;
+ right: 8rpx;
+ border-radius: 8rpx;
+ padding: 4rpx 8rpx;
+ z-index: 1;
+}
+.status-badge-active {
+ background: linear-gradient(135deg, #FFD700, #FFA500);
+ box-shadow: 0 0 12rpx rgba(255, 215, 0, 0.6);
+}
+.status-badge-pending {
+ background: rgba(0, 0, 0, 0.6);
+}
+.status-text {
+ font-size: 18rpx;
+ color: #fff;
+ font-weight: bold;
+}
+
.nft-name {
display: block;
font-size: 22rpx;