fix(consignment): 仅自动匹配命中时发送短信
后台手动匹配与手动拼单不再发送短信;同步更新后台提示文案与集成测试断言。
This commit is contained in:
@@ -818,13 +818,7 @@ async function main() {
|
||||
'SELECT * FROM consignment_sms_logs WHERE work_order_id = $1 AND inventory_id = $2',
|
||||
[Number(exactWo.id), Number(invARow.id)],
|
||||
)
|
||||
const smsRow = sms.rows[0]
|
||||
assert(smsRow, '手动匹配没有生成短信记录')
|
||||
assert(smsRow.status === 'sent', `短信状态=${smsRow.status}`)
|
||||
assert(smsRow.phone === '13800138000', `短信手机号=${smsRow.phone}`)
|
||||
assert(smsRow.match_type === 'manual', `短信 match_type=${smsRow.match_type}`)
|
||||
assert(String(smsRow.content).includes('【CTEST】'), `短信内容=${smsRow.content}`)
|
||||
assert(String(smsRow.content).includes('CT-WO-EXACT-'), `短信内容=${smsRow.content}`)
|
||||
assert(sms.rows.length === 0, '手动匹配不得发送短信')
|
||||
},
|
||||
)
|
||||
|
||||
@@ -1064,15 +1058,7 @@ async function main() {
|
||||
'SELECT * FROM consignment_sms_logs WHERE work_order_id = $1 ORDER BY id',
|
||||
[Number(shareWo.id)],
|
||||
)
|
||||
assert(sms.rows.length === 2, `拼单短信=${sms.rows.length}`)
|
||||
assert(
|
||||
sms.rows.every((row) => row.status === 'sent'),
|
||||
'拼单短信必须全部发送成功',
|
||||
)
|
||||
assert(
|
||||
sms.rows.every((row) => row.match_type === 'manual'),
|
||||
'拼单短信 match_type 必须 manual',
|
||||
)
|
||||
assert(sms.rows.length === 0, '手动拼单不得发送短信')
|
||||
const wo = await query<Record<string, any>>('SELECT * FROM work_orders WHERE id = $1', [
|
||||
Number(shareWo.id),
|
||||
])
|
||||
|
||||
@@ -54,8 +54,9 @@ function resolveSellerPhone(inventory: ConsignmentInventoryRow): string {
|
||||
}
|
||||
|
||||
/**
|
||||
* 寄卖匹配成功短信:自动匹配、后台手动匹配、拼单份额匹配都会走这里。
|
||||
* 寄卖匹配成功短信:只在自动匹配命中后发送。
|
||||
*
|
||||
* 业务口径:后台手动匹配、手动拼单不发送短信;只有分类开启自动匹配并实际命中时才发。
|
||||
* 发送记录以「工单 + 库存」为幂等键:同一工单同一库存只发一次;
|
||||
* 短信失败不回滚匹配事务,只记录 failed 便于后台排查/补发。
|
||||
*/
|
||||
@@ -63,6 +64,9 @@ export async function sendConsignmentMatchSuccessSms(
|
||||
payload: ConsignmentMatchSmsPayload,
|
||||
): Promise<ConsignmentMatchSmsStatus> {
|
||||
try {
|
||||
if (payload.matchType !== 'auto') {
|
||||
return 'skipped'
|
||||
}
|
||||
const config = getWorkerPlatformNotificationConfig().consignmentMatchSms
|
||||
if (!config.enabled) {
|
||||
return 'skipped'
|
||||
|
||||
@@ -175,8 +175,8 @@ export default function NotificationsPanel() {
|
||||
<Alert
|
||||
type="info"
|
||||
showIcon
|
||||
message="匹配成功后向寄卖人发送短信"
|
||||
description="自动匹配、后台手动匹配与拼单份额匹配都会触发;同一工单同一库存只发送一次,短信失败不影响匹配结果。"
|
||||
message="自动匹配命中后向寄卖人发送短信"
|
||||
description="仅分类开启自动匹配且自动匹配实际命中时发送;后台手动匹配、手动拼单不发送。同一工单同一库存只发送一次,短信失败不影响匹配结果。"
|
||||
/>
|
||||
<Space align="center" size={12}>
|
||||
<Switch
|
||||
|
||||
Reference in New Issue
Block a user