1 | <?php |
||||
2 | /** |
||||
3 | * Created by PhpStorm. |
||||
4 | * User: yiranzai |
||||
5 | * Date: 19-3-22 |
||||
6 | * Time: 下午2:19 |
||||
7 | */ |
||||
8 | |||||
9 | namespace Yiranzai\Byrobot\Traits; |
||||
10 | |||||
11 | /** |
||||
12 | * Trait Base |
||||
13 | * @package Yiranzai\Byrobot\Traits |
||||
14 | */ |
||||
15 | trait Base |
||||
16 | { |
||||
17 | /** |
||||
18 | * @var string |
||||
19 | */ |
||||
20 | private static $appKey; |
||||
21 | /** |
||||
22 | * @var string |
||||
23 | */ |
||||
24 | private static $appSecret; |
||||
25 | /** |
||||
26 | * 接口域名 |
||||
27 | * @var string |
||||
28 | */ |
||||
29 | private static $baseUrl = 'https://api.byrobot.cn'; |
||||
30 | /** |
||||
31 | * 接口版本 |
||||
32 | * @var string |
||||
33 | */ |
||||
34 | private static $apiVersion = 'v1'; |
||||
35 | |||||
36 | /** |
||||
37 | * @var \Yiranzai\Byrobot\Byrobot |
||||
38 | */ |
||||
39 | private static $robot; |
||||
40 | |||||
41 | /** |
||||
42 | * @var array |
||||
43 | */ |
||||
44 | public static $url = [ |
||||
45 | 'getCompanys' => [ |
||||
46 | 'url' => '/openapi/{apiVersion}/company/getCompanys', |
||||
47 | 'method' => 'GET', |
||||
48 | 'desc' => '获取绑定公司列表接口', |
||||
49 | ], |
||||
50 | 'getPhones' => [ |
||||
51 | 'url' => '/openapi/{apiVersion}/company/getPhones', |
||||
52 | 'method' => 'GET', |
||||
53 | 'desc' => '获取公司的主叫电话列表接口', |
||||
54 | ], |
||||
55 | 'getRobots' => [ |
||||
56 | 'url' => '/openapi/{apiVersion}/company/getRobots', |
||||
57 | 'method' => 'GET', |
||||
58 | 'desc' => '获取公司的机器人话术列表接口', |
||||
59 | ], |
||||
60 | 'addBlackList' => [ |
||||
61 | 'url' => '/openapi/{apiVersion}/company/addBlackList', |
||||
62 | 'method' => 'POST', |
||||
63 | 'desc' => '添加单个黑名单到公司默认黑名单组接口', |
||||
64 | ], |
||||
65 | 'statistics' => [ |
||||
66 | 'url' => '/openapi/{apiVersion}/company/seat/statistics', |
||||
67 | 'method' => 'GET', |
||||
68 | 'desc' => '获取公司AI坐席概况接口', |
||||
69 | ], |
||||
70 | 'createTask' => [ |
||||
71 | 'url' => '/openapi/{apiVersion}/task/createTask', |
||||
72 | 'method' => 'POST', |
||||
73 | 'desc' => '创建任务接口', |
||||
74 | ], |
||||
75 | 'start' => [ |
||||
76 | 'url' => '/openapi/{apiVersion}/task/start', |
||||
77 | 'method' => 'POST', |
||||
78 | 'desc' => '启动任务接口', |
||||
79 | ], |
||||
80 | 'pause' => [ |
||||
81 | 'url' => '/openapi/{apiVersion}/task/pause', |
||||
82 | 'method' => 'POST', |
||||
83 | 'desc' => '暂停任务接口', |
||||
84 | ], |
||||
85 | 'stop' => [ |
||||
86 | 'url' => '/openapi/{apiVersion}/task/stop', |
||||
87 | 'method' => 'POST', |
||||
88 | 'desc' => '停止任务接口', |
||||
89 | ], |
||||
90 | 'delete' => [ |
||||
91 | 'url' => '/openapi/{apiVersion}/task/delete', |
||||
92 | 'method' => 'POST', |
||||
93 | 'desc' => '删除任务', |
||||
94 | ], |
||||
95 | 'importTaskCustomer' => [ |
||||
96 | 'url' => '/openapi/{apiVersion}/task/importTaskCustomer', |
||||
97 | 'method' => 'POST', |
||||
98 | 'desc' => '向任务中导入客户接口', |
||||
99 | ], |
||||
100 | 'update' => [ |
||||
101 | 'url' => '/openapi/{apiVersion}/task/update', |
||||
102 | 'method' => 'POST', |
||||
103 | 'desc' => '修改任务', |
||||
104 | ], |
||||
105 | 'call' => [ |
||||
106 | 'url' => '/openapi/{apiVersion}/task/call', |
||||
107 | 'method' => 'POST', |
||||
108 | 'desc' => '单次电话外呼', |
||||
109 | ], |
||||
110 | 'singleCallByMobile' => [ |
||||
111 | 'url' => '/openapi/{apiVersion}/task/singleCallByMobile', |
||||
112 | 'method' => 'POST', |
||||
113 | 'desc' => '根据手机号进行单次电话外呼', |
||||
114 | ], |
||||
115 | 'getTasks' => [ |
||||
116 | 'url' => '/openapi/{apiVersion}/task/getTasks', |
||||
117 | 'method' => 'GET', |
||||
118 | 'desc' => '获取任务列表接口', |
||||
119 | ], |
||||
120 | 'getTaskDetail' => [ |
||||
121 | 'url' => '/openapi/{apiVersion}/task/getTaskDetail', |
||||
122 | 'method' => 'GET', |
||||
123 | 'desc' => '获取任务详情接口', |
||||
124 | ], |
||||
125 | 'queryDoneTaskPhones' => [ |
||||
126 | 'url' => '/openapi/{apiVersion}/task/queryDoneTaskPhones', |
||||
127 | 'method' => 'POST', |
||||
128 | 'desc' => '获取已经完成任务电话号码接口', |
||||
129 | ], |
||||
130 | 'notDialedCustomerList' => [ |
||||
131 | 'url' => '/openapi/{apiVersion}/task/notDialedCustomerList', |
||||
132 | 'method' => 'POST', |
||||
133 | 'desc' => '获取任务未开始的电话列表', |
||||
134 | ], |
||||
135 | 'phoneLogInfo' => [ |
||||
136 | 'url' => '/openapi/{apiVersion}/task/phoneLogInfo', |
||||
137 | 'method' => 'GET', |
||||
138 | 'desc' => '获取一个通话的详情接口', |
||||
139 | ], |
||||
140 | ]; |
||||
141 | |||||
142 | /** |
||||
143 | * @param $key |
||||
144 | * @return $this |
||||
145 | */ |
||||
146 | public function key($key): self |
||||
147 | { |
||||
148 | self::$appKey = $key; |
||||
149 | return $this; |
||||
150 | } |
||||
151 | |||||
152 | /** |
||||
153 | * @param $secret |
||||
154 | * @return $this |
||||
155 | */ |
||||
156 | public function secret($secret): self |
||||
157 | { |
||||
158 | self::$appSecret = $secret; |
||||
159 | return $this; |
||||
160 | } |
||||
161 | |||||
162 | /** |
||||
163 | * @param $version |
||||
164 | * @return $this |
||||
165 | */ |
||||
166 | public function version($version): self |
||||
167 | { |
||||
168 | self::$apiVersion = $version; |
||||
169 | return $this; |
||||
170 | } |
||||
171 | |||||
172 | /** |
||||
173 | * @param $url |
||||
174 | * @return $this |
||||
175 | */ |
||||
176 | public function url($url): self |
||||
177 | { |
||||
178 | self::$baseUrl = $url; |
||||
179 | return $this; |
||||
180 | } |
||||
181 | |||||
182 | /** |
||||
183 | * 获取百应机器人实例 |
||||
184 | * |
||||
185 | * @param array $config |
||||
186 | * @return \Yiranzai\Byrobot\Byrobot |
||||
187 | */ |
||||
188 | 15 | public static function init(array $config = []): \Yiranzai\Byrobot\Byrobot |
|||
189 | { |
||||
190 | 15 | if (null === static::$robot) { |
|||
0 ignored issues
–
show
Bug
introduced
by
![]() |
|||||
191 | 3 | static::$robot = new static($config); |
|||
0 ignored issues
–
show
The call to
Yiranzai\Byrobot\Traits\Base::__construct() has too many arguments starting with $config .
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue. If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above. ![]() |
|||||
192 | } |
||||
193 | 15 | return static::$robot; |
|||
194 | } |
||||
195 | } |
||||
196 |