更改任务通知获取方式

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

@ -67,13 +67,5 @@ class Hooks {
public static function onBeforePageDisplay(OutputPage $out, $skin) { public static function onBeforePageDisplay(OutputPage $out, $skin) {
$out->addModules(['ext.isekai.userpoints.quests.notification']); $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) { mw.hook('postEdit').add(function (data) {
console.log('onPostEdit'); console.log('onPostEdit');
var notificationData = mw.config.get('wgIsekaiQuestsCompleteNotification'); var mwApi = new mw.Api();
if (notificationData) { mwApi.get({
onQuestsCompleteNotification(notificationData); action: 'userquestsgetnotification',
} else { }).done(function (data) {
// VE通过API获取消息 if (data.userquestsgetnotification && data.userquestsgetnotification.notification) {
var mwApi = new mw.Api(); onQuestsCompleteNotification(data.userquestsgetnotification.notification);
mwApi.get({ }
action: 'userquestsgetnotification', });
}).done(function (data) {
if (data.userquestsgetnotification && data.userquestsgetnotification.notification) {
onQuestsCompleteNotification(data.userquestsgetnotification.notification);
}
});
}
}); });
Loading…
Cancel
Save