From a92c164af11161e0bad4eb58ed14c69bc9f3431c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B2=A1=E5=A4=8D=E4=B9=A0?= <2353956224@qq.com> Date: Mon, 4 Aug 2025 13:07:36 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=B7=E7=9B=B4=E6=92=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/utils/wsActions.js | 6 +- src/views/VideoStream.vue | 129 +++++++++++++++++++++++++++----------- 2 files changed, 96 insertions(+), 39 deletions(-) diff --git a/src/utils/wsActions.js b/src/utils/wsActions.js index 7908329..e187478 100644 --- a/src/utils/wsActions.js +++ b/src/utils/wsActions.js @@ -45,9 +45,13 @@ export function createWsActions(wslist) { search: (udid, index) => send(index, { udid, action: 'click', type: 'search', index, resourceId: 'com.zhiliaoapp.musically:id/gtz' }), //搜索页面 searchHost: (udid, index) => send(index, { udid, action: 'click', type: 'searchHost', index, resourceId: 'com.zhiliaoapp.musically:id/t6f' }), //搜索主播 toHost: (udid, index) => send(index, { udid, action: 'click', type: 'toHost', index, resourceId: 'com.zhiliaoapp.musically:id/iso' }), //进入主页二 + toLive: (udid, index) => send(index, { udid, action: 'click', type: 'toLive', index, resourceId: 'com.zhiliaoapp.musically:id/gtz' }), //直播页面 + isHead: (udid, index) => send(index, { udid, action: 'click', type: 'isHead', index, resourceId: 'com.zhiliaoapp.musically:id/i32' }), //主播页面 + isOneLive: (udid, index) => send(index, { udid, action: 'click', type: 'isOneLive', index, resourceId: 'com.zhiliaoapp.musically:id/s1w' }), //判断是否是单人直播 hostVideo: (udid, index, num) => send(index, { udid, action: 'click', type: 'hostVideo', index, resourceId: 'com.zhiliaoapp.musically:id/d3u', num: num }), //主播视频 test: (udid, index) => send(index, { udid, action: 'test', type: 'test', index, resourceId: 'com.zhiliaoapp.musically:id/TESTFFFXXX' }), //截屏测试 - test2: (udid, index) => send(index, { udid, action: 'dump', type: 'test', index, resourceId: 'com.zhiliaoapp.musically:id/kg4' }), //截屏测试 + + // test2: (udid, index) => send(index, { udid, action: 'dump', type: 'test', index, resourceId: 'com.zhiliaoapp.musically:id/kg4' }), //截屏测试 }; } diff --git a/src/views/VideoStream.vue b/src/views/VideoStream.vue index 15d9ee2..912e7a4 100644 --- a/src/views/VideoStream.vue +++ b/src/views/VideoStream.vue @@ -24,7 +24,7 @@ 私信输入 私信发送 --> 刷新 - 123 +
@@ -35,6 +35,7 @@ 打开tiktok 重置tiktok + 打开直播 {{ runType[0] == 'like' ? '养号中' : '一键养号' }} @@ -45,17 +46,6 @@ 全部停止 登出
-
- -
- - -
- -
-
- - - -
@@ -119,7 +102,8 @@ 发送 打印ui节点树 - 等待 + 判断单人还是双人 + 下滑 关闭当前应用 安装 APK 文件 传送文件 @@ -265,12 +249,7 @@ const initVideoStream = (udid, index) => { setTimeout(() => { wslist[index].send(openStr); }, 300); - // playTimer.value[index] = setTimeout(() => { - // instanceList.value[index].converter.play(); - // }, 3000); - //`````````````````````````````````````````````````````````````````````````````````` wsCache.set(udid, instanceList.value[index]); - //`````````````````````````````````````````````````````````````````````````````````` }; const magicSize = stringToUtf8ByteArray('scrcpy_message'); // 3. 处理接收到的二进制数据 @@ -351,8 +330,11 @@ const initVideoStream = (udid, index) => { console.log('尺寸系数', iponeCoefficient.value[index]) } else { console.log(resData.type, '坐标返回:x:', resData.x, 'y:', resData.y); - // clickxy(resData.x * 0.3, resData.y * 0.3, index) } + + + + phoneXYinfo.value[index].id = resData.udid if (resData.type == 'Likes') {//判断是否是 点赞 phoneXYinfo.value[index].Likes = { x: resData.x * iponeCoefficient.value[index].width, y: resData.y * iponeCoefficient.value[index].height } @@ -366,9 +348,6 @@ const initVideoStream = (udid, index) => { textContent.value[index] = resData.message } else if (resData.type == 'Comtext') {//评论输入 phoneXYinfo.value[index].Comtext = { x: resData.x * iponeCoefficient.value[index].width, y: resData.y * iponeCoefficient.value[index].height } - // setTimeout(() => { - // setComText(index)//粘贴内容 - // }, 1000) } else if (resData.type == 'ComPush') {//评论发送 phoneXYinfo.value[index].ComPush = { x: resData.x * iponeCoefficient.value[index].width, y: resData.y * iponeCoefficient.value[index].height } setTimeout(() => { @@ -394,10 +373,6 @@ const initVideoStream = (udid, index) => { // LikesToCommentToComPush(deviceInformation.value[index].udid, index) //是否继续循环任务 } else if (resData.type == 'return') {//私信评论 phoneXYinfo.value[index].return = { x: resData.x * iponeCoefficient.value[index].width, y: resData.y * iponeCoefficient.value[index].height } - // wsActions.slideDown(deviceInformation.value[index].udid, index)//是否继续下一个视频 - // setTimeout(() => { - // LikesToCommentToComPush(deviceInformation.value[index].udid, index) - // }, 1000); } else if (resData.type == 'addHost') {//添加关注 phoneXYinfo.value[index].addHost = { x: resData.x * iponeCoefficient.value[index].width, y: resData.y * iponeCoefficient.value[index].height } wsActions.slideDown(deviceInformation.value[index].udid, index)//是否继续下一个视频 @@ -455,7 +430,8 @@ const initVideoStream = (udid, index) => { } else if (resData.message == 1) { console.log('有关注', index) const randomNum = Math.random(); // 生成一个0到1之间的随机数 - if (randomNum < 0.6) { + //是否点赞评论的概率 + if (randomNum < 0.07) { console.log('进行点赞评论', index) LikesToCommentToComPush(deviceInformation.value[index].udid, index) } else { @@ -466,7 +442,56 @@ const initVideoStream = (udid, index) => { } } else if (resData.type == 'openDY') {//视频关注主播 createTaskQueue(index).clear();//清除队伍中的任务 + } else if (resData.type == 'toLive') {//打开直播 + + wsActions.isHead(deviceInformation.value[index].udid, index)//判断直播 + + } else if (resData.type == 'isHead') {//判断有没有头像 + if (resData.message == 1) { + wsActions.isOneLive(deviceInformation.value[index].udid, index)//判断直播 + } else { + return + } + + } else if (resData.type == 'isOneLive') {//判断单人还是双人 + if (resData.message == 0) { + wsActions.slideDown(deviceInformation.value[index].udid, index)//是否继续下一个视频 + wsActions.isHead(deviceInformation.value[index].udid, index)//判断直播 + return + } + // 用法: + (async () => { + const result = await randomDelayAndExecute(); + //30%概率 + if (result) { + + let count = 0; + const num = Math.floor(Math.random() * 31) + 5; + const interval = setInterval(() => { + if (count >= num) { + clearInterval(interval); + wsActions.slideDown(deviceInformation.value[index].udid, index)//是否继续下一个视频 + wsActions.isHead(deviceInformation.value[index].udid, index)//判断直播 + + return; + } + clickxy( + resData.x * iponeCoefficient.value[index].width, + resData.y * iponeCoefficient.value[index].height, + index + ) + count++; + }, 300); + return; + } else { + wsActions.slideDown(deviceInformation.value[index].udid, index)//是否继续下一个视频 + wsActions.isHead(deviceInformation.value[index].udid, index)//判断直播 + return + } + })(); + } + setphoneXYinfo(phoneXYinfo.value) if (resData.type != 'isHost') { if (resData.type == 'hostVideo' || resData.type == 'Likes') { @@ -784,10 +809,11 @@ onMounted(() => { } else { stroageHost.value = getHostList() stroageHost.value.push(({ country: data.country, text: data.hostsId, state: false })) - setHostList(stroageHost.value) + if (isMsgPop.value) { + setHostList(stroageHost.value) + } + } - - //更新状态 // update( // { @@ -1260,6 +1286,27 @@ function randomSeeVideo(udid, index) { wsActions.isHost(udid, index)//检测 }, delay); } +//延迟3-4分钟后秒后检测关注 +async function randomDelayAndExecute() { + const minDelay = 1 * 60 * 1000; + const maxDelay = 4 * 60 * 1000; + const randomDelay = Math.floor(Math.random() * (maxDelay - minDelay + 1)) + minDelay; + + console.log(`将延迟 ${Math.round(randomDelay / 1000)} 秒后执行...`); + + return new Promise((resolve) => { + setTimeout(() => { + const randomNum = Math.floor(Math.random() * 100); + if (randomNum < 30) { + console.log("30%概率触发"); + resolve(true); + } else { + console.log("70%概率触发"); + resolve(false); + } + }, randomDelay); + }); +} //选中样式 function getVideoStyle(index) { @@ -1345,7 +1392,13 @@ function parentNum() { wsActions.isHost(device.udid, index) }) } - +function brushLive() { + isStop.value = false; + deviceInformation.value.forEach((device, index) => { + // runType.value[index] = 'brushLive' + wsActions.toLive(device.udid, index) + }) +} //确认多行文本框内容 function onDialogConfirm(result, type, index) { console.log(result, type, index);