Commit a47040a3 authored by 郝聪敏's avatar 郝聪敏

添加接口延时;正在投递状态延时重试;操作完成弹窗bug

parent fc21f3af
...@@ -425,6 +425,7 @@ class HomeController extends Controller { ...@@ -425,6 +425,7 @@ class HomeController extends Controller {
this.ctx.logger.info(result); this.ctx.logger.info(result);
await service.home.updateStatus(result); await service.home.updateStatus(result);
if (lock) lock.unlock(); if (lock) lock.unlock();
ctx.logger.info('解锁成功');
} catch (e) { } catch (e) {
ctx.logger.error((e && e.message) || '出现未知错误'); ctx.logger.error((e && e.message) || '出现未知错误');
if (!lock) { if (!lock) {
...@@ -432,6 +433,7 @@ class HomeController extends Controller { ...@@ -432,6 +433,7 @@ class HomeController extends Controller {
return; return;
} }
lock.unlock(); lock.unlock();
ctx.logger.info('解锁成功');
} }
} }
......
[{"name":"tinfo","value":"1588757204.0000","domain":".exmail.qq.com","path":"/","expires":-1,"size":20,"httpOnly":false,"secure":false,"session":true},{"name":"pcache","value":"a3a1f8d65f4614dMTU5MTM0OTIwNA@763349601@7","domain":".exmail.qq.com","path":"/","expires":1589189204.193691,"size":47,"httpOnly":false,"secure":false,"session":false},{"name":"sid","value":"763349601&7d4cbf8ba7f343b1776e2e8abea94f0b,cPNmPQ2BR_CY.","domain":".exmail.qq.com","path":"/","expires":-1,"size":59,"httpOnly":true,"secure":false,"session":true},{"name":"qm_ssum","value":"763349601&990a6f905765aee00388594e5679dc90","domain":".exmail.qq.com","path":"/","expires":-1,"size":49,"httpOnly":false,"secure":false,"session":true},{"name":"qqmail_alias","value":"tiange.zeng@lkbang.com","domain":".exmail.qq.com","path":"/","expires":-1,"size":34,"httpOnly":false,"secure":false,"session":true},{"name":"qm_sid","value":"7d4cbf8ba7f343b1776e2e8abea94f0b,cPNmPQ2BR_CY.","domain":".exmail.qq.com","path":"/","expires":-1,"size":52,"httpOnly":true,"secure":false,"session":true},{"name":"_gat","value":"1","domain":".exmail.qq.com","path":"/","expires":1588757263,"size":5,"httpOnly":false,"secure":false,"session":false},{"name":"logout_page","value":"dm_loginpage","domain":".qq.com","path":"/","expires":1588843604,"size":23,"httpOnly":false,"secure":false,"session":false},{"name":"_gid","value":"GA1.3.1779487220.1588757204","domain":".exmail.qq.com","path":"/","expires":1588843603,"size":31,"httpOnly":false,"secure":false,"session":false},{"name":"qylevel","value":"2","domain":".exmail.qq.com","path":"/","expires":-1,"size":8,"httpOnly":false,"secure":false,"session":true},{"name":"dm_login_weixin_rem","value":"","domain":".qq.com","path":"/","expires":1588843604,"size":19,"httpOnly":false,"secure":false,"session":false},{"name":"qm_verifyimagesession","value":"h0105e45bb704bff20a3ec64e241b20afac0c9777b65a987cb0bb4b98bd8160ed878d4c443d7c4256bc","domain":".qq.com","path":"/","expires":-1,"size":104,"httpOnly":false,"secure":false,"session":true},{"name":"biz_username","value":"763349601","domain":".exmail.qq.com","path":"/","expires":-1,"size":21,"httpOnly":false,"secure":false,"session":true},{"name":"CCSHOW","value":"0000","domain":".exmail.qq.com","path":"/","expires":1604309204.193596,"size":10,"httpOnly":false,"secure":false,"session":false},{"name":"Hm_lpvt_bdfb0d7298c0c5a5a2475c291ac7aca2","value":"1588757204","domain":".exmail.qq.com","path":"/","expires":-1,"size":50,"httpOnly":false,"secure":false,"session":true},{"name":"qm_username","value":"763349601","domain":".exmail.qq.com","path":"/","expires":-1,"size":20,"httpOnly":false,"secure":false,"session":true},{"name":"qm_sk","value":"763349601&yKamb4b5","domain":".exmail.qq.com","path":"/","expires":-1,"size":23,"httpOnly":false,"secure":false,"session":true},{"name":"Hm_lvt_bdfb0d7298c0c5a5a2475c291ac7aca2","value":"1588043915","domain":".exmail.qq.com","path":"/","expires":1620293203,"size":49,"httpOnly":false,"secure":false,"session":false},{"name":"","value":"0.4473179612768925","domain":"exmail.qq.com","path":"/","expires":-1,"size":18,"httpOnly":false,"secure":false,"session":true},{"name":"ssl_edition","value":"sail.qq.com","domain":".exmail.qq.com","path":"/","expires":-1,"size":22,"httpOnly":false,"secure":false,"session":true},{"name":"qm_flag","value":"3","domain":".exmail.qq.com","path":"/","expires":-1,"size":8,"httpOnly":false,"secure":false,"session":true},{"name":"username","value":"763349601&763349601","domain":".exmail.qq.com","path":"/","expires":-1,"size":27,"httpOnly":false,"secure":false,"session":true},{"name":"_ga","value":"GA1.3.189918274.1588043915","domain":".exmail.qq.com","path":"/","expires":1651829203,"size":29,"httpOnly":false,"secure":false,"session":false},{"name":"qm_authimgs_id","value":"0","domain":".qq.com","path":"/","expires":-1,"size":15,"httpOnly":false,"secure":false,"session":true}] [{"name":"timezone_offset","value":"-480","domain":".exmail.qq.com","path":"/","expires":-1,"size":19,"httpOnly":false,"secure":false,"session":true},{"name":"tinfo","value":"1591165734.0000","domain":".exmail.qq.com","path":"/","expires":-1,"size":20,"httpOnly":false,"secure":false,"session":true},{"name":"pcache","value":"10dcff48f3cdec9MTU5Mzc1NzczNA@763349601@7","domain":".exmail.qq.com","path":"/","expires":1591597734.394307,"size":47,"httpOnly":false,"secure":false,"session":false},{"name":"sid","value":"763349601&60ee52a1ec33522f6a624d7dde2a9c24,cPNmPQyOSqH4.","domain":".exmail.qq.com","path":"/","expires":-1,"size":59,"httpOnly":true,"secure":false,"session":true},{"name":"","value":"0.37248957559032125","domain":"exmail.qq.com","path":"/","expires":-1,"size":19,"httpOnly":false,"secure":false,"session":true},{"name":"qylevel","value":"2","domain":".exmail.qq.com","path":"/","expires":-1,"size":8,"httpOnly":false,"secure":false,"session":true},{"name":"dm_login_weixin_rem","value":"","domain":".qq.com","path":"/","expires":1591252133,"size":19,"httpOnly":false,"secure":false,"session":false},{"name":"_gid","value":"GA1.3.1788287499.1591165733","domain":".exmail.qq.com","path":"/","expires":1591252133,"size":31,"httpOnly":false,"secure":false,"session":false},{"name":"logout_page","value":"dm_loginpage","domain":".qq.com","path":"/","expires":1591252133,"size":23,"httpOnly":false,"secure":false,"session":false},{"name":"qm_authimgs_id","value":"0","domain":".qq.com","path":"/","expires":-1,"size":15,"httpOnly":false,"secure":false,"session":true},{"name":"Hm_lpvt_bdfb0d7298c0c5a5a2475c291ac7aca2","value":"1591165733","domain":".exmail.qq.com","path":"/","expires":-1,"size":50,"httpOnly":false,"secure":false,"session":true},{"name":"qm_username","value":"763349601","domain":".exmail.qq.com","path":"/","expires":-1,"size":20,"httpOnly":false,"secure":false,"session":true},{"name":"username","value":"763349601&763349601","domain":".exmail.qq.com","path":"/","expires":-1,"size":27,"httpOnly":false,"secure":false,"session":true},{"name":"_ga","value":"GA1.3.189918274.1588043915","domain":".exmail.qq.com","path":"/","expires":1654237733,"size":29,"httpOnly":false,"secure":false,"session":false},{"name":"ssl_edition","value":"sail.qq.com","domain":".exmail.qq.com","path":"/","expires":-1,"size":22,"httpOnly":false,"secure":false,"session":true},{"name":"qm_flag","value":"3","domain":".exmail.qq.com","path":"/","expires":-1,"size":8,"httpOnly":false,"secure":false,"session":true},{"name":"Hm_lvt_bdfb0d7298c0c5a5a2475c291ac7aca2","value":"1591165733","domain":".exmail.qq.com","path":"/","expires":1622701733,"size":49,"httpOnly":false,"secure":false,"session":false},{"name":"qm_sk","value":"763349601&yKamb4b5","domain":".exmail.qq.com","path":"/","expires":-1,"size":23,"httpOnly":false,"secure":false,"session":true},{"name":"qm_sid","value":"60ee52a1ec33522f6a624d7dde2a9c24,cPNmPQyOSqH4.","domain":".exmail.qq.com","path":"/","expires":-1,"size":52,"httpOnly":true,"secure":false,"session":true},{"name":"qqmail_alias","value":"tiange.zeng@lkbang.com","domain":".exmail.qq.com","path":"/","expires":-1,"size":34,"httpOnly":false,"secure":false,"session":true},{"name":"qm_ssum","value":"763349601&c56545ad12b06cffaec9393df41ee15f","domain":".exmail.qq.com","path":"/","expires":-1,"size":49,"httpOnly":false,"secure":false,"session":true},{"name":"_gat","value":"1","domain":".exmail.qq.com","path":"/","expires":1591165792,"size":5,"httpOnly":false,"secure":false,"session":false},{"name":"qm_verifyimagesession","value":"h015ba60771a1cc312c3e9a009a389d9fdb41abde02ea86dbb88bc1f0d72dbb78cab1da95b1f93db4fb","domain":".qq.com","path":"/","expires":-1,"size":104,"httpOnly":false,"secure":false,"session":true},{"name":"biz_username","value":"763349601","domain":".exmail.qq.com","path":"/","expires":-1,"size":21,"httpOnly":false,"secure":false,"session":true},{"name":"CCSHOW","value":"0000","domain":".exmail.qq.com","path":"/","expires":1606717734.394209,"size":10,"httpOnly":false,"secure":false,"session":false}]
\ No newline at end of file \ No newline at end of file
...@@ -420,10 +420,11 @@ class HomeService extends Service { ...@@ -420,10 +420,11 @@ class HomeService extends Service {
async getMails() { async getMails() {
const { ctx } = this; const { ctx } = this;
const limit = 50; const limit = 50;
console.log(`${ctx.app.config.legal.host}/api/email/get/${limit}`); ctx.logger.info(`${ctx.app.config.legal.host}/api/email/get/${limit}`);
const { data: result } = await ctx.curl(`${ctx.app.config.legal.host}/api/email/get/${limit}`, { const { data: result } = await ctx.curl(`${ctx.app.config.legal.host}/api/email/get/${limit}`, {
dataType: 'json', dataType: 'json',
method: 'POST', method: 'POST',
timeout: [ 30000, 30000 ],
}); });
return validate(result); return validate(result);
...@@ -431,12 +432,13 @@ class HomeService extends Service { ...@@ -431,12 +432,13 @@ class HomeService extends Service {
async updateStatus(mails) { async updateStatus(mails) {
const { ctx } = this; const { ctx } = this;
console.log(`${ctx.app.config.legal.host}/api/email/callback`); ctx.logger.info(`${ctx.app.config.legal.host}/api/email/callback`);
const { data: result } = await ctx.curl(`${ctx.app.config.legal.host}/api/email/callback`, { const { data: result } = await ctx.curl(`${ctx.app.config.legal.host}/api/email/callback`, {
contentType: 'json', contentType: 'json',
dataType: 'json', dataType: 'json',
method: 'POST', method: 'POST',
data: mails, data: mails,
timeout: [ 30000, 30000 ],
}); });
return validate(result); return validate(result);
...@@ -521,7 +523,7 @@ class HomeService extends Service { ...@@ -521,7 +523,7 @@ class HomeService extends Service {
ctx.logger.info('tecent mail: 已登录'); ctx.logger.info('tecent mail: 已登录');
for (let i = 0; i < mails.length; i++) { for (let i = 0; i < mails.length; i++) {
const email = mails[i].email; const email = mails[i].email;
ctx.logger.info(`tecent mail: 准备发送第${i + 1}封邮件 mail: ${email}`); ctx.logger.info(`tecent mail: 准备发送第${i + 1}封邮件 mail: ${email}, id: ${mails[i].id}`);
await page.click('#composebtn'); await page.click('#composebtn');
const mainFrame = await page.frames().find(f => f.name() === 'mainFrame'); const mainFrame = await page.frames().find(f => f.name() === 'mainFrame');
await mainFrame.waitFor(3000); await mainFrame.waitFor(3000);
...@@ -547,25 +549,26 @@ class HomeService extends Service { ...@@ -547,25 +549,26 @@ class HomeService extends Service {
let sendStatus = await mailSendStatusFrame.$eval('#statusbtn', el => el.innerHTML); let sendStatus = await mailSendStatusFrame.$eval('#statusbtn', el => el.innerHTML);
const receiver = await mailSendStatusFrame.$eval('.oneline', el => el.innerHTML); const receiver = await mailSendStatusFrame.$eval('.oneline', el => el.innerHTML);
if (sendStatus === '正在投递') { if (sendStatus === '正在投递') {
await mailSendStatusFrame.waitFor(10000); await mailSendStatusFrame.waitFor(30000);
const clickStatus = await mailSendStatusFrame.$eval('#clickstu', el => el.innerHTML); const clickStatus = await mailSendStatusFrame.$eval('#clickstu', el => el.innerHTML);
if (clickStatus === '[查看详情]') await mailSendStatusFrame.click('#clickstu'); if (clickStatus === '[查看详情]') await mailSendStatusFrame.click('#clickstu');
await mailSendStatusFrame.click('#refreshbutton'); await mailSendStatusFrame.click('#refreshbutton');
await mailSendStatusFrame.waitFor(2000); await mailSendStatusFrame.waitFor(5000);
sendStatus = await mailSendStatusFrame.$eval('#statusbtn', el => el.innerHTML); sendStatus = await mailSendStatusFrame.$eval('#statusbtn', el => el.innerHTML);
} }
if (!receiver.includes(email)) { await mailSendStatusFrame.click('#statusbtn');
ctx.logger.error('收件箱不一致, 投递失败');
continue;
}
if (sendStatus !== '投递成功') { if (sendStatus !== '投递成功') {
ctx.logger.error(sendStatus || '投递失败'); ctx.logger.error(sendStatus || '投递失败');
continue; continue;
} }
await page.mouse.move(0, 0); if (!receiver.includes(email)) {
ctx.logger.error('收件箱不一致, 投递失败');
continue;
}
const mainFrameContainer = await page.$('#mainFrameContainer'); const mainFrameContainer = await page.$('#mainFrameContainer');
const imageName = `${email}_${Date.now()}.png`; const imageName = `${email}_${Date.now()}.png`;
await mainFrameContainer.screenshot({ path: `./app/public/images/${imageName}` }); await mainFrameContainer.screenshot({ path: `./app/public/images/${imageName}` });
......
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 to comment