fix(expressPlatform): 面单下单参数调整
- 菠萝派/淘宝面单 payload 字段调整:tid/transtype/mainsubpaymode 等按平台传参, 移除暂不使用的字段 - 菜鸟取号:oaid 超 128 位时转 caid 传递、tid 改用 pay_no; 调试输出改缓存(Cainiaoquery/Cainiaoresult)
This commit is contained in:
parent
29e7b6ae70
commit
9327611552
@ -707,45 +707,44 @@ class ExpressPlatformService extends MainService {
|
||||
object_Id: `${order.warehouse_id.toString(16)}_${order.id}_${order_tmp.business_key}`, // 菠萝派平台要求订单唯一标识必须为字符串
|
||||
orderno: `${order.warehouse_id.toString(16)}_${order.id}_${order_tmp.business_key}`, // 菠萝派平台要求订单号必须为字符串
|
||||
plattradeno: listByWarehousePlatformCode.platform_code === 'DY' && order.from_key === 23060081 && !!order.pay_no ? order.pay_no : order.source_order_codes || order.delivery_order_code || '',
|
||||
ismultiplepieces: order.package_count > 1 ? 1 : 0,
|
||||
logisticno: allocatedWaybillMap.get(`${Number(order.id) || 0}:${Number(order_tmp.business_key) || 0}`) || '',
|
||||
logistictype: order.logistics_code || '',
|
||||
tid:listByWarehousePlatformCode.platform_code === 'DY' && order.from_key === 23060081 && !!order.pay_no ? order.pay_no : order.source_order_codes || order.delivery_order_code || '',
|
||||
//ismultiplepieces: order.package_count > 1 ? 1 : 0,
|
||||
//logisticno: allocatedWaybillMap.get(`${Number(order.id) || 0}:${Number(order_tmp.business_key) || 0}`) || '',
|
||||
logistictype: expressListItem[listByWarehousePlatformCode.platform_code] || '',
|
||||
providercode: expressListItem[listByWarehousePlatformCode.platform_code] || order.logistics_code || '',
|
||||
numpackage: order.package_count || 1,
|
||||
businessType: listByWarehousePlatformCode.product_type,
|
||||
numpackage: order.package_count || '1',
|
||||
businesstype: listByWarehousePlatformCode.product_type,
|
||||
transtype:'0',
|
||||
transtypecode:'1',
|
||||
mainsubpaymode:'1',
|
||||
businessplat: order.sys_platform_code === 'KS' ? order.sys_platform_code : 'OTHERS',
|
||||
paymode: listByWarehousePlatformCode.paymode ?? 1,
|
||||
paymode: listByWarehousePlatformCode.paymode.toString() ?? '1',
|
||||
ordertype: listByWarehousePlatformCode.ordertype ?? 'JH_Normal',
|
||||
ProviderID: listByWarehousePlatformCode.providerid ?? '',
|
||||
procode: order.procode || '普通商品',
|
||||
codpaymoney: order.ar_amount ?? null,
|
||||
packagemoney: order.item_amount ?? null,
|
||||
weight: Number(order.items_weight) || 0, // 单位 g,需确认 PolyAPI 期望单位
|
||||
supporpaymoney: order.total_amount ?? null,
|
||||
length: Number(order.length) || 0,
|
||||
width: Number(order.width) || 0,
|
||||
height: Number(order.height) || 0,
|
||||
volume: Number(order.volume) || 0,
|
||||
ispickup: listByWarehousePlatformCode.ispickup ?? 0,
|
||||
ProductType: listByWarehousePlatformCode.product_type || '',
|
||||
Sipshopid: listByWarehousePlatformCode.platform_shop_id || '',
|
||||
ProviderID:'',
|
||||
//procode: order.procode || '普通商品',
|
||||
//codpaymoney: order.ar_amount ?? null,
|
||||
//packagemoney: order.item_amount ?? null,
|
||||
//weight: Number(order.items_weight) || 0, // 单位 g,需确认 PolyAPI 期望单位
|
||||
//supporpaymoney: order.total_amount ?? null,
|
||||
//ispickup: listByWarehousePlatformCode.ispickup ?? 0,
|
||||
//ProductType: listByWarehousePlatformCode.product_type || '',
|
||||
//Sipshopid: listByWarehousePlatformCode.platform_shop_id || '',
|
||||
oaid: order.oaid || '',
|
||||
sys_express_code: listByWarehousePlatformCode.sys_express_code || '',
|
||||
platform_code: listByWarehousePlatformCode.platform_code || '',
|
||||
cpcode: expressListItem[listByWarehousePlatformCode.platform_code] || '',
|
||||
logisticsproductname: 'JH_02',
|
||||
dmssorting: 0,
|
||||
brandno: listByWarehousePlatformCode.brandno || null,
|
||||
//dmssorting: 0,
|
||||
//brandno: listByWarehousePlatformCode.brandno || null,
|
||||
needencrypt: 1,
|
||||
customername:"测试",
|
||||
ordersource: matchedPlatform.ordersource || '',
|
||||
inputsite: listByWarehousePlatformCode.site_code || '',
|
||||
//inputsite: order.sys_platform_code === 'XHS' ? '' :listByWarehousePlatformCode.site_code || '',
|
||||
sitecode: listByWarehousePlatformCode.site_code || '',
|
||||
shipperno: listByWarehousePlatformCode.shipperno || '',
|
||||
customercode: listByWarehousePlatformCode.shipperno || listByWarehousePlatformCode.client_id || '',
|
||||
shipperno: order.sys_platform_code === 'XHS' ? '' :listByWarehousePlatformCode.shipperno || '',
|
||||
customercode: order.sys_platform_code === 'XHS' ? '' :listByWarehousePlatformCode.shipperno || listByWarehousePlatformCode.client_id || '',
|
||||
sender: {
|
||||
company: listByWarehousePlatformCode.shop_name || '',
|
||||
Company: listByWarehousePlatformCode.shop_name || '',
|
||||
name: listByWarehousePlatformCode.sender_name || '',
|
||||
phone: listByWarehousePlatformCode.sender_tel || '',
|
||||
phone: order.sys_platform_code === 'XHS' ? undefined :listByWarehousePlatformCode.sender_tel || '',
|
||||
mobile: order.sys_platform_code === 'XHS' ? listByWarehousePlatformCode.sender_tel : undefined,
|
||||
country: 'CN',
|
||||
city: listByWarehousePlatformCode.city_name || '',
|
||||
@ -771,21 +770,21 @@ class ExpressPlatformService extends MainService {
|
||||
},
|
||||
goods: (order.orderItems && order.orderItems.map(item => ({
|
||||
productid: item.item_code,
|
||||
cnname: item.item_name || '商品',
|
||||
cnname: 'sp',
|
||||
count: item.plan_qty || 0,
|
||||
}))) || [],
|
||||
Mallmaskid: '',
|
||||
//Mallmaskid: '',
|
||||
|
||||
template_url: listByWarehousePlatformCode.template_id || '',
|
||||
labelformat: listByWarehousePlatformCode.labelformat || '',
|
||||
extraInfo: ExpressList.find(item => item.code === listByWarehousePlatformCode.sys_express_code)?.polyapi_extra_info || '',
|
||||
//labelformat: listByWarehousePlatformCode.labelformat || '',
|
||||
//extraInfo: ExpressList.find(item => item.code === listByWarehousePlatformCode.sys_express_code)?.polyapi_extra_info || '',
|
||||
};
|
||||
console.log('matchedPlatform.platid', matchedPlatform.platid);
|
||||
console.log('startPlayload', playload);
|
||||
|
||||
if (Number(matchedPlatform.platid) === 673) {
|
||||
playload.BizVersion = '2';
|
||||
playload.brandno = listByWarehousePlatformCode.brandno || '';
|
||||
playload.brandno = listByWarehousePlatformCode.brandno === "SF" ? listByWarehousePlatformCode.brandno : undefined;
|
||||
}
|
||||
if (Number(matchedPlatform.platid) === 544) {
|
||||
const {
|
||||
@ -898,7 +897,7 @@ class ExpressPlatformService extends MainService {
|
||||
playload.mainsubpaymode = '1';
|
||||
delete playload.plattradeno;
|
||||
}
|
||||
playload.ProviderID = listByWarehousePlatformCode.providerid;
|
||||
playload.ProviderID = listByWarehousePlatformCode.providerid || "";
|
||||
console.log('playload', playload);
|
||||
return playload;
|
||||
}),
|
||||
@ -1105,7 +1104,7 @@ class ExpressPlatformService extends MainService {
|
||||
receivertel: '',
|
||||
cargoname: '',
|
||||
senddata: '',
|
||||
weight: '',
|
||||
//weight: '',
|
||||
eCustomerCode: '',
|
||||
remark: '',
|
||||
selleruserid: '',
|
||||
@ -1761,6 +1760,8 @@ class ExpressPlatformService extends MainService {
|
||||
.filter(Boolean)
|
||||
: [];
|
||||
const recipientMobile = orderDelivery && (orderDelivery.mobile || orderDelivery.tel) || '';
|
||||
const orderDeliveryOaid = orderDelivery && orderDelivery.oaid ? String(orderDelivery.oaid).trim() : '';
|
||||
const oaidTooLong = orderDeliveryOaid.length > 128;
|
||||
|
||||
const tradeOrderInfo = {
|
||||
logistics_services: normalizedExtData,
|
||||
@ -1797,10 +1798,10 @@ class ExpressPlatformService extends MainService {
|
||||
mobile: recipientMobile,
|
||||
name: orderDelivery && orderDelivery.name || '',
|
||||
phone: recipientMobile,
|
||||
oaid: orderDelivery && orderDelivery.oaid || '',
|
||||
tid: sourceOrderCodes[0] || '',
|
||||
oaid: oaidTooLong ? '' : orderDeliveryOaid,
|
||||
caid: oaidTooLong ? orderDeliveryOaid : '',
|
||||
tid: orderDelivery.pay_no || '',
|
||||
},
|
||||
oaid: orderDelivery && orderDelivery.oaid || '',
|
||||
user_id: listByWarehousePlatformCode.shop && listByWarehousePlatformCode.shop.owner_id || 0,
|
||||
notify_extend_info: normalizedExtData,
|
||||
};
|
||||
@ -1842,7 +1843,8 @@ class ExpressPlatformService extends MainService {
|
||||
shipping_branch_code: String(listByWarehousePlatformCode.site_code || '').trim(),
|
||||
},
|
||||
};
|
||||
console.log('cainiaoPayload', JSON.stringify(cainiaoPayload));
|
||||
|
||||
await this.app.setCacheAsync('Cainiaoquery', JSON.stringify(cainiaoPayload), 3600);
|
||||
const requestParams = {
|
||||
method: 'cainiao.waybill.ii.get',
|
||||
app_key: appKey,
|
||||
@ -1865,7 +1867,7 @@ class ExpressPlatformService extends MainService {
|
||||
sign,
|
||||
},
|
||||
});
|
||||
console.log('菜鸟取号返回数据', JSON.stringify(response));
|
||||
await this.app.setCacheAsync('Cainiaoresult', JSON.stringify(response), 3600);
|
||||
|
||||
const responseData = response && Object.prototype.hasOwnProperty.call(response, 'data')
|
||||
? response.data
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user