124 lines
3.6 KiB
PHP

<?php
namespace App\Services\Business\KuaiTuanTuan;
class FaceSheet extends KuaiTuanTuan
{
protected $clientId = '24f25877aca447c5830a6aa896301d5e';
protected $clientSecret = '59b6f4bd402c6423878a8f4ef1bde28359c1f05a';
protected $redirectUri = 'http://erp.chutang66.com/pdd/ship';
public function __construct()
{
}
public function getAuthUrl($shopId, $platId)
{
$state = $shopId . '_' . $platId;
return "https://wb.pinduoduo.com/logistics/auth?client_id={$this->clientId}&redirect_uri={$this->redirectUri}&state={$state}";
}
/**
* 快递公司查看接口
*
* @return mixed
*/
public function getCompanies()
{
$type = 'pdd.logistics.companies.get';
$appendParams = [];
return $this->doRequest($type, $appendParams);
}
public function getWayBill()
{
$type = 'pdd.waybill.get';
$appendParams = [
'param_waybill_cloud_print_apply_new_request' => [
'sender' => [
'address' => [
'city' => '昆明市',
'country' => '中国',
'detail' => '肖家营花卉市场1期-3',
'district' => '官渡区',
'province' => '云南省',
],
'name' => '赵先生',
'mobile' => '13093715108',
],
'trade_order_info_dtos' => [[
'object_id' => 'SF_' . time(),
'order_info' => [
'order_channels_type' => 'PDD',
'trade_order_list' => ['PO-230712-007140873850822']
],
'package_info' => [
'items' => [[
'count' => 1,
'name' => '花落花卉',
]]
],
'recipient' => [
'address' => [
'city' => '成都市',
'detail' => '河之洲3期6栋2单元',
'district' => '崇州市',
'province' => '四川省',
],
'name' => '吕鸶',
'mobile' => '13194975115'
],
'template_url' => 'https://file-link.pinduoduo.com/sf_one',
'user_id' => '2256799818137902',
]],
'wp_code' => 'SF',
]
];
$appendParams['param_waybill_cloud_print_apply_new_request'] = json_encode($appendParams['param_waybill_cloud_print_apply_new_request'], 256);
return $this->doRequest($type, $appendParams);
}
/**
* searchWayBill
*
* @return mixed
*/
public function searchWayBill()
{
$type = 'pdd.waybill.search';
$appendParams = [];
return $this->doRequest($type, $appendParams);
}
public function getLogisticsOrderTrance()
{
$type = 'pdd.logistics.ordertrace.get';
$appendParams = [];
return $this->doRequest($type, $appendParams);
}
public function getStdTemplates()
{
$type = 'pdd.cloudprint.stdtemplates.get';
$appendParams = [
'wp_code' => 'SF'
];
return $this->doRequest($type, $appendParams);
}
public function getCustomares()
{
$type = 'pdd.cloudprint.customares.get';
$appendParams = [];
return $this->doRequest($type, $appendParams);
}
}