Skip to content

Commit

Permalink
fix:的卢&赤兔
Browse files Browse the repository at this point in the history
  • Loading branch information
fifthThirteen committed Jul 15, 2024
1 parent 66d7582 commit 01346ab
Show file tree
Hide file tree
Showing 4 changed files with 185 additions and 98 deletions.
9 changes: 9 additions & 0 deletions src/assets/css/horse/broadcast.less
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,15 @@
.pointer;
}
}
&.is-chitu,
&.is-dilu {
.u-times {
.flex;
flex-direction: column;
font-size: 12px;
color: #999;
}
}
}
}
}
Expand Down
188 changes: 98 additions & 90 deletions src/assets/data/horse_broadcast.json
Original file line number Diff line number Diff line change
@@ -1,90 +1,98 @@
{
"龙子": {
"id": 5733,
"itemId": "8_5733"
},
"龙子·燕歌": {
"id": 27803,
"itemId": "8_27803"
},
"龙子·潮生": {
"id": 27824,
"itemId": "8_27824"
},
"龙子·踏莎": {
"id": 27845,
"itemId": "8_27845"
},
"麟驹": {
"id": 5739,
"itemId": "8_5739"
},
"麟驹·燕歌": {
"id": 27800,
"itemId": "8_27800"
},
"麟驹·潮生": {
"id": 27821,
"itemId": "8_27821"
},
"麟驹·踏莎": {
"id": 27842,
"itemId": "8_27842"
},
"绝尘": {
"id": 5866,
"itemId": "8_5866"
},
"绝尘·燕歌": {
"id": 27797,
"itemId": "8_27797"
},
"绝尘·潮生": {
"id": 27818,
"itemId": "8_27818"
},
"绝尘·踏莎": {
"id": 27839,
"itemId": "8_27839"
},
"赤蛇": {
"id": 5869,
"itemId": "8_5869"
},
"赤蛇·燕歌": {
"id": 27792,
"itemId": "8_27792"
},
"赤蛇·潮生": {
"id": 27815,
"itemId": "8_27815"
},
"赤蛇·踏莎": {
"id": 27836,
"itemId": "8_27836"
},
"闪电": {
"id": 5872,
"itemId": "8_5872"
},
"闪电·燕歌": {
"id": 27791,
"itemId": "8_27791"
},
"闪电·潮生": {
"id": 27812,
"itemId": "8_27812"
},
"闪电·踏莎": {
"id": 27833,
"itemId": "8_27833"
},
"里飞沙·踏秋": {
"id": 5875,
"itemId": "8_5875"
},
"赤兔·飞虹": {
"id": 28811,
"itemId": "8_28811"
}
}
{
"龙子": {
"id": 5733,
"itemId": "8_5733"
},
"龙子·燕歌": {
"id": 27803,
"itemId": "8_27803"
},
"龙子·潮生": {
"id": 27824,
"itemId": "8_27824"
},
"龙子·踏莎": {
"id": 27845,
"itemId": "8_27845"
},
"麟驹": {
"id": 5739,
"itemId": "8_5739"
},
"麟驹·燕歌": {
"id": 27800,
"itemId": "8_27800"
},
"麟驹·潮生": {
"id": 27821,
"itemId": "8_27821"
},
"麟驹·踏莎": {
"id": 27842,
"itemId": "8_27842"
},
"绝尘": {
"id": 5866,
"itemId": "8_5866"
},
"绝尘·燕歌": {
"id": 27797,
"itemId": "8_27797"
},
"绝尘·潮生": {
"id": 27818,
"itemId": "8_27818"
},
"绝尘·踏莎": {
"id": 27839,
"itemId": "8_27839"
},
"赤蛇": {
"id": 5869,
"itemId": "8_5869"
},
"赤蛇·燕歌": {
"id": 27792,
"itemId": "8_27792"
},
"赤蛇·潮生": {
"id": 27815,
"itemId": "8_27815"
},
"赤蛇·踏莎": {
"id": 27836,
"itemId": "8_27836"
},
"闪电": {
"id": 5872,
"itemId": "8_5872"
},
"闪电·燕歌": {
"id": 27791,
"itemId": "8_27791"
},
"闪电·潮生": {
"id": 27812,
"itemId": "8_27812"
},
"闪电·踏莎": {
"id": 27833,
"itemId": "8_27833"
},
"里飞沙·踏秋": {
"id": 5875,
"itemId": "8_5875"
},
"赤兔·飞虹": {
"id": 28811,
"itemId": "8_28811"
},
"赤兔": {
"id": 28811,
"itemId": "8_28811"
},
"的卢": {
"id": 38642,
"itemId": "8_38642"
}
}
77 changes: 73 additions & 4 deletions src/components/horse/HorseBroadcastV2.vue
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,29 @@
</div>
</div>
</div>
<span v-else class="m-horse no-horse">本周赤兔尚未刷新</span>
</div>
<div v-if="hasExist" class="m-horse is-chitu">
<div class="u-col u-times">
<div>本CD赤兔已刷新</div>
<div>{{ existData.time }}</div>
</div>
<span class="u-col u-name">{{ existData.map_name }}</span>
<div class="u-col u-horse">
<el-image :src="getImgSrc('赤兔')" class="item"></el-image>
</div>
</div>
<span v-else class="m-horse no-horse">本CD赤兔尚未刷新</span>
<div v-if="diluHasExist" class="m-horse is-dilu">
<div class="u-col u-times">
<div>本周的卢已刷新</div>
<div>{{ diluExistData.time }}</div>
</div>
<span class="u-col u-name">{{ diluExistData.map_name }}</span>
<div class="u-col u-horse">
<el-image :src="getImgSrc('的卢')" class="item"></el-image>
</div>
</div>
<span v-else class="m-horse no-horse">本周的卢尚未刷新</span>
</div>
</div>

