using environment variable

This commit is contained in:
luming 2023-08-08 17:59:07 +08:00
parent ba66528512
commit b097383e7f

View File

@ -14,28 +14,13 @@ const headers = {
'Referer': 'https://huodong3.3839.com/n/hykb/grow/daily.php',
'Accept-Encoding': 'gzip, deflate',
'Accept-Language': 'zh-CN,zh;q=0.9,en-US;q=0.8,en;q=0.7',
'Cookie': 'UM_distinctid=188f5301bb07e-0b3fe772707e02-12155723-61ed0-188f5301bb16c; Hm_lvt_f1fb60d2559a83c8fa1ee6125a352bd7=1690692437; Hm_lpvt_f1fb60d2559a83c8fa1ee6125a352bd7=1691470971'
'Cookie': process.env.HYKB_COOKIE
};
const api = 'https://huodong3.3839.com/n/hykb/grow/ajax.php';
const daily_list_api = 'https://huodong3.3839.com/n/hykb/grow/daily.php';
const share_callback_action = 'DailyShareCallb';
const share_daily_action = 'DailyShare';
// bbs.forEach((id,index) => {
// console.log("sign to bbsId => " + id);
// let data = qs.stringify({
// 'gameId': id
// });
// config['data'] = data;
// axios.request(config)
// .then((response) => {
// console.log(JSON.stringify(response.data));
// })
// .catch((error) => {
// console.log(error);
// });
// });
/**
* random
@ -57,8 +42,8 @@ function getApiData(action, id) {
'id': id,
'mode': 'weixin',
'r': generateRandom(),
'scookie': '5|0|38524686|cmFpbmVyb3Npb24=|kb2318B047E13AB3BAC4C9E36B388B6260|7vcwpJVjplVWoJIUpl6xITZO7j9c7lIn7v7OGv6Aov6=%1|2f18a0f2283ce7f6804281632ccdef22',
'device': 'kb2318B047E13AB3BAC4C9E36B388B6260'
'scookie': process.env.HYKB_SCOOKIE,
'device': process.env.HYKB_DEVICE
});
let config = {
method: 'post',
@ -72,14 +57,14 @@ function getApiData(action, id) {
.then((response) => {
// console.log(JSON.stringify(response.data));
let json_data = JSON.stringify(response.data);
if (action === share_callback_action && json_data && json_data['key'] === "501") {
if (action === share_callback_action && json_data && response.data['key'] === "501") {
config['data']['ac'] = share_daily_action;
axios.request(config)
.then((res) => {
let daily_json = JSON.stringify(res.data);
if (daily_json && daily_json['key'] === "503") {
let csd = daily_json['reward_csd_num'];
let today_csd = daily_json['day_rw_csd'];
if (daily_json && res.data['key'] === "503") {
let csd = res.data['reward_csd_num'];
let today_csd = res.data['day_rw_csd'];
console.log("分享获得成熟度 " + csd + " 今日总共获取成熟度 " + today_csd);
} else {
console.log(JSON.stringify(data));
@ -97,7 +82,7 @@ function getApiData(action, id) {
.catch((error) => {
console.log(error);
});
return json_data;
return null;
}
function sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms));