|
@@ -3,6 +3,7 @@ const fetch = require('node-fetch'); // Node.js 18以下版本需要安装 node-
|
|
const config = require('../../../etc/config.json');
|
|
const config = require('../../../etc/config.json');
|
|
const redis_help = require('../../use_redis');
|
|
const redis_help = require('../../use_redis');
|
|
const helper = require('../../helper');
|
|
const helper = require('../../helper');
|
|
|
|
+const tools = require('../../../tools');
|
|
const CMD = {}
|
|
const CMD = {}
|
|
|
|
|
|
CMD.switchApp = async function(yw_id) {
|
|
CMD.switchApp = async function(yw_id) {
|
|
@@ -10,25 +11,27 @@ CMD.switchApp = async function(yw_id) {
|
|
// console.log("res:",res.headers)
|
|
// console.log("res:",res.headers)
|
|
let OPENSESSID = await redis_help.getKeyValue("OPENSESSID")
|
|
let OPENSESSID = await redis_help.getKeyValue("OPENSESSID")
|
|
let timestamp = helper.getCurrentUnixTimestamp()
|
|
let timestamp = helper.getCurrentUnixTimestamp()
|
|
- return await fetch("https://open.yuewen.com/api/account/switchApp", {
|
|
|
|
- "headers": {
|
|
|
|
- "accept": "application/json, text/plain, */*",
|
|
|
|
- "accept-language": "zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6",
|
|
|
|
- "content-type": "application/json",
|
|
|
|
- "priority": "u=1, i",
|
|
|
|
- "sec-ch-ua": "\"Microsoft Edge\";v=\"131\", \"Chromium\";v=\"131\", \"Not_A Brand\";v=\"24\"",
|
|
|
|
- "sec-ch-ua-mobile": "?0",
|
|
|
|
- "sec-ch-ua-platform": "\"Windows\"",
|
|
|
|
- "sec-fetch-dest": "empty",
|
|
|
|
- "sec-fetch-mode": "cors",
|
|
|
|
- "sec-fetch-site": "same-origin",
|
|
|
|
- "cookie": `Hm_lvt_990f9ab9737a266517417cc2949bb3f4=${timestamp}; csrfToken=ffZRRnqo6A4ngGbvAVP_zK5_; OPENSESSID=${OPENSESSID}; yw_open_token=67db7bcd069db; is_read_notice=67db7bcd069db; sidebarStatus=0`,
|
|
|
|
- "Referer": "https://open.yuewen.com/new/library",
|
|
|
|
- "Referrer-Policy": "strict-origin-when-cross-origin"
|
|
|
|
- },
|
|
|
|
- "body": `{\"coopid\":24,\"appid\":${yw_id}}`,
|
|
|
|
- "method": "POST"
|
|
|
|
- });
|
|
|
|
|
|
+ let coopid = 24
|
|
|
|
+ if(yw_id==0){
|
|
|
|
+ coopid = 0
|
|
|
|
+ }
|
|
|
|
+ // return await fetch("https://open.yuewen.com/api/account/switchApp", {
|
|
|
|
+ // "headers": {
|
|
|
|
+ // "accept": "application/json, text/plain, */*",
|
|
|
|
+ // "cookie": `Hm_lvt_990f9ab9737a266517417cc2949bb3f4=${timestamp}; csrfToken=ffZRRnqo6A4ngGbvAVP_zK5_; OPENSESSID=${OPENSESSID}; yw_open_token=67db7bcd069db; is_read_notice=67db7bcd069db; sidebarStatus=0`,
|
|
|
|
+ // },
|
|
|
|
+ // "body": `{\"coopid\":${coopid},\"appid\":${yw_id}}`,
|
|
|
|
+ // "method": "POST"
|
|
|
|
+ // });
|
|
|
|
+
|
|
|
|
+ let client = tools.getOneNewClinet( {
|
|
|
|
+ "cookie": `Hm_lvt_990f9ab9737a266517417cc2949bb3f4=${timestamp}; csrfToken=ffZRRnqo6A4ngGbvAVP_zK5_; OPENSESSID=${OPENSESSID}; yw_open_token=67db7bcd069db; is_read_notice=67db7bcd069db; sidebarStatus=0`,
|
|
|
|
+ })
|
|
|
|
+
|
|
|
|
+ return await client.post("https://open.yuewen.com/api/account/switchApp",{
|
|
|
|
+ coopid:coopid,
|
|
|
|
+ appid:yw_id
|
|
|
|
+ })
|
|
}
|
|
}
|
|
|
|
|
|
module.exports = CMD;
|
|
module.exports = CMD;
|