diff --git a/apps/admin.js b/apps/admin.js index 47f2b40a..c1fa1c67 100644 --- a/apps/admin.js +++ b/apps/admin.js @@ -1,9 +1,8 @@ export async function userStat(e) { + if (await e.checkAuth({ + auth: "master" + })) return true; - if (!e.isMaster) { - // e.reply("暂无权限"); - return; - } let ret = /\d+/.exec(e.msg) if (ret && ret[0]) { @@ -30,10 +29,10 @@ export async function userStat(e) { } export async function rebuildCookie(e) { - let MysApi = await e.initMysApi({ + if (await e.checkAuth({ auth: "master" - }); - if (!MysApi) return true; + })) return true; + let count = 0; for (let qq in NoteCookie) { @@ -49,10 +48,9 @@ export async function rebuildCookie(e) { } export async function userStatus(e, { Models }) { - let MysApi = await e.initMysApi({ + if (await e.checkAuth({ auth: "master" - }); - if (!MysApi) return true; + })) return true; let { MysUser } = Models; let userList = await MysUser.getAll(); @@ -68,10 +66,10 @@ export async function userStatus(e, { Models }) { } export async function userCacheRebuild(e, { Models }) { - let MysApi = await e.initMysApi({ + if (await e.checkAuth({ auth: "master" - }); - if (!MysApi) return true; + })) return true; + let { MysUser } = Models; await MysUser._delCache(); @@ -80,10 +78,9 @@ export async function userCacheRebuild(e, { Models }) { } export async function mysUserCk(e, { Models }) { - let MysApi = await e.initMysApi({ + if (await e.checkAuth({ auth: "master" - }); - if (!MysApi) return true; + })) return true; let uid = e.msg.replace("#ck", ""); @@ -91,9 +88,9 @@ export async function mysUserCk(e, { Models }) { let user = await MysUser.get(uid); let ret = []; - console.log(user); + let cookie = await user.getCookie(); - console.log(cookie) + e.reply("完成"); return true; } \ No newline at end of file diff --git a/apps/character.js b/apps/character.js index 9b7f0d8e..704cdbb6 100644 --- a/apps/character.js +++ b/apps/character.js @@ -45,7 +45,7 @@ export async function character(e, { render, User }) { let roleId = char.id, uid = e.targetUser.uid; - let charData = await MysApi.getData('character'); + let charData = await MysApi.getCharacter(); if (!charData) return true; @@ -81,7 +81,6 @@ export async function character(e, { render, User }) { return true; //事件结束不再往下 } - //#老婆 export async function wife(e, { render, User }) { let msg = e.msg; @@ -112,7 +111,7 @@ export async function wife(e, { render, User }) { return true; } - let data = await MysApi.getData("character"); + let data = await MysApi.getCharacter(); if (!data) return true; let avatars = data.avatars; @@ -179,9 +178,7 @@ async function getTalent(e, avatars, MysApi) { let skill = {}; - let skillres = await MysApi.getData("detail", { - avatar_id: avatars.id, - }); + let skillres = await MysApi.getAvatar(avatars.id); if (skillres.retcode == 0 && skillres.data && skillres.data.skill_list) { skill.id = avatars.id; @@ -220,7 +217,6 @@ async function getTalent(e, avatars, MysApi) { return skill; } - // 获取角色数据 function getCharacterData(avatars) { let list = []; @@ -296,67 +292,6 @@ function getCharacterData(avatars) { }; } - -export function roleIdToName(keyword, search_val = false) { - if (!keyword) { - return false; - } - if (search_val) { - return genshin.roleId[keyword][0] ? genshin.roleId[keyword][0] : ""; - } - - if (!nameID) { - nameID = new Map(); - for (let i in genshin.roleId) { - for (let val of genshin.roleId[i]) { - nameID.set(val, i); - } - } - } - let name = nameID.get(keyword); - return name ? name : ""; -} - -async function limitGet(e) { - if (!e.isGroup) { - return true; - } - - if (e.isMaster) { - return true; - } - - let key = `genshin:limit:${e.user_id}`; - let num = await redis.get(key); - - if (num && num >= e.groupConfig.mysDayLimit - 1) { - let name = lodash.truncate(e.sender.card, { length: 8 }); - e.reply([segment.at(e.user_id, name), "\n今日查询已达上限"]); - return false; - } - - return true; -} - -async function limitSet(e) { - if (!e.isGroup) { - return true; - } - - let key = `genshin:limit:${e.user_id}`; - let dayEnd = getDayEnd(); - - await redis.incr(key); - redis.expire(key, dayEnd); -} - -function getDayEnd() { - let now = new Date(); - let dayEnd = new Date(now.getFullYear(), now.getMonth(), now.getDate(), "23", "59", "59").getTime() / 1000; - - return dayEnd - parseInt(now.getTime() / 1000); -} - function getCharacterImg(name) { if (!fs.existsSync(`./plugins/miao-plugin/resources/characterImg/${name}/`)) { diff --git a/resources/characterImg/芭芭拉/04.jpg b/resources/characterImg/芭芭拉/04.jpg index 304edd44..83757c53 100644 Binary files a/resources/characterImg/芭芭拉/04.jpg and b/resources/characterImg/芭芭拉/04.jpg differ diff --git a/resources/characterImg/芭芭拉/12.png b/resources/characterImg/芭芭拉/12.png deleted file mode 100644 index 05790da8..00000000 Binary files a/resources/characterImg/芭芭拉/12.png and /dev/null differ diff --git a/resources/characterImg/芭芭拉/19.jpg b/resources/characterImg/芭芭拉/19.jpg deleted file mode 100644 index fb2679dc..00000000 Binary files a/resources/characterImg/芭芭拉/19.jpg and /dev/null differ diff --git a/resources/characterImg/芭芭拉/20.jpg b/resources/characterImg/芭芭拉/20.jpg deleted file mode 100644 index 83757c53..00000000 Binary files a/resources/characterImg/芭芭拉/20.jpg and /dev/null differ