更改任务通知获取方式

master
落雨楓 2 years ago
parent 839eae0239
commit 51c361300f

@ -67,13 +67,5 @@ class Hooks {
public static function onBeforePageDisplay(OutputPage $out, $skin) {
$out->addModules(['ext.isekai.userpoints.quests.notification']);
$sessionManager = SessionManager::getGlobalSession();
if ($sessionManager->exists(QuestsUtils::SESSION_KEY_QUEST_COMPLETE_NOTIFICATION)) {
$out->addJsConfigVars([
'wgIsekaiQuestsCompleteNotification' => $sessionManager->get(QuestsUtils::SESSION_KEY_QUEST_COMPLETE_NOTIFICATION),
]);
$sessionManager->remove(QuestsUtils::SESSION_KEY_QUEST_COMPLETE_NOTIFICATION);
}
}
}

@ -52,18 +52,12 @@ function onQuestsCompleteNotification(notificationData) {
mw.hook('postEdit').add(function (data) {
console.log('onPostEdit');
var notificationData = mw.config.get('wgIsekaiQuestsCompleteNotification');
if (notificationData) {
onQuestsCompleteNotification(notificationData);
} else {
// VE通过API获取消息
var mwApi = new mw.Api();
mwApi.get({
action: 'userquestsgetnotification',
}).done(function (data) {
if (data.userquestsgetnotification && data.userquestsgetnotification.notification) {
onQuestsCompleteNotification(data.userquestsgetnotification.notification);
}
});
}
var mwApi = new mw.Api();
mwApi.get({
action: 'userquestsgetnotification',
}).done(function (data) {
if (data.userquestsgetnotification && data.userquestsgetnotification.notification) {
onQuestsCompleteNotification(data.userquestsgetnotification.notification);
}
});
});
Loading…
Cancel
Save