Expand All @@ -60,7 +81,7 @@ import servers_std from "@jx3box/jx3box-data/data/server/server_std.json";
import servers_origin from "@jx3box/jx3box-data/data/server/server_origin.json";
import horseSites from "@/assets/data/horse_sites.json";
import horseBroadcast from "@/assets/data/horse_broadcast.json";
import { getGameReporter, getUserInfo, getChituHorse } from "@/service/horse";
import { getGameReporter, getUserInfo, getHorseReporter } from "@/service/horse";
import dayjs from "@/plugins/day";
export default {
name: "HorseBroadcast",
Expand All @@ -87,6 +108,9 @@ export default {
`,
chituLoading: false,
active: 0,
diluHasExist: false,
diluExistData: {},
};
},
computed: {
Expand Down Expand Up @@ -117,7 +141,7 @@ export default {
let list = this.list || [];
const arr = this.isPhone ? [] : new Array(column * 4 - 1 - list.length).fill({});
list = list.sort((a, b) => this.convertTime(a.fromTime) - this.convertTime(b.fromTime));
return list.concat(this.existData, arr) || [];
return list.concat(arr) || [];
},
isPhone() {
return document.documentElement.clientWidth <= 820;
Expand All @@ -129,14 +153,59 @@ export default {
this.existData = {};
this.getGameReporter();
this.loadChituData();
this.loadDiluData();
},
},
methods: {
loadDiluData() {
// 每周一、三、五、六、日 10:00-24:00期间随机开启
// 开启前60分钟及开启时均有系统公告提醒
// 同服务器每周只开启一次
// 【的卢】随机刷新于某一野外场景
const server = this.server;
const type = "dilu-horse";
this.chituLoading = true;
getHorseReporter(type, server)
.then((res) => {
const list = res.data?.data?.list || [];
if (!list.length) {
return;
}
// 最近刷新时间
const created_at = dayjs.tz(list?.[0].created_at || dayjs.tz());
const now = dayjs.tz();
const now_day = now.day();
let cd_from_time = now.day(1).hour(10).minute(0).second(0).millisecond(0);
let cd_to_time = cd_from_time.add(1, "week").add(-10, "hour").add(-1, "millisecond");
if (now_day < 1) {
// 周日为0 / 为上一个CD
cd_from_time = dayjs.tz(cd_from_time).add(-1, "week");
cd_to_time = dayjs.tz(cd_to_time).add(-1, "week");
}
// 最近刷新时间是否在当前CD中
const isBetween = dayjs.tz(created_at).isBetween(cd_from_time, cd_to_time);
this.diluHasExist = isBetween;
if (isBetween) {
const content = list?.[0]?.content || "";
const mapName = content.match(/的卢已经出现在(\S*)中/)
? content.match(/的卢已经出现在(\S*)中/)[1]
: "";
this.diluExistData = {
map_name: mapName,
time: dayjs.tz(created_at).format("YYYY-MM-DD HH:mm:ss"),
};
}
})
.finally(() => {
this.chituLoading = false;
});
},
loadChituData() {
const server = this.server;
const type = "chitu-horse";
// 周二7点到下周一7点为一个CD, 7天内随机刷一只,地图为黑戈壁、阴山大草原、鲲鹏岛
this.chituLoading = true;
getChituHorse(server)
getHorseReporter(type, server)
.then((res) => {
const list = res.data?.data?.list || [];
const content = list?.[0]?.content || "";
Expand Down
9 changes: 5 additions & 4 deletions src/service/horse.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ function getHorses(params) {
});
}

function getHorse(params) {
function getHorse(params) {
return $.get(`/horse`, {
params,
});
Expand All @@ -32,12 +32,13 @@ function getGameReporter(params) {
});
}

export function getChituHorse(server) {
// 赤兔 的卢
function getHorseReporter(type, server) {
const params = {
pageIndex: 1,
pageSize: 50,
server,
type: "chitu-horse",
type,
subtype: "share_msg",
};
return $next().get("/api/game/reporter/horse", {
Expand All @@ -49,4 +50,4 @@ function getUserInfo() {
return $cms().get("/api/cms/user/my/info");
}

export { getHorses, getHorse, getAttrs, getFeeds, getGameReporter, getUserInfo };
export { getHorses, getHorse, getAttrs, getFeeds, getGameReporter, getUserInfo, getHorseReporter };

0 comments on commit 01346ab

Please sign in to comment.