跑通consumer下单之后派单给delivery2

This commit is contained in:
2026-05-27 19:09:17 +08:00
parent c26f2c5431
commit 1bf9d11c35
13 changed files with 2554 additions and 436 deletions

View File

@@ -645,7 +645,16 @@ async function listWorkerTaskIds(): Promise<Array<string>> {
return result
}
}
const legacyResponse = await supa.from('hss_service_orders').select('id').eq('current_staff_id', userId).order('created_at', { ascending: false }).execute()
let staffProfileId = ''
const staffResponse = await supa.from('ml_delivery_staff').select('id').eq('uid', userId).limit(1).execute()
if (staffResponse.error == null && staffResponse.data != null) {
const staffRows = staffResponse.data as Array<any>
if (staffRows.length > 0) {
staffProfileId = readString(staffRows[0], 'id')
}
}
const legacyStaffId = staffProfileId != '' ? staffProfileId : userId
const legacyResponse = await supa.from('hss_service_orders').select('id').eq('current_staff_id', legacyStaffId).order('created_at', { ascending: false }).execute()
if (legacyResponse.error != null || legacyResponse.data == null) {
return [] as Array<string>
}