Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/yiier/yii2-cross-border-express

跨境物流接口:云途物流、三态速递、飞特物流
https://github.com/yiier/yii2-cross-border-express

express yii2-extension

Last synced: 4 months ago
JSON representation

跨境物流接口:云途物流、三态速递、飞特物流

Awesome Lists containing this project

README

        

Cross Border Express for Yii2
================
跨境物流接口,目前只支持:

- 云途物流
- 三态速递
- 飞特物流
- 华磊物流
- 集优物流
- 万邦物流
- 速递管家
- 易仓物流
- 顺丰国际物流
- K5物流系统
- 燕文物流
- 互联通物流

[![Latest Stable Version](https://poser.pugx.org/yiier/yii2-cross-border-express/v/stable)](https://packagist.org/packages/yiier/yii2-cross-border-express)
[![Total Downloads](https://poser.pugx.org/yiier/yii2-cross-border-express/downloads)](https://packagist.org/packages/yiier/yii2-cross-border-express)
[![Latest Unstable Version](https://poser.pugx.org/yiier/yii2-cross-border-express/v/unstable)](https://packagist.org/packages/yiier/yii2-cross-border-express)
[![License](https://poser.pugx.org/yiier/yii2-cross-border-express/license)](https://packagist.org/packages/yiier/yii2-cross-border-express)

Installation
------------

The preferred way to install this extension is through [composer](http://getcomposer.org/download/).

Either run

```
php composer.phar require --prefer-dist yiier/yii2-cross-border-express "*"
```

or add

```
"yiier/yii2-cross-border-express": "*"
```

to the require section of your `composer.json` file.

Usage
-----

### 配置

```php
5.0,

// 可用的平台配置
'platforms' => [
'santai' => [
'appKey' => 'xxx',
'token' => 'xxx',
'userId' => 'xxx'
],
'yuntu' => [
'account' => 'xxx',
'secret' => 'xxx',
],
'feite' => [
'token' => 'xxx',
'syncPlatformId' => '', // 订单同步平台标识(一般指第三方平台标识,格式类似:scb.logistics.flyt)
'accountId' => 'xxx',
'password' => '',
'printUsername' => '', // 面单接口需要
'printPassword' => '' // 面单接口需要
],
'hualei' => [
'host' => '',
'print_host' => '',
'customer_id' => '', # 如果customer_id和customer_user_id不为空可不填username及password
'customer_user_id' => '',
'username' => '',
'password' => '',
],
'jiyou' => [
'host' => '',
'user_token' => ''
],
'wanb' => [
"host" => "http://api-sbx.wanbexpress.com",
"account_no" => "",
"token" => "",
"warehouse_code" => "",
"oss_wan_domain" => "oss-cn-beijing.aliyuncs.com",
"oss_lan_domain" => "oss-cn-beijing-internal.aliyuncs.com",
"oss_bucket" => "",
"oss_access_key_id" => "",
"oss_access_key_secret" => "",
],
'courierbutler' => [
"host" => "http://lfn.rtb56.com",
"app_token" => "",
"app_key" => "",
],
'eccang' => [
"appKey" => "",
"appToken" => "",
"host" => ""
],
'sfexpress' => [
"accesscode" => "",
"username" => "",
"checkword" => "",
"platform_code" => "",
],
'k5' => [
"host" => "",
"clientid" => "",
"token" => "",
],
'yw56' => [
"host" => '',
"userId" => '',
"token" => '',
"ossBucket" => '',
"ossAccessKeyId" => '',
"ossAccessKeySecret" => '',
"ossLanDomain" => "oss-accelerate-internal.aliyuncs.com",
"ossWanDomain" => "oss-accelerate.aliyuncs.com",
],
'huiliantong' => [
'host' => "",
'userToken' => ''
]
],
];

$express = new \yiier\crossBorderExpress\Express($config, 'santai');

```

### 发货

```php
customerOrderNo = 'xxx';
$expressOrder->transportCode = 'xxx';

$goods[] = new \yiier\crossBorderExpress\contracts\Goods();
$goods->description = 'xxx';
$goods->cnDescription = 'xxx';
$goods->quantity = 'xxx';
$goods->weight = 'xxx';
$goods->hsCode = 'xxx';
$goods->enMaterial = 'cotton';
$goods->cnMaterial = '棉';
$goods->worth = 1; // 1美元;
$goods->sku = 'xxx'; // 云途某些渠道需要

$expressOrder->goods = $goods;
$expressOrder->evaluate = 1; // 1美元
$expressOrder->taxesNumber = 'xxx'; // 税号
$expressOrder->isRemoteConfirm = 1; // 是否同意收偏远费
$expressOrder->isReturn = 1; // 是否退件
$expressOrder->withBattery = 0; // 是否带电池

$package = new \yiier\crossBorderExpress\contracts\Package();
$package->description = 'xxxx';
$package->quantity = 1;
$package->weight = 'xxx';
$package->declareWorth = 1; // 1美元
$expressOrder->package = $package;

$recipient = new \yiier\crossBorderExpress\contracts\Recipient();
$recipient->countryCode = 'xx';
$recipient->name = 'xx';
$recipient->address = 'xx';
$recipient->city = 'xx';
$recipient->state = 'xx';
$recipient->zip = 'xx';
$recipient->phone = 'xx';
$expressOrder->recipient = $recipient;

$shipper = new \yiier\crossBorderExpress\contracts\Shipper();
$shipper->countryCode = 'CN';
$shipper->name = 'xxx';
$shipper->company = 'xxx';
$shipper->address = 'xxx';
$shipper->city = 'xxx';
$shipper->state = 'xxx';
$shipper->zip = 'xx';
$shipper->phone = 'xxx';
$expressOrder->shipper = $shipper;

// 发货
$express->createOrder($expressOrder);
```

### 获取物流方式

```php
getTransportsByCountryCode($countryCode))) {
foreach ($transports as $transport) {
// 带跟踪号的物流方式
$item[$transport->code] = [
'code' => $transport->code,
'name' => $transport->cnName,
'is_tracking_no' => (int)$transport->ifTracking,
'data' => $transport->data,
];
}
}
return $item;
```

### 获取打印地址

```php
getPrintUrl($orderNumber);
```

### 获取订单详细费用

```php
getOrderFee($orderNumber);
```

## 相关链接

- [云途接口文档](https://docs.qq.com/pdf/DVldoV2JWQ2hTQWNH)
- [三态接口文档](http://www.sfcservice.com/api-doc)
- [飞特接口文档](https://docs.qq.com/doc/DV1lrcURDTHNhRkR3)
- [华磊接口文档](http://www.sz56t.com:8090/pages/viewpage.action?pageId=3473454)
- [集优接口文档](http://120.25.155.64:8086/xms/download/api/HLT-XMS-API.docx)
- [万邦接口文档](http://apidoc.wanbexpress.com/)
- [速递管家接口文档](http://lfn.rtb56.com/usercenter/manager/api_document.aspx)
- [易仓物流](http://ec.wiki.eccang.com/docs/show/2547)
- [顺丰国际物流](http://docs.uat.trackmeeasy.com/api/)
- [互联通物流系统](http://8.129.12.42:8086/xms/download/api/HLT-XMS-API.docx)