修复因为数据库索引导致签到功能异常的问题
parent
e7ce4d04c9
commit
d39a4861c4
@ -1,105 +1,105 @@
|
|||||||
{
|
{
|
||||||
"name": "Isekai User Points",
|
"name": "Isekai User Points",
|
||||||
"namemsg": "isekai-userpoints",
|
"namemsg": "isekai-userpoints",
|
||||||
"author": "Hyperzlib",
|
"author": "Hyperzlib",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"url": "https://git.isekai.cn/Isekai-Project/mediawiki-extension-IsekaiUserPoints",
|
"url": "https://git.isekai.cn/Isekai-Project/mediawiki-extension-IsekaiUserPoints",
|
||||||
"descriptionmsg": "isekai-userpoints-desc",
|
"descriptionmsg": "isekai-userpoints-desc",
|
||||||
"license-name": "GPL-2.0-or-later",
|
"license-name": "GPL-2.0-or-later",
|
||||||
"type": "api",
|
"type": "api",
|
||||||
"requires": {
|
"requires": {
|
||||||
"MediaWiki": ">= 1.35.0"
|
"MediaWiki": ">= 1.35.0"
|
||||||
},
|
},
|
||||||
"MessagesDirs": {
|
"MessagesDirs": {
|
||||||
"IsekaiUserPoints": [
|
"IsekaiUserPoints": [
|
||||||
"i18n"
|
"i18n"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"ExtensionMessagesFiles": {
|
"ExtensionMessagesFiles": {
|
||||||
"IsekaiUserPointsAlias": "IsekaiUserPoints.alias.php"
|
"IsekaiUserPointsAlias": "IsekaiUserPoints.alias.php"
|
||||||
},
|
},
|
||||||
"AutoloadNamespaces": {
|
"AutoloadNamespaces": {
|
||||||
"Isekai\\UserPoints\\": "includes"
|
"Isekai\\UserPoints\\": "includes"
|
||||||
},
|
},
|
||||||
"Hooks": {
|
"Hooks": {
|
||||||
"LoadExtensionSchemaUpdates": "Isekai\\UserPoints\\Hooks::onLoadExtensionSchemaUpdates",
|
"LoadExtensionSchemaUpdates": "Isekai\\UserPoints\\Hooks::onLoadExtensionSchemaUpdates",
|
||||||
"BeforePageDisplay": "Isekai\\UserPoints\\Hooks::onBeforePageDisplay",
|
"BeforePageDisplay": "Isekai\\UserPoints\\Hooks::onBeforePageDisplay",
|
||||||
"GetPreferences": "Isekai\\UserPoints\\Hooks::onGetPreferences"
|
"GetPreferences": "Isekai\\UserPoints\\Hooks::onGetPreferences"
|
||||||
},
|
},
|
||||||
"APIModules": {
|
"APIModules": {
|
||||||
"userdailysign": "Isekai\\UserPoints\\Api\\ApiUserDailySign"
|
"userdailysign": "Isekai\\UserPoints\\Api\\ApiUserDailySign"
|
||||||
},
|
},
|
||||||
"APIPropModules": {
|
"APIPropModules": {
|
||||||
"userpoints": "Isekai\\UserPoints\\Api\\ApiQueryUserPoints",
|
"userpoints": "Isekai\\UserPoints\\Api\\ApiQueryUserPoints",
|
||||||
"pointinfo": "Isekai\\UserPoints\\Api\\ApiQueryPointInfo"
|
"pointinfo": "Isekai\\UserPoints\\Api\\ApiQueryPointInfo"
|
||||||
},
|
},
|
||||||
"APIListModules": {
|
"APIListModules": {
|
||||||
"userspoints": "Isekai\\UserPoints\\Api\\ApiQueryUsersPoints"
|
"userspoints": "Isekai\\UserPoints\\Api\\ApiQueryUsersPoints"
|
||||||
},
|
},
|
||||||
"ServiceWiringFiles": [
|
"ServiceWiringFiles": [
|
||||||
"IsekaiUserPoints.services.php"
|
"IsekaiUserPoints.services.php"
|
||||||
],
|
],
|
||||||
"GroupPermissions": {
|
"GroupPermissions": {
|
||||||
"bureaucrat": {
|
"bureaucrat": {
|
||||||
"queryuserpoints": true,
|
"queryuserpoints": true,
|
||||||
"edituserpoints": true
|
"edituserpoints": true
|
||||||
},
|
},
|
||||||
"suppress": {
|
"suppress": {
|
||||||
"queryuserpoints": true,
|
"queryuserpoints": true,
|
||||||
"edituserpoints": true
|
"edituserpoints": true
|
||||||
},
|
},
|
||||||
"sysop": {
|
"sysop": {
|
||||||
"queryuserpoints": true,
|
"queryuserpoints": true,
|
||||||
"edituserpoints": true
|
"edituserpoints": true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"GrantPermissions": {
|
"GrantPermissions": {
|
||||||
"userpointsmanager": {
|
"userpointsmanager": {
|
||||||
"queryuserpoints": true,
|
"queryuserpoints": true,
|
||||||
"edituserpoints": true
|
"edituserpoints": true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"ResourceModules": {
|
"ResourceModules": {
|
||||||
"ext.isekai.userpoints.base": {
|
"ext.isekai.userpoints.base": {
|
||||||
"styles": ["ext.isekai.userpoints.base.less"]
|
"styles": ["ext.isekai.userpoints.base.less"]
|
||||||
},
|
},
|
||||||
"ext.isekai.userpoints.dailysign": {
|
"ext.isekai.userpoints.dailysign": {
|
||||||
"scripts": ["ext.isekai.userpoints.dailysign.js"],
|
"scripts": ["ext.isekai.userpoints.dailysign.js"],
|
||||||
"messages": [
|
"messages": [
|
||||||
"comma-separator",
|
"comma-separator",
|
||||||
"isekai-userpoints-point-name-num",
|
"isekai-userpoints-point-name-num",
|
||||||
"isekai-userpoints-dailysign-notify-title",
|
"isekai-userpoints-dailysign-notify-title",
|
||||||
"isekai-userpoints-dailysign-notify-success"
|
"isekai-userpoints-dailysign-notify-success"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"ResourceFileModulePaths": {
|
"ResourceFileModulePaths": {
|
||||||
"localBasePath": "modules",
|
"localBasePath": "modules",
|
||||||
"remoteExtPath": "IsekaiUserPoints/modules"
|
"remoteExtPath": "IsekaiUserPoints/modules"
|
||||||
},
|
},
|
||||||
"config": {
|
"config": {
|
||||||
"IsekaiUserPointConfig": {
|
"IsekaiUserPointConfig": {
|
||||||
"value": {
|
"value": {
|
||||||
"exp": {
|
"exp": {
|
||||||
"name": "Exp.",
|
"name": "Exp.",
|
||||||
"namemsg": "isekai-userpoints-point-name-exp",
|
"namemsg": "isekai-userpoints-point-name-exp",
|
||||||
"icon": {
|
"icon": {
|
||||||
"normal": {
|
"normal": {
|
||||||
"image": "https://static.isekai.dev/isekaiwiki/isekaiwiki-exp.png"
|
"image": "https://static.isekai.dev/isekaiwiki/isekaiwiki-exp.png"
|
||||||
},
|
},
|
||||||
"invert": {
|
"invert": {
|
||||||
"image": "https://static.isekai.dev/isekaiwiki/isekaiwiki-exp-invert.png"
|
"image": "https://static.isekai.dev/isekaiwiki/isekaiwiki-exp-invert.png"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"IsekaiUserPointShowOnUserPerferences": {
|
"IsekaiUserPointShowOnUserPerferences": {
|
||||||
"value": true
|
"value": true
|
||||||
},
|
},
|
||||||
"IsekaiUserDailySignConfig": {
|
"IsekaiUserDailySignConfig": {
|
||||||
"value": null
|
"value": null
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"manifest_version": 2
|
"manifest_version": 2
|
||||||
}
|
}
|
@ -1,43 +1,45 @@
|
|||||||
$(function() {
|
$(function() {
|
||||||
const storeKey = 'isekai-userpoints-dailysign-lastSignDate';
|
if (!mw.user.isAnon()) {
|
||||||
const lastSignDate = localStorage.getItem(storeKey);
|
const storeKey = 'isekai-userpoints-dailysign-lastSignDate';
|
||||||
const today = new Date().toLocaleDateString();
|
const lastSignDate = localStorage.getItem(storeKey);
|
||||||
if (lastSignDate !== today) {
|
const today = new Date().toLocaleDateString();
|
||||||
let mwApi = new mw.Api();
|
if (lastSignDate !== today) {
|
||||||
mwApi.postWithToken('csrf', {
|
let mwApi = new mw.Api();
|
||||||
action: 'userdailysign',
|
mwApi.postWithToken('csrf', {
|
||||||
}).done(function(data) {
|
action: 'userdailysign',
|
||||||
if (data.userdailysign && data.userdailysign.success) {
|
}).done(function(data) {
|
||||||
if (Array.isArray(data.userdailysign.point_delta)) {
|
if (data.userdailysign && data.userdailysign.success) {
|
||||||
const pointDelta = data.userdailysign.point_delta;
|
if (Array.isArray(data.userdailysign.point_delta)) {
|
||||||
let pointMsgList = [];
|
const pointDelta = data.userdailysign.point_delta;
|
||||||
pointDelta.forEach(function (pointDeltaInfo) {
|
let pointMsgList = [];
|
||||||
let msg = mw.msg('isekai-userpoints-point-name-num', pointDeltaInfo.name, pointDeltaInfo.icon, pointDeltaInfo.points);
|
pointDelta.forEach(function (pointDeltaInfo) {
|
||||||
pointMsgList.push(msg);
|
let msg = mw.msg('isekai-userpoints-point-name-num', pointDeltaInfo.name, pointDeltaInfo.icon, pointDeltaInfo.points);
|
||||||
});
|
pointMsgList.push(msg);
|
||||||
let separator = mw.msg('comma-separator');
|
});
|
||||||
let pointMsg = pointMsgList.join(separator);
|
let separator = mw.msg('comma-separator');
|
||||||
|
let pointMsg = pointMsgList.join(separator);
|
||||||
|
|
||||||
let notificationMsg = mw.msg('isekai-userpoints-dailysign-notify-success', pointMsg);
|
let notificationMsg = mw.msg('isekai-userpoints-dailysign-notify-success', pointMsg);
|
||||||
mw.notify('', {
|
mw.notify('', {
|
||||||
title: mw.msg('isekai-userpoints-dailysign-notify-title'),
|
title: mw.msg('isekai-userpoints-dailysign-notify-title'),
|
||||||
tag: 'isekai-userpoints-dailysign',
|
tag: 'isekai-userpoints-dailysign',
|
||||||
id: 'isekai-userpoints-dailysign-notify',
|
id: 'isekai-userpoints-dailysign-notify',
|
||||||
});
|
});
|
||||||
|
|
||||||
function changeNotifyContent() {
|
function changeNotifyContent() {
|
||||||
let notifyDom = document.querySelector('#isekai-userpoints-dailysign-notify');
|
let notifyDom = document.querySelector('#isekai-userpoints-dailysign-notify');
|
||||||
if (notifyDom) {
|
if (notifyDom) {
|
||||||
notifyDom.querySelector('.mw-notification-content').innerHTML = notificationMsg;
|
notifyDom.querySelector('.mw-notification-content').innerHTML = notificationMsg;
|
||||||
} else {
|
} else {
|
||||||
requestAnimationFrame(changeNotifyContent);
|
requestAnimationFrame(changeNotifyContent);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
changeNotifyContent();
|
changeNotifyContent();
|
||||||
|
}
|
||||||
|
localStorage.setItem(storeKey, today);
|
||||||
}
|
}
|
||||||
localStorage.setItem(storeKey, today);
|
});
|
||||||
}
|
}
|
||||||
});
|
|
||||||
}
|
}
|
||||||
});
|
});
|
Loading…
Reference in New Issue