优化限制爬取数量
This commit is contained in:
@@ -34,7 +34,7 @@ export default {
|
|||||||
setCoinsNum: '设置金币数量',
|
setCoinsNum: '设置金币数量',
|
||||||
setFansNum: '设置粉丝数量',
|
setFansNum: '设置粉丝数量',
|
||||||
setQuery: '后台查询频率',
|
setQuery: '后台查询频率',
|
||||||
setNum: '期望可邀请主播数量',
|
setNum: ' 期望可邀请主播数量',
|
||||||
minCoinsNum: '最小金币数量',
|
minCoinsNum: '最小金币数量',
|
||||||
maxCoinsNum: '最大金币数量',
|
maxCoinsNum: '最大金币数量',
|
||||||
minFansNum: '最小粉丝数量',
|
minFansNum: '最小粉丝数量',
|
||||||
|
|||||||
@@ -112,10 +112,15 @@
|
|||||||
<el-col :span="6">
|
<el-col :span="6">
|
||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
<label>{{ $t('workbenchesSetup.setNum') }}</label>
|
<label>{{ $t('workbenchesSetup.setNum') }}</label>
|
||||||
|
<label style="color: #00000070; font-size: 15px;">(到达数量后停止爬取)</label>
|
||||||
|
<el-button type="primary" @click="isLimit = true"
|
||||||
|
:disabled="!pyData.isStart">设置爬取数量</el-button>
|
||||||
|
<el-button type="info" @click="isLimit = false"
|
||||||
|
:disabled="!pyData.isStart">不限爬取数量</el-button>
|
||||||
<!-- <el-input type='number' v-model="pyData.frequency.hour" @input="handleInputHour" -->
|
<!-- <el-input type='number' v-model="pyData.frequency.hour" @input="handleInputHour" -->
|
||||||
<div class="center-justify" style="height: 100% ;">
|
<div v-if="isLimit" class="center-justify">
|
||||||
<el-input type='number' v-model="hostNum" :placeholder="$t('workbenchesSetup.num')"
|
<el-input type='number' v-model="hostNum" :placeholder="$t('workbenchesSetup.num')"
|
||||||
style="width: 100% ; margin-bottom: 70px;" :disabled="!pyData.isStart">
|
style="width: 100% ;" :disabled="!pyData.isStart">
|
||||||
<template #append>{{ $t('workbenchesSetup.num') }}</template>
|
<template #append>{{ $t('workbenchesSetup.num') }}</template>
|
||||||
</el-input>
|
</el-input>
|
||||||
</div>
|
</div>
|
||||||
@@ -217,8 +222,12 @@ let pyData = ref({
|
|||||||
tenantId: getUser().tenantId,
|
tenantId: getUser().tenantId,
|
||||||
userId: getUser().userId,
|
userId: getUser().userId,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
//是否限制查询数量
|
||||||
|
let isLimit = ref(false);
|
||||||
//需要查询的主播数
|
//需要查询的主播数
|
||||||
let hostNum = ref(0);
|
let hostNum = ref(0);
|
||||||
|
|
||||||
//按钮提交状态
|
//按钮提交状态
|
||||||
let submitting = ref(true);
|
let submitting = ref(true);
|
||||||
|
|
||||||
@@ -299,10 +308,14 @@ const submit = () => {
|
|||||||
ElMessage.error('请输入正确的频率区间值');
|
ElMessage.error('请输入正确的频率区间值');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
//是否限制爬取数量
|
||||||
|
if (isLimit.value) {
|
||||||
if (hostNum.value <= 0) {
|
if (hostNum.value <= 0) {
|
||||||
ElMessage.error('请输入正确的可邀请数量');
|
ElMessage.error('请输入正确的可邀请数量');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
ElMessageBox.confirm(
|
ElMessageBox.confirm(
|
||||||
'确认开始爬取数据?',
|
'确认开始爬取数据?',
|
||||||
@@ -335,10 +348,13 @@ const submit = () => {
|
|||||||
getHostTimer.value = setInterval(() => {
|
getHostTimer.value = setInterval(() => {
|
||||||
fetchDataCount().then((res) => {
|
fetchDataCount().then((res) => {
|
||||||
hostData.value = JSON.parse(res);
|
hostData.value = JSON.parse(res);
|
||||||
|
if (isLimit.value) {
|
||||||
if (hostData.value.canInvitationCount >= hostNum.value) {
|
if (hostData.value.canInvitationCount >= hostNum.value) {
|
||||||
unsubmit();
|
unsubmit();
|
||||||
alert('爬取完毕')
|
alert('爬取完毕')
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
})
|
})
|
||||||
}, 1000);
|
}, 1000);
|
||||||
getNumTimer.value = setInterval(() => {
|
getNumTimer.value = setInterval(() => {
|
||||||
|
|||||||
Reference in New Issue
Block a user