Skip to content

Commit

Permalink
fix: MUD and BLU level requirements
Browse files Browse the repository at this point in the history
  • Loading branch information
fzlins committed Aug 1, 2023
1 parent 55ec5eb commit 4c7b139
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 19 deletions.
16 changes: 8 additions & 8 deletions resource/sites/blutopia.cc/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
14 changes: 7 additions & 7 deletions resource/sites/monikadesign.uk/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,46 +14,46 @@
"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": "自动通过候选;访问邀请区"
},
{
"level": "7",
"name": "Archivist",
"interval": "12",
"interval": "3M",
"seedingSize": "10TB",
"averageSeedtime": "60",
"privilege": "个人全局免费;自动通过候选;访问邀请区"
Expand Down
2 changes: 1 addition & 1 deletion src/interface/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ export interface LevelRequirement {
level?: number;
name?: string;
// 间隔要求
interval?: number;
interval?: string;
// 日期要求
requiredDate?: string;
// 上传数要求
Expand Down
25 changes: 22 additions & 3 deletions src/options/views/Home.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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);
},
/**
* 获取站点用户信息
*/
Expand Down

0 comments on commit 4c7b139

Please sign in to comment.