mirror of
https://github.com/certd/certd.git
synced 2026-10-13 07:38:56 +08:00
chore(plugin): add vip restriction support for plugins
1. 新增数据库迁移脚本添加vip字段 2. 补充实体类和接口的vip字段支持 3. 添加插件卡片会员标识展示逻辑 4. 实现会员限制判断
This commit is contained in:
@@ -110,6 +110,7 @@ export type OnlinePluginBean = {
|
||||
downloadCount?: number;
|
||||
score?: number;
|
||||
aiCheckStatus?: string;
|
||||
vip?: string;
|
||||
editable?: boolean;
|
||||
selfAuthored?: boolean;
|
||||
installed?: boolean;
|
||||
|
||||
@@ -23,6 +23,9 @@
|
||||
<a-tooltip v-if="plugin.aiCheckStatus === 'passed'" :title="t('certd.onlinePluginAiReviewPassed')">
|
||||
<fs-icon class="plugin-card__ai-check-icon" icon="ion:shield-checkmark-outline" />
|
||||
</a-tooltip>
|
||||
<a-tooltip v-if="requiresVip" title="需要 Plus 会员">
|
||||
<fs-icon class="plugin-card__vip-icon" icon="lucide:crown" />
|
||||
</a-tooltip>
|
||||
</div>
|
||||
</div>
|
||||
<div class="plugin-card__actions">
|
||||
@@ -227,6 +230,10 @@ const isDisabled = computed(() => {
|
||||
return props.source === "local" ? props.plugin.disabled : props.plugin.localDisabled;
|
||||
});
|
||||
|
||||
const requiresVip = computed(() => {
|
||||
return props.plugin.vip === "plus" || props.plugin.needPlus === true;
|
||||
});
|
||||
|
||||
const canRemoveLocal = computed(() => {
|
||||
return isOwnImportedPlugin.value;
|
||||
});
|
||||
@@ -626,6 +633,13 @@ function handleVersionClick() {
|
||||
margin-left: 8px;
|
||||
}
|
||||
|
||||
.plugin-card__vip-icon {
|
||||
flex: none;
|
||||
color: #faad14;
|
||||
font-size: 16px;
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
.plugin-card__title {
|
||||
display: block;
|
||||
min-width: 0;
|
||||
|
||||
@@ -3,3 +3,6 @@ ALTER TABLE "pi_plugin" ADD COLUMN "installed" boolean NOT NULL DEFAULT true;
|
||||
UPDATE "pi_plugin" SET "installed" = true;
|
||||
|
||||
ALTER TABLE "pi_plugin" ADD COLUMN "ai_check_status" varchar(32) NOT NULL DEFAULT '';
|
||||
|
||||
ALTER TABLE "pi_plugin" ADD COLUMN "vip" varchar(50);
|
||||
|
||||
|
||||
@@ -77,6 +77,9 @@ export class PluginEntity {
|
||||
@Column({ name: "ai_check_status", comment: "最新版本AI审核状态", length: 32, default: "" })
|
||||
aiCheckStatus: string;
|
||||
|
||||
@Column({ comment: "最低VIP等级", length: 50, nullable: true })
|
||||
vip: string;
|
||||
|
||||
@Column({ name: "sync_time", comment: "同步时间", nullable: true })
|
||||
syncTime: number;
|
||||
|
||||
|
||||
@@ -111,6 +111,7 @@ export type OnlinePluginBean = {
|
||||
downloadCount?: number;
|
||||
score?: number;
|
||||
aiCheckStatus?: string;
|
||||
vip?: string;
|
||||
editable?: boolean;
|
||||
selfAuthored?: boolean;
|
||||
installed?: boolean;
|
||||
@@ -684,6 +685,7 @@ export class PluginService extends BaseService<PluginEntity> {
|
||||
downloadCount: item.downloadCount,
|
||||
score: item.score,
|
||||
aiCheckStatus: item.aiCheckStatus,
|
||||
vip: item.vip,
|
||||
syncTime,
|
||||
type: old?.type || "store",
|
||||
disabled: old?.disabled ?? false,
|
||||
@@ -718,6 +720,7 @@ export class PluginService extends BaseService<PluginEntity> {
|
||||
downloadCount: item.downloadCount,
|
||||
score: item.score,
|
||||
aiCheckStatus: item.aiCheckStatus,
|
||||
vip: item.vip,
|
||||
syncTime: item.syncTime,
|
||||
installed: isInstalled,
|
||||
localPluginId: isInstalled ? item.id : undefined,
|
||||
|
||||
Reference in New Issue
Block a user