Merge branch 'ship' of gitea.51mars.com:Oak-Team/oak-pay-business into ship

This commit is contained in:
Xu Chang 2025-03-12 11:18:40 +08:00
commit 463f58e6f7
14 changed files with 660 additions and 28 deletions

View File

@ -5,9 +5,9 @@ export default interface ShipClazz<ED extends EntityDict & BaseEntityDict, Conte
available(shipServiceId: string, orderIds: string[], context: Context): Promise<boolean>;
eOrder(shipId: string, context: Context): Promise<string>;
cancelOrder(shipId: string, context: Context): Promise<void>;
syncState(shipId: string): Promise<EntityDict['ship']['OpSchema']['iState']>;
syncPaths(shipId: string): Promise<EntityDict['ship']['OpSchema']['extraPaths']>;
getPrintInfo(shipId: string): Promise<{
syncState(shipId: string, context: Context): Promise<EntityDict['ship']['OpSchema']['iState']>;
syncPaths(shipId: string, context: Context): Promise<EntityDict['ship']['OpSchema']['extraPaths']>;
getPrintInfo(shipId: string, context: Context): Promise<{
type: 'html';
data: string;
}>;

View File

@ -5,4 +5,10 @@ import DebugClazz from './WechatMpShip.debug';
export default class WechatMpShip<ED extends EntityDict & BaseEntityDict, Context extends BackendRuntimeContext<ED>> extends DebugClazz<ED, Context> {
eOrder(shipId: string, context: Context): Promise<string>;
cancelOrder(shipId: string, context: Context): Promise<void>;
syncState(shipId: string, context: Context): Promise<EntityDict['ship']['OpSchema']['iState']>;
syncPaths(shipId: string, context: Context): Promise<EntityDict['ship']['OpSchema']['extraPaths']>;
getPrintInfo(shipId: string, context: Context): Promise<{
type: 'html';
data: string;
}>;
}

View File

@ -24,11 +24,36 @@ export default class WechatMpShipDebug<ED extends EntityDict & BaseEntityDict, C
waybill_id: NonNullable<ED["ship"]["Schema"]["extraShipId"]>;
order_id: string;
}>;
protected prepareGetWaybillToken(shipId: string, context: Context): Promise<{
openid: string | undefined;
sender_phone: string;
receiver_phone: string;
delivery_id: string;
waybill_id: NonNullable<ED["ship"]["Schema"]["extraShipId"]>;
goods_info: {
detail_list: {
goods_name: string;
goods_img_url: string;
goods_desc?: string | undefined;
}[];
};
}>;
protected prepareGetPath(shipId: string, context: Context): Promise<{
openid: string | undefined;
delivery_id: string;
waybill_id: NonNullable<ED["ship"]["Schema"]["extraShipId"]>;
}>;
protected prepareGetOrder(shipId: string, context: Context): Promise<{
order_id: string;
openid: string | undefined;
delivery_id: string;
waybill_id: NonNullable<ED["ship"]["Schema"]["extraShipId"]>;
}>;
eOrder(shipId: string, context: Context): Promise<string>;
cancelOrder(shipId: string, context: Context): Promise<void>;
syncState(shipId: string): Promise<EntityDict["ship"]["OpSchema"]["iState"]>;
syncPaths(extraShipId: string): Promise<EntityDict["ship"]["OpSchema"]["extraPaths"]>;
getPrintInfo(shipId: string): Promise<{
syncState(shipId: string, context: Context): Promise<EntityDict["ship"]["OpSchema"]["iState"]>;
syncPaths(shipId: string, context: Context): Promise<EntityDict["ship"]["OpSchema"]["extraPaths"]>;
getPrintInfo(shipId: string, context: Context): Promise<{
type: "html";
data: string;
}>;

View File

@ -204,6 +204,123 @@ export default class WechatMpShipDebug {
order_id: shipId,
};
}
async prepareGetWaybillToken(shipId, context) {
const [ship] = await context.select('ship', {
data: {
id: 1,
from: {
id: 1,
phone: 1,
},
to: {
id: 1,
phone: 1,
},
shipService: {
shipCompanyId: 1,
},
extraShipId: 1,
wechatMpShip: {
applicationId: 1,
},
shipOrder$ship: {
$entity: 'shipOrder',
data: {
id: 1,
orderId: 1,
},
},
},
filter: {
id: shipId,
}
}, { dontCollect: true });
assert(ship);
const { extraShipId, from, to, shipService, shipOrder$ship: shipOrders, wechatMpShip } = ship;
const orderIds = shipOrders.map(ele => ele.orderId);
const { openId } = await this.getReceiverInfo(orderIds, wechatMpShip.applicationId, context);
const extraData = await this.getExtraData(shipId, context);
const detailList = extraData.shop.detail_list;
//todo order_detail_path
return {
openid: openId,
sender_phone: from.phone,
receiver_phone: from.phone,
delivery_id: shipService.shipCompanyId,
waybill_id: extraShipId,
goods_info: {
detail_list: detailList,
},
// trans_id: '',
// order_detail_path: '',
};
}
async prepareGetPath(shipId, context) {
const [ship] = await context.select('ship', {
data: {
id: 1,
extraShipId: 1,
shipService: {
shipCompanyId: 1,
},
shipOrder$ship: {
$entity: 'shipOrder',
data: {
orderId: 1,
},
},
wechatMpShip: {
applicationId: 1,
},
},
filter: {
id: shipId,
}
}, { dontCollect: true });
assert(ship);
const { extraShipId, shipService, shipOrder$ship: shipOrders, wechatMpShip } = ship;
const orderIds = shipOrders.map(ele => ele.orderId);
const { openId } = await this.getReceiverInfo(orderIds, wechatMpShip.applicationId, context);
return {
openid: openId,
delivery_id: shipService.shipCompanyId,
waybill_id: extraShipId,
};
}
async prepareGetOrder(shipId, context) {
const [ship] = await context.select('ship', {
data: {
id: 1,
extraShipId: 1,
shipService: {
shipCompanyId: 1,
},
shipOrder$ship: {
$entity: 'shipOrder',
data: {
orderId: 1,
order: {}
},
},
wechatMpShip: {
applicationId: 1,
},
},
filter: {
id: shipId,
}
}, { dontCollect: true });
assert(ship);
const { extraShipId, shipService, shipOrder$ship: shipOrders, wechatMpShip } = ship;
const orderIds = shipOrders.map(ele => ele.orderId);
const { openId } = await this.getReceiverInfo(orderIds, wechatMpShip.applicationId, context);
return {
order_id: shipId,
openid: openId,
delivery_id: shipService.shipCompanyId,
waybill_id: extraShipId,
};
}
async eOrder(shipId, context) {
const data = await this.prepareOrder(shipId, context);
console.log('mock eOrder to wechatMpShip, data:', data);
@ -213,13 +330,13 @@ export default class WechatMpShipDebug {
const data = await this.prepareCancelOrder(shipId, context);
console.log('mock cancelOrder to wechatMpShip, data:', data);
}
syncState(shipId) {
syncState(shipId, context) {
throw new Error("Method not implemented.");
}
syncPaths(extraShipId) {
syncPaths(shipId, context) {
throw new Error("Method not implemented.");
}
getPrintInfo(shipId) {
getPrintInfo(shipId, context) {
throw new Error("Method not implemented.");
}
}

View File

@ -11,4 +11,70 @@ export default class WechatMpShip extends DebugClazz {
const data = await this.prepareCancelOrder(shipId, context);
await instance.cancelExpressOrder(data);
}
async syncState(shipId, context) {
const instance = await this.getInstance(context);
const data = await this.prepareGetPath(shipId, context);
const result = await instance.getExpressPath(data);
const { path_item_num, path_item_list } = result;
const latestPath = path_item_list[path_item_num - 1] || undefined;
const latestType = latestPath?.action_type;
/**
* action_type:
* 100001 揽件阶段-揽件成功
* 100002 揽件阶段-揽件失败
* 100003 揽件阶段-分配业务员
* 200001 运输阶段-更新运输轨迹
* 300002 派送阶段-开始派送
* 300003 派送阶段-签收成功
* 300004 派送阶段-签收失败
* 400001 异常阶段-订单取消
* 400002 异常阶段-订单滞留
*/
let state = undefined;
switch (latestType) {
case 100001:
case 100003:
case 200001:
case 300002: {
state = 'shipping';
break;
}
case 300003: {
state = 'received';
break;
}
// case 400001: {
// state = 'reject';
// break;
// }
case 100002:
case 300004:
case 400002: {
state = 'unknow';
break;
}
}
return state;
}
async syncPaths(shipId, context) {
const instance = await this.getInstance(context);
const data = await this.prepareGetPath(shipId, context);
const result = await instance.getExpressPath(data);
const paths = result.path_item_list?.map((path) => ({
time: path.action_time,
action: path.action_msg,
}));
return paths;
}
async getPrintInfo(shipId, context) {
const instance = await this.getInstance(context);
const data = await this.prepareGetOrder(shipId, context);
const result = await instance.getExpressOrder(data);
const base64Html = result.print_html;
// const html = Buffer.from(base64Html, 'base64').toString('utf8');
return {
type: 'html',
data: base64Html,
};
}
}

View File

@ -5,9 +5,9 @@ export default interface ShipClazz<ED extends EntityDict & BaseEntityDict, Conte
available(shipServiceId: string, orderIds: string[], context: Context): Promise<boolean>;
eOrder(shipId: string, context: Context): Promise<string>;
cancelOrder(shipId: string, context: Context): Promise<void>;
syncState(shipId: string): Promise<EntityDict['ship']['OpSchema']['iState']>;
syncPaths(shipId: string): Promise<EntityDict['ship']['OpSchema']['extraPaths']>;
getPrintInfo(shipId: string): Promise<{
syncState(shipId: string, context: Context): Promise<EntityDict['ship']['OpSchema']['iState']>;
syncPaths(shipId: string, context: Context): Promise<EntityDict['ship']['OpSchema']['extraPaths']>;
getPrintInfo(shipId: string, context: Context): Promise<{
type: 'html';
data: string;
}>;

View File

@ -5,4 +5,10 @@ import DebugClazz from './WechatMpShip.debug';
export default class WechatMpShip<ED extends EntityDict & BaseEntityDict, Context extends BackendRuntimeContext<ED>> extends DebugClazz<ED, Context> {
eOrder(shipId: string, context: Context): Promise<string>;
cancelOrder(shipId: string, context: Context): Promise<void>;
syncState(shipId: string, context: Context): Promise<EntityDict['ship']['OpSchema']['iState']>;
syncPaths(shipId: string, context: Context): Promise<EntityDict['ship']['OpSchema']['extraPaths']>;
getPrintInfo(shipId: string, context: Context): Promise<{
type: 'html';
data: string;
}>;
}

View File

@ -24,11 +24,36 @@ export default class WechatMpShipDebug<ED extends EntityDict & BaseEntityDict, C
waybill_id: NonNullable<ED["ship"]["Schema"]["extraShipId"]>;
order_id: string;
}>;
protected prepareGetWaybillToken(shipId: string, context: Context): Promise<{
openid: string | undefined;
sender_phone: string;
receiver_phone: string;
delivery_id: string;
waybill_id: NonNullable<ED["ship"]["Schema"]["extraShipId"]>;
goods_info: {
detail_list: {
goods_name: string;
goods_img_url: string;
goods_desc?: string | undefined;
}[];
};
}>;
protected prepareGetPath(shipId: string, context: Context): Promise<{
openid: string | undefined;
delivery_id: string;
waybill_id: NonNullable<ED["ship"]["Schema"]["extraShipId"]>;
}>;
protected prepareGetOrder(shipId: string, context: Context): Promise<{
order_id: string;
openid: string | undefined;
delivery_id: string;
waybill_id: NonNullable<ED["ship"]["Schema"]["extraShipId"]>;
}>;
eOrder(shipId: string, context: Context): Promise<string>;
cancelOrder(shipId: string, context: Context): Promise<void>;
syncState(shipId: string): Promise<EntityDict["ship"]["OpSchema"]["iState"]>;
syncPaths(extraShipId: string): Promise<EntityDict["ship"]["OpSchema"]["extraPaths"]>;
getPrintInfo(shipId: string): Promise<{
syncState(shipId: string, context: Context): Promise<EntityDict["ship"]["OpSchema"]["iState"]>;
syncPaths(shipId: string, context: Context): Promise<EntityDict["ship"]["OpSchema"]["extraPaths"]>;
getPrintInfo(shipId: string, context: Context): Promise<{
type: "html";
data: string;
}>;

View File

@ -207,6 +207,123 @@ class WechatMpShipDebug {
order_id: shipId,
};
}
async prepareGetWaybillToken(shipId, context) {
const [ship] = await context.select('ship', {
data: {
id: 1,
from: {
id: 1,
phone: 1,
},
to: {
id: 1,
phone: 1,
},
shipService: {
shipCompanyId: 1,
},
extraShipId: 1,
wechatMpShip: {
applicationId: 1,
},
shipOrder$ship: {
$entity: 'shipOrder',
data: {
id: 1,
orderId: 1,
},
},
},
filter: {
id: shipId,
}
}, { dontCollect: true });
(0, assert_1.default)(ship);
const { extraShipId, from, to, shipService, shipOrder$ship: shipOrders, wechatMpShip } = ship;
const orderIds = shipOrders.map(ele => ele.orderId);
const { openId } = await this.getReceiverInfo(orderIds, wechatMpShip.applicationId, context);
const extraData = await this.getExtraData(shipId, context);
const detailList = extraData.shop.detail_list;
//todo order_detail_path
return {
openid: openId,
sender_phone: from.phone,
receiver_phone: from.phone,
delivery_id: shipService.shipCompanyId,
waybill_id: extraShipId,
goods_info: {
detail_list: detailList,
},
// trans_id: '',
// order_detail_path: '',
};
}
async prepareGetPath(shipId, context) {
const [ship] = await context.select('ship', {
data: {
id: 1,
extraShipId: 1,
shipService: {
shipCompanyId: 1,
},
shipOrder$ship: {
$entity: 'shipOrder',
data: {
orderId: 1,
},
},
wechatMpShip: {
applicationId: 1,
},
},
filter: {
id: shipId,
}
}, { dontCollect: true });
(0, assert_1.default)(ship);
const { extraShipId, shipService, shipOrder$ship: shipOrders, wechatMpShip } = ship;
const orderIds = shipOrders.map(ele => ele.orderId);
const { openId } = await this.getReceiverInfo(orderIds, wechatMpShip.applicationId, context);
return {
openid: openId,
delivery_id: shipService.shipCompanyId,
waybill_id: extraShipId,
};
}
async prepareGetOrder(shipId, context) {
const [ship] = await context.select('ship', {
data: {
id: 1,
extraShipId: 1,
shipService: {
shipCompanyId: 1,
},
shipOrder$ship: {
$entity: 'shipOrder',
data: {
orderId: 1,
order: {}
},
},
wechatMpShip: {
applicationId: 1,
},
},
filter: {
id: shipId,
}
}, { dontCollect: true });
(0, assert_1.default)(ship);
const { extraShipId, shipService, shipOrder$ship: shipOrders, wechatMpShip } = ship;
const orderIds = shipOrders.map(ele => ele.orderId);
const { openId } = await this.getReceiverInfo(orderIds, wechatMpShip.applicationId, context);
return {
order_id: shipId,
openid: openId,
delivery_id: shipService.shipCompanyId,
waybill_id: extraShipId,
};
}
async eOrder(shipId, context) {
const data = await this.prepareOrder(shipId, context);
console.log('mock eOrder to wechatMpShip, data:', data);
@ -216,13 +333,13 @@ class WechatMpShipDebug {
const data = await this.prepareCancelOrder(shipId, context);
console.log('mock cancelOrder to wechatMpShip, data:', data);
}
syncState(shipId) {
syncState(shipId, context) {
throw new Error("Method not implemented.");
}
syncPaths(extraShipId) {
syncPaths(shipId, context) {
throw new Error("Method not implemented.");
}
getPrintInfo(shipId) {
getPrintInfo(shipId, context) {
throw new Error("Method not implemented.");
}
}

View File

@ -14,5 +14,71 @@ class WechatMpShip extends WechatMpShip_debug_1.default {
const data = await this.prepareCancelOrder(shipId, context);
await instance.cancelExpressOrder(data);
}
async syncState(shipId, context) {
const instance = await this.getInstance(context);
const data = await this.prepareGetPath(shipId, context);
const result = await instance.getExpressPath(data);
const { path_item_num, path_item_list } = result;
const latestPath = path_item_list[path_item_num - 1] || undefined;
const latestType = latestPath?.action_type;
/**
* action_type:
* 100001 揽件阶段-揽件成功
* 100002 揽件阶段-揽件失败
* 100003 揽件阶段-分配业务员
* 200001 运输阶段-更新运输轨迹
* 300002 派送阶段-开始派送
* 300003 派送阶段-签收成功
* 300004 派送阶段-签收失败
* 400001 异常阶段-订单取消
* 400002 异常阶段-订单滞留
*/
let state = undefined;
switch (latestType) {
case 100001:
case 100003:
case 200001:
case 300002: {
state = 'shipping';
break;
}
case 300003: {
state = 'received';
break;
}
// case 400001: {
// state = 'reject';
// break;
// }
case 100002:
case 300004:
case 400002: {
state = 'unknow';
break;
}
}
return state;
}
async syncPaths(shipId, context) {
const instance = await this.getInstance(context);
const data = await this.prepareGetPath(shipId, context);
const result = await instance.getExpressPath(data);
const paths = result.path_item_list?.map((path) => ({
time: path.action_time,
action: path.action_msg,
}));
return paths;
}
async getPrintInfo(shipId, context) {
const instance = await this.getInstance(context);
const data = await this.prepareGetOrder(shipId, context);
const result = await instance.getExpressOrder(data);
const base64Html = result.print_html;
// const html = Buffer.from(base64Html, 'base64').toString('utf8');
return {
type: 'html',
data: base64Html,
};
}
}
exports.default = WechatMpShip;

View File

@ -13,13 +13,13 @@ export default interface ShipClazz<ED extends EntityDict & BaseEntityDict, Conte
cancelOrder(shipId: string, context: Context): Promise<void>;
// 同步状态
syncState(shipId: string): Promise<EntityDict['ship']['OpSchema']['iState']>;
syncState(shipId: string, context: Context): Promise<EntityDict['ship']['OpSchema']['iState']>;
// 同步轨迹
syncPaths(shipId: string): Promise<EntityDict['ship']['OpSchema']['extraPaths']>;
syncPaths(shipId: string, context: Context): Promise<EntityDict['ship']['OpSchema']['extraPaths']>;
// 返回打印数据
getPrintInfo(shipId: string): Promise<{
getPrintInfo(shipId: string, context: Context): Promise<{
type: 'html';
data: string;
}>

View File

@ -22,7 +22,6 @@ export const fullShipProjection: EntityDict['ship']['Projection'] = {
wechatMpName: 1,
}
},
serial: 1,
deposit$ship: {
$entity: 'deposit',
data: {

View File

@ -117,11 +117,11 @@ export default class WechatMpShipDebug<ED extends EntityDict & BaseEntityDict, C
parent: {
id: 1,
name: 1,
},
},
},
},
},
to: {
to: {
id: 1,
detail: 1,
name: 1,
@ -245,6 +245,140 @@ export default class WechatMpShipDebug<ED extends EntityDict & BaseEntityDict, C
};
}
protected async prepareGetWaybillToken(shipId: string, context: Context) {
const [ship] = await context.select('ship', {
data: {
id: 1,
from: {
id: 1,
phone: 1,
},
to: {
id: 1,
phone: 1,
},
shipService: {
shipCompanyId: 1,
},
extraShipId: 1,
wechatMpShip: {
applicationId: 1,
},
shipOrder$ship: {
$entity: 'shipOrder',
data: {
id: 1,
orderId: 1,
},
},
},
filter: {
id: shipId,
}
}, { dontCollect: true });
assert(ship);
const { extraShipId, from, to, shipService, shipOrder$ship: shipOrders, wechatMpShip } = ship;
const orderIds = shipOrders!.map(ele => ele.orderId);
const { openId } = await this.getReceiverInfo(orderIds, wechatMpShip!.applicationId!, context);
const extraData = await this.getExtraData(shipId, context);
const detailList = extraData.shop.detail_list! as Array<{
goods_name: string;
goods_img_url: string;
goods_desc?: string;
}>;
//todo order_detail_path
return {
openid: openId,
sender_phone: from!.phone!,
receiver_phone: from!.phone!,
delivery_id: shipService!.shipCompanyId!,
waybill_id: extraShipId!,
goods_info: {
detail_list: detailList,
},
// trans_id: '',
// order_detail_path: '',
};
}
protected async prepareGetPath(shipId: string, context: Context) {
const [ship] = await context.select('ship', {
data: {
id: 1,
extraShipId: 1,
shipService: {
shipCompanyId: 1,
},
shipOrder$ship: {
$entity: 'shipOrder',
data: {
orderId: 1,
},
},
wechatMpShip: {
applicationId: 1,
},
},
filter: {
id: shipId,
}
}, { dontCollect: true });
assert(ship);
const { extraShipId, shipService, shipOrder$ship: shipOrders, wechatMpShip } = ship;
const orderIds = shipOrders!.map(ele => ele.orderId);
const { openId } = await this.getReceiverInfo(orderIds, wechatMpShip!.applicationId!, context);
return {
openid: openId,
delivery_id: shipService!.shipCompanyId!,
waybill_id: extraShipId!,
};
}
protected async prepareGetOrder(shipId: string, context: Context) {
const [ship] = await context.select('ship', {
data: {
id: 1,
extraShipId: 1,
shipService: {
shipCompanyId: 1,
},
shipOrder$ship: {
$entity: 'shipOrder',
data: {
orderId: 1,
order:{
}
},
},
wechatMpShip: {
applicationId: 1,
},
},
filter: {
id: shipId,
}
}, { dontCollect: true });
assert(ship);
const { extraShipId, shipService, shipOrder$ship: shipOrders, wechatMpShip } = ship;
const orderIds = shipOrders!.map(ele => ele.orderId);
const { openId } = await this.getReceiverInfo(orderIds, wechatMpShip!.applicationId!, context);
return {
order_id: shipId,
openid: openId,
delivery_id: shipService!.shipCompanyId!,
waybill_id: extraShipId!,
};
}
async eOrder(shipId: string, context: Context): Promise<string> {
const data = await this.prepareOrder(shipId, context);
@ -255,16 +389,16 @@ export default class WechatMpShipDebug<ED extends EntityDict & BaseEntityDict, C
async cancelOrder(shipId: string, context: Context): Promise<void> {
const data = await this.prepareCancelOrder(shipId, context);
console.log('mock cancelOrder to wechatMpShip, data:', data);
console.log('mock cancelOrder to wechatMpShip, data:', data);
}
syncState(shipId: string): Promise<EntityDict["ship"]["OpSchema"]["iState"]> {
syncState(shipId: string, context: Context): Promise<EntityDict["ship"]["OpSchema"]["iState"]> {
throw new Error("Method not implemented.");
}
syncPaths(extraShipId: string): Promise<EntityDict["ship"]["OpSchema"]["extraPaths"]> {
syncPaths(shipId: string, context: Context): Promise<EntityDict["ship"]["OpSchema"]["extraPaths"]> {
throw new Error("Method not implemented.");
}
getPrintInfo(shipId: string): Promise<{ type: "html"; data: string; }> {
getPrintInfo(shipId: string, context: Context): Promise<{ type: "html"; data: string; }> {
throw new Error("Method not implemented.");
}
};

View File

@ -18,4 +18,75 @@ export default class WechatMpShip<ED extends EntityDict & BaseEntityDict, Contex
const data = await this.prepareCancelOrder(shipId, context);
await instance.cancelExpressOrder(data);
}
async syncState(shipId: string, context: Context): Promise<EntityDict['ship']['OpSchema']['iState']> {
const instance = await this.getInstance(context);
const data = await this.prepareGetPath(shipId, context);
const result = await instance.getExpressPath(data);
const { path_item_num, path_item_list } = result;
const latestPath = path_item_list[path_item_num - 1] || undefined;
const latestType = latestPath?.action_type;
/**
* action_type:
* 100001 -
* 100002 -
* 100003 -
* 200001 -
* 300002 -
* 300003 -
* 300004 -
* 400001 -
* 400002 -
*/
let state: EntityDict['ship']['OpSchema']['iState'] = undefined;
switch (latestType) {
case 100001:
case 100003:
case 200001:
case 300002: {
state = 'shipping';
break;
}
case 300003: {
state = 'received';
break;
}
// case 400001: {
// state = 'reject';
// break;
// }
case 100002:
case 300004:
case 400002: {
state = 'unknow';
break;
}
}
return state;
}
async syncPaths(shipId: string, context: Context): Promise<EntityDict['ship']['OpSchema']['extraPaths']> {
const instance = await this.getInstance(context);
const data = await this.prepareGetPath(shipId, context);
const result = await instance.getExpressPath(data);
const paths = result.path_item_list?.map((path) => ({
time: path.action_time,
action: path.action_msg,
}));
return paths;
}
async getPrintInfo(shipId: string, context: Context): Promise<{ type: 'html'; data: string; }> {
const instance = await this.getInstance(context);
const data = await this.prepareGetOrder(shipId, context);
const result = await instance.getExpressOrder(data);
const base64Html = result.print_html;
// const html = Buffer.from(base64Html, 'base64').toString('utf8');
return {
type: 'html',
data: base64Html,
}
}
}