forked from yoone/API
1
0
Fork 0

style: 修复代码缩进和格式问题

统一调整代码缩进格式,删除多余空格和空行,保持代码风格一致
This commit is contained in:
zhuotianyuan 2026-01-22 14:49:22 +08:00
parent acecd3bef4
commit c592310fa9
2 changed files with 32 additions and 32 deletions

View File

@ -15,20 +15,20 @@ export class SyncTmsJob implements IJob {
logger: ILogger;
@Inject()
logisticsService: LogisticsService;
@InjectEntityModel(Shipment)
shipmentModel: Repository<Shipment>
logisticsService: LogisticsService;
@InjectEntityModel(Shipment)
shipmentModel: Repository<Shipment>
async onTick() {
const shipments:Shipment[] = await this.shipmentModel.findBy({ tracking_provider: 'freightwaves',finished: false });
const results = await Promise.all(
shipments.map(async shipment => {
return await this.logisticsService.updateFreightwavesShipmentState(shipment);
})
)
this.logger.info(`更新运单状态完毕 ${JSON.stringify(results)}`);
return results
const shipments: Shipment[] = await this.shipmentModel.findBy({ tracking_provider: 'freightwaves', finished: false });
const results = await Promise.all(
shipments.map(async shipment => {
return await this.logisticsService.updateFreightwavesShipmentState(shipment);
})
)
this.logger.info(`更新运单状态完毕 ${JSON.stringify(results)}`);
return results
}
onComplete(result: any) {

View File

@ -140,20 +140,20 @@ interface QueryOrderResponseData {
}
// 修改订单响应数据接口
interface ModifyOrderResponseData extends CreateOrderResponseData {}
interface ModifyOrderResponseData extends CreateOrderResponseData { }
// 订单退款响应数据接口
interface RefundOrderResponseData {}
interface RefundOrderResponseData { }
@Provide()
export class FreightwavesService {
@Inject() logger;
// 默认配置
// 默认配置
private config: FreightwavesConfig = {
appSecret: 'gELCHguGmdTLo!zfihfM91hae8G@9Sz23Mh6pHrt',
apiBaseUrl: 'http://tms.freightwaves.ca:8901/',
partner: '25072621035200000060'
apiBaseUrl: 'http://tms.freightwaves.ca:8901/',
partner: '25072621035200000060'
};
// 初始化配置
@ -180,19 +180,19 @@ export class FreightwavesService {
};
// 记录请求前的详细信息
console.log(`Sending request to: ${this.config.apiBaseUrl}${url}`,JSON.stringify({
console.log(`Sending request to: ${this.config.apiBaseUrl}${url}`, JSON.stringify({
headers,
data
}))
console.log('Request data:', `${this.config.apiBaseUrl}${url}`, data,headers);
console.log('Request data:', `${this.config.apiBaseUrl}${url}`, data, headers);
// 发送请求 - 临时禁用SSL证书验证以解决UNABLE_TO_VERIFY_LEAF_SIGNATURE错误
const response = await axios.post<FreightwavesResponse<T>>(
`${this.config.apiBaseUrl}${url}`,
data,
{
{
headers,
httpsAgent: new (require('https').Agent)({
rejectUnauthorized: false
httpsAgent: new (require('https').Agent)({
rejectUnauthorized: false
})
}
);
@ -400,12 +400,12 @@ export class FreightwavesService {
// 调用创建订单方法
this.log('开始测试创建订单...');
this.log('测试参数:', testParams);
// 注意:在实际环境中取消注释以下行来执行真实请求
const result = await this.createOrder(testParams);
this.log('创建订单成功:', result);
this.log('创建订单成功:', result);
// 返回模拟结果
return {
partnerOrderNumber: testParams.partnerOrderNumber,
@ -485,14 +485,14 @@ export class FreightwavesService {
// 调用费用试算方法
this.log('开始测试费用试算...');
this.log('测试参数:', testParams);
// 注意:在实际环境中取消注释以下行来执行真实请求
const result = await this.rateTry(testParams);
this.log('费用试算成功:', result);
this.log('测试完成:费用试算方法调用成功(模拟)');
this.log('提示在实际环境中取消注释代码中的rateTry调用行来执行真实请求');
// 返回模拟结果
return {
shipCompany: 'DHL',
@ -529,13 +529,13 @@ export class FreightwavesService {
// 调用查询订单方法
this.log('开始测试查询订单...');
this.log('测试参数:', testParams);
// 注意:在实际环境中取消注释以下行来执行真实请求
const result = await this.queryOrder(testParams);
this.log('查询订单成功:', result);
this.log('测试完成:查询订单方法调用成功(模拟)');
// 返回模拟结果
return {
thirdOrderId: 'thirdOrder-123456789',