发送消息ok
This commit is contained in:
@@ -32,6 +32,7 @@ import {
|
||||
} from '../../repositories/task-inventory-binding-repo.js'
|
||||
import { createTaskEvent, listTaskEventsByTaskId } from '../../repositories/task-event-repo.js'
|
||||
import { getWebhookEventById, listWebhookEvents, listWebhookEventsByOrderId } from '../../repositories/webhook-event-repo.js'
|
||||
import { listMessageDeliveries } from '../../repositories/message-delivery-repo.js'
|
||||
import { createHttpError } from '../../utils/http.js'
|
||||
import { formatFenToAmount, normalizeFen, parseAmountToFen } from '../../utils/money.js'
|
||||
import { nowIso } from '../../utils/time.js'
|
||||
@@ -197,6 +198,28 @@ export async function getAdminTasks(query = {}) {
|
||||
}
|
||||
}
|
||||
|
||||
export async function getAdminMessageDeliveries(query = {}) {
|
||||
const page = normalizePage(query.page)
|
||||
const pageSize = normalizePageSize(query.pageSize)
|
||||
const { items, total } = await listMessageDeliveries({
|
||||
page,
|
||||
pageSize,
|
||||
provider: String(query.provider || '').trim(),
|
||||
platform: String(query.platform || '').trim(),
|
||||
status: String(query.status || '').trim(),
|
||||
shopId: String(query.shopId || '').trim(),
|
||||
platformOrderId: String(query.platformOrderId || '').trim(),
|
||||
taskNo: String(query.taskNo || '').trim(),
|
||||
dateFrom: normalizeDateQuery(query.dateFrom),
|
||||
dateTo: normalizeDateQuery(query.dateTo, true),
|
||||
})
|
||||
|
||||
return {
|
||||
items: items.map(mapAdminMessageDeliveryListItem),
|
||||
pagination: { page, pageSize, total },
|
||||
}
|
||||
}
|
||||
|
||||
export async function getAdminTaskDetail(taskId) {
|
||||
const task = await getTaskById(Number(taskId))
|
||||
|
||||
@@ -1103,6 +1126,33 @@ function mapAdminFulfillmentBindingConfigItem(item) {
|
||||
}
|
||||
}
|
||||
|
||||
function mapAdminMessageDeliveryListItem(item) {
|
||||
return {
|
||||
deliveryId: Number(item.id),
|
||||
provider: String(item.provider || '').trim(),
|
||||
platform: String(item.platform || '').trim(),
|
||||
shopId: String(item.shop_id || '').trim(),
|
||||
shopName: String(item.shop_name || '').trim(),
|
||||
channel: String(item.channel || '').trim(),
|
||||
orderId: item.order_id ? Number(item.order_id) : null,
|
||||
taskId: item.task_id ? Number(item.task_id) : null,
|
||||
taskNo: String(item.task_no || '').trim(),
|
||||
taskStatus: String(item.task_status || '').trim(),
|
||||
platformOrderId: String(item.platform_order_id || '').trim(),
|
||||
recipientKey: String(item.recipient_key || '').trim(),
|
||||
messageContent: String(item.message_content || '').trim(),
|
||||
claimUrl: String(item.claim_url || '').trim(),
|
||||
status: String(item.status || '').trim(),
|
||||
requestUrl: String(item.request_url || '').trim(),
|
||||
responseStatus: Number(item.response_status || 0),
|
||||
response: safeParseJson(item.response_json),
|
||||
errorMessage: String(item.error_message || '').trim(),
|
||||
sentAt: item.sent_at || null,
|
||||
createdAt: item.created_at,
|
||||
updatedAt: item.updated_at,
|
||||
}
|
||||
}
|
||||
|
||||
function matchesObservedProduct(binding, observed) {
|
||||
const provider = String(binding?.provider || '').trim()
|
||||
const platform = String(binding?.platform || '').trim()
|
||||
|
||||
Reference in New Issue
Block a user