This commit is contained in:
2026-08-03 17:00:05 +08:00
parent 82ec4edba9
commit 36b13c76dc
5 changed files with 752 additions and 622 deletions

View File

@@ -1961,6 +1961,10 @@ const en = {
factoryEmails: 'Sender accounts',
factoryEmailsPlaceholder: 'Select one or more sender accounts',
factorySendCount: 'Send count',
factoryMinInterval: 'Min interval',
factoryMaxInterval: 'Max interval',
factoryNeedInterval: 'Please enter non-negative integer min interval and max interval',
factoryIntervalRangeInvalid: 'Min interval cannot be greater than max interval',
factoryType: 'Scenario',
factoryTypeEditor: 'Editor',
factoryTypeArticle: 'Promote article',

View File

@@ -1941,6 +1941,10 @@ const zh = {
factoryEmails: '发送邮箱',
factoryEmailsPlaceholder: '请选择发送账号(可多选)',
factorySendCount: '发送数量',
factoryMinInterval: 'min_interval',
factoryMaxInterval: 'max_interval',
factoryNeedInterval: '请填写非负整数的 min_interval 和 max_interval',
factoryIntervalRangeInvalid: 'min_interval 不能大于 max_interval',
factoryType: '场景类型',
factoryTypeEditor: '编辑',
factoryTypeArticle: '推广文章',

File diff suppressed because it is too large Load Diff

View File

@@ -666,6 +666,8 @@ export default {
' "expert_type": "5",\n' +
' "email_ids": "12",\n' +
' "send_count": "1",\n' +
' "min_interval": "30",\n' +
' "max_interval": "60",\n' +
' "fetch_ids": "1,2",\n' +
' "target_partitions": "1,2",\n' +
' "target_country_ids": "",\n' +
@@ -718,6 +720,8 @@ export default {
'expert_type',
'email_ids',
'send_count',
'min_interval',
'max_interval',
'template_id',
'style_id',
'fetch_ids',
@@ -731,6 +735,8 @@ export default {
out[k] = o[k] === null || o[k] === '' ? '' : String(o[k]);
});
if (out.start_promotion === undefined || out.start_promotion === '') out.start_promotion = '0';
if (out.min_interval === undefined || out.min_interval === '') out.min_interval = '30';
if (out.max_interval === undefined || out.max_interval === '') out.max_interval = '60';
if (out.fetch_ids === undefined) out.fetch_ids = '';
if (out.target_partitions === undefined) out.target_partitions = '';
if (out.target_country_ids === undefined) out.target_country_ids = '';
@@ -756,6 +762,8 @@ export default {
expert_type: '5',
email_ids: '',
send_count: '1',
min_interval: '30',
max_interval: '60',
fetch_ids: '',
target_partitions: '1,2',
target_country_ids: '',
@@ -825,13 +833,21 @@ export default {
this.$message.success(this.$t('autoPromotion.factoryBatchImportUiFromJsonOk'));
},
validatePromotionFactoryPayload(p, index) {
const req = ['journal_id', 'type', 'expert_type', 'email_ids', 'send_count', 'template_id', 'style_id'];
const req = ['journal_id', 'type', 'expert_type', 'email_ids', 'send_count', 'min_interval', 'max_interval', 'template_id', 'style_id'];
for (let i = 0; i < req.length; i++) {
const k = req[i];
if (p[k] == null || String(p[k]).trim() === '') {
return this.$t('autoPromotion.factoryBatchImportMissing', { index: index + 1, field: k });
}
}
const minInterval = Number(p.min_interval);
const maxInterval = Number(p.max_interval);
if (!Number.isInteger(minInterval) || minInterval < 0 || !Number.isInteger(maxInterval) || maxInterval < 0) {
return this.$t('autoPromotion.factoryBatchImportMissing', { index: index + 1, field: 'min_interval/max_interval' });
}
if (minInterval > maxInterval) {
return this.$t('autoPromotion.factoryBatchImportMissing', { index: index + 1, field: 'min_interval<=max_interval' });
}
if (String(p.expert_type) === '5') {
if (!String(p.fetch_ids || '').trim()) {
return this.$t('autoPromotion.factoryBatchImportNeedFetch', { index: index + 1 });

View File

@@ -160,6 +160,34 @@
</div>
</div>
<div class="param-item">
<label class="param-label"
>{{ $t('autoPromotion.factoryMinInterval') }}<span class="factory-required-star" aria-hidden="true">*</span></label
>
<el-input-number
v-model="minInterval"
:min="0"
:precision="0"
:step="1"
size="small"
controls-position="right"
/>
</div>
<div class="param-item">
<label class="param-label"
>{{ $t('autoPromotion.factoryMaxInterval') }}<span class="factory-required-star" aria-hidden="true">*</span></label
>
<el-input-number
v-model="maxInterval"
:min="0"
:precision="0"
:step="1"
size="small"
controls-position="right"
/>
</div>
<div class="param-item">
<label class="param-label">
{{ $t('autoPromotion.factoryScenario') }}<span class="factory-required-star" aria-hidden="true">*</span>
@@ -357,6 +385,8 @@
factoryZoneCountryIds: [],
selectedEmailIds: [],
sendCount: 1,
minInterval: 30,
maxInterval: 60,
sendCountMax: 9999,
sendLimitFromApi: false,
factoryType: '1',
@@ -693,6 +723,14 @@
const n = Number(task.send_count);
if (!isNaN(n) && n > 0) this.sendCount = n;
}
if (task.min_interval != null && String(task.min_interval) !== '') {
const n = Number(task.min_interval);
if (!isNaN(n) && n >= 0 && Number.isInteger(n)) this.minInterval = n;
}
if (task.max_interval != null && String(task.max_interval) !== '') {
const n = Number(task.max_interval);
if (!isNaN(n) && n >= 0 && Number.isInteger(n)) this.maxInterval = n;
}
const emailIds = String(task.email_ids || '')
.split(',')
.map((s) => String(s).trim())
@@ -829,6 +867,11 @@
}
return null;
},
isValidInterval(value) {
if (value == null || value === '') return false;
const n = Number(value);
return !isNaN(n) && Number.isInteger(n) && n >= 0;
},
syncActiveStep() {
var s = -1;
if (this.selectedJournalId) {
@@ -842,6 +885,8 @@
String(this.expertType || '').trim() !== '' &&
this.sendCount != null &&
this.sendCount >= 1 &&
this.isValidInterval(this.minInterval) &&
this.isValidInterval(this.maxInterval) &&
this.selectedEmailIds &&
this.selectedEmailIds.length > 0
) {
@@ -1390,6 +1435,16 @@
this.$message.warning(this.$t('autoPromotion.factoryFillRequired'));
return;
}
if (!this.isValidInterval(this.minInterval) || !this.isValidInterval(this.maxInterval)) {
this.$message.warning(this.$t('autoPromotion.factoryNeedInterval'));
return;
}
const minInterval = Number(this.minInterval);
const maxInterval = Number(this.maxInterval);
if (minInterval > maxInterval) {
this.$message.warning(this.$t('autoPromotion.factoryIntervalRangeInvalid'));
return;
}
if (this.isExpertDatabaseType && (!this.factoryFieldIds || !this.factoryFieldIds.length)) {
this.$message.warning(this.$t('autoPromotion.factoryNeedPromotionFields'));
return;
@@ -1405,6 +1460,8 @@
expert_type: String(this.expertType || '').trim(),
email_ids: this.selectedEmailIds.join(','),
send_count: String(this.sendCount),
min_interval: String(minInterval),
max_interval: String(maxInterval),
template_id: String(this.factoryConfig.defaultTemplateId),
style_id: String(this.factoryConfig.defaultStyleId),
fetch_ids: this.isExpertDatabaseType ? (this.factoryFieldIds || []).join(',') : '',
@@ -1481,6 +1538,12 @@
},
sendCount: function () {
this.syncActiveStep();
},
minInterval: function () {
this.syncActiveStep();
},
maxInterval: function () {
this.syncActiveStep();
}
}
};