需要自行去青龙面板添加环境变量P5X,如果不需要推送自行修改,环境变量内容是完美账号Cookie

自行修改代码中的itemid和uid,itemid需要抓包获取

const notify = require('./sendNotify.js');
let axios = require('axios');
let title = "P5X积分商店库存监控\n";
let content = "P5X积分商店库存监控完毕\n";

let cookie = process.env.P5X;

axios({
    url: 'https://pwgcapi.wanmei.com/m/p5x/shop/item/list?pageNum=1&pageSize=20',
    method: 'get',
    headers: {
        Cookie: cookie
    }
})
.then(response => {
    // 获取商品列表成功,继续执行
    if (response.data.code==0){
        let itemList=response.data.result.data;
        for (let item of itemList) {
            //console.log(JSON.stringify(item));
            if(item.remainCount>0){
                //console.log(item.name)
                content=content+item.name+"  余量:"+item.remainCount+"\n";
                // 如果当前为水杯
                if(item.productId==5713){
                    // 发起购买,自行修改UID
                        axios({
                        url: `https://pwgcapi.wanmei.com/m/p5x/shop/buy/entity?uid=XXXX&count=1&itemId=5713`,
                        method: 'get',
                        headers: {
                            Cookie: cookie1
                        }
                    })
                    .then(buyResponse => {
                        // 处理购买成功的逻辑
                        console.log("购买成功:" + buyResponse.data);
                        notify.sendNotify(title + "水杯购买成功", '');
                    })
                    .catch(buyError => {
                        console.error("购买失败:" + buyError);
                        notify.sendNotify(title + "水杯有库存但购买失败,请手动购买并检查代码", '');
                    });
                }
            }
        }
        notify.sendNotify(title + content, '');
    }
})
.catch(error => {
    console.error(error);
    notify.sendNotify(title + "接口调用失败,请检查", '');
});

//notify.sendNotify(title + JSON.stringify(response.data), '');

给我去玩异度之刃3