feat(douyu): 兑换图片默认隐藏 + 供应商直充默认上限800
- 兑换图片仅显示本页面本次发起过兑换的账号,历史截图默认不展示 - douyu_config 增加 gold_api_max_amount,默认800 - 配置弹窗可修改,输入框按上限 clamp,执行器下单前再校验 - 新增迁移0130,补充配置/超限测试
This commit is contained in:
@@ -950,6 +950,7 @@ export interface DouyuConfig {
|
||||
gold_api_product_id: string;
|
||||
gold_api_account_template_name: string;
|
||||
recharge_duplicate_confirm_minutes: number;
|
||||
gold_api_max_amount: number;
|
||||
gift_id: string;
|
||||
skin_id: string;
|
||||
updated_at: string | null;
|
||||
|
||||
@@ -220,6 +220,8 @@ export default function DouyuTasksPage({ handbook }: { handbook: HandbookKind })
|
||||
const [configOpen, setConfigOpen] = useState(false);
|
||||
const [concurrency, setConcurrency] = useState(3);
|
||||
const [goldAmount, setGoldAmount] = useState(() => savedPositiveInteger(DOUYU_GOLD_AMOUNT_STORAGE_KEY));
|
||||
// 历史兑换截图默认不展示;只有本页面本次实际发起过兑换的账号才显示。
|
||||
const [exchangeImageAccountIds, setExchangeImageAccountIds] = useState<Set<number>>(() => new Set());
|
||||
const [giftCount, setGiftCount] = useState(() => savedPositiveInteger(DOUYU_GIFT_COUNT_STORAGE_KEY));
|
||||
const [selectedGoodsId, setSelectedGoodsId] = useState('');
|
||||
const [xpdPayType, setXpdPayType] = useState<'1' | '5'>('1');
|
||||
@@ -453,11 +455,12 @@ export default function DouyuTasksPage({ handbook }: { handbook: HandbookKind })
|
||||
const map = new Map<number, DouyuTaskItem>();
|
||||
for (const task of visibleTasks) {
|
||||
if (!exchangeTaskSucceeded(task)) continue;
|
||||
if (!exchangeImageAccountIds.has(task.account_id)) continue;
|
||||
const previous = map.get(task.account_id);
|
||||
if (!previous || task.id > previous.id) map.set(task.account_id, task);
|
||||
}
|
||||
return map;
|
||||
}, [visibleTasks]);
|
||||
}, [visibleTasks, exchangeImageAccountIds]);
|
||||
|
||||
const latestLockedTaskByAccount = useMemo(() => {
|
||||
const paidOrders = new Set(
|
||||
@@ -1113,6 +1116,13 @@ export default function DouyuTasksPage({ handbook }: { handbook: HandbookKind })
|
||||
}
|
||||
// 只有本页面创建的批次才允许主动弹二维码,防止其他工作台/浏览器的任务打扰当前操作。
|
||||
locallyStartedBatchIds.current.add(result.batch_id);
|
||||
if (['exchange_goods', 'exchange_esports_goods', 'exchange_xpd_goods'].includes(taskType)) {
|
||||
setExchangeImageAccountIds((prev) => {
|
||||
const next = new Set(prev);
|
||||
for (const id of ids) next.add(id);
|
||||
return next;
|
||||
});
|
||||
}
|
||||
if (
|
||||
DOUYU_PAYMENT_TASK_TYPE_SET.has(taskType)
|
||||
&& !(taskType === 'create_gold_qr' && goldRechargeChannel === 'supplier_api')
|
||||
@@ -2423,6 +2433,10 @@ export default function DouyuTasksPage({ handbook }: { handbook: HandbookKind })
|
||||
}
|
||||
};
|
||||
const goldAmountLabel = '充值金额';
|
||||
const supplierMaxGoldAmount = Math.max(
|
||||
1,
|
||||
Number(config?.gold_api_max_amount) || 800,
|
||||
);
|
||||
const isRechargeChannelLoading = goldRechargeChannel === null;
|
||||
const isSupplierGoldRecharge = goldRechargeChannel === 'supplier_api';
|
||||
const goldRechargeChannelLabel = isRechargeChannelLoading
|
||||
@@ -2592,8 +2606,13 @@ export default function DouyuTasksPage({ handbook }: { handbook: HandbookKind })
|
||||
<InputNumber
|
||||
size="small"
|
||||
min={1}
|
||||
max={isSupplierGoldRecharge ? supplierMaxGoldAmount : undefined}
|
||||
value={goldAmount}
|
||||
onChange={(v) => setGoldAmount(v || 1)}
|
||||
onChange={(v) => setGoldAmount(
|
||||
isSupplierGoldRecharge
|
||||
? Math.min(Number(v) || 1, supplierMaxGoldAmount)
|
||||
: (Number(v) || 1),
|
||||
)}
|
||||
addonBefore={goldAmountLabel}
|
||||
style={{ width: '100%' }}
|
||||
/>
|
||||
@@ -2661,8 +2680,13 @@ export default function DouyuTasksPage({ handbook }: { handbook: HandbookKind })
|
||||
<InputNumber
|
||||
size="small"
|
||||
min={1}
|
||||
max={isSupplierGoldRecharge ? supplierMaxGoldAmount : undefined}
|
||||
value={goldAmount}
|
||||
onChange={(v) => setGoldAmount(v || 1)}
|
||||
onChange={(v) => setGoldAmount(
|
||||
isSupplierGoldRecharge
|
||||
? Math.min(Number(v) || 1, supplierMaxGoldAmount)
|
||||
: (Number(v) || 1),
|
||||
)}
|
||||
addonBefore={goldAmountLabel}
|
||||
style={{ width: '100%' }}
|
||||
/>
|
||||
@@ -3125,6 +3149,20 @@ export default function DouyuTasksPage({ handbook }: { handbook: HandbookKind })
|
||||
} : prev)}
|
||||
/>
|
||||
</Space>
|
||||
<Space style={{ width: '100%', justifyContent: 'space-between' }}>
|
||||
<Text>最大单笔充值额度(鱼翅)</Text>
|
||||
<InputNumber
|
||||
min={1}
|
||||
max={1000000}
|
||||
precision={0}
|
||||
style={{ width: 300 }}
|
||||
value={configFormValues.gold_api_max_amount}
|
||||
onChange={(value) => setConfigFormValues((prev) => prev ? {
|
||||
...prev,
|
||||
gold_api_max_amount: Number(value) || 800,
|
||||
} : prev)}
|
||||
/>
|
||||
</Space>
|
||||
{[
|
||||
{ label: '供应商商品 ID', key: 'gold_api_product_id' },
|
||||
{ label: '充值账号模板名(值为斗鱼昵称)', key: 'gold_api_account_template_name' },
|
||||
|
||||
Reference in New Issue
Block a user