mirror of
https://github.com/ctrlcvs/xiaoyao-cvs-plugin.git
synced 2024-12-23 11:40:51 +08:00
修正版本不兼容问题
This commit is contained in:
parent
e504813321
commit
f1c0f4e210
@ -18,7 +18,7 @@ export const rule = {
|
|||||||
describe: "米游社米游币签到(理论上会签到全部所以区分开了)"
|
describe: "米游社米游币签到(理论上会签到全部所以区分开了)"
|
||||||
},
|
},
|
||||||
sign: {
|
sign: {
|
||||||
reg: "^#*(原神|崩坏3|崩坏2|未定事件簿|大别野|崩坏星穹铁道|绝区零)签到$",
|
reg: "^#*(崩坏3|崩坏2|未定事件簿|大别野|崩坏星穹铁道|绝区零)签到$",
|
||||||
describe: "米社规则签到"
|
describe: "米社规则签到"
|
||||||
},
|
},
|
||||||
cookiesDocHelp: {
|
cookiesDocHelp: {
|
||||||
@ -188,9 +188,6 @@ async function cookie(e) {
|
|||||||
let cookie, uid;
|
let cookie, uid;
|
||||||
let miHoYoApi = new MihoYoApi(e);
|
let miHoYoApi = new MihoYoApi(e);
|
||||||
let skuid;
|
let skuid;
|
||||||
if(Object.keys((await miHoYoApi.getStoken(e.user_id))).length != 0){
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
let cookiesDoc=await getcookiesDoc();
|
let cookiesDoc=await getcookiesDoc();
|
||||||
if (isV3) {
|
if (isV3) {
|
||||||
skuid= await gsCfg.getBingCookie(e.user_id);
|
skuid= await gsCfg.getBingCookie(e.user_id);
|
||||||
@ -210,6 +207,10 @@ async function cookie(e) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
e.uid = uid;
|
e.uid = uid;
|
||||||
|
e.cookie=cookie;
|
||||||
|
if(Object.keys((await miHoYoApi.getStoken(e.user_id))).length != 0){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
if (!cookie.includes("login_ticket")&&(isV3&&!skuid?.login_ticket)) {
|
if (!cookie.includes("login_ticket")&&(isV3&&!skuid?.login_ticket)) {
|
||||||
e.reply("米游社登录cookie不完整,请前往米游社通行证处重新获取cookie~\ncookies必须包含login_ticket【教程】 "+cookiesDoc)
|
e.reply("米游社登录cookie不完整,请前往米游社通行证处重新获取cookie~\ncookies必须包含login_ticket【教程】 "+cookiesDoc)
|
||||||
return false;
|
return false;
|
||||||
|
@ -82,15 +82,16 @@ export default class MihoYoApi {
|
|||||||
constructor(e) {
|
constructor(e) {
|
||||||
if (e) {
|
if (e) {
|
||||||
this.e = e
|
this.e = e
|
||||||
|
this.cookie=e.cookie
|
||||||
this.userId = String(e.user_id)
|
this.userId = String(e.user_id)
|
||||||
this.msgName = e.msg.replace(/#|签到|井|米游社|mys|社区/g, "")
|
this.msgName = e.msg.replace(/#|签到|井|米游社|mys|社区/g, "")
|
||||||
}
|
}
|
||||||
Data.createDir("", YamlDataUrl, false);
|
Data.createDir("", YamlDataUrl, false);
|
||||||
//初始化配置文件
|
// //初始化配置文件
|
||||||
let data = this.getStoken(this.e.user_id);
|
let data = this.getStoken(this.e.user_id);
|
||||||
let dataCk = gsCfg.getfileYaml(`${_path}/data/MysCookie/`, e.user_id);
|
if(data){
|
||||||
this.cookies = `stuid=${data.stuid};stoken=${data.stoken};ltoken=${data.ltoken};`;
|
this.cookies = `stuid=${data.stuid};stoken=${data.stoken};ltoken=${data.ltoken};`;
|
||||||
this.cookie = `account_id=${data.account_id};cookie_token=${data.cookie_token};`;
|
}
|
||||||
}
|
}
|
||||||
getbody() {
|
getbody() {
|
||||||
for (let item in boards) {
|
for (let item in boards) {
|
||||||
@ -103,12 +104,11 @@ export default class MihoYoApi {
|
|||||||
let kkbody = this.getbody();
|
let kkbody = this.getbody();
|
||||||
try {
|
try {
|
||||||
// 获取账号信息
|
// 获取账号信息
|
||||||
const {
|
const objData= await this.getUserInfo(kkbody)
|
||||||
game_uid,
|
if(objData.retcode!=200) {
|
||||||
region,
|
return objData
|
||||||
nickname
|
}
|
||||||
} = await this.getUserInfo(kkbody)
|
if (!objData.nickname) {
|
||||||
if (!nickname) {
|
|
||||||
return {
|
return {
|
||||||
message: `未绑定${this.msgName}信息`
|
message: `未绑定${this.msgName}信息`
|
||||||
}
|
}
|
||||||
@ -124,7 +124,7 @@ export default class MihoYoApi {
|
|||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
// 签到操作
|
// 签到操作
|
||||||
return await this.postSign(kkbody, game_uid, region)
|
return await this.postSign(kkbody, objData.game_uid, objData.region)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
logger.mark(`error.message`, error.message)
|
logger.mark(`error.message`, error.message)
|
||||||
}
|
}
|
||||||
@ -174,9 +174,7 @@ export default class MihoYoApi {
|
|||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
async getHonkai2SignInfo(game_uid, region, nickname, board) {
|
|
||||||
|
|
||||||
}
|
|
||||||
async forumPostList(forumId) {
|
async forumPostList(forumId) {
|
||||||
const url =
|
const url =
|
||||||
`https://api-takumi.mihoyo.com/post/api/getForumPostList?forum_id=${forumId}&is_good=false&is_hot=false&page_size=10&sort_type=1`;
|
`https://api-takumi.mihoyo.com/post/api/getForumPostList?forum_id=${forumId}&is_good=false&is_hot=false&page_size=10&sort_type=1`;
|
||||||
@ -334,19 +332,28 @@ export default class MihoYoApi {
|
|||||||
.getpubHeaders(board)).timeout(10000);
|
.getpubHeaders(board)).timeout(10000);
|
||||||
let resObj = JSON.parse(res.text);
|
let resObj = JSON.parse(res.text);
|
||||||
let data = resObj.data
|
let data = resObj.data
|
||||||
|
if(resObj.retcode!=0){
|
||||||
|
return resObj
|
||||||
|
}
|
||||||
const game_uid = data?.list?. [0]?.game_uid
|
const game_uid = data?.list?. [0]?.game_uid
|
||||||
const region = data?.list?. [0]?.region
|
const region = data?.list?. [0]?.region
|
||||||
const nickname = data?.list?. [0]?.nickname
|
const nickname = data?.list?. [0]?.nickname
|
||||||
return {
|
return {
|
||||||
game_uid,
|
game_uid,
|
||||||
region,
|
region,
|
||||||
nickname
|
nickname,retcode:200
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 游戏签到操作 逻辑通用, 根据传入的 board 构建不同的参数
|
// 游戏签到操作
|
||||||
async postSign(board, game_uid, region) {
|
async postSign(board, game_uid, region) {
|
||||||
let url =
|
let url =
|
||||||
`https://api-takumi.mihoyo.com/common/eutheniav2/sign?region=${region}&act_id=${board.actid}&uid=${game_uid}`
|
`https://api-takumi.mihoyo.com/common/eutheniav2/sign`
|
||||||
|
if(board.name=="原神"){
|
||||||
|
url=`https://api-takumi.mihoyo.com/event/bbs_sign_reward/sign`
|
||||||
|
}
|
||||||
|
url+=`?region=${region}&act_id=${board.actid}&uid=${game_uid}`
|
||||||
|
// console.log(url)
|
||||||
|
// console.log(this.e)
|
||||||
let res = await superagent.post(url).set(this.getpubHeaders(board)).timeout(10000);
|
let res = await superagent.post(url).set(this.getpubHeaders(board)).timeout(10000);
|
||||||
let resObj = JSON.parse(res.text);
|
let resObj = JSON.parse(res.text);
|
||||||
return resObj
|
return resObj
|
||||||
|
Loading…
Reference in New Issue
Block a user