From 3449c02d0c57caae72db00ede278adc2304b124f Mon Sep 17 00:00:00 2001 From: qier222 <68148142+qier222@users.noreply.github.com> Date: Sun, 25 Oct 2020 14:09:13 +0800 Subject: [PATCH] feat: automatically get daily signin points --- src/utils/common.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/utils/common.js b/src/utils/common.js index cf693f0..4f76fd8 100644 --- a/src/utils/common.js +++ b/src/utils/common.js @@ -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); } }