forked from ChinaBygones/PHP-DouyinRobot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Adb.php
73 lines (69 loc) · 1.53 KB
/
Adb.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
<?php
class Adb
{
protected $follow = [];
protected $slide = [];
protected $fabulous = [];
public function __construct(array $config)
{
$this->follow = $config["follow"];
$this->slide = $config["slide"];
$this->fabulous = $config["fabulous"];
}
/**
* Describe:关注
* @Author: Bygones
* Date: 2019-06-15
* Time: 23:16
* @return mixed
*/
public function Follow()
{
$x = $this->follow["x"];
$y = $this->follow["y"];
exec("adb shell input tap ".$x." ".$y." ");
return true;
}
/**
* Describe:滑动
* @Author: Bygones
* Date: 2019-06-15
* Time: 23:22
* @return mixed
*/
public function Slide()
{
$x = $this->slide["x"];
$y = $this->slide["y"];
$x1 = $this->slide["x1"];
$y1 = $this->slide["y1"];
exec("adb shell input swipe ".$x." ".$y." ".$x1." ".$y1." ");
return true;
}
/**
* Describe:点赞
* @Author: Bygones
* Date: 2019-06-16
* Time: 11:05
*/
public function Fabulous()
{
$x = $this->fabulous["x"];
$y = $this->fabulous["y"];
exec("adb shell input tap ".$x." ".$y." ");
return true;
}
/**
* Describe:截图
* @Author: Bygones
* Date: 2019-06-15
* Time: 23:33
*/
public function Screenshot()
{
$dir = __DIR__ . "/img/dy".date("YmdHis").".png";
exec("adb exec-out screencap -p > ".$dir);
return $dir;
}
}
?>