diff --git a/resource/sites/blutopia.cc/config.json b/resource/sites/blutopia.cc/config.json index 576a7f480..1b5526203 100644 --- a/resource/sites/blutopia.cc/config.json +++ b/resource/sites/blutopia.cc/config.json @@ -12,51 +12,51 @@ "levelRequirements": [{ "level": "1", "name": "BluUser", - "interval": "1", + "interval": "30D", "uploaded": "1TiB", "privilege": "5 download slots" },{ "level": "2", "name": "BluMaster", - "interval": "2", + "interval": "60D", "uploaded": "5TiB", "privilege": "10 download slots" },{ "level": "3", "name": "BluExtremist", - "interval": "3", + "interval": "90D", "uploaded": "20TiB", "privilege": "Automatic torrent approvals; Invite forums; 15 download slots" },{ "level": "4", "name": "BluLegend", - "interval": "6", + "interval": "180D", "uploaded": "50TiB", "privilege": "Automatic torrent approvals; Invite forums; 20 download slots" },{ "level": "5", "name": "Blutopian", - "interval": "12", + "interval": "365D", "uploaded": "100TiB", "privilege": "Automatic torrent approvals; Invite forums; Immunity to automated HnR warnings; Global Freeleech; 25 download slots" },{ "level": "6", "name": "BluSeeder", - "interval": "4", + "interval": "30D", "seedingSize": "5TiB", "averageSeedtime": "30", "privilege": "Automatic torrent approvals; Invite forums; Immunity to automated HnR warnings; 15 download slots" },{ "level": "7", "name": "BluCollector", - "interval": "8", + "interval": "60D", "seedingSize": "10TiB", "averageSeedtime": "60", "privilege": "Automatic torrent approvals; Invite forums; Immunity to automated HnR warnings; Global Freeleech; 20 download slots" },{ "level": "8", "name": "BluArchivist", - "interval": "13", + "interval": "90D", "seedingSize": "20TiB", "averageSeedtime": "90", "privilege": "Automatic torrent approvals; Invite forums; Immunity to automated HnR warnings; Global Freeleech; Global Double Upload; 25 download slots" diff --git a/resource/sites/monikadesign.uk/config.json b/resource/sites/monikadesign.uk/config.json index 904ebfed0..143a06e85 100644 --- a/resource/sites/monikadesign.uk/config.json +++ b/resource/sites/monikadesign.uk/config.json @@ -14,38 +14,38 @@ "levelRequirements": [{ "level": "1", "name": "PowerUser", - "interval": "4", + "interval": "1M", "uploaded": "1TB", "privilege": "访问邀请区" },{ "level": "2", "name": "SuperUser", - "interval": "8", + "interval": "2M", "uploaded": "2TB", "privilege": "访问邀请区" },{ "level": "3", "name": "ExtremeUser", - "interval": "12", + "interval": "3M", "uploaded": "5TB", "privilege": "自动通过候选;访问邀请区" },{ "level": "4", "name": "InsaneUser", - "interval": "18", + "interval": "6M", "uploaded": "10TB", "privilege": "自动通过候选;访问邀请区" },{ "level": "5", "name": "Veteran", - "interval": "36", + "interval": "12M", "uploaded": "15TB", "privilege": "个人全局双倍上传;自动通过候选;访问邀请区" }, { "level": "6", "name": "Seeder", - "interval": "4", + "interval": "1M", "seedingSize": "3TB", "averageSeedtime": "30", "privilege": "自动通过候选;访问邀请区" @@ -53,7 +53,7 @@ { "level": "7", "name": "Archivist", - "interval": "12", + "interval": "3M", "seedingSize": "10TB", "averageSeedtime": "60", "privilege": "个人全局免费;自动通过候选;访问邀请区" diff --git a/src/interface/common.ts b/src/interface/common.ts index 224362e70..b84b19203 100644 --- a/src/interface/common.ts +++ b/src/interface/common.ts @@ -278,7 +278,7 @@ export interface LevelRequirement { level?: number; name?: string; // 间隔要求 - interval?: number; + interval?: string; // 日期要求 requiredDate?: string; // 上传数要求 diff --git a/src/options/views/Home.vue b/src/options/views/Home.vue index 5b76cd55a..070701071 100644 --- a/src/options/views/Home.vue +++ b/src/options/views/Home.vue @@ -683,7 +683,7 @@ export default Vue.extend({ if (levelRequirement.requiredDate) break; if (levelRequirement.interval && user.joinDateTime) { - levelRequirement.requiredDate = dayjs(user.joinDateTime).add(levelRequirement.interval as number, "week").format("YYYY-MM-DD"); + levelRequirement.requiredDate = this.getRequiredDate(levelRequirement.interval, user.joinDateTime).format("YYYY-MM-DD"); } else break; } @@ -762,8 +762,7 @@ export default Vue.extend({ } if (levelRequirement.interval && user.joinDateTime) { - let weeks = levelRequirement.interval as number; - let requiredDate = dayjs(user.joinDateTime).add(weeks, "week"); + let requiredDate = this.getRequiredDate(levelRequirement.interval, user.joinDateTime); if (dayjs(new Date()).isBefore(requiredDate)) { nextLevel.requiredDate = requiredDate.format("YYYY-MM-DD"); nextLevel.level = levelRequirement.level; @@ -942,6 +941,26 @@ export default Vue.extend({ } return 0; }, + /** + * @return {dayjs.Dayjs} + */ + getRequiredDate(interval: string, joinDateTime: string) : dayjs.Dayjs { + let unit = "week"; + switch (interval.replace(/[^A-Za-z]/g, "")) + { + case "D": + unit = "day"; + break; + case "M": + unit = "month"; + break; + case "Y": + unit = "year"; + break; + } + let num = interval.replace(/\D/g,''); + return dayjs(joinDateTime).add(parseInt(num), unit as dayjs.ManipulateType); + }, /** * 获取站点用户信息 */