|
@@ -2,11 +2,14 @@ const axios = require('axios');
|
|
|
const qs = require('querystring');
|
|
|
const dns = require('dns').promises;
|
|
|
const net = require('net');
|
|
|
+const tools = require('../../../tools');
|
|
|
+
|
|
|
+
|
|
|
|
|
|
|
|
|
class AdminSession {
|
|
|
constructor(options = {}) {
|
|
|
- this.baseURL = 'https://admin.wqxsw.com';
|
|
|
+ this.baseURL = 'https://vip.wqxsw.com';
|
|
|
this.dnsServers = options.dnsServers || ['8.8.8.8', '8.8.4.4', '223.5.5.5', '223.6.6.6'];
|
|
|
this.maxRetries = options.maxRetries || 3;
|
|
|
this.currentRetry = 0;
|
|
@@ -68,7 +71,7 @@ class AdminSession {
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
- async login(username = 'zydx16', password = 'Xuan6963') {
|
|
|
+ async login(username = 'zydx3vip', password = 'Xuan6963') {
|
|
|
try {
|
|
|
// 先进行DNS检查
|
|
|
let targetHost = this.baseURL;
|
|
@@ -89,7 +92,7 @@ class AdminSession {
|
|
|
|
|
|
// 添加重要的请求头
|
|
|
const headers = {
|
|
|
- 'Host': 'admin.wqxsw.com',
|
|
|
+ 'Host': 'vip.wqxsw.com',
|
|
|
'Referer': `${this.baseURL}/admin/index/login?url=%2Fadmin%2Fnotice%2Findex%3Fref%3Daddtabs`,
|
|
|
'Cookie': 'PHPSESSID=vi938g4mfaqjeelunmjmfa68tn'
|
|
|
};
|
|
@@ -110,8 +113,7 @@ class AdminSession {
|
|
|
}
|
|
|
}
|
|
|
);
|
|
|
-
|
|
|
- return response.data;
|
|
|
+ return [response.data,response.config.headers.Cookie];
|
|
|
} catch (error) {
|
|
|
if (this.currentRetry < this.maxRetries) {
|
|
|
this.currentRetry++;
|
|
@@ -148,7 +150,11 @@ async function main() {
|
|
|
try {
|
|
|
console.log('开始登录...');
|
|
|
const result = await session.login();
|
|
|
+ if(result[0].code==1){
|
|
|
+ await tools.setDzCookie(result[1])
|
|
|
+ }
|
|
|
console.log('登录结果:', result);
|
|
|
+
|
|
|
} catch (error) {
|
|
|
console.error('登录失败:', error.message);
|
|
|
|