commit | author | age
|
bc5e1e
|
1 |
//操作 |
X |
2 |
|
|
3 |
let dynamicData = require("slib/dynamicData"), datas = require("slib/datas"), |
|
4 |
swiper = require("slib/swiper"), request = require("slib/request"); |
|
5 |
|
|
6 |
function actions() { |
|
7 |
|
|
8 |
} |
|
9 |
|
|
10 |
|
|
11 |
/** |
|
12 |
* description 根据关键词搜索视频 |
|
13 |
* @param keyword {string} : 搜索词 |
|
14 |
* @param platform {number} : 平台 |
|
15 |
* @return {boolean} : 返回是否成功 |
|
16 |
*/ |
|
17 |
actions.prototype.searchVideoByKeyword = function (keyword, platform) { |
|
18 |
let result = false; |
|
19 |
let startNum = 3; //重试次数 |
|
20 |
//搜索内容 |
|
21 |
logd('准备搜索'); |
b2d3f7
|
22 |
dynamicData.deviceLog(true, {log_detail: '准备搜索'}); |
bc5e1e
|
23 |
let schemesItem = datas.schemes.filter(item => item.platform === platform); |
b2d3f7
|
24 |
let map = {"uri": schemesItem[0].scheme["search"] + keyword}; |
bc5e1e
|
25 |
let num = 0; |
X |
26 |
search: |
b2d3f7
|
27 |
while (num < startNum) { |
P |
28 |
try { |
|
29 |
logd(JSON.stringify(map)); |
|
30 |
if (utils.openActivity(map)) { |
|
31 |
sleep(8 * 1000); |
|
32 |
logd('搜索完成, 准备进入结果页'); |
|
33 |
let log = { |
|
34 |
log_detail: '搜索完成, 准备进入结果页', |
|
35 |
operate_type: 4, |
|
36 |
keyword: keyword |
bc5e1e
|
37 |
} |
b2d3f7
|
38 |
dynamicData.deviceLog(true, log); |
P |
39 |
// dynamicData.insertTrace(log); |
|
40 |
|
|
41 |
let notVideo = text("搜索结果为空").getOneNodeInfo(3 * 1000); |
|
42 |
if (notVideo) { |
|
43 |
logd('搜索受限, 准备关闭脚本'); |
|
44 |
actions.prototype.exceptionLog('搜索受限, 准备关闭脚本'); |
|
45 |
request.sendDingDing('搜索受限,任务停止', '', false); |
|
46 |
exit(); |
|
47 |
break; |
|
48 |
} |
|
49 |
//进入视频页 |
|
50 |
if (platform === 1) { //抖音 |
|
51 |
let tab_node = clz("android.widget.Button").text("视频").getOneNodeInfo(10 * 1000); //视频分类 |
bc5e1e
|
52 |
if (tab_node) { |
X |
53 |
tab_node.click(); |
|
54 |
logd('已进入视频分类'); |
b2d3f7
|
55 |
dynamicData.deviceLog(true, {log_detail: '已进入视频分类'}); |
bc5e1e
|
56 |
sleep(8 * 1000); |
b2d3f7
|
57 |
let video_node = id("com.ss.android.ugc.aweme:id/cover").getOneNodeInfo(10 * 1000); //第一个作品 |
bc5e1e
|
58 |
if (video_node) { |
X |
59 |
video_node.click(); |
b2d3f7
|
60 |
logd('已进入视频, 准备浏览作品'); |
P |
61 |
dynamicData.deviceLog(true, {log_detail: '已进入视频, 准备浏览作品'}); |
|
62 |
sleep(3 * 1000); |
bc5e1e
|
63 |
result = true; |
X |
64 |
break; |
|
65 |
} |
|
66 |
} |
b2d3f7
|
67 |
} else if (platform === 2) { //小红书 |
P |
68 |
let selector = text("筛选").getOneNodeInfo(10 * 1000); |
|
69 |
if (selector) { |
|
70 |
selector.click(); |
|
71 |
sleep(5 * 1000); |
|
72 |
let tab_node = text("视频").getOneNodeInfo(10 * 1000); //视频分类 |
|
73 |
if (tab_node) { |
|
74 |
tab_node.click(); |
|
75 |
sleep(5 * 1000); |
|
76 |
let finishSelector = text("完成").clickable(true).getOneNodeInfo(10 * 1000); |
|
77 |
if (finishSelector) { |
|
78 |
finishSelector.click(); |
|
79 |
} else { |
|
80 |
selector.click(); |
|
81 |
} |
bc5e1e
|
82 |
logd('已进入视频分类'); |
b2d3f7
|
83 |
dynamicData.deviceLog(true, {log_detail: '已进入视频分类'}); |
P |
84 |
sleep(8 * 1000); |
|
85 |
let video_node = clz("android.widget.ImageView").depth(13).getOneNodeInfo(10 * 1000); //第一个作品 |
|
86 |
if (video_node) { |
|
87 |
video_node.click(); |
|
88 |
logd('已进入视频页, 准备浏览作品'); |
|
89 |
dynamicData.deviceLog(true, {log_detail: '已进入视频页, 准备浏览作品'}); |
|
90 |
result = true; |
|
91 |
break; |
|
92 |
} |
|
93 |
} |
|
94 |
} |
|
95 |
} else if (platform === 3) { //快手 |
|
96 |
let tabs = id("com.smile.gifmaker:id/tabs").getOneNodeInfo(10 * 1000).child(0).allChildren(); //分类 |
|
97 |
if (tabs) { |
|
98 |
for (let i = 1; i < tabs.length; i++) { |
|
99 |
tabs[i].click(); |
|
100 |
sleep(8 * 1000); |
|
101 |
let live_node = id("com.smile.gifmaker:id/live_status_text").getOneNodeInfo(5 * 1000); //直播分类 |
|
102 |
let video_node = id("com.smile.gifmaker:id/player_cover").getOneNodeInfo(5 * 1000); //视频分类 |
|
103 |
if (!live_node && video_node) { |
|
104 |
logd('已进入视频分类'); |
|
105 |
dynamicData.deviceLog(true, {log_detail: '已进入视频分类'}); |
|
106 |
video_node.click(); |
|
107 |
dynamicData.deviceLog(true, {log_detail: '已进入视频, 准备浏览作品'}); |
|
108 |
sleep(3 * 1000) |
|
109 |
result = true; |
|
110 |
break search; |
|
111 |
} |
bc5e1e
|
112 |
} |
X |
113 |
} |
|
114 |
} |
b2d3f7
|
115 |
} else { |
P |
116 |
logd('搜索失败, 重新搜索'); |
|
117 |
dynamicData.deviceLog(false, {log_detail: '搜索失败, 重新搜索'}); |
bc5e1e
|
118 |
} |
b2d3f7
|
119 |
} catch (e) { |
P |
120 |
logd('搜索失败:' + e); |
|
121 |
actions.prototype.exceptionLog('搜索失败:' + e); |
bc5e1e
|
122 |
} |
b2d3f7
|
123 |
num++; |
bc5e1e
|
124 |
} |
X |
125 |
return result; |
|
126 |
} |
|
127 |
|
b2d3f7
|
128 |
|
P |
129 |
/** |
|
130 |
* description 根据关键词搜索视频 |
|
131 |
* @param keyword {string} : 搜索词 |
|
132 |
* @param platform {number} : 平台 (百度,QQ浏览器) |
|
133 |
* @return {boolean} : 返回是否成功 |
|
134 |
*/ |
eb0bd1
|
135 |
// actions.prototype.searchByKeyword = function (keyword, platform) { |
H |
136 |
// let result = false; |
|
137 |
// let startNum = 3; //重试次数 |
|
138 |
// //搜索内容 |
|
139 |
// logd('准备搜索'); |
|
140 |
// dynamicData.deviceLog(true, {log_detail: '准备搜索'}); |
|
141 |
// let schemesItem = datas.schemes.filter(item => item.platform === platform); |
|
142 |
// let map = {"uri": schemesItem[0].scheme["search"] + keyword}; |
|
143 |
// let num = 0; |
|
144 |
// search: |
|
145 |
// while (num < startNum) { |
|
146 |
// try { |
|
147 |
// let searchLayout = id("com.baidu.searchbox:id/obfuscated").getOneNodeInfo(5000); |
|
148 |
// if (searchLayout) { |
|
149 |
// let editableTextSelector = clz("android.widget.EditText"); |
|
150 |
// if (editableTextSelector) { |
|
151 |
// click(editableTextSelector); |
|
152 |
// logd('搜索框已点击'); |
|
153 |
// editableTextSelector.clearText(); |
|
154 |
// inputText(editableTextSelector, keyword); |
|
155 |
// logd('输入搜索内容:' + keyword); |
|
156 |
// let searchBtn = text("搜索").getOneNodeInfo(5000); |
|
157 |
// if (searchBtn.click()) { |
|
158 |
// logd('搜索已点击'); |
|
159 |
// result = true; |
|
160 |
// } |
|
161 |
// } else { |
|
162 |
// let searchBox = searchLayout.getOneNodeInfo(clz("android.widget.TextView"), 5000); |
|
163 |
// if (searchBox.click()) { |
|
164 |
// logd('搜索框已点击'); |
|
165 |
// let searchLayout2 = id("com.baidu.searchbox:id/obfuscated").getOneNodeInfo(5000); |
|
166 |
// if (searchLayout2) { |
|
167 |
// let editTextSelector2 = searchLayout2.getOneNodeInfo(clz("android.widget.EditText"), 5000); |
|
168 |
// editTextSelector2.clearText(); |
|
169 |
// inputText(editTextSelector2, keyword); |
|
170 |
// logd('输入搜索内容:' + keyword); |
|
171 |
// let searchBtn = text("搜索").getOneNodeInfo(5000); |
|
172 |
// if (searchBtn.click()) { |
|
173 |
// logd('搜索已点击'); |
|
174 |
// result = true; |
|
175 |
// } |
|
176 |
// } |
|
177 |
// } |
|
178 |
// } |
|
179 |
|
|
180 |
// } |
|
181 |
// logd(JSON.stringify(map)); |
|
182 |
// } catch (e) { |
|
183 |
// logd('搜索失败:' + e); |
|
184 |
// actions.prototype.exceptionLog('搜索失败:' + e); |
|
185 |
// } |
|
186 |
// num++; |
|
187 |
// } |
|
188 |
// return result; |
|
189 |
// } |
|
190 |
|
b2d3f7
|
191 |
actions.prototype.searchByKeyword = function (keyword, platform) { |
P |
192 |
let result = false; |
|
193 |
let startNum = 3; //重试次数 |
|
194 |
//搜索内容 |
|
195 |
logd('准备搜索'); |
|
196 |
dynamicData.deviceLog(true, {log_detail: '准备搜索'}); |
|
197 |
let schemesItem = datas.schemes.filter(item => item.platform === platform); |
|
198 |
let map = {"uri": schemesItem[0].scheme["search"] + keyword}; |
|
199 |
let num = 0; |
eb0bd1
|
200 |
|
b2d3f7
|
201 |
search: |
P |
202 |
while (num < startNum) { |
|
203 |
try { |
eb0bd1
|
204 |
if (platform === 4) { |
H |
205 |
|
|
206 |
let searchLayout = id("com.baidu.searchbox:id/baidu_searchbox").getOneNodeInfo(5000); |
|
207 |
if (searchLayout&&searchLayout.click()) { |
|
208 |
// if (editableTextSelector) { |
|
209 |
// click(editableTextSelector); |
|
210 |
// editableTextSelector.click() |
|
211 |
let editableTextSelector = clz("android.widget.EditText").pkg("com.baidu.searchbox").getOneNodeInfo(5000); |
b2d3f7
|
212 |
logd('搜索框已点击'); |
eb0bd1
|
213 |
sleep(1000); |
H |
214 |
// editableTextSelector.clearText(); |
|
215 |
if (editableTextSelector) { |
|
216 |
// editableTextSelector.pasteText(keyword) |
|
217 |
if (imeInputText(null, keyword)) { |
|
218 |
|
b2d3f7
|
219 |
logd('输入搜索内容:' + keyword); |
P |
220 |
let searchBtn = text("搜索").getOneNodeInfo(5000); |
|
221 |
if (searchBtn.click()) { |
|
222 |
logd('搜索已点击'); |
|
223 |
result = true; |
|
224 |
} |
|
225 |
} |
|
226 |
} |
|
227 |
|
eb0bd1
|
228 |
} else { |
H |
229 |
logd('没有找找到搜索按钮,第二种搜索方式'); |
|
230 |
let searchLayout2 = id("com.baidu.searchbox:id/obfuscated").depth(14).drawingOrder(2).child().getOneNodeInfo(5000) |
|
231 |
// toast(JSON.stringify(searchLayout2)); |
|
232 |
if (searchLayout2&&searchLayout2.click()) { |
|
233 |
let editableTextSelector = clz("android.widget.EditText").pkg("com.baidu.searchbox").getOneNodeInfo(5000); |
|
234 |
sleep(1000); |
|
235 |
if (editableTextSelector) { |
|
236 |
if (imeInputText(null, keyword)) { |
|
237 |
|
|
238 |
let searchBtn = text("搜索").getOneNodeInfo(5000); |
|
239 |
if (searchBtn.click()) { |
|
240 |
logd('搜索已点击'); |
|
241 |
result = true; |
|
242 |
} |
|
243 |
} |
|
244 |
} |
|
245 |
}else{ |
|
246 |
logd('没有找到搜索按钮 '); |
|
247 |
} |
|
248 |
} |
|
249 |
// editableTextSelector.clearText(); |
|
250 |
// imeInputText(editableTextSelector, keyword); |
|
251 |
// searchBtn.click(); |
|
252 |
// } |
|
253 |
// } else { |
|
254 |
// let searchBox = searchLayout.getOneNodeInfo(clz("android.widget.TextView"), 5000); |
|
255 |
// if (searchBox.click()) { |
|
256 |
// logd('搜索框已点击'); |
|
257 |
// let searchLayout2 = id("com.baidu.searchbox:id/obfuscated").getOneNodeInfo(5000); |
|
258 |
// if (searchLayout2) { |
|
259 |
// let editTextSelector2 = searchLayout2.getOneNodeInfo(clz("android.widget.EditText"), 5000); |
|
260 |
// editTextSelector2.clearText(); |
|
261 |
// inputText(editTextSelector2, keyword); |
|
262 |
// logd('输入搜索内容:' + keyword); |
|
263 |
// let searchBtn = text("搜索").getOneNodeInfo(5000); |
|
264 |
// if (searchBtn.click()) { |
|
265 |
// logd('搜索已点击'); |
|
266 |
// result = true; |
|
267 |
// } |
|
268 |
// } |
|
269 |
// } |
|
270 |
} else if (platform === 5) { |
|
271 |
//qq浏览器 |
|
272 |
let searchLayout = id("com.tencent.mtt:id/search_bar_tv_hotword").getOneNodeInfo(5000); |
|
273 |
if (searchLayout && searchLayout.click()) { |
|
274 |
//获取到 准备写入 |
|
275 |
sleep(1000); |
|
276 |
let editableTextSelector = id("com.tencent.mtt:id/search_frame_input_bar").getOneNodeInfo(5000);//.pkg('com.tencent.mtt') |
|
277 |
// let editableTextSelector = clz("android.widget.EditText").pkg("com.tencent.mtt").getOneNodeInfo(3000) |
|
278 |
logd(JSON.stringify(editableTextSelector)); |
|
279 |
sleep(1000); |
|
280 |
if (editableTextSelector) { |
|
281 |
// imeInputText(editableTextSelector,keyword) |
|
282 |
// imeInputText(null,keyword) |
|
283 |
if (imeInputText(null, keyword)) { |
|
284 |
sleep(3000); |
|
285 |
let searchBtn = text("搜索").getOneNodeInfo(5000); |
|
286 |
if (searchBtn.click()) { |
|
287 |
logd('搜索已点击'); |
|
288 |
result = true; |
|
289 |
} |
|
290 |
} else { |
|
291 |
logd('imeInputText 失败'); |
|
292 |
|
|
293 |
} |
|
294 |
|
|
295 |
// pasteText(editableTextSelector, keyword) |
|
296 |
// editableTextSelector.inputText(keyword) |
|
297 |
|
|
298 |
// if (searchBtn.click()) { |
|
299 |
// logd('搜索已点击'); |
|
300 |
// result = true; |
|
301 |
// } |
|
302 |
} else { |
|
303 |
logd('没有找到要写入的搜索框'); |
|
304 |
} |
|
305 |
} else { |
|
306 |
logd('没有找到搜索框') |
|
307 |
} |
b2d3f7
|
308 |
} |
eb0bd1
|
309 |
|
H |
310 |
// } |
b2d3f7
|
311 |
logd(JSON.stringify(map)); |
P |
312 |
} catch (e) { |
|
313 |
logd('搜索失败:' + e); |
|
314 |
actions.prototype.exceptionLog('搜索失败:' + e); |
|
315 |
} |
|
316 |
num++; |
|
317 |
} |
|
318 |
return result; |
|
319 |
} |
bc5e1e
|
320 |
|
X |
321 |
/** |
|
322 |
* description 根据用户id搜索视频 |
|
323 |
* @param userId {string} : 用户id |
|
324 |
* @param platform {number} : 平台 |
|
325 |
* @return {boolean} : 返回用户信息 |
|
326 |
*/ |
|
327 |
actions.prototype.searchVideoByUserId = function (userId, platform) { |
|
328 |
let result = false; |
|
329 |
let startNum = 3; //重试次数 |
|
330 |
//搜索用户 |
|
331 |
logd('准备搜索用户'); |
b2d3f7
|
332 |
dynamicData.deviceLog(true, {log_detail: '准备搜索用户'}); |
bc5e1e
|
333 |
let schemesItem = datas.schemes.filter(item => item.platform === platform); |
X |
334 |
let map = {"uri": schemesItem[0].scheme["search"] + userId}; |
|
335 |
let num = 0; |
|
336 |
while (num < startNum) { |
|
337 |
try { |
|
338 |
if (utils.openActivity(map)) { |
b2d3f7
|
339 |
sleep(8 * 1000); |
bc5e1e
|
340 |
logd('搜索完成,准备进入用户主页'); |
X |
341 |
let log = { |
|
342 |
log_detail: '搜索完成,准备进入用户主页', |
|
343 |
operate_type: 4, |
|
344 |
keyword: userId |
|
345 |
} |
|
346 |
dynamicData.deviceLog(true, log); |
|
347 |
dynamicData.insertTrace(log); |
|
348 |
|
|
349 |
let notVideo = text("搜索结果为空").getOneNodeInfo(3 * 1000); |
|
350 |
if (notVideo) { |
|
351 |
logd('搜索受限, 准备关闭脚本'); |
|
352 |
actions.prototype.exceptionLog('搜索受限, 准备关闭脚本'); |
|
353 |
request.sendDingDing('搜索受限,任务停止', '', false); |
|
354 |
exit(); |
|
355 |
break; |
|
356 |
} |
|
357 |
//进入用户分类 |
|
358 |
let tab_node, user_node, video_node, video_tab; //用户分类,第一个用户,第一个视频,作品分类 |
|
359 |
if (platform === 1) tab_node = clz("android.widget.Button").text("用户").getOneNodeInfo(8 * 1000); |
|
360 |
if (platform === 2) tab_node = text("用户").getOneNodeInfo(8 * 1000); |
|
361 |
if (platform === 3) { |
|
362 |
let tabs = id("com.smile.gifmaker:id/tabs").getOneNodeInfo(8 * 1000).child(0).allChildren(); //分类 |
|
363 |
if (tabs) { |
|
364 |
for (let i = 1; i < tabs.length; i++) { |
|
365 |
tabs[i].click(); |
|
366 |
sleep(8 * 1000); |
|
367 |
let name_node = id("com.smile.gifmaker:id/name").getOneNodeInfo(5 * 1000); //用户分类 |
|
368 |
let video_node = id("com.smile.gifmaker:id/player_cover").getOneNodeInfo(5 * 1000); //视频分类 |
|
369 |
if (name_node && !video_node) { |
|
370 |
tab_node = id("com.smile.gifmaker:id/tabs").getOneNodeInfo(8 * 1000).child(0).child(i); |
|
371 |
break; |
|
372 |
} |
|
373 |
} |
|
374 |
} |
|
375 |
} |
|
376 |
if (tab_node) { |
|
377 |
tab_node.click(); |
|
378 |
logd('已进入用户分类'); |
b2d3f7
|
379 |
dynamicData.deviceLog(true, {log_detail: '已进入用户分类'}); |
bc5e1e
|
380 |
sleep(5 * 1000); |
X |
381 |
//进入用户主页 |
|
382 |
if (platform === 1) user_node = clz("com.lynx.tasm.behavior.ui.LynxFlattenUI").getOneNodeInfo(8 * 1000); |
|
383 |
if (platform === 2) user_node = clz("android.widget.RelativeLayout").getOneNodeInfo(8 * 1000); |
|
384 |
if (platform === 3) user_node = id("com.smile.gifmaker:id/user_root_layout").getOneNodeInfo(8 * 1000); |
|
385 |
if (user_node) { |
|
386 |
user_node.click(); |
|
387 |
logd('已进入用户主页'); |
b2d3f7
|
388 |
dynamicData.deviceLog(true, {log_detail: '已进入用户主页'}); |
bc5e1e
|
389 |
sleep(5 * 1000); |
X |
390 |
if (platform === 1) video_tab = descMatch(".*作品.*").clz("android.widget.TextView").selected(false).getOneNodeInfo(8 * 1000); |
|
391 |
if (platform === 2) video_tab = descMatch(".*笔记.*").clz("android.view.ViewGroup").selected(false).getOneNodeInfo(8 * 1000); |
|
392 |
if (platform === 3) video_tab = textMatch(".*作品.*").id("com.smile.gifmaker:id/tab_text").selected(false).getOneNodeInfo(8 * 1000); |
|
393 |
if (video_tab) { |
|
394 |
video_tab.click(); |
|
395 |
logd('已进入作品分类'); |
b2d3f7
|
396 |
dynamicData.deviceLog(true, {log_detail: '已进入作品分类'}); |
bc5e1e
|
397 |
sleep(2 * 1000); |
X |
398 |
} |
|
399 |
//进入作品 |
|
400 |
if (platform === 1) video_node = id("com.ss.android.ugc.aweme:id/cover").getOneNodeInfo(8 * 1000); |
|
401 |
if (platform === 2) video_node = drawingOrder(3).depth(23).getOneNodeInfo(8 * 1000); |
|
402 |
if (platform === 3) video_node = id("com.smile.gifmaker:id/player_cover").getOneNodeInfo(8 * 1000); |
|
403 |
if (video_node) { |
|
404 |
video_node.click(); |
|
405 |
logd('已进入视频页, 准备浏览作品'); |
b2d3f7
|
406 |
dynamicData.deviceLog(true, {log_detail: '已进入视频页, 准备浏览作品'}); |
bc5e1e
|
407 |
result = true; |
X |
408 |
break; |
|
409 |
} |
|
410 |
} |
|
411 |
} |
|
412 |
} else { |
|
413 |
logd('搜索失败, 重新搜索'); |
b2d3f7
|
414 |
dynamicData.deviceLog(false, {log_detail: '搜索失败, 重新搜索'}); |
bc5e1e
|
415 |
} |
X |
416 |
} catch (e) { |
|
417 |
logd('搜索失败:' + e); |
|
418 |
actions.prototype.exceptionLog('搜索失败:' + e); |
|
419 |
} |
|
420 |
num++; |
|
421 |
} |
|
422 |
return result; |
|
423 |
} |
|
424 |
|
|
425 |
|
|
426 |
/** |
|
427 |
* description 打开视频地址 |
|
428 |
* @param url {string} : 地址 |
|
429 |
* @param platform {number} : 平台 |
|
430 |
* @return {boolean} : 返回是否成功 |
|
431 |
*/ |
|
432 |
actions.prototype.searchVideoByUrl = function (url, platform) { |
|
433 |
let result = false; |
|
434 |
let startNum = 3; //重试次数 |
|
435 |
//搜索视频 |
|
436 |
dynamicData.deviceLog(true, {log_detail: '准备打开视频'}); |
|
437 |
let schemesItem = datas.schemes.filter(item => item.platform === platform); |
b2d3f7
|
438 |
let map = {"uri": schemesItem[0].scheme["search"] + url}; |
bc5e1e
|
439 |
let num = 0; |
X |
440 |
while (num < startNum) { |
|
441 |
try { |
|
442 |
if (utils.openActivity(map)) { |
|
443 |
sleep(8000); |
|
444 |
logd('已进入视频'); |
|
445 |
let log = { |
|
446 |
log_detail: '已进入视频', |
|
447 |
operate_type: 4, |
|
448 |
} |
|
449 |
dynamicData.deviceLog(true, log); |
|
450 |
dynamicData.insertTrace(log); |
|
451 |
result = true; |
|
452 |
break; |
|
453 |
} else { |
|
454 |
logd('打开视频失败'); |
b2d3f7
|
455 |
dynamicData.deviceLog(false, {log_detail: '打开视频失败'}); |
bc5e1e
|
456 |
} |
X |
457 |
} catch (e) { |
|
458 |
logd('搜索失败:' + e); |
|
459 |
let error = { |
b2d3f7
|
460 |
log_detail: '搜索失败:' + e, |
P |
461 |
operate_type: 16 |
bc5e1e
|
462 |
} |
X |
463 |
dynamicData.deviceLog(true, error); |
|
464 |
dynamicData.insertTrace(error); |
|
465 |
} |
|
466 |
num++; |
|
467 |
} |
|
468 |
return result; |
|
469 |
} |
|
470 |
|
|
471 |
|
|
472 |
/** |
|
473 |
* description 评论回复 |
|
474 |
* @param dom {object} : 评论节点 |
|
475 |
* @param log {object} : 日志参数组 |
|
476 |
* @return {boolean} : 返回是否成功 |
|
477 |
*/ |
|
478 |
actions.prototype.commentReply = function (dom, log) { |
|
479 |
let result = false; |
|
480 |
if (dom) { |
|
481 |
dom.click(); |
|
482 |
let title = textMatch(".*自己评论.*").getOneNodeInfo(10000); |
|
483 |
if (title) { |
|
484 |
logd('当前评论不允许回复, 继续浏览评论'); |
|
485 |
log.log_detail = '当前评论不允许回复, 继续浏览评论'; |
|
486 |
dynamicData.deviceLog(true, log); |
|
487 |
} else { |
|
488 |
logd('准备输入回复内容'); |
|
489 |
log.log_detail = '准备输入回复内容'; |
|
490 |
dynamicData.deviceLog(true, log); |
|
491 |
let words = "hello"; |
|
492 |
let input_selectors = clz("android.widget.EditText").getOneNodeInfo(10000); |
|
493 |
if (input_selectors) { |
|
494 |
if (input_selectors.inputText(words)) { |
|
495 |
logd('回复内容 "' + words + '" 输入成功, 准备发送'); |
|
496 |
log.log_detail = '回复内容 "' + words + '" 输入成功, 准备发送'; |
|
497 |
dynamicData.deviceLog(true, log); |
|
498 |
let send = text("发送").getOneNodeInfo(10000); |
|
499 |
if (send) { |
|
500 |
send.click(); |
|
501 |
logd('回复完成, 继续浏览评论'); |
|
502 |
log.log_detail = '回复完成, 继续浏览评论'; |
|
503 |
log.operate_type = 11; |
|
504 |
dynamicData.deviceLog(true, log); |
|
505 |
dynamicData.insertTrace(log); |
|
506 |
delete log.operate_type; |
|
507 |
result = true; |
|
508 |
} |
|
509 |
} |
|
510 |
} |
|
511 |
} |
|
512 |
} |
|
513 |
return result; |
|
514 |
} |
|
515 |
|
|
516 |
|
|
517 |
/** |
|
518 |
* description 私信 |
|
519 |
* @param dom {object} : 头像节点 |
|
520 |
* @param platform {number} : 平台 |
|
521 |
* @param log {object} : 日志参数组 |
|
522 |
* @return {boolean} : 返回是否成功 |
|
523 |
*/ |
|
524 |
actions.prototype.message = function (dom, platform, log) { |
|
525 |
let result = false; |
|
526 |
logd('准备进入用户主页'); |
|
527 |
log.log_detail = '准备进入用户主页'; |
|
528 |
dynamicData.deviceLog(true, log); |
|
529 |
if (dom) { |
|
530 |
dom.click(); |
|
531 |
logd('开始浏览用户主页'); |
|
532 |
log.log_detail = '开始浏览用户主页'; |
|
533 |
log.operate_type = 12; |
|
534 |
dynamicData.deviceLog(true, log); |
|
535 |
dynamicData.insertTrace(log) |
|
536 |
delete log.operate_type; |
|
537 |
if (platform === 1) { //抖音先关注再私信 |
|
538 |
let follow_btn = text("关注").clickable(true).getOneNodeInfo(10000); |
|
539 |
if (follow_btn) { |
|
540 |
follow_btn.click(); |
|
541 |
logd('已关注用户, 准备进入私信'); |
|
542 |
log.log_detail = '已关注用户, 准备进入私信'; |
|
543 |
log.operate_type = 13; |
|
544 |
dynamicData.deviceLog(true, log); |
|
545 |
dynamicData.insertTrace(log); |
|
546 |
delete log.operate_type; |
|
547 |
//判断私密账户 |
|
548 |
let private = textMatch(".*私密账号.*").getOneNodeInfo(10000); |
|
549 |
let ok = text("知道了").getOneNodeInfo(10000); |
|
550 |
if (private) { |
|
551 |
ok.click(); |
|
552 |
logd('该用户是私密账户, 取消私信, 准备返回评论区'); |
|
553 |
log.log_detail = '该用户是私密账户, 取消私信, 准备返回评论区'; |
|
554 |
dynamicData.deviceLog(true, log); |
|
555 |
actions.prototype.go_back(1); |
|
556 |
return false; |
|
557 |
} |
|
558 |
} |
|
559 |
} |
|
560 |
let message_btn; //私信按钮 |
|
561 |
if (platform === 1) message_btn = text("私信").getOneNodeInfo(8000); |
|
562 |
if (platform === 2) message_btn = desc("发消息").getOneNodeInfo(8000); |
|
563 |
if (platform === 3) message_btn = id("com.smile.gifmaker:id/send_message_small_icon").getOneNodeInfo(8000); |
|
564 |
let title = text("账号已经注销").getOneNodeInfo(10000); |
|
565 |
//判断是否注销 |
|
566 |
if (title) { |
|
567 |
logd('该用户已注销, 取消私信, 准备返回评论区'); |
|
568 |
log.log_detail = '该用户已注销, 取消私信, 准备返回评论区'; |
|
569 |
dynamicData.deviceLog(true, log); |
|
570 |
actions.prototype.go_back(1); |
|
571 |
return false; |
|
572 |
} else if (message_btn) { |
|
573 |
message_btn.click(); |
|
574 |
logd('已进入私信页, 准备发消息'); |
|
575 |
log.log_detail = '已进入私信页, 准备发消息'; |
|
576 |
dynamicData.deviceLog(true, log); |
|
577 |
let input_selectors = clz("android.widget.EditText"); |
|
578 |
let word = "hello"; |
|
579 |
//寻找输入框 输入话术 |
|
580 |
if (inputText(input_selectors, word)) { |
|
581 |
let send_btn; //发送按钮 |
|
582 |
if (platform === 1) send_btn = desc("发送").getOneNodeInfo(8000); |
|
583 |
if (platform === 2) send_btn = text("发送").getOneNodeInfo(index(0), 8000); |
|
584 |
if (platform === 3) send_btn = id("com.smile.gifmaker:id/send_btn").getOneNodeInfo(8000); |
|
585 |
if (send_btn.click()) { |
|
586 |
logd('私信完成,准备返回评论区'); |
|
587 |
log.log_detail = '私信完成,准备返回评论区'; |
|
588 |
log.operate_type = 14; |
b2d3f7
|
589 |
log.keyword = text; |
bc5e1e
|
590 |
dynamicData.deviceLog(true, log); |
X |
591 |
dynamicData.insertTrace(log); |
|
592 |
delete log.operate_type; |
|
593 |
actions.prototype.go_back(2); |
|
594 |
result = true; |
|
595 |
} |
|
596 |
} |
|
597 |
} |
|
598 |
} |
|
599 |
return result; |
|
600 |
} |
|
601 |
|
|
602 |
|
|
603 |
/** |
|
604 |
* description 点赞 |
|
605 |
* @param dom {object} : 爱心节点 |
|
606 |
* @param log {object} : 日志参数组 |
|
607 |
* @return {boolean} : 返回是否成功 |
|
608 |
*/ |
|
609 |
actions.prototype.like = function (dom, log) { |
|
610 |
let result = false; |
|
611 |
if (dom) { |
|
612 |
dom.click(); |
|
613 |
logd('已点赞, 继续浏览'); |
|
614 |
log.log_detail = '已点赞, 继续浏览'; |
|
615 |
log.operate_type = 10; |
|
616 |
dynamicData.deviceLog(true, log); |
|
617 |
dynamicData.insertTrace(log); |
|
618 |
delete log.operate_type; |
|
619 |
result = true; |
|
620 |
} |
|
621 |
return result; |
|
622 |
} |
|
623 |
|
|
624 |
|
|
625 |
/** |
|
626 |
* description 收藏 |
|
627 |
* @param dom {object} : 收藏节点 |
|
628 |
* @param log {object} : 日志参数组 |
|
629 |
* @return {boolean} : 返回是否成功 |
|
630 |
*/ |
|
631 |
actions.prototype.collection = function (dom, log) { |
|
632 |
let result = false; |
|
633 |
if (dom) { |
|
634 |
dom.click(); |
|
635 |
logd('已收藏, 继续浏览'); |
|
636 |
log.log_detail = '已收藏, 继续浏览'; |
|
637 |
log.operate_type = 7; |
|
638 |
dynamicData.deviceLog(true, log); |
|
639 |
dynamicData.insertTrace(log); |
|
640 |
delete log.operate_type; |
|
641 |
result = true; |
|
642 |
} |
|
643 |
return result; |
|
644 |
} |
|
645 |
|
|
646 |
|
|
647 |
/** |
|
648 |
* description 关注 |
|
649 |
* @param dom {object} : 关注节点 |
|
650 |
* @param log {object} : 日志参数组 |
|
651 |
* @return {boolean} : 返回是否成功 |
|
652 |
*/ |
|
653 |
actions.prototype.follow = function (dom, log) { |
|
654 |
let result = false; |
|
655 |
if (dom) { |
|
656 |
dom.click(); |
|
657 |
logd('已关注, 继续浏览'); |
|
658 |
log.log_detail = '已关注, 继续浏览'; |
|
659 |
log.operate_type = 13; |
|
660 |
dynamicData.deviceLog(true, log); |
|
661 |
dynamicData.insertTrace(log); |
|
662 |
delete log.operate_type; |
|
663 |
result = true; |
|
664 |
} |
|
665 |
return result; |
|
666 |
} |
|
667 |
|
|
668 |
|
|
669 |
/** |
|
670 |
* description 评论 |
|
671 |
* @param log {object} : 日志参数组 |
|
672 |
* @return {boolean} : 返回是否成功 |
|
673 |
*/ |
|
674 |
actions.prototype.comment = function (log) { |
|
675 |
let result = false; |
|
676 |
logd('准备输入评论内容'); |
|
677 |
log.log_detail = '准备输入评论内容'; |
|
678 |
dynamicData.deviceLog(true, log); |
|
679 |
let words = 'hello'; |
|
680 |
let input_selectors; |
|
681 |
input_selectors = clz("android.widget.EditText").getOneNodeInfo(10000); |
|
682 |
let input_tips = textMatch(".*说点什么.*").getOneNodeInfo(10000); |
|
683 |
if (input_selectors || input_tips) { |
|
684 |
if (input_tips) { |
|
685 |
input_tips.click(); |
|
686 |
sleep(4000); |
|
687 |
input_selectors = clz("android.widget.EditText").getOneNodeInfo(10000); |
|
688 |
} |
|
689 |
if (input_selectors.inputText(words)) { |
|
690 |
logd('评论内容 "' + words + '" 输入成功, 准备发送'); |
|
691 |
log.log_detail = '评论内容 "' + words + '" 输入成功, 准备发送'; |
|
692 |
dynamicData.deviceLog(true, log); |
|
693 |
let send = text("发送").getOneNodeInfo(10000); |
|
694 |
if (send) { |
|
695 |
send.click(); |
|
696 |
logd('评论完成, 继续浏览'); |
|
697 |
log.log_detail = '评论完成, 继续浏览'; |
|
698 |
log.operate_type = 9; |
|
699 |
dynamicData.deviceLog(true, log); |
|
700 |
dynamicData.insertTrace(log); |
|
701 |
actions.prototype.go_back(1); |
|
702 |
delete log.operate_type; |
|
703 |
result = true; |
|
704 |
} |
|
705 |
} |
|
706 |
} |
|
707 |
return result; |
|
708 |
} |
|
709 |
|
|
710 |
|
|
711 |
/** |
|
712 |
* description 获取用户账号信息 |
|
713 |
* @param dom {object} : 头像节点 |
|
714 |
* @param platform {number} : 平台 |
|
715 |
* @return {object} : 返回用户账号信息 |
|
716 |
*/ |
|
717 |
actions.prototype.getUserInfo = function (dom, platform) { |
|
718 |
let startNum = 3; //重试次数 |
b2d3f7
|
719 |
let user = {id: '', nickname: ''}; //账号信息 |
bc5e1e
|
720 |
let num = 0; |
X |
721 |
if (dom) { |
|
722 |
let clickResult = dom.click(); |
|
723 |
if (!clickResult) dom.click(); |
|
724 |
logd('准备进入用户主页'); |
b2d3f7
|
725 |
dynamicData.deviceLog(true, {log_detail: '准备进入用户主页'}); |
bc5e1e
|
726 |
} |
X |
727 |
sleep(2 * 1000); |
|
728 |
while (num < startNum) { |
|
729 |
try { |
|
730 |
if (platform === 1) { //抖音 |
|
731 |
let idSelector = textMatch(".*抖音号.*").getOneNodeInfo(8 * 1000); |
|
732 |
let nameSelector = descMatch(".*复制名字.*").getOneNodeInfo(8 * 1000); |
|
733 |
if (idSelector) user.id = idSelector.text.slice(4); |
|
734 |
if (nameSelector) user.nickname = nameSelector.text; |
|
735 |
} else if (platform === 2) { //小红书 |
|
736 |
let idSelectors = textMatch(".*小红书号.*").getOneNodeInfo(8 * 1000); |
|
737 |
if (idSelectors) { |
|
738 |
if (idSelectors.text.includes(":")) { |
|
739 |
user.id = idSelectors.text.slice(5); |
|
740 |
} else { |
|
741 |
user.id = idSelectors.text.slice(4); |
|
742 |
} |
|
743 |
} |
|
744 |
let nameSelectors = depth(16).drawingOrder(9).clz("android.widget.TextView").getOneNodeInfo(8 * 1000); |
|
745 |
if (nameSelectors) user.nickname = nameSelectors.text; |
|
746 |
} else if (platform === 3) { //快手 |
|
747 |
let idSelectors = id("com.smile.gifmaker:id/profile_user_kwai_id").getOneNodeInfo(10 * 1000); |
|
748 |
if (idSelectors) { |
|
749 |
user.id = idSelectors.text.slice(4); |
|
750 |
user.nickname = id("com.smile.gifmaker:id/user_name_tv").getOneNodeInfo(10 * 1000).text; |
|
751 |
} |
|
752 |
} |
|
753 |
if (user.id !== '') { |
|
754 |
logd('已获取用户账号信息'); |
|
755 |
let log = { |
b2d3f7
|
756 |
log_detail: '已获取用户账号信息', |
P |
757 |
operate_type: 12 |
bc5e1e
|
758 |
} |
X |
759 |
dynamicData.deviceLog(true, log); |
|
760 |
dynamicData.insertTrace(log); |
|
761 |
break; |
|
762 |
} |
|
763 |
|
|
764 |
} catch (e) { |
|
765 |
logd('获取用户账号失败:' + e); |
b2d3f7
|
766 |
dynamicData.deviceLog(true, {log_detail: '获取用户账号失败:' + e}); |
bc5e1e
|
767 |
} |
X |
768 |
num++; |
|
769 |
} |
|
770 |
return user; |
|
771 |
} |
|
772 |
|
|
773 |
|
|
774 |
/** |
|
775 |
* description 获取视频地址 |
|
776 |
* @param platform {number} : 平台 |
|
777 |
* @return {object} : 返回地址信息 |
|
778 |
*/ |
|
779 |
actions.prototype.getVideoLink = function (platform) { |
|
780 |
try { |
|
781 |
let shareDesc = descMatch(".*分享.*").getOneNodeInfo(8000); |
|
782 |
let shareId = id("com.smile.gifmaker:id/forward_icon").getOneNodeInfo(8000); |
|
783 |
if (shareDesc || shareId) { |
|
784 |
if (platform === 3) { |
|
785 |
shareId.click(); |
|
786 |
} else { |
|
787 |
shareDesc.click(); |
|
788 |
} |
|
789 |
sleep(3000); |
b2d3f7
|
790 |
let share = [textMatch(".*复制链接.*").getOneNodeInfo(8000), textMatch(".*链接分享.*").getOneNodeInfo(10000), |
bc5e1e
|
791 |
textMatch(".*分享至.*").pkg("com.ss.android.ugc.aweme").getOneNodeInfo(8000)]; |
b2d3f7
|
792 |
for (let i = 0; i < share.length; i++) { |
bc5e1e
|
793 |
if (share[i]) { |
X |
794 |
share[i].parent().click(); |
|
795 |
sleep(2000); |
|
796 |
let content = utils.getClipboardText(); |
|
797 |
if (content) { |
|
798 |
let index = content.lastIndexOf("http"); |
|
799 |
let link = content.slice(index); |
|
800 |
return link; |
|
801 |
} else { |
|
802 |
return null; |
|
803 |
} |
|
804 |
} |
|
805 |
} |
|
806 |
} |
|
807 |
} catch (e) { |
|
808 |
logd('获取视频地址失败:' + e); |
b2d3f7
|
809 |
dynamicData.deviceLog(false, {log_detail: '获取视频地址失败:' + e}); |
bc5e1e
|
810 |
return null; |
X |
811 |
} |
|
812 |
} |
|
813 |
|
|
814 |
|
|
815 |
/** |
|
816 |
* description 获取作品信息 |
|
817 |
* @param platform {number} : 平台 |
|
818 |
* @return {object} : 返回节点信息 |
|
819 |
*/ |
|
820 |
actions.prototype.getVideoInfo = function (platform) { |
|
821 |
let startNum = 3, info = {}; //重试次数, 节点信息 |
|
822 |
let num = 0; |
|
823 |
while (num < startNum) { |
b2d3f7
|
824 |
try { |
bc5e1e
|
825 |
switch (platform) { |
X |
826 |
case 1: //抖音 |
b2d3f7
|
827 |
info.nameSelector = id("com.ss.android.ugc.aweme:id/title").getOneNodeInfo(10 * 1000); //用户名称 |
P |
828 |
info.postSelector = id("com.ss.android.ugc.aweme:id/desc").getOneNodeInfo(10 * 1000); //作品名称 |
|
829 |
info.avatarSelector = id("com.ss.android.ugc.aweme:id/user_avatar").getOneNodeInfo(10 * 1000); //头像 |
|
830 |
info.commentSelector = id("com.ss.android.ugc.aweme:id/comment_container").getOneNodeInfo(10 * 1000); // 评论按钮 |
|
831 |
info.commentCountSelector = id("com.ss.android.ugc.aweme:id/comment_container").getOneNodeInfo(10 * 1000).nextSiblings()[0].child(0); //评论数 |
|
832 |
break; |
|
833 |
case 2: //小红书 |
|
834 |
info.nameSelector = id("com.xingin.xhs:id/matrixNickNameView").getOneNodeInfo(10 * 1000); |
|
835 |
info.postSelector = id("com.xingin.xhs:id/noteContentText").getOneNodeInfo(10 * 1000); |
|
836 |
info.avatarSelector = id("com.xingin.xhs:id/matrixAvatarView").getOneNodeInfo(10 * 1000); |
|
837 |
info.commentSelector = id("com.xingin.xhs:id/commentLayout").getOneNodeInfo(10 * 1000); |
|
838 |
info.commentCountSelector = id("com.xingin.xhs:id/commentLayout").getOneNodeInfo(10 * 1000).child(1); |
|
839 |
break; |
|
840 |
case 3: //快手 |
|
841 |
info.nameSelector = id("com.smile.gifmaker:id/user_name_text_view").getOneNodeInfo(10 * 1000); |
|
842 |
info.postSelector = id("com.smile.gifmaker:id/element_caption_label").getOneNodeInfo(10 * 1000); |
|
843 |
info.avatarSelector = id("com.smile.gifmaker:id/follow_avatar_view").getOneNodeInfo(10 * 1000); |
|
844 |
info.commentSelector = id("com.smile.gifmaker:id/comment_icon").getOneNodeInfo(10 * 1000); |
|
845 |
info.commentCountSelector = id("com.smile.gifmaker:id/comment_count_view").getOneNodeInfo(10 * 1000); |
bc5e1e
|
846 |
} |
X |
847 |
if (info.nameSelector && info.postSelector && info.avatarSelector && info.commentSelector && info.commentCountSelector) { |
|
848 |
break; |
|
849 |
} else { |
|
850 |
info = null; |
|
851 |
} |
|
852 |
} catch (e) { |
|
853 |
info = null; |
|
854 |
} |
|
855 |
num++; |
|
856 |
} |
|
857 |
return info; |
|
858 |
} |
|
859 |
|
|
860 |
|
|
861 |
/** |
|
862 |
* description 随机翻页 |
|
863 |
*/ |
|
864 |
actions.prototype.randomSwiper = function () { |
|
865 |
let max_swiperTimes = random(1, 3); //翻页次数 |
|
866 |
let swiperTimes = 0; |
|
867 |
while (swiperTimes < max_swiperTimes) { |
|
868 |
swiper.pageSwiper(); //翻页 |
|
869 |
logd('随机翻页第' + (swiperTimes + 1) + '次'); |
b2d3f7
|
870 |
let log = {log_detail: '随机翻页第' + (swiperTimes + 1) + '次', operate_type: 15}; |
bc5e1e
|
871 |
dynamicData.deviceLog(false, log); |
X |
872 |
dynamicData.insertTrace(log); |
|
873 |
swiperTimes++; |
b2d3f7
|
874 |
sleep(random(4000, 6000)); |
bc5e1e
|
875 |
} |
X |
876 |
} |
|
877 |
|
|
878 |
/** |
|
879 |
* description 视频翻页 |
|
880 |
* @param log {object} : 日志参数组 |
|
881 |
*/ |
|
882 |
actions.prototype.videoSwiper = function (log) { |
|
883 |
let logInfo = log ? log : {}; |
|
884 |
logInfo.log_detail = '视频翻页'; |
|
885 |
logInfo.operate_type = 15; |
|
886 |
swiper.pageSwiper(); |
|
887 |
logd('视频翻页'); |
|
888 |
dynamicData.deviceLog(false, logInfo); |
b2d3f7
|
889 |
// dynamicData.insertTrace(logInfo); |
bc5e1e
|
890 |
} |
X |
891 |
|
|
892 |
|
|
893 |
/** |
|
894 |
* description 脚本异常日志 |
|
895 |
* @param log_detail {string} : 日志明细 |
|
896 |
*/ |
|
897 |
actions.prototype.exceptionLog = function (log_detail) { |
|
898 |
let error = { |
b2d3f7
|
899 |
log_detail: log_detail, |
P |
900 |
operate_type: 16 |
bc5e1e
|
901 |
} |
X |
902 |
logd(error); |
|
903 |
dynamicData.deviceLog(false, error); |
|
904 |
dynamicData.insertTrace(error); |
|
905 |
} |
|
906 |
|
|
907 |
|
|
908 |
/** |
|
909 |
* description 自定义返回函数 |
|
910 |
* @param page {number} : 返回页数 |
|
911 |
*/ |
|
912 |
actions.prototype.go_back = function (page) { |
|
913 |
let count = 0; |
|
914 |
while (count < page) { |
|
915 |
back(); |
|
916 |
count++; |
|
917 |
sleep(3500); |
|
918 |
} |
|
919 |
} |
|
920 |
|
|
921 |
|
|
922 |
/** |
|
923 |
* 分发数据给对应设备 |
|
924 |
* @param deviceNos {string} : 设备信息 |
|
925 |
* @param data {string} : 数据 |
|
926 |
* @param separator {string} : 数据分隔符 |
|
927 |
* @return {string} : 返回当前设备分配的数据 |
|
928 |
*/ |
|
929 |
actions.prototype.distributeDataToDevices = function (deviceNos, data, separator) { |
|
930 |
let deviceNo = ecloud.getDeviceNo(); //设备编号 |
|
931 |
let devicesArray = deviceNos.split(","); |
|
932 |
let dataArray = data.split(separator); |
|
933 |
for (let i = 0; i < devicesArray.length; i++) { |
|
934 |
if (devicesArray[i] === deviceNo && dataArray[i]) { |
|
935 |
return dataArray[i]; |
|
936 |
} |
|
937 |
} |
|
938 |
} |
|
939 |
|
|
940 |
|
|
941 |
/** |
|
942 |
* 数据按指定字符分割成数组 |
|
943 |
* @param data {string} : 数据 |
|
944 |
* @param separator {string} : 分割符 |
|
945 |
* @return {array} : 返回数据 |
|
946 |
*/ |
|
947 |
actions.prototype.splitData = function (data, separator) { |
|
948 |
let dataArray = data.split(separator); |
b2d3f7
|
949 |
let filterArray = dataArray.filter(function (value) { |
bc5e1e
|
950 |
return value !== undefined && value !== null && value !== ''; |
X |
951 |
}); |
|
952 |
return filterArray; |
|
953 |
} |
|
954 |
|
|
955 |
|
|
956 |
module.exports = new actions(); |