Commit c7b520f9 by 马玮

Update .gitignore

parent a9233a5a
!/tmp/workflow
/tmp/captcha/*
/tmp/workflow/*
/logs/dealer/*
\ No newline at end of file
......@@ -48,44 +48,48 @@ class Autohome extends Base {
async tryLogin() {
// 随机返回登录状态
// return [new errors.TryLoginError('登录失效'), randomInt(0, 1)];
let newCookies;
let oldCookies;
let loginStatus = false;
try {
oldCookies = await DealerHelper.getCookies(this.params);
} catch (e) {
logger.debug(`accountID: ${this.params.accountID}, 没有cookies: ${e}`);
}
let newCookies;
let oldCookies;
let loginStatus = false;
if (oldCookies) {
const horseman = new Horseman({
ignoreSSLErrors: true
});
loginStatus =
await
horseman
.userAgent('Mozilla/5.0 (Windows NT 6.1; WOW64; rv:27.0) Gecko/20100101 Firefox/27.0')
.viewport(1920, 1080)
.cookies(oldCookies)
.open('http://ics.Autohome.com.cn/passport/Home/Index')
.screenshot('tmp/workflow/autohome/tryLogin.png')
.exists('#loginout');
newCookies = await horseman.cookies();
await horseman.close();
}
try {
oldCookies = await DealerHelper.getCookies(this.params);
} catch (e) {
logger.debug(`accountID: ${this.params.accountID}, 没有cookies: ${e}`);
}
if (loginStatus) {
const params = this.params;
params.cookies = newCookies;
if (oldCookies) {
const horseman = new Horseman({
ignoreSSLErrors: true
});
logger.debug(`accountID: ${this.params.accountID}, cookies: ${JSON.stringify(newCookies)}`);
loginStatus =
await
horseman
.userAgent('Mozilla/5.0 (Windows NT 6.1; WOW64; rv:27.0) Gecko/20100101 Firefox/27.0')
.viewport(1920, 1080)
.cookies(oldCookies)
.open('http://ics.Autohome.com.cn/passport/Home/Index')
.screenshot('tmp/workflow/autohome/tryLogin.png')
.exists('#loginout');
newCookies = await horseman.cookies();
await horseman.close();
}
if (loginStatus) {
const params = this.params;
params.cookies = newCookies;
logger.debug(`accountID: ${this.params.accountID}, cookies: ${JSON.stringify(newCookies)}`);
await DealerHelper.saveCookies(params);
return 1;
} else {
throw new errors.TryLoginError('登录失效');
}
} catch (e) {
await DealerHelper.saveCookies(params);
return 1;
} else {
throw new errors.TryLoginError('登录失效');
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment