mirror of
https://github.com/GiriNeko/YesPlayMusic.git
synced 2025-12-16 13:17:46 +00:00
feat: automatically get daily signin points
This commit is contained in:
parent
7d456f7460
commit
3449c02d0c
1 changed files with 6 additions and 2 deletions
|
|
@ -1,5 +1,6 @@
|
|||
import { isAccountLoggedIn } from "./auth";
|
||||
import { refreshCookie } from "@/api/auth";
|
||||
import { dailySignin } from "@/api/user";
|
||||
import dayjs from "dayjs";
|
||||
import store from "@/store";
|
||||
|
||||
|
|
@ -79,9 +80,10 @@ export function updateHttps(url) {
|
|||
}
|
||||
|
||||
export function dailyTask() {
|
||||
let lastDate = store.state.settings.lastRefreshCookieDate;
|
||||
if (
|
||||
store.state.settings.lastRefreshCookieDate === undefined ||
|
||||
store.state.settings.lastRefreshCookieDate !== dayjs().date()
|
||||
isAccountLoggedIn() &&
|
||||
(lastDate === undefined || lastDate !== dayjs().date())
|
||||
) {
|
||||
console.log("execute dailyTask");
|
||||
store.commit("updateSettings", {
|
||||
|
|
@ -89,5 +91,7 @@ export function dailyTask() {
|
|||
value: dayjs().date(),
|
||||
});
|
||||
refreshCookie();
|
||||
dailySignin(0);
|
||||
dailySignin(1);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue