Skip to content

Commit

Permalink
feat: 添加高德地图
Browse files Browse the repository at this point in the history
  • Loading branch information
axetroy committed Oct 2, 2017
1 parent 48015c8 commit e783e1c
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 0 deletions.
40 changes: 40 additions & 0 deletions app/providers/gaode.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
const puppeteer = require('puppeteer');
const Provider = require('../provider');

const config = require('../config');

const utils = require('../utils');

class GaoDeProvider extends Provider {
constructor() {
super();
this.url = `http://id.amap.com/register/index`;
}
async resolve(ctx) {
const options = ctx.options;
const page = ctx.page;

const [$mobile] = await Promise.all([page.$('#phone')]);

await $mobile.click();
await page.type(options.phone, { delay: 100 });

// 按下鼠标,拖动滚动条
await page.mouse.move(550, 325);
await page.mouse.click(550, 325);
await page.mouse.down({
button: 'left'
});

await page.mouse.move(900, 325, { steps: 1 });

await page.mouse.up({ button: 'left' });
// 松开鼠标

await utils.sleep(1000);

await page.click('#send_msg');
}
}

module.exports = GaoDeProvider;
2 changes: 2 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const YoukuProvider = require('./app/providers/youku');
const IQiYiProvider = require('./app/providers/iqiyi');
const XiaoMiProvider = require('./app/providers/xiaomi');
const SixYueGameProvider = require('./app/providers/6yuecom');
const GaoDeProvider = require('./app/providers/gaode');

new App({
username: 'abc1333llgo',
Expand All @@ -27,4 +28,5 @@ new App({
.provider(IQiYiProvider)
.provider(XiaoMiProvider)
.provider(SixYueGameProvider)
.provider(GaoDeProvider)
.bootstrap({ autoClose: false });

0 comments on commit e783e1c

Please sign in to comment.