2.0版本
This commit is contained in:
@@ -49,3 +49,17 @@ export function upholdinfo(data) {
|
|||||||
export function getCountryinfo(data) {
|
export function getCountryinfo(data) {
|
||||||
return postAxios({ url: 'api/tkinfo/countryinfo', data })
|
return postAxios({ url: 'api/tkinfo/countryinfo', data })
|
||||||
}
|
}
|
||||||
|
//修改主播建联状态
|
||||||
|
export function update(data) {
|
||||||
|
return postAxios({ url: 'api/save_data/update', data })
|
||||||
|
}
|
||||||
|
|
||||||
|
//获取话术
|
||||||
|
export function prologue(data) {
|
||||||
|
return getAxios({ url: 'api/common/prologue', data })
|
||||||
|
}
|
||||||
|
|
||||||
|
//获取评论
|
||||||
|
export function comment(data) {
|
||||||
|
return getAxios({ url: 'api/common/comment', data })
|
||||||
|
}
|
||||||
@@ -5,6 +5,10 @@ export function chat(data) {
|
|||||||
return postAxios({ url: '/chat', data })
|
return postAxios({ url: '/chat', data })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function translationToChinese(data) {
|
||||||
|
return postAxios({ url: '/translationToChinese', data })
|
||||||
|
}
|
||||||
|
|
||||||
export function translation(data) {
|
export function translation(data) {
|
||||||
return postAxios({ url: '/translation', data })
|
return postAxios({ url: '/translation', data })
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,9 @@
|
|||||||
<el-scrollbar class="chat-box">
|
<el-scrollbar class="chat-box">
|
||||||
<div v-for="(msg, index) in messages" :key="index"
|
<div v-for="(msg, index) in messages" :key="index"
|
||||||
:class="msg.position === 'left' ? 'left-message' : 'right-message'">
|
:class="msg.position === 'left' ? 'left-message' : 'right-message'">
|
||||||
<div :class="['bubble', msg.position]">{{ msg.text }}</div>
|
<div @click="fallbackCopyTextToClipboard(index, msg.text)"
|
||||||
|
:class="['bubble', msg.position, { 'active': activeIndex === index }]">{{ msg.text }}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</el-scrollbar>
|
</el-scrollbar>
|
||||||
</div>
|
</div>
|
||||||
@@ -13,7 +15,8 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { defineProps, defineEmits } from 'vue'
|
import { defineProps, defineEmits, ref } from 'vue'
|
||||||
|
import { ElMessage } from 'element-plus'
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
visible: Boolean,
|
visible: Boolean,
|
||||||
@@ -27,6 +30,34 @@ const props = defineProps({
|
|||||||
const emit = defineEmits(['close'])
|
const emit = defineEmits(['close'])
|
||||||
|
|
||||||
const close = () => emit('close')
|
const close = () => emit('close')
|
||||||
|
|
||||||
|
let activeIndex = ref(null);
|
||||||
|
|
||||||
|
// 兜底方案:传统复制方法
|
||||||
|
function fallbackCopyTextToClipboard(index, text) {
|
||||||
|
activeIndex.value = index;
|
||||||
|
const textArea = document.createElement('textarea');
|
||||||
|
textArea.value = text;
|
||||||
|
textArea.style.position = 'fixed';
|
||||||
|
textArea.style.left = '-999999px';
|
||||||
|
textArea.style.top = '-999999px';
|
||||||
|
document.body.appendChild(textArea);
|
||||||
|
textArea.focus();
|
||||||
|
textArea.select();
|
||||||
|
|
||||||
|
try {
|
||||||
|
const successful = document.execCommand('copy');
|
||||||
|
if (successful) {
|
||||||
|
ElMessage.success('复制成功');
|
||||||
|
} else {
|
||||||
|
ElMessage.error('复制失败1');
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
ElMessage.error('复制失败2');
|
||||||
|
}
|
||||||
|
|
||||||
|
document.body.removeChild(textArea);
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
@@ -70,6 +101,11 @@ const close = () => emit('close')
|
|||||||
word-break: break-word;
|
word-break: break-word;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.bubble.active {
|
||||||
|
box-shadow: 0 0 15px 3px rgba(74, 144, 226, 0.7);
|
||||||
|
border: 1px solid #4a90e2;
|
||||||
|
}
|
||||||
|
|
||||||
.bubble.left {
|
.bubble.left {
|
||||||
background-color: #ffffff;
|
background-color: #ffffff;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
<template>
|
<template>
|
||||||
<el-dialog draggable :title="title" v-model="visibleLocal" width="600px" @close="handleCancel">
|
<el-dialog draggable :title="title" v-model="visibleLocal" width="600px" @close="handleCancel">
|
||||||
|
|
||||||
<el-input type="textarea" v-model="rawText" :rows="10" :placeholder="placeholder" clearable></el-input>
|
<el-input type="textarea" v-model="rawText" :rows="10" :placeholder="placeholder" clearable></el-input>
|
||||||
<template #footer>
|
<template #footer>
|
||||||
|
<el-button v-if="title !== '主播ID'" type="success" @click="exportPrologue(title)">导入{{ title }}</el-button>
|
||||||
<el-button @click="handleCancel">取消</el-button>
|
<el-button @click="handleCancel">取消</el-button>
|
||||||
<el-button type="primary" @click="handleConfirm">确定</el-button>
|
<el-button type="primary" @click="handleConfirm">确定</el-button>
|
||||||
</template>
|
</template>
|
||||||
@@ -10,6 +12,7 @@
|
|||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, computed, watch } from 'vue';
|
import { ref, computed, watch } from 'vue';
|
||||||
|
import { prologue, comment } from '@/api/account';
|
||||||
|
|
||||||
// 定义接收的 props
|
// 定义接收的 props
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
@@ -97,9 +100,25 @@ function handleConfirm() {
|
|||||||
|
|
||||||
/** 点击取消或对话框关闭 */
|
/** 点击取消或对话框关闭 */
|
||||||
function handleCancel() {
|
function handleCancel() {
|
||||||
|
rawText.value = '';
|
||||||
emit('update:visible', false);
|
emit('update:visible', false);
|
||||||
emit('cancel');
|
emit('cancel');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function exportPrologue(title) {
|
||||||
|
if (title === '评论') {
|
||||||
|
comment().then((res) => {
|
||||||
|
console.log(res);
|
||||||
|
rawText.value = res.map(item => item).join('\n\n');
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
prologue().then((res) => {
|
||||||
|
console.log(res);
|
||||||
|
rawText.value = res.map(item => item).join('\n\n');
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
|||||||
@@ -11,14 +11,14 @@ import { ElMessage } from 'element-plus';
|
|||||||
|
|
||||||
// const { stopScript } = usePythonBridge();
|
// const { stopScript } = usePythonBridge();
|
||||||
|
|
||||||
const specialBaseURL = 'http://120.26.251.180:15330'
|
const specialBaseURL = 'http://ai.zhukeping.com'
|
||||||
const specialUrlPrefixes = ['chat', 'translation'] // 示例路径前缀
|
const specialUrlPrefixes = ['chat', 'translation', 'translationToChinese'] // 示例路径前缀
|
||||||
// 请求地址前缀
|
// 请求地址前缀
|
||||||
let baseURL = ''
|
let baseURL = ''
|
||||||
if (process.env.NODE_ENV === 'development') {
|
if (process.env.NODE_ENV === 'development') {
|
||||||
// 生产环境
|
// 生产环境
|
||||||
// baseURL = "https://api.tkpage.yolozs.com"
|
// baseURL = "https://api.tkpage.yolozs.com"
|
||||||
// baseURL = "http://192.168.1.174:8101"
|
// baseURL = "http://192.168.1.155:8101"
|
||||||
baseURL = "http://47.79.98.113:8101"
|
baseURL = "http://47.79.98.113:8101"
|
||||||
} else {
|
} else {
|
||||||
// 测试环境
|
// 测试环境
|
||||||
@@ -56,9 +56,9 @@ axios.interceptors.request.use((config) => {
|
|||||||
|
|
||||||
// 响应拦截器
|
// 响应拦截器
|
||||||
axios.interceptors.response.use((response) => {
|
axios.interceptors.response.use((response) => {
|
||||||
console.log("response", response.data)
|
// console.log("response", response.data)
|
||||||
if (response.data.code == 0 || response.data.code == 200) {
|
if (response.data.code == 0 || response.data.code == 200) {
|
||||||
console.log("response", response.data.data)
|
// console.log("response", response.data.data)
|
||||||
return response.data.data
|
return response.data.data
|
||||||
} else if (response.data.code == 40400) {
|
} else if (response.data.code == 40400) {
|
||||||
// stopScript();
|
// stopScript();
|
||||||
|
|||||||
44
src/utils/sseUtils.js
Normal file
44
src/utils/sseUtils.js
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
//初始化sse连接
|
||||||
|
let eventSource = null
|
||||||
|
//重连延迟
|
||||||
|
let retryTimeout = null
|
||||||
|
export function connectSSE(url, onMessage) {
|
||||||
|
// 如果已有连接,先关闭
|
||||||
|
if (eventSource) {
|
||||||
|
eventSource.close()
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log('[SSE] 正在连接:', url)
|
||||||
|
|
||||||
|
eventSource = new EventSource(url)
|
||||||
|
|
||||||
|
eventSource.onopen = () => {
|
||||||
|
console.log('[SSE] 连接已建立')
|
||||||
|
}
|
||||||
|
|
||||||
|
eventSource.onmessage = (event) => {
|
||||||
|
try {
|
||||||
|
const data = JSON.parse(event.data)
|
||||||
|
if (onMessage) onMessage(data)
|
||||||
|
} catch (e) {
|
||||||
|
if (onMessage) onMessage(event.data)
|
||||||
|
console.warn('[SSE] 消息解析失败:', event.data)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
eventSource.onerror = (err) => {
|
||||||
|
console.error('[SSE] 连接错误:', err)
|
||||||
|
|
||||||
|
eventSource.close()
|
||||||
|
eventSource = null
|
||||||
|
|
||||||
|
// 避免重复重连
|
||||||
|
if (retryTimeout) clearTimeout(retryTimeout)
|
||||||
|
|
||||||
|
// 3秒后重连
|
||||||
|
retryTimeout = setTimeout(() => {
|
||||||
|
console.log('[SSE] 尝试重新连接...')
|
||||||
|
connectSSE(url, onMessage)
|
||||||
|
}, 1000)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -14,7 +14,7 @@ export function setUser(user) {
|
|||||||
|
|
||||||
localStorage.setItem('user', JSON.stringify(user));
|
localStorage.setItem('user', JSON.stringify(user));
|
||||||
}
|
}
|
||||||
|
//获取用户信息
|
||||||
export function getUser() {
|
export function getUser() {
|
||||||
return JSON.parse(localStorage.getItem('user'));
|
return JSON.parse(localStorage.getItem('user'));
|
||||||
}
|
}
|
||||||
@@ -43,3 +43,41 @@ export function setphoneXYinfo(data) {
|
|||||||
export function getphoneXYinfo() {
|
export function getphoneXYinfo() {
|
||||||
return JSON.parse(localStorage.getItem('XYinfo'));
|
return JSON.parse(localStorage.getItem('XYinfo'));
|
||||||
}
|
}
|
||||||
|
// 用于获取主播信息
|
||||||
|
export function getHostList() {
|
||||||
|
return JSON.parse(localStorage.getItem('hostList'));
|
||||||
|
}
|
||||||
|
// 用于设置主播信息
|
||||||
|
export function setHostList(data) {
|
||||||
|
localStorage.setItem('hostList', JSON.stringify(data));
|
||||||
|
}
|
||||||
|
|
||||||
|
// 用于获取私信信息
|
||||||
|
export function getContentpriList() {
|
||||||
|
const arr = JSON.parse(localStorage.getItem('Contentpri'))
|
||||||
|
return [arr, arr, arr, arr, arr, arr, arr, arr];
|
||||||
|
}
|
||||||
|
// 用于设置私信信息
|
||||||
|
export function setContentpriList(data) {
|
||||||
|
localStorage.setItem('Contentpri', JSON.stringify(data));
|
||||||
|
}
|
||||||
|
|
||||||
|
// 用于获取评论信息
|
||||||
|
export function getContentList() {
|
||||||
|
const arr = JSON.parse(localStorage.getItem('Content'))
|
||||||
|
return [arr, arr, arr, arr, arr, arr, arr, arr];
|
||||||
|
}
|
||||||
|
// 用于设置评论信息
|
||||||
|
export function setContentList(data) {
|
||||||
|
localStorage.setItem('Content', JSON.stringify(data));
|
||||||
|
}
|
||||||
|
// 用于绘画信息
|
||||||
|
// export function setContentList(data) {
|
||||||
|
// sessionStorage.setItem('Content', JSON.stringify(data));
|
||||||
|
// }
|
||||||
|
|
||||||
|
// // 用于获取评论信息
|
||||||
|
// export function getContentList() {
|
||||||
|
// const arr = JSON.parse(sessionStorage.getItem('Content'))
|
||||||
|
// return [arr, arr, arr, arr, arr, arr, arr, arr];
|
||||||
|
// }
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
// src/utils/wsActions.js
|
// src/utils/wsActions.js
|
||||||
|
|
||||||
// 传入 wslist、isStopLike 等需要依赖的外部变量
|
// 传入 wslist、isStopLike 等需要依赖的外部变量
|
||||||
export function createWsActions(wslist, isStopLike = null) {
|
export function createWsActions(wslist) {
|
||||||
// 通用 ws 发送方法
|
// 通用 ws 发送方法
|
||||||
function send(index, payload) {
|
function send(index, payload) {
|
||||||
if (wslist[index]) {
|
if (wslist[index]) {
|
||||||
@@ -34,18 +34,20 @@ export function createWsActions(wslist, isStopLike = null) {
|
|||||||
clickPrivatetext: (udid, index) => send(index, { udid, action: 'click', type: 'Privatetex', index, resourceId: 'com.zhiliaoapp.musically:id/hob' }), //私信输入框
|
clickPrivatetext: (udid, index) => send(index, { udid, action: 'click', type: 'Privatetex', index, resourceId: 'com.zhiliaoapp.musically:id/hob' }), //私信输入框
|
||||||
clickPrivatePush: (udid, index) => send(index, { udid, action: 'click', type: 'PrivatePush', index, resourceId: 'com.zhiliaoapp.musically:id/hog' }),//私信发送
|
clickPrivatePush: (udid, index) => send(index, { udid, action: 'click', type: 'PrivatePush', index, resourceId: 'com.zhiliaoapp.musically:id/hog' }),//私信发送
|
||||||
clickCopy: (udid, index) => send(index, { udid, action: 'click', type: 'clickCopy', index, resourceId: 'com.zhiliaoapp.musically:id/kg4' }),//查询最后一条信息并返回位置
|
clickCopy: (udid, index) => send(index, { udid, action: 'click', type: 'clickCopy', index, resourceId: 'com.zhiliaoapp.musically:id/kg4' }),//查询最后一条信息并返回位置
|
||||||
clickCopyList: (udid, index) => send(index, { udid, action: 'click', type: 'clickCopyList', index, resourceId: 'com.zhiliaoapp.musically:id/kg4' }),//查询最后一条信息并返回位置
|
clickCopyList: (udid, index) => send(index, { udid, action: 'dump', type: 'clickCopyList', index, resourceId: 'com.zhiliaoapp.musically:id/kg4' }),//查询最后一条信息并返回位置
|
||||||
clickCopyText: (udid, index) => send(index, { udid, action: 'click', type: 'clickCopyText', index, resourceId: 'com.zhiliaoapp.musically:id/ui' }),//点击复制文字
|
clickCopyText: (udid, index) => send(index, { udid, action: 'click', type: 'clickCopyText', index, resourceId: 'com.zhiliaoapp.musically:id/ui' }),//点击复制文字
|
||||||
getmesNum: (udid, index) => send(index, { udid, action: 'click', type: 'getmesNum', index, resourceId: 'com.zhiliaoapp.musically:id/jyv' }), //获取收件箱消息数量
|
getmesNum: (udid, index) => send(index, { udid, action: 'dump', type: 'getmesNum', index, resourceId: 'com.zhiliaoapp.musically:id/jyv' }), //获取收件箱消息数量
|
||||||
clickMesage: (udid, index) => send(index, { udid, action: 'click', type: 'clickMesage', index, resourceId: 'com.zhiliaoapp.musically:id/e3_' }), //点击有消息的私信
|
clickMesage: (udid, index) => send(index, { udid, action: 'click', type: 'clickMesage', index, resourceId: 'com.zhiliaoapp.musically:id/e3_' }), //点击有消息的私信
|
||||||
isVideoAndLive: (udid, index) => send(index, { udid, action: 'click', type: 'isVideoAndLive', index, resourceId: 'com.zhiliaoapp.musically:id/long_press_layout' }), //获取是视频还是直播
|
clickSysMesage: (udid, index) => send(index, { udid, action: 'click', type: 'clickSysMesage', index, resourceId: 'com.zhiliaoapp.musically:id/j7s' }), //点击有消息的系统通知
|
||||||
|
// isVideoAndLive: (udid, index) => send(index, { udid, action: 'click', type: 'isVideoAndLive', index, resourceId: 'com.zhiliaoapp.musically:id/long_press_layout' }), //获取是视频还是直播
|
||||||
addHost: (udid, index) => send(index, { udid, action: 'click', type: 'addHost', index, resourceId: 'com.zhiliaoapp.musically:id/fuq' }), //视频页面的关注
|
addHost: (udid, index) => send(index, { udid, action: 'click', type: 'addHost', index, resourceId: 'com.zhiliaoapp.musically:id/fuq' }), //视频页面的关注
|
||||||
isHost: (udid, index) => send(index, { udid, action: 'click', type: 'isHost', index, resourceId: 'com.zhiliaoapp.musically:id/fuq' }), //判断视频页面的关注
|
isHost: (udid, index) => send(index, { udid, action: 'click', type: 'isHost', index, resourceId: 'com.zhiliaoapp.musically:id/fuq' }), //判断视频页面的关注
|
||||||
search: (udid, index) => send(index, { udid, action: 'click', type: 'search', index, resourceId: 'com.zhiliaoapp.musically:id/gtz' }), //搜索页面
|
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' }), //搜索主播
|
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' }), //进入主页二
|
toHost: (udid, index) => send(index, { udid, action: 'click', type: 'toHost', index, resourceId: 'com.zhiliaoapp.musically:id/iso' }), //进入主页二
|
||||||
hostVideo: (udid, index, num) => send(index, { udid, action: 'click', type: 'hostVideo', index, resourceId: 'com.zhiliaoapp.musically:id/d3u', num: num }), //主播视频
|
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: 'click', type: 'test', index, resourceId: 'com.zhiliaoapp.musically:id/j7s' }), //截屏测试
|
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' }), //截屏测试
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,6 +24,7 @@
|
|||||||
<el-button @click="clickPrivatetext(device.udid, index)">私信输入</el-button>
|
<el-button @click="clickPrivatetext(device.udid, index)">私信输入</el-button>
|
||||||
<el-button @click="clickPrivatePush(device.udid, index)">私信发送</el-button> -->
|
<el-button @click="clickPrivatePush(device.udid, index)">私信发送</el-button> -->
|
||||||
<el-button type="warning" @click="reload()">刷新</el-button>
|
<el-button type="warning" @click="reload()">刷新</el-button>
|
||||||
|
<el-button type="warning" @click="opentanchuan()">123</el-button>
|
||||||
<div></div>
|
<div></div>
|
||||||
<!-- <el-button @click="wsActions.clickCopy(device.udid, index)">找私信</el-button> -->
|
<!-- <el-button @click="wsActions.clickCopy(device.udid, index)">找私信</el-button> -->
|
||||||
<!-- <el-button @click="wsActions.clickCopyList(device.udid, index)">私信列表</el-button> -->
|
<!-- <el-button @click="wsActions.clickCopyList(device.udid, index)">私信列表</el-button> -->
|
||||||
@@ -33,7 +34,10 @@
|
|||||||
<!-- <el-button @click="wsActions.slideRight(device.udid, index)">右滑</el-button> -->
|
<!-- <el-button @click="wsActions.slideRight(device.udid, index)">右滑</el-button> -->
|
||||||
<!-- <el-button @click="wsActions.isHost(device.udid, index)">一键养号</el-button> -->
|
<!-- <el-button @click="wsActions.isHost(device.udid, index)">一键养号</el-button> -->
|
||||||
<el-button type="success" @click="openTk()">打开tiktok</el-button>
|
<el-button type="success" @click="openTk()">打开tiktok</el-button>
|
||||||
<el-button type="success" @click="showDialog = true; dialogTitle = '评论'; selectedDevice = 999">一键养号</el-button>
|
<el-button type="success" @click="resetTk()">重置tiktok</el-button>
|
||||||
|
|
||||||
|
<el-button :type="runType[0] == 'like' ? 'danger' : 'success'" @click="parentNum()">{{ runType[0] == 'like' ?
|
||||||
|
'养号中' : '一键养号' }}</el-button>
|
||||||
<el-button type="success"
|
<el-button type="success"
|
||||||
@click="showDialog = true; dialogTitle = '主播ID'; selectedDevice = 999">一键关注并打招呼</el-button>
|
@click="showDialog = true; dialogTitle = '主播ID'; selectedDevice = 999">一键关注并打招呼</el-button>
|
||||||
<el-button type="success" v-if="!isShowMes" @click="openMonitor()">开启监测消息</el-button>
|
<el-button type="success" v-if="!isShowMes" @click="openMonitor()">开启监测消息</el-button>
|
||||||
@@ -44,8 +48,8 @@
|
|||||||
<div></div>
|
<div></div>
|
||||||
<!-- <el-button @click="wsActions.test(device.udid, index)">截屏</el-button> -->
|
<!-- <el-button @click="wsActions.test(device.udid, index)">截屏</el-button> -->
|
||||||
<div></div>
|
<div></div>
|
||||||
<!-- <el-button @click="wsActions.search(device.udid, index)">搜索</el-button>
|
|
||||||
<div></div>
|
<!-- <div></div>
|
||||||
<el-button @click="wsActions.searchHost(device.udid, index)">搜主播</el-button>
|
<el-button @click="wsActions.searchHost(device.udid, index)">搜主播</el-button>
|
||||||
<div></div>
|
<div></div>
|
||||||
<el-button @click="wsActions.toHost(device.udid, index)">主页</el-button>
|
<el-button @click="wsActions.toHost(device.udid, index)">主页</el-button>
|
||||||
@@ -93,7 +97,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="input-info" v-show="selectedDevice == index" :style="{ left: phone.width * 1.4 + 4 + '0px' }">
|
<div class="input-info" v-show="selectedDevice == index" :style="{ left: phone.width * 1.4 + 4 + '0px' }">
|
||||||
<!-- <div class="input-info" v-show="false"> -->
|
<!-- <div class="input-info" v-show="false"> -->
|
||||||
<el-button @click="showDialog = true; dialogTitle = '主播ID';">批量关注</el-button>
|
<!-- <el-button @click="showDialog = true; dialogTitle = '主播ID';">批量关注</el-button> -->
|
||||||
<div></div>
|
<div></div>
|
||||||
<!-- <el-button @click="showDialog = true; dialogTitle = '评论';">导入评论</el-button> -->
|
<!-- <el-button @click="showDialog = true; dialogTitle = '评论';">导入评论</el-button> -->
|
||||||
<div></div>
|
<div></div>
|
||||||
@@ -102,8 +106,11 @@
|
|||||||
<!-- <el-button @click="showDialog = true; dialogTitle = '私信';">导入私信</el-button> -->
|
<!-- <el-button @click="showDialog = true; dialogTitle = '私信';">导入私信</el-button> -->
|
||||||
<div></div>
|
<div></div>
|
||||||
<el-button @click="getComArr(index, '私信')">查看私信</el-button>
|
<el-button @click="getComArr(index, '私信')">查看私信</el-button>
|
||||||
<el-button @click="wsActions.getmesNum(device.udid, index)">检测消息</el-button>
|
<!-- <el-button @click="wsActions.search(device.udid, index)">搜索</el-button> -->
|
||||||
|
<!-- <el-button @click="wsActions.getmesNum(device.udid, index)">检测消息</el-button> -->
|
||||||
<!-- <el-button @click="wsActions.clickMesage(device.udid, index)">进入消息</el-button> -->
|
<!-- <el-button @click="wsActions.clickMesage(device.udid, index)">进入消息</el-button> -->
|
||||||
|
<el-button @click="wsActions.clickSysMesage(device.udid, index)">进入消息</el-button>
|
||||||
|
<el-button @click="resetApp(device.udid, index)">重置应用</el-button>
|
||||||
<el-button
|
<el-button
|
||||||
@click="wsActions.clickCopyList(device.udid, index); openShowChat = true; istranslate = true">翻译本页对话</el-button>
|
@click="wsActions.clickCopyList(device.udid, index); openShowChat = true; istranslate = true">翻译本页对话</el-button>
|
||||||
<!-- <el-button @click="wsActions.getSize(device.udid, index)">获取屏幕尺寸</el-button> -->
|
<!-- <el-button @click="wsActions.getSize(device.udid, index)">获取屏幕尺寸</el-button> -->
|
||||||
@@ -111,8 +118,9 @@
|
|||||||
<el-input style="border: 1px solid #000;" v-model="textContent[index]" type="text"></el-input>
|
<el-input style="border: 1px solid #000;" v-model="textContent[index]" type="text"></el-input>
|
||||||
<el-button @click="setComText(index)">发送</el-button>
|
<el-button @click="setComText(index)">发送</el-button>
|
||||||
</div>
|
</div>
|
||||||
<el-button @click="wsActions.test(device.udid, index)">截屏</el-button>
|
<el-button @click="wsActions.test(device.udid, index)">打印ui节点树</el-button>
|
||||||
<el-button @click="wsActions.killNow(device.udid, index)">关闭</el-button>
|
<el-button @click="wsActions.test2(device.udid, index)">等待</el-button>
|
||||||
|
<el-button @click="wsActions.killNow(device.udid, index)">关闭当前应用</el-button>
|
||||||
<el-button @click="chooseFile(device.udid, index, 1, wsActions)">安装 APK 文件</el-button>
|
<el-button @click="chooseFile(device.udid, index, 1, wsActions)">安装 APK 文件</el-button>
|
||||||
<el-button @click="chooseFile(device.udid, index, 2, wsActions)">传送文件</el-button>
|
<el-button @click="chooseFile(device.udid, index, 2, wsActions)">传送文件</el-button>
|
||||||
<!-- <el-button @click="wsActions.isHost(device.udid, index)">一键养号</el-button> -->
|
<!-- <el-button @click="wsActions.isHost(device.udid, index)">一键养号</el-button> -->
|
||||||
@@ -137,23 +145,26 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import { ref, onMounted, onUnmounted, onBeforeUnmount, watch, inject } from "vue";
|
import { ref, onMounted, onUnmounted, onBeforeUnmount, watch, inject } from "vue";
|
||||||
import VideoConverter from "h264-converter";
|
import VideoConverter from "h264-converter";
|
||||||
import { Buffer } from 'buffer'; // 如果在浏览器环境需要引入buffer包
|
|
||||||
import { useRouter } from 'vue-router';
|
import { useRouter } from 'vue-router';
|
||||||
import { setphoneXYinfo, getphoneXYinfo } from '@/utils/storage'
|
import { setphoneXYinfo, getphoneXYinfo, getUser, getHostList, setHostList, getContentpriList, setContentpriList, getContentList, setContentList } from '@/utils/storage'
|
||||||
import { set } from "lodash";
|
|
||||||
import { toBufferBtn, stringToUtf8ByteArray, getClipboard, setClipboard, bufferToString, startsWithHeader, trimLongArray, base64ToBinary, toBuffer } from '@/utils/bufferUtils';
|
import { toBufferBtn, stringToUtf8ByteArray, getClipboard, setClipboard, bufferToString, startsWithHeader, trimLongArray, base64ToBinary, toBuffer } from '@/utils/bufferUtils';
|
||||||
import { createWsActions } from '@/utils/wsActions';
|
import { createWsActions } from '@/utils/wsActions';
|
||||||
import { ElMessage, ElMessageBox, ElLoading } from 'element-plus'
|
import { ElMessage, ElMessageBox, ElLoading } from 'element-plus'
|
||||||
import { chat, translation } from "@/api/chat";
|
import { chat, translationToChinese, translation } from "@/api/chat";
|
||||||
|
import { update } from '@/api/account';
|
||||||
import MultiLineInputDialog from '@/components/MultiLineInputDialog.vue'; // 根据实际路径修改
|
import MultiLineInputDialog from '@/components/MultiLineInputDialog.vue'; // 根据实际路径修改
|
||||||
import ChatDialog from '@/components/ChatDialog.vue'
|
import ChatDialog from '@/components/ChatDialog.vue'
|
||||||
import { splitArray } from '@/utils/arrUtil'
|
import { splitArray } from '@/utils/arrUtil'
|
||||||
import { chooseFile } from '@/utils/fileUtil'
|
import { chooseFile } from '@/utils/fileUtil'
|
||||||
|
import { connectSSE } from '@/utils/sseUtils'
|
||||||
|
import { set } from "lodash";
|
||||||
|
import { prologue, comment } from '@/api/account';
|
||||||
|
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
let wsActions = null;
|
let wsActions = null;
|
||||||
|
let userdata = getUser();
|
||||||
// 引入刷新方法
|
// 引入刷新方法
|
||||||
const reload = inject("reload")
|
const reload = inject("reload")
|
||||||
let refresh = ref(true);
|
|
||||||
let phone = ref({ width: 207, height: 470 });
|
let phone = ref({ width: 207, height: 470 });
|
||||||
const openStr = base64ToBinary("ZQBwAAAAAAA8CgLQAtAAAAAAAAAAAAD/AAAAAAAAAAAAAAAA"); //开启视频流的启动命令
|
const openStr = base64ToBinary("ZQBwAAAAAAA8CgLQAtAAAAAAAAAAAAD/AAAAAAAAAAAAAAAA"); //开启视频流的启动命令
|
||||||
const eitwo = base64ToBinary("BAIAAABHVFJD"); //开启设备信息的命令
|
const eitwo = base64ToBinary("BAIAAABHVFJD"); //开启设备信息的命令
|
||||||
@@ -168,19 +179,23 @@ let dialogTitle = ref('');
|
|||||||
let textContent = ref(['', '', '', '', '', '', '', '']);
|
let textContent = ref(['', '', '', '', '', '', '', '']);
|
||||||
let textContentArr = ref([[], [], [], [], [], [], [], [], []]);
|
let textContentArr = ref([[], [], [], [], [], [], [], [], []]);
|
||||||
//主播id内容
|
//主播id内容
|
||||||
let hostIdContent = ref(['', '', '', '', '', '', '', '']);
|
let hostIdArr = ref([{}, {}, {}, {}, {}, {}, {}, {}]);
|
||||||
let hostIdContentArr = ref([[], [], [], [], [], [], [], [], []]);
|
// let hostIdContentArr = ref([[], [], [], [], [], [], [], [], []]);
|
||||||
//私信文本内容
|
//私信文本内容
|
||||||
let textContentpri = ref(['', '', '', '', '', '', '', '']);
|
let textContentpri = ref(['', '', '', '', '', '', '', '']);
|
||||||
let textContentpriArr = ref([[], [], [], [], [], [], [], [], []]);
|
let textContentpriArr = ref([[], [], [], [], [], [], [], [], []]);
|
||||||
//保存聊天内容
|
//保存聊天内容
|
||||||
let chatList = ref([]);
|
let chatList = ref([]);
|
||||||
|
//保存爬虫发送的主播信息 待存缓存
|
||||||
|
let stroageHost = ref([]);
|
||||||
//选中设备
|
//选中设备
|
||||||
let selectedDevice = ref(999);
|
let selectedDevice = ref(999);
|
||||||
//ws列表
|
//ws列表
|
||||||
let wslist = [];
|
let wslist = [];
|
||||||
// 是否停止点赞
|
// 是否停止
|
||||||
let isStopLike = ref([false, false, false, false, false, false, false, false]);
|
let isStop = ref(false);
|
||||||
|
//sse弹窗是否存在
|
||||||
|
let isMsgPop = ref(false);
|
||||||
//播放器列表
|
//播放器列表
|
||||||
let instanceList = ref([{}, {}, {}, {}, {}, {}, {}, {}]);
|
let instanceList = ref([{}, {}, {}, {}, {}, {}, {}, {}]);
|
||||||
//是否是在关注主播
|
//是否是在关注主播
|
||||||
@@ -245,14 +260,14 @@ const initVideoStream = (udid, index) => {
|
|||||||
|
|
||||||
wslist[index].onopen = () => {
|
wslist[index].onopen = () => {
|
||||||
console.log("手机显示ws已开启");
|
console.log("手机显示ws已开启");
|
||||||
wsActions = createWsActions(wslist, isStopLike);
|
wsActions = createWsActions(wslist);
|
||||||
// 发送 开启 视频流数据
|
// 发送 开启 视频流数据
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
wslist[index].send(openStr);
|
wslist[index].send(openStr);
|
||||||
}, 300);
|
}, 300);
|
||||||
playTimer.value[index] = setTimeout(() => {
|
// playTimer.value[index] = setTimeout(() => {
|
||||||
instanceList.value[index].converter.play();
|
// instanceList.value[index].converter.play();
|
||||||
}, 3000);
|
// }, 3000);
|
||||||
//``````````````````````````````````````````````````````````````````````````````````
|
//``````````````````````````````````````````````````````````````````````````````````
|
||||||
wsCache.set(udid, instanceList.value[index]);
|
wsCache.set(udid, instanceList.value[index]);
|
||||||
//``````````````````````````````````````````````````````````````````````````````````
|
//``````````````````````````````````````````````````````````````````````````````````
|
||||||
@@ -263,7 +278,7 @@ const initVideoStream = (udid, index) => {
|
|||||||
const data = new Uint8Array(event.data);
|
const data = new Uint8Array(event.data);
|
||||||
//判断返回的如果是字符串为自定义返回
|
//判断返回的如果是字符串为自定义返回
|
||||||
if (typeof event.data == 'string') {
|
if (typeof event.data == 'string') {
|
||||||
if (isStopLike.value[index]) {
|
if (isStop.value) {
|
||||||
createTaskQueue(index).clear();//清除队伍中的任务
|
createTaskQueue(index).clear();//清除队伍中的任务
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -281,6 +296,11 @@ const initVideoStream = (udid, index) => {
|
|||||||
} else if (resData.type == 'getmesNum') {
|
} else if (resData.type == 'getmesNum') {
|
||||||
if (resData.message == 0) {
|
if (resData.message == 0) {
|
||||||
console.log('没有消息')
|
console.log('没有消息')
|
||||||
|
if (runType.value[index] == 'follow') {
|
||||||
|
LikesToLikesToLikes(deviceInformation.value[index].udid, index)
|
||||||
|
|
||||||
|
}
|
||||||
|
//如果检测到有新消息,会收到两条ws回复,一条message==1 一条message==成功
|
||||||
} else if (resData.message == 1) {
|
} else if (resData.message == 1) {
|
||||||
console.log('有消息')
|
console.log('有消息')
|
||||||
} else if (resData.message == '点击成功') {
|
} else if (resData.message == '点击成功') {
|
||||||
@@ -290,11 +310,16 @@ const initVideoStream = (udid, index) => {
|
|||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
clickxy(resData.x * iponeCoefficient.value[index].width, resData.y * iponeCoefficient.value[index].height, index) //index为9的时候长按
|
clickxy(resData.x * iponeCoefficient.value[index].width, resData.y * iponeCoefficient.value[index].height, index) //index为9的时候长按
|
||||||
}, 100)
|
}, 100)
|
||||||
wsActions.clickMesage(deviceInformation.value[index].udid, index) //点击消息进入对话框
|
wsActions.clickSysMesage(deviceInformation.value[index].udid, index) //点击消息进入对话框
|
||||||
}, 1500)
|
}, 1500)
|
||||||
}
|
}
|
||||||
} else if (resData.type == 'clickMesage') {
|
} else if (resData.type == 'clickMesage') {
|
||||||
|
//点击进入新消息页面以后,获取页面信息
|
||||||
wsActions.clickCopyList(deviceInformation.value[index].udid, index)
|
wsActions.clickCopyList(deviceInformation.value[index].udid, index)
|
||||||
|
} else if (resData.type == 'clickSysMesage') {
|
||||||
|
setTimeout(() => {
|
||||||
|
Back('', index)
|
||||||
|
}, 3000)
|
||||||
} else if (resData.type == 'isVideoAndLive') {
|
} else if (resData.type == 'isVideoAndLive') {
|
||||||
console.log(resData.message)
|
console.log(resData.message)
|
||||||
} else if (resData.type == 'clickCopyList') { //获取到的消息列表
|
} else if (resData.type == 'clickCopyList') { //获取到的消息列表
|
||||||
@@ -307,10 +332,12 @@ const initVideoStream = (udid, index) => {
|
|||||||
console.log('最新消息', mesBox)
|
console.log('最新消息', mesBox)
|
||||||
console.log("翻译", istranslate.value)
|
console.log("翻译", istranslate.value)
|
||||||
if (istranslate.value == false) {
|
if (istranslate.value == false) {
|
||||||
|
if (mesBox.position == 'right') return
|
||||||
|
openShowChat.value = true
|
||||||
console.log("执行ai")
|
console.log("执行ai")
|
||||||
chat({ msg: mesBox.text }).then(res => {
|
chat({ msg: mesBox.text }).then(res => {
|
||||||
console.log("ai返回", res)
|
console.log("ai返回", res)
|
||||||
textContentpri.value[index] = res
|
textContentpri.value[index] = res.result
|
||||||
PrivatetexToPrivatePush(deviceInformation.value[index].udid, index)
|
PrivatetexToPrivatePush(deviceInformation.value[index].udid, index)
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
@@ -334,6 +361,9 @@ const initVideoStream = (udid, index) => {
|
|||||||
}
|
}
|
||||||
} else if (resData.type == 'Comment') {//打开评论
|
} else if (resData.type == 'Comment') {//打开评论
|
||||||
phoneXYinfo.value[index].Comment = { x: resData.x * iponeCoefficient.value[index].width, y: resData.y * iponeCoefficient.value[index].height }
|
phoneXYinfo.value[index].Comment = { x: resData.x * iponeCoefficient.value[index].width, y: resData.y * iponeCoefficient.value[index].height }
|
||||||
|
} else if (resData.type == 'CommentText') {//复制评论
|
||||||
|
phoneXYinfo.value[index].CommentText = { x: resData.x * iponeCoefficient.value[index].width, y: resData.y * iponeCoefficient.value[index].height }
|
||||||
|
textContent.value[index] = resData.message
|
||||||
} else if (resData.type == 'Comtext') {//评论输入
|
} else if (resData.type == 'Comtext') {//评论输入
|
||||||
phoneXYinfo.value[index].Comtext = { x: resData.x * iponeCoefficient.value[index].width, y: resData.y * iponeCoefficient.value[index].height }
|
phoneXYinfo.value[index].Comtext = { x: resData.x * iponeCoefficient.value[index].width, y: resData.y * iponeCoefficient.value[index].height }
|
||||||
// setTimeout(() => {
|
// setTimeout(() => {
|
||||||
@@ -376,25 +406,42 @@ const initVideoStream = (udid, index) => {
|
|||||||
}, 1000);
|
}, 1000);
|
||||||
} else if (resData.type == 'Privatetex') {//私信评论
|
} else if (resData.type == 'Privatetex') {//私信评论
|
||||||
phoneXYinfo.value[index].Privatetex = { x: resData.x * iponeCoefficient.value[index].width, y: resData.y * iponeCoefficient.value[index].height }
|
phoneXYinfo.value[index].Privatetex = { x: resData.x * iponeCoefficient.value[index].width, y: resData.y * iponeCoefficient.value[index].height }
|
||||||
} else if (resData.type == 'PrivatePush') {//私信发送
|
} else if (resData.type == 'PrivatePush' || resData.type == 'PrivatePushFollow') {//私信发送
|
||||||
phoneXYinfo.value[index].PrivatePush = { x: resData.x * iponeCoefficient.value[index].width, y: resData.y * iponeCoefficient.value[index].height }
|
phoneXYinfo.value[index].PrivatePush = { x: resData.x * iponeCoefficient.value[index].width, y: resData.y * iponeCoefficient.value[index].height }
|
||||||
//如果是在关注主播的任务中
|
|
||||||
if (runType.value[index] == 'follow') {
|
|
||||||
runType.value[index] = ''
|
|
||||||
}
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
Back('', index);
|
Back('', index);
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
Back('', index);
|
Back('', index);
|
||||||
if (runType.value[index] == 'listen') {
|
setTimeout(() => {
|
||||||
} else if (runType.value[index] == 'like' || runType.value[index] == 'follow') {
|
Back('', index);
|
||||||
LikesToLikesToLikes(deviceInformation.value[index].udid, index, 2)
|
setTimeout(() => {
|
||||||
}
|
if (resData.type == 'PrivatePush') {
|
||||||
|
Back('', index);
|
||||||
|
setTimeout(() => {
|
||||||
|
Back('', index);
|
||||||
|
setTimeout(() => {
|
||||||
|
Back('', index);
|
||||||
|
//正常没有消息,发送完私信以后,返回六次,然后继续下一个任务
|
||||||
|
wsActions.getmesNum(deviceInformation.value[index].udid, index)
|
||||||
|
// LikesToLikesToLikes(deviceInformation.value[index].udid, index)
|
||||||
|
|
||||||
|
}, 1000);
|
||||||
|
}, 1000);
|
||||||
|
} else if (resData.type == 'PrivatePushFollow') {
|
||||||
|
//如果有新消息,回复完私信以后,返回三次,然后继续下一个任务
|
||||||
|
wsActions.getmesNum(deviceInformation.value[index].udid, index)
|
||||||
|
// LikesToLikesToLikes(deviceInformation.value[index].udid, index)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}, 1000);
|
||||||
|
}, 1000);
|
||||||
}, 1000);
|
}, 1000);
|
||||||
}, 1000);
|
}, 1000);
|
||||||
|
|
||||||
} else if (resData.type == 'clickCopy') {//点击复制
|
} else if (resData.type == 'clickCopy') {//点击复制
|
||||||
phoneXYinfo.value[index].clickCopy = { x: resData.x * iponeCoefficient.value[index].width, y: resData.y * iponeCoefficient.value[index].height }
|
phoneXYinfo.value[index].clickCopy = { x: resData.x * iponeCoefficient.value[index].width, y: resData.y * iponeCoefficient.value[index].height }
|
||||||
} else if (resData.type == 'hostVideo') {//点击复制
|
} else if (resData.type == 'hostVideo') {//观看主播视频
|
||||||
phoneXYinfo.value[index].hostVideo = { x: resData.x * iponeCoefficient.value[index].width, y: resData.y * iponeCoefficient.value[index].height }
|
phoneXYinfo.value[index].hostVideo = { x: resData.x * iponeCoefficient.value[index].width, y: resData.y * iponeCoefficient.value[index].height }
|
||||||
} else if (resData.type == 'isHost') {//视频关注主播
|
} else if (resData.type == 'isHost') {//视频关注主播
|
||||||
phoneXYinfo.value[index].isHost = { x: resData.x * iponeCoefficient.value[index].width, y: resData.y * iponeCoefficient.value[index].height }
|
phoneXYinfo.value[index].isHost = { x: resData.x * iponeCoefficient.value[index].width, y: resData.y * iponeCoefficient.value[index].height }
|
||||||
@@ -408,18 +455,17 @@ const initVideoStream = (udid, index) => {
|
|||||||
} else if (resData.message == 1) {
|
} else if (resData.message == 1) {
|
||||||
console.log('有关注', index)
|
console.log('有关注', index)
|
||||||
const randomNum = Math.random(); // 生成一个0到1之间的随机数
|
const randomNum = Math.random(); // 生成一个0到1之间的随机数
|
||||||
if (randomNum < 0.5) {
|
if (randomNum < 0.6) {
|
||||||
console.log('进行点赞评论', index)
|
console.log('进行点赞评论', index)
|
||||||
LikesToCommentToComPush(deviceInformation.value[index].udid, index)
|
LikesToCommentToComPush(deviceInformation.value[index].udid, index)
|
||||||
} else {
|
} else {
|
||||||
console.log('下一个', index)
|
console.log('下一个', index)
|
||||||
wsActions.slideDown(deviceInformation.value[index].udid, index)//是否继续下一个视频
|
wsActions.slideDown(deviceInformation.value[index].udid, index)//是否继续下一个视频
|
||||||
setTimeout(() => {
|
randomSeeVideo(deviceInformation.value[index].udid, index) //30-50秒后继续循环任务
|
||||||
console.log('观看视频中', index)
|
|
||||||
randomSeeVideo(deviceInformation.value[index].udid, index) //30-50秒后继续循环任务
|
|
||||||
}, 1000);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else if (resData.type == 'openDY') {//视频关注主播
|
||||||
|
createTaskQueue(index).clear();//清除队伍中的任务
|
||||||
}
|
}
|
||||||
setphoneXYinfo(phoneXYinfo.value)
|
setphoneXYinfo(phoneXYinfo.value)
|
||||||
if (resData.type != 'isHost') {
|
if (resData.type != 'isHost') {
|
||||||
@@ -427,56 +473,68 @@ const initVideoStream = (udid, index) => {
|
|||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
createTaskQueue(index).next(); // 继续队列中下一个任务
|
createTaskQueue(index).next(); // 继续队列中下一个任务
|
||||||
}, 5000)
|
}, 5000)
|
||||||
|
} else if (resData.type == 'getmesNum') {
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
createTaskQueue(index).next(); // 继续队列中下一个任务
|
createTaskQueue(index).next(); // 继续队列中下一个任务
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// --------------------------------------------------------------------------报错处理
|
// ----------------------------------------------------------------------------------------------------报错处理
|
||||||
// console.error(resData.type, resData)
|
|
||||||
//如果该视频无法被评论,返回刷下一条视频
|
//如果该视频无法被评论,返回刷下一条视频
|
||||||
if (resData.type == 'Comtext') {
|
if (resData.type == 'Comtext' || resData.type == 'CommentText') {
|
||||||
if (runType.value[index] == 'follow') {
|
if (runType.value[index] == 'follow') {
|
||||||
createTaskQueue(index).clear();//清除队伍中的任务
|
|
||||||
Back('', index)
|
Back('', index)
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
Back('', index)
|
Back('', index)
|
||||||
setTimeout(() => {
|
createTaskQueue(index).next(); // 继续队列中下一个任务
|
||||||
Back('', index)
|
createTaskQueue(index).next(); // 继续队列中下一个任务
|
||||||
LikesToLikesToLikes(deviceInformation.value[index].udid, index, 2)
|
|
||||||
}, 1000)
|
|
||||||
}, 1000)
|
}, 1000)
|
||||||
} else {
|
} else {
|
||||||
createTaskQueue(index).clear();//清除队伍中的任务
|
resetApp(udid, index)
|
||||||
Back('', index)
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
Back('', index)
|
wsActions.isHost(deviceInformation.value[index].udid, index)
|
||||||
setTimeout(() => {
|
|
||||||
wsActions.isHost(deviceInformation.value[index].udid, index)
|
|
||||||
}, 1000)
|
|
||||||
}, 1000)
|
}, 1000)
|
||||||
}
|
}
|
||||||
//如果该视频无法被私信,返回刷下一条视频
|
//如果该视频无法被搜索到,返回刷下一条视频
|
||||||
} else if (resData.type == 'Privatetex') {
|
} else if (resData.type == 'toHost') {
|
||||||
createTaskQueue(index).clear();//清除队伍中的任务
|
|
||||||
Back('', index)
|
Back('', index)
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
Back('', index)
|
Back('', index)
|
||||||
LikesToLikesToLikes(deviceInformation.value[index].udid, index, 2)
|
createTaskQueue(index).clear();//清除队伍中的任务
|
||||||
|
setTimeout(() => {
|
||||||
|
Back('', index)
|
||||||
|
LikesToLikesToLikes(deviceInformation.value[index].udid, index)
|
||||||
|
}, 1000)
|
||||||
}, 1000)
|
}, 1000)
|
||||||
} else if (resData.type == 'hostVideo') {
|
} else if (resData.type == 'Privatetex' || resData.type == 'hostVideo' || resData.type == 'search') {
|
||||||
createTaskQueue(index).clear();//清除队伍中的任务
|
if (runType.value[index] == 'follow') {
|
||||||
Back('', index)
|
//关注的时候出现无法私信和没有视频的情况 错误重置
|
||||||
setTimeout(() => {
|
resetApp(udid, index)
|
||||||
LikesToLikesToLikes(deviceInformation.value[index].udid, index, 2)
|
setTimeout(() => {
|
||||||
}, 1000)
|
wsActions.getmesNum(deviceInformation.value[index].udid, index)
|
||||||
} else if (resData.type == 'getmesNum' || resData.type == 'clickMesage') {
|
// LikesToLikesToLikes(deviceInformation.value[index].udid, index)
|
||||||
|
}, 1000)
|
||||||
|
}
|
||||||
|
|
||||||
|
} else if (resData.type == 'getmesNum') {
|
||||||
|
if (runType.value[index] == 'follow') {
|
||||||
|
LikesToLikesToLikes(deviceInformation.value[index].udid, index)
|
||||||
|
}
|
||||||
|
//getmesNum出现没有消息的情况
|
||||||
|
} else if (resData.type == 'clickMesage' || resData.type == 'ComPush') {
|
||||||
|
//ComPush关注主播的时候出现无法评论的视频 会跳过评论发送,不处理评论发送的返回错误
|
||||||
} else if (resData.type == 'clickCopyList') {
|
} else if (resData.type == 'clickCopyList') {
|
||||||
//如果无法获取到聊天记录,返回继续检测
|
//如果无法获取到聊天记录,返回继续检测
|
||||||
|
console.error('未找到聊天,返回')
|
||||||
Back('', index)
|
Back('', index)
|
||||||
|
|
||||||
|
} else if (resData.type == 'clickSysMesage') {
|
||||||
|
//如果没有系统消息,则点击新消息
|
||||||
|
wsActions.clickMesage(deviceInformation.value[index].udid, index) //点击消息进入对话框
|
||||||
} else {
|
} else {
|
||||||
console.error(resData.message); // 错误处理
|
console.error(resData.message, resData.type); // 错误处理
|
||||||
ElMessage.error(resData.message);
|
ElMessage.error(resData.message);
|
||||||
createTaskQueue(index).clear();//清除队伍中的任务
|
createTaskQueue(index).clear();//清除队伍中的任务
|
||||||
}
|
}
|
||||||
@@ -624,13 +682,6 @@ const key = (index, state, keycode) => {
|
|||||||
|
|
||||||
const handleVisibilityChange = () => {
|
const handleVisibilityChange = () => {
|
||||||
if (document.visibilityState === "hidden") {
|
if (document.visibilityState === "hidden") {
|
||||||
if (playTimer.value) {
|
|
||||||
console.log("清除定时器");
|
|
||||||
playTimer.value.forEach(Timer => {
|
|
||||||
clearInterval(Timer);
|
|
||||||
});
|
|
||||||
playTimer.value = [{}, {}, {}, {}, {}, {}, {}, {}];
|
|
||||||
}
|
|
||||||
console.log("页面被隐藏");
|
console.log("页面被隐藏");
|
||||||
isshow.value = false;
|
isshow.value = false;
|
||||||
// 页面被隐藏时执行的逻辑
|
// 页面被隐藏时执行的逻辑
|
||||||
@@ -669,8 +720,137 @@ onMounted(() => {
|
|||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
loading.close()
|
loading.close()
|
||||||
}, 2000)
|
}, 2000)
|
||||||
|
|
||||||
|
//sse接收爬虫发送的消息
|
||||||
|
connectSSE(`https://datasave.api.yolozs.com/api/sse/connect/${userdata.tenantId}/${userdata.id}`, (data) => {
|
||||||
|
// connectSSE(`http://192.168.1.155:19665/api/sse/connect/${userdata.tenantId}/${userdata.id}`, (data) => {
|
||||||
|
// 处理服务端推送的数据
|
||||||
|
console.log('来自服务端:', data)
|
||||||
|
|
||||||
|
//接收到start
|
||||||
|
if (data === 'start') {
|
||||||
|
if (!isMsgPop.value) {
|
||||||
|
isMsgPop.value = true;
|
||||||
|
ElMessageBox.confirm(
|
||||||
|
'检测到YOLO助手正在爬取主播,是否进行操作?',
|
||||||
|
'消息提醒',
|
||||||
|
{
|
||||||
|
confirmButtonText: '开始',
|
||||||
|
cancelButtonText: '取消',
|
||||||
|
type: 'success',
|
||||||
|
}
|
||||||
|
)
|
||||||
|
.then(() => {
|
||||||
|
//开启sse版follow任务
|
||||||
|
|
||||||
|
ElMessage({
|
||||||
|
type: 'success',
|
||||||
|
message: '任务开启成功',
|
||||||
|
})
|
||||||
|
setHostList(stroageHost.value)
|
||||||
|
//重启tk
|
||||||
|
resetTk()
|
||||||
|
//获取评论
|
||||||
|
comment().then((resA) => {
|
||||||
|
console.log('resA:', resA);
|
||||||
|
setContentList(resA)
|
||||||
|
//评论
|
||||||
|
textContentArr.value.forEach((item, indexA) => {
|
||||||
|
textContent.value[indexA] = resA[getRandomNumber(resA.length - 1)];
|
||||||
|
})
|
||||||
|
prologue().then((resB) => {
|
||||||
|
console.log('resB:', resB);
|
||||||
|
setContentpriList(resB)
|
||||||
|
//私信
|
||||||
|
textContentpriArr.value.forEach((item, indexA) => {
|
||||||
|
textContentpri.value[indexA] = resB[getRandomNumber(resB.length - 1)];
|
||||||
|
runType.value[indexA] = 'follow'
|
||||||
|
console.log('runType', runType.value[indexA])
|
||||||
|
})
|
||||||
|
deviceInformation.value.forEach((device, indexB) => {
|
||||||
|
if (getHostList().length <= 0) return;
|
||||||
|
|
||||||
|
// LikesToLikesToLikes(device.udid, indexB)
|
||||||
|
wsActions.getmesNum(device.udid, indexB)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
|
.catch(() => {
|
||||||
|
stroageHost.value = []
|
||||||
|
isMsgPop.value = false;
|
||||||
|
})
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
stroageHost.value = getHostList()
|
||||||
|
stroageHost.value.push(({ country: data.country, text: data.hostsId, state: false }))
|
||||||
|
setHostList(stroageHost.value)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//更新状态
|
||||||
|
// update(
|
||||||
|
// {
|
||||||
|
// id: data.id,
|
||||||
|
// operationStatus: 1,
|
||||||
|
// }
|
||||||
|
// ).then(() => {
|
||||||
|
|
||||||
|
// })
|
||||||
|
|
||||||
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
|
function opentanchuan() {
|
||||||
|
ElMessageBox.confirm(
|
||||||
|
'接收到YOLO爬虫爬取到的主播,开始进行操作?',
|
||||||
|
'消息提醒',
|
||||||
|
{
|
||||||
|
confirmButtonText: '开始',
|
||||||
|
cancelButtonText: '取消',
|
||||||
|
type: 'success',
|
||||||
|
}
|
||||||
|
)
|
||||||
|
.then(() => {
|
||||||
|
ElMessage({
|
||||||
|
type: 'success',
|
||||||
|
message: '任务开启成功',
|
||||||
|
})
|
||||||
|
resetTk()
|
||||||
|
comment().then((resA) => {
|
||||||
|
console.log('resA:', resA);
|
||||||
|
setContentList(resA)
|
||||||
|
//评论
|
||||||
|
textContentArr.value.forEach((item, indexA) => {
|
||||||
|
textContent.value[indexA] = resA[getRandomNumber(resA.length - 1)];
|
||||||
|
})
|
||||||
|
|
||||||
|
prologue().then((resB) => {
|
||||||
|
|
||||||
|
console.log('resB:', resB);
|
||||||
|
setContentpriList(resB)
|
||||||
|
//私信
|
||||||
|
textContentpriArr.value.forEach((item, indexA) => {
|
||||||
|
textContentpri.value[indexA] = resB[getRandomNumber(resB.length - 1)];
|
||||||
|
runType.value[indexA] = 'follow'
|
||||||
|
console.log('runType', runType.value[indexA])
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
deviceInformation.value.forEach((device, indexB) => {
|
||||||
|
if (getHostList().length <= 0) return;
|
||||||
|
|
||||||
|
// LikesToLikesToLikes(device.udid, indexB)
|
||||||
|
wsActions.getmesNum(device.udid, indexB)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
|
.catch(() => {
|
||||||
|
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
onBeforeUnmount(() => {
|
onBeforeUnmount(() => {
|
||||||
document.removeEventListener("visibilitychange", handleVisibilityChange);
|
document.removeEventListener("visibilitychange", handleVisibilityChange);
|
||||||
});
|
});
|
||||||
@@ -750,10 +930,6 @@ const ObtainDeviceInformation = () => {
|
|||||||
})
|
})
|
||||||
if (!isrepeat) {
|
if (!isrepeat) {
|
||||||
deviceInformation.value.push(data.data.device);
|
deviceInformation.value.push(data.data.device);
|
||||||
// setTimeout(() => {
|
|
||||||
// initVideoStream(data.data.device.udid, deviceInformation.value.length - 1);
|
|
||||||
// initCanvas(data.data.device.udid);
|
|
||||||
// }, 300);
|
|
||||||
new Promise((resolve, reject) => {
|
new Promise((resolve, reject) => {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
try {
|
try {
|
||||||
@@ -777,20 +953,18 @@ const ObtainDeviceInformation = () => {
|
|||||||
async function LikesToCommentToComPush(udid, index) {
|
async function LikesToCommentToComPush(udid, index) {
|
||||||
await sendWsTask(index, { udid, action: 'click', type: 'Likes', index, resourceId: 'com.zhiliaoapp.musically:id/dy6' });
|
await sendWsTask(index, { udid, action: 'click', type: 'Likes', index, resourceId: 'com.zhiliaoapp.musically:id/dy6' });
|
||||||
await sendWsTask(index, { udid, action: 'click', type: 'Comment', index, resourceId: 'com.zhiliaoapp.musically:id/cvd' });
|
await sendWsTask(index, { udid, action: 'click', type: 'Comment', index, resourceId: 'com.zhiliaoapp.musically:id/cvd' });
|
||||||
|
await sendWsTask(index, { udid, action: 'dump', type: 'CommentText', index, resourceId: 'com.zhiliaoapp.musically:id/d5q' });
|
||||||
await sendWsTask(index, { udid, action: 'click', type: 'Comtext', index, resourceId: 'com.zhiliaoapp.musically:id/cs0' });
|
await sendWsTask(index, { udid, action: 'click', type: 'Comtext', index, resourceId: 'com.zhiliaoapp.musically:id/cs0' });
|
||||||
await sendWsTask(index, { udid, action: 'click', type: 'ComPush', index, resourceId: 'com.zhiliaoapp.musically:id/bqg' });
|
await sendWsTask(index, { udid, action: 'click', type: 'ComPush', index, resourceId: 'com.zhiliaoapp.musically:id/bqg' });
|
||||||
}
|
}
|
||||||
|
|
||||||
//点赞主页4个作品+评论最后一个作品并返回
|
//点赞主页4个作品+评论最后一个作品并返回
|
||||||
async function LikesToLikesToLikes(udid, index, type) {
|
async function LikesToLikesToLikes(udid, index) {
|
||||||
isStopLike.value[index] = false;
|
isStop.value = false;
|
||||||
runType.value[index] = 'follow';
|
runType.value[index] = 'follow';
|
||||||
if (type == 2) {
|
|
||||||
await sendWsTask(index, { udid, action: 'click', type: 'searchTxt', index, resourceId: 'com.zhiliaoapp.musically:id/f0l' });
|
// await sendWsTask(index, { udid, action: 'click', type: 'getmesNum', index, resourceId: 'com.zhiliaoapp.musically:id/jyv' });
|
||||||
await sendWsTask(index, { udid, action: 'click', type: 'close', index, resourceId: 'com.zhiliaoapp.musically:id/blw' });
|
await sendWsTask(index, { udid, action: 'click', type: 'search', index, resourceId: 'com.zhiliaoapp.musically:id/gtz' });
|
||||||
} else if (type == 1) {
|
|
||||||
await sendWsTask(index, { udid, action: 'click', type: 'search', index, resourceId: 'com.zhiliaoapp.musically:id/gtz' });
|
|
||||||
}
|
|
||||||
await sendWsTask(index, { udid, action: 'click', type: 'searchHost', index, resourceId: 'com.zhiliaoapp.musically:id/t6f' });
|
await sendWsTask(index, { udid, action: 'click', type: 'searchHost', index, resourceId: 'com.zhiliaoapp.musically:id/t6f' });
|
||||||
await sendWsTask(index, { udid, action: 'click', type: 'toHost', index, resourceId: 'com.zhiliaoapp.musically:id/iso' });
|
await sendWsTask(index, { udid, action: 'click', type: 'toHost', index, resourceId: 'com.zhiliaoapp.musically:id/iso' });
|
||||||
await sendWsTask(index, { udid, action: 'click', type: 'hostVideo', index, resourceId: 'com.zhiliaoapp.musically:id/u3o', num: 0 });
|
await sendWsTask(index, { udid, action: 'click', type: 'hostVideo', index, resourceId: 'com.zhiliaoapp.musically:id/u3o', num: 0 });
|
||||||
@@ -811,9 +985,16 @@ async function LikesToLikesToLikes(udid, index, type) {
|
|||||||
//私信
|
//私信
|
||||||
async function PrivatetexToPrivatePush(udid, index) {
|
async function PrivatetexToPrivatePush(udid, index) {
|
||||||
await sendWsTask(index, { udid, action: 'click', type: 'Privatetex', index, resourceId: 'com.zhiliaoapp.musically:id/hob' });
|
await sendWsTask(index, { udid, action: 'click', type: 'Privatetex', index, resourceId: 'com.zhiliaoapp.musically:id/hob' });
|
||||||
await sendWsTask(index, { udid, action: 'click', type: 'PrivatePush', index, resourceId: 'com.zhiliaoapp.musically:id/hog' });
|
await sendWsTask(index, { udid, action: 'click', type: 'PrivatePushFollow', index, resourceId: 'com.zhiliaoapp.musically:id/hog' });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//重置当前应用
|
||||||
|
async function resetApp(udid, index) {
|
||||||
|
createTaskQueue(index).clear();//清除队伍中的任务
|
||||||
|
|
||||||
|
await sendWsTask(index, { udid, action: 'killNow' });
|
||||||
|
await sendWsTask(index, { udid, action: 'openDY' });
|
||||||
|
}
|
||||||
//发送评论字符到手机方法
|
//发送评论字符到手机方法
|
||||||
function setComText(index) {
|
function setComText(index) {
|
||||||
isSend.value = true;
|
isSend.value = true;
|
||||||
@@ -822,7 +1003,9 @@ function setComText(index) {
|
|||||||
}, 300);
|
}, 300);
|
||||||
console.log('发送评论内容', index, textContent.value[index])
|
console.log('发送评论内容', index, textContent.value[index])
|
||||||
wslist[index].send(setClipboard(textContent.value[index]));
|
wslist[index].send(setClipboard(textContent.value[index]));
|
||||||
textContent.value[index] = textContentArr.value[index][getRandomNumber(textContentArr.value[index].length - 1)];
|
if (runType.value[index] === 'follow') {
|
||||||
|
textContent.value[index] = getContentList()[index][getRandomNumber(getContentList()[index].length - 1)];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//发送主播ID字符到手机方法
|
//发送主播ID字符到手机方法
|
||||||
@@ -831,31 +1014,38 @@ function setHostId(index) {
|
|||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
isSend.value = false;
|
isSend.value = false;
|
||||||
}, 300);
|
}, 300);
|
||||||
console.log('发送主播id内容', index, hostIdContent.value[index])
|
const host = markFirstFalseAsTrue(getHostList())
|
||||||
wslist[index].send(setClipboard(hostIdContent.value[index])); //发送内容
|
if (host == null) {
|
||||||
//获取当前主播ID的下标
|
createTaskQueue(index).clear();//清除队伍中的任务
|
||||||
const indexBom = hostIdContentArr.value[index].indexOf(hostIdContent.value[index]) + 1;
|
ElMessage.success('主播ID已全部发送完毕');
|
||||||
console.log(hostIdContentArr.value[index].indexOf(hostIdContent.value[index]) + 1, '当前主播下标');
|
return;
|
||||||
console.log(hostIdContentArr.value[index], '主播列表');
|
|
||||||
//如果是最后一个ID 则重置
|
|
||||||
if (indexBom == hostIdContentArr.value[index].length) {
|
|
||||||
// isStopLike.value[index] = true;
|
|
||||||
hostIdContent.value[index] = ''
|
|
||||||
return
|
|
||||||
}
|
}
|
||||||
hostIdContent.value[index] = hostIdContentArr.value[index][indexBom];
|
hostIdArr.value[index] = host;
|
||||||
console.log(hostIdContent.value[index], '下次搜索')
|
wslist[index].send(setClipboard(host.text)); //发送内容
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//发送私信字符到手机方法
|
//发送私信字符到手机方法
|
||||||
function setPrivateText(index) {
|
function setPrivateText(index, datatype) {
|
||||||
isSend.value = true;
|
isSend.value = true;
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
isSend.value = false;
|
isSend.value = false;
|
||||||
}, 300);
|
}, 300);
|
||||||
console.log('发送私信内容', index, textContentpri.value[index])
|
console.log('发送私信内容', index, textContentpri.value[index])
|
||||||
wslist[index].send(setClipboard(textContentpri.value[index]));
|
//如果是在关注主播中,发送的开场白进行对应国家翻译
|
||||||
textContentpri.value[index] = textContentpriArr.value[index][getRandomNumber(textContentpriArr.value[index].length - 1)];
|
if (runType.value[index] === 'follow' && datatype == 'PrivatePush') {
|
||||||
|
translation({ msg: getContentpriList()[index][getRandomNumber(getContentpriList()[index].length - 1)], country: hostIdArr.value[index].country }).then(res => {
|
||||||
|
console.log(res)
|
||||||
|
textContentpri.value[index] = res;
|
||||||
|
wslist[index].send(setClipboard(textContentpri.value[index]));
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
wslist[index].send(setClipboard(textContentpri.value[index]));
|
||||||
|
textContentpri.value[index] = getContentpriList()[index][getRandomNumber(getContentpriList()[index].length - 1)];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
//获取手机粘贴板方法
|
//获取手机粘贴板方法
|
||||||
function getText(index) {
|
function getText(index) {
|
||||||
@@ -864,11 +1054,11 @@ function getText(index) {
|
|||||||
|
|
||||||
function getComArr(index, type) {
|
function getComArr(index, type) {
|
||||||
if (type == '评论') {
|
if (type == '评论') {
|
||||||
ElMessageBox.alert(textContentArr.value[index], `当前${type}内容`, {
|
ElMessageBox.alert(getContentList()[index], `当前${type}内容`, {
|
||||||
confirmButtonText: 'OK',
|
confirmButtonText: 'OK',
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
ElMessageBox.alert(textContentpriArr.value[index], `当前${type}内容`, {
|
ElMessageBox.alert(getContentpriList()[index], `当前${type}内容`, {
|
||||||
confirmButtonText: 'OK',
|
confirmButtonText: 'OK',
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -969,10 +1159,12 @@ function createTaskQueue(index) {
|
|||||||
enqueue(task) {
|
enqueue(task) {
|
||||||
taskQueues.get(index).push(task);
|
taskQueues.get(index).push(task);
|
||||||
if (taskQueues.get(index).length === 1) {
|
if (taskQueues.get(index).length === 1) {
|
||||||
|
console.log("执行任务第一个任务");
|
||||||
task(); // 执行第一个任务
|
task(); // 执行第一个任务
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
next() {
|
next() {
|
||||||
|
console.log('执行等待中任务')
|
||||||
const queue = taskQueues.get(index);
|
const queue = taskQueues.get(index);
|
||||||
queue.shift(); // 移除已完成任务
|
queue.shift(); // 移除已完成任务
|
||||||
if (queue.length > 0) {
|
if (queue.length > 0) {
|
||||||
@@ -981,76 +1173,72 @@ function createTaskQueue(index) {
|
|||||||
},
|
},
|
||||||
clear() {
|
clear() {
|
||||||
taskQueues.set(index, []); // 清除所有任务
|
taskQueues.set(index, []); // 清除所有任务
|
||||||
|
},
|
||||||
|
getNum() {
|
||||||
|
return taskQueues.get(index)
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
//发送检查该手机的xy坐标任务
|
//发送检查该手机的xy坐标任务
|
||||||
function sendWsTask(index, data) {
|
function sendWsTask(index, data) {
|
||||||
console.log('发送任务', data.type);
|
console.log('任务等待中', data.type);
|
||||||
return new Promise((resolve) => {
|
return new Promise((resolve) => {
|
||||||
const queue = createTaskQueue(index);
|
try {
|
||||||
const task = () => {
|
const queue = createTaskQueue(index);
|
||||||
//发送评论的文本粘贴事件
|
// console.log("创建队列", queue.getNum());
|
||||||
if (data.type == 'Likes') {
|
const task = () => {
|
||||||
clickxy(160, 360, index)
|
|
||||||
}
|
//发送评论的文本粘贴事件
|
||||||
if (data.type == 'isHost') {
|
if (data.type == 'Likes') {
|
||||||
// clickxy(160, 360, index)
|
|
||||||
}
|
|
||||||
if (data.type == 'Comment') {
|
|
||||||
if (runType.value[index] == 'follow') {
|
|
||||||
clickxy(160, 360, index)
|
clickxy(160, 360, index)
|
||||||
}
|
}
|
||||||
}
|
if (data.type == 'isHost') {
|
||||||
if (data.type == 'ComPush') {
|
}
|
||||||
setTimeout(() => {
|
if (data.type == 'Comment') {
|
||||||
setComText(index)//粘贴内容
|
if (runType.value[index] == 'follow') {
|
||||||
}, 500)
|
clickxy(160, 360, index)
|
||||||
}
|
}
|
||||||
if (data.type == 'searchHost') {
|
}
|
||||||
setTimeout(() => {
|
if (data.type == 'ComPush') {
|
||||||
setHostId(index)//粘贴内容
|
setTimeout(() => {
|
||||||
}, 500)
|
setComText(index)//粘贴内容
|
||||||
}
|
}, 500)
|
||||||
//发送私信的文本粘贴事件
|
}
|
||||||
if (data.type == 'PrivatePush') {
|
if (data.type == 'searchHost') {
|
||||||
setPrivateText(index)
|
setTimeout(() => {
|
||||||
}
|
setHostId(index)//粘贴内容
|
||||||
//关注前的返回和右滑
|
}, 500)
|
||||||
if (data.type == 'Attention') {
|
}
|
||||||
// setTimeout(() => {
|
//发送私信的文本粘贴事件
|
||||||
// Back('', index)
|
if (data.type == 'PrivatePush' || data.type == 'PrivatePushFollow') {
|
||||||
// setTimeout(() => {
|
setPrivateText(index, data.type)
|
||||||
// wsActions.slideRight(data.udid, index)
|
}
|
||||||
// }, 500);
|
//关注前的返回和右滑
|
||||||
// }, 500);
|
if (data.type == 'Attention') {
|
||||||
}
|
|
||||||
//发送关注之前的返回
|
}
|
||||||
if (data.type == 'addHost') {
|
//发送关注之前的返回
|
||||||
// setTimeout(() => {
|
if (data.type == 'addHost') {
|
||||||
// Back('', index)
|
}
|
||||||
// setTimeout(() => {
|
//发送任务
|
||||||
// clickxy(160, 360, index)
|
if (data.type == 'Attention') {
|
||||||
// wsActions.isHost(data.udid, index)
|
setTimeout(() => {
|
||||||
// }, 1000);
|
wslist[index].send(JSON.stringify(data));
|
||||||
// }, 500);
|
resolve();
|
||||||
}
|
}, 1000)
|
||||||
//发送任务
|
} else {
|
||||||
console.log('发送任务', data);
|
|
||||||
if (data.type == 'Attention') {
|
|
||||||
setTimeout(() => {
|
|
||||||
wslist[index].send(JSON.stringify(data));
|
wslist[index].send(JSON.stringify(data));
|
||||||
resolve();
|
resolve();
|
||||||
}, 1000)
|
}
|
||||||
} else {
|
// 表示当前任务“已发出”,但不是“已完成”
|
||||||
wslist[index].send(JSON.stringify(data));
|
// 实际完成由 onmessage 中的 success 决定并继续执行队列
|
||||||
resolve();
|
};
|
||||||
}
|
queue.enqueue(task);
|
||||||
// 表示当前任务“已发出”,但不是“已完成”
|
} catch (e) {
|
||||||
// 实际完成由 onmessage 中的 success 决定并继续执行队列
|
console.error('发送任务错误:', e);
|
||||||
};
|
}
|
||||||
queue.enqueue(task);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1066,8 +1254,8 @@ function getRandomNumber(n) {
|
|||||||
|
|
||||||
//延迟30-50秒后检测关注
|
//延迟30-50秒后检测关注
|
||||||
function randomSeeVideo(udid, index) {
|
function randomSeeVideo(udid, index) {
|
||||||
const delay = Math.floor(Math.random() * (50 - 30 + 1) + 30) * 1000;
|
const delay = Math.floor(Math.random() * (50 - 30) + 10) * 1000;
|
||||||
setTimeout(() => {
|
playTimer.value[index] = setTimeout(() => {
|
||||||
console.log('观看结束', index);
|
console.log('观看结束', index);
|
||||||
wsActions.isHost(udid, index)//检测
|
wsActions.isHost(udid, index)//检测
|
||||||
}, delay);
|
}, delay);
|
||||||
@@ -1091,15 +1279,25 @@ function getVideoStyle(index) {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function stop(udid, index) {
|
function stop() {
|
||||||
// actions[index] = [];
|
// actions[index] = [];
|
||||||
createTaskQueue(index).clear();//清除队伍中的任务
|
|
||||||
cloesMonitor();
|
cloesMonitor();
|
||||||
isStopLike.value.forEach((item, i) => {
|
isStop.value = true; //停止所有任务
|
||||||
isStopLike.value[i] = true;
|
isMsgPop.value = false;//关闭爬虫sse任务
|
||||||
runType.value[index] = ''
|
deviceInformation.value.forEach((item, i) => {
|
||||||
|
console.log('停止', i);
|
||||||
|
createTaskQueue(i).clear();//清除队伍中的任务
|
||||||
|
console.log(createTaskQueue(i).getNum())
|
||||||
|
//停止当前任务
|
||||||
|
|
||||||
|
//重置当前状态
|
||||||
|
runType.value[i] = ''
|
||||||
|
//清除观看视频定时器
|
||||||
|
clearInterval(playTimer.value[i])
|
||||||
|
playTimer.value[i] = null;//清除定时器
|
||||||
|
|
||||||
})
|
})
|
||||||
console.log('停止', isStopLike.value);
|
console.log('停止', isStop.value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1108,24 +1306,30 @@ function openTk() {
|
|||||||
wsActions.open(device.udid, index)
|
wsActions.open(device.udid, index)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
function resetTk() {
|
||||||
|
isStop.value = false;
|
||||||
|
deviceInformation.value.forEach((device, index) => {
|
||||||
|
resetApp(device.udid, index)
|
||||||
|
})
|
||||||
|
}
|
||||||
//监听所有手机是否有消息
|
//监听所有手机是否有消息
|
||||||
function openMonitor() {
|
function openMonitor(type) {
|
||||||
|
isStop.value = false;
|
||||||
|
|
||||||
deviceInformation.value.forEach((device, index) => {
|
deviceInformation.value.forEach((device, index) => {
|
||||||
wsActions.getmesNum(device.udid, index)
|
wsActions.getmesNum(device.udid, index)
|
||||||
isStopLike.value[index] = false;
|
|
||||||
runType.value[index] = 'listen'
|
runType.value[index] = 'listen'
|
||||||
})
|
})
|
||||||
isShowMes.value = setInterval(() => {
|
isShowMes.value = setInterval(() => {
|
||||||
deviceInformation.value.forEach((device, index) => {
|
deviceInformation.value.forEach((device, index) => {
|
||||||
wsActions.getmesNum(device.udid, index)
|
wsActions.getmesNum(device.udid, index)
|
||||||
isStopLike.value[index] = false;
|
|
||||||
})
|
})
|
||||||
}, 10000)
|
}, 10000)
|
||||||
}
|
}
|
||||||
|
|
||||||
//关闭监听
|
//关闭监听
|
||||||
function cloesMonitor() {
|
function cloesMonitor() {
|
||||||
|
|
||||||
deviceInformation.value.forEach((device, index) => {
|
deviceInformation.value.forEach((device, index) => {
|
||||||
runType.value[index] = ''
|
runType.value[index] = ''
|
||||||
})
|
})
|
||||||
@@ -1135,8 +1339,8 @@ function cloesMonitor() {
|
|||||||
|
|
||||||
//一键养号
|
//一键养号
|
||||||
function parentNum() {
|
function parentNum() {
|
||||||
|
isStop.value = false;
|
||||||
deviceInformation.value.forEach((device, index) => {
|
deviceInformation.value.forEach((device, index) => {
|
||||||
isStopLike.value[index] = false;
|
|
||||||
runType.value[index] = 'like'
|
runType.value[index] = 'like'
|
||||||
wsActions.isHost(device.udid, index)
|
wsActions.isHost(device.udid, index)
|
||||||
})
|
})
|
||||||
@@ -1146,18 +1350,22 @@ function parentNum() {
|
|||||||
function onDialogConfirm(result, type, index) {
|
function onDialogConfirm(result, type, index) {
|
||||||
console.log(result, type, index);
|
console.log(result, type, index);
|
||||||
if (type == '评论') {
|
if (type == '评论') {
|
||||||
//index ==999 表示全部
|
//index ==999 表示批量养号,输入完评论后 即可直接执行脚本
|
||||||
if (index == 999) {
|
// if (index == 999) {
|
||||||
|
// getContentList().forEach((item, indexA) => {
|
||||||
|
// // textContentArr.value[indexA] = result;
|
||||||
|
// textContent.value[indexA] = result[getRandomNumber(result.length - 1)];
|
||||||
|
// })
|
||||||
|
// setContentList(result)
|
||||||
|
// console.log(getContentList())
|
||||||
|
// parentNum()
|
||||||
|
// //index==998是批量关注主播 输入完评论后 还需要输入私信内容
|
||||||
|
// } else
|
||||||
|
if (index == 998) {
|
||||||
textContentArr.value.forEach((item, indexA) => {
|
textContentArr.value.forEach((item, indexA) => {
|
||||||
textContentArr.value[indexA] = result;
|
|
||||||
textContent.value[indexA] = result[getRandomNumber(result.length - 1)];
|
|
||||||
})
|
|
||||||
parentNum()
|
|
||||||
} else if (index == 998) {
|
|
||||||
textContentArr.value.forEach((item, indexA) => {
|
|
||||||
textContentArr.value[indexA] = result;
|
|
||||||
textContent.value[indexA] = result[getRandomNumber(result.length - 1)];
|
textContent.value[indexA] = result[getRandomNumber(result.length - 1)];
|
||||||
})
|
})
|
||||||
|
setContentList(result)
|
||||||
//打开私信弹窗
|
//打开私信弹窗
|
||||||
selectedDevice.value = 999;
|
selectedDevice.value = 999;
|
||||||
dialogTitle.value = '私信';
|
dialogTitle.value = '私信';
|
||||||
@@ -1165,18 +1373,24 @@ function onDialogConfirm(result, type, index) {
|
|||||||
showDialog.value = true;
|
showDialog.value = true;
|
||||||
}, 600)
|
}, 600)
|
||||||
} else {
|
} else {
|
||||||
textContentArr.value[index] = result;
|
setContentList(result)
|
||||||
|
|
||||||
textContent.value[index] = result[getRandomNumber(result.length - 1)];
|
textContent.value[index] = result[getRandomNumber(result.length - 1)];
|
||||||
}
|
}
|
||||||
} else if (type == '私信') {
|
} else if (type == '私信') {
|
||||||
//index ==999 表示全部
|
//index ==999 表示全部
|
||||||
if (index == 999) {
|
if (index == 999) {
|
||||||
textContentpriArr.value.forEach((item, indexA) => {
|
textContentpriArr.value.forEach((item, indexA) => {
|
||||||
textContentpriArr.value[indexA] = result;
|
|
||||||
textContentpri.value[indexA] = result[getRandomNumber(result.length - 1)];
|
textContentpri.value[indexA] = result[getRandomNumber(result.length - 1)];
|
||||||
|
runType.value[indexA] = 'follow'
|
||||||
})
|
})
|
||||||
|
|
||||||
|
setContentpriList(result)
|
||||||
deviceInformation.value.forEach((device, indexB) => {
|
deviceInformation.value.forEach((device, indexB) => {
|
||||||
LikesToLikesToLikes(device.udid, indexB, 1)
|
if (getHostList().length <= 0) return;
|
||||||
|
|
||||||
|
// LikesToLikesToLikes(device.udid, indexB)
|
||||||
|
wsActions.getmesNum(device.udid, indexB)
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
textContentpriArr.value[index] = result;
|
textContentpriArr.value[index] = result;
|
||||||
@@ -1186,38 +1400,50 @@ function onDialogConfirm(result, type, index) {
|
|||||||
//index ==999 表示全部
|
//index ==999 表示全部
|
||||||
if (index == 999) {
|
if (index == 999) {
|
||||||
//分割数组 几台设备 分为几个数组
|
//分割数组 几台设备 分为几个数组
|
||||||
const hostIdArrList = splitArray(result, deviceInformation.value.length)
|
let hostListResult = [];
|
||||||
deviceInformation.value.forEach((device, indexA) => {
|
result.forEach((item, indexA) => {
|
||||||
hostIdContentArr.value[indexA] = hostIdArrList[indexA];
|
hostListResult.push({ country: '', text: item, state: false })
|
||||||
hostIdContent.value[indexA] = hostIdContentArr.value[indexA][0];
|
|
||||||
})
|
})
|
||||||
|
setHostList(hostListResult)
|
||||||
//打开评论弹窗
|
//打开评论弹窗
|
||||||
selectedDevice.value = 998;
|
selectedDevice.value = 998;
|
||||||
dialogTitle.value = '评论';
|
dialogTitle.value = '评论';
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
showDialog.value = true;
|
showDialog.value = true;
|
||||||
}, 600)
|
}, 600)
|
||||||
} else {
|
|
||||||
hostIdContentArr.value[index] = result;
|
|
||||||
hostIdContent.value[index] = result[0];
|
|
||||||
deviceInformation.value.forEach((device, indexA) => {
|
|
||||||
if (index == indexA) {
|
|
||||||
LikesToLikesToLikes(device.udid, index, 1)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
// else {
|
||||||
|
// hostIdContentArr.value[index] = result;
|
||||||
|
// hostIdContent.value[index] = result[0];
|
||||||
|
// deviceInformation.value.forEach((device, indexA) => {
|
||||||
|
// if (index == indexA) {
|
||||||
|
// LikesToLikesToLikes(device.udid, index)
|
||||||
|
// }
|
||||||
|
// })
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function getTranslation(list) {
|
function getTranslation(list) {
|
||||||
list.forEach((item, index) => {
|
list.forEach((item, index) => {
|
||||||
translation({ msg: item.text }).then(res => {
|
translationToChinese({ msg: item.text }).then(res => {
|
||||||
console.log(res);
|
console.log(res);
|
||||||
chatList.value[index].text = res
|
chatList.value[index].text = res
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function markFirstFalseAsTrue(hostList) {
|
||||||
|
const index = hostList.findIndex(item => item.state === false);
|
||||||
|
if (index !== -1) {
|
||||||
|
hostList[index].state = true;
|
||||||
|
setHostList(hostList)
|
||||||
|
return hostList[index]; // 可选:返回被修改的对象
|
||||||
|
}
|
||||||
|
return null; // 没有找到 false 的项
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="less">
|
<style scoped lang="less">
|
||||||
|
|||||||
Reference in New Issue
Block a user