192 lines
6.3 KiB
PHP
192 lines
6.3 KiB
PHP
|
<?php
|
|||
|
|
|||
|
// +----------------------------------------------------------------------
|
|||
|
// | WeChatDeveloper
|
|||
|
// +----------------------------------------------------------------------
|
|||
|
// | 版权所有 2014~2022 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
|
|||
|
// +----------------------------------------------------------------------
|
|||
|
// | 官方网站: https://thinkadmin.top
|
|||
|
// +----------------------------------------------------------------------
|
|||
|
// | 开源协议 ( https://mit-license.org )
|
|||
|
// +----------------------------------------------------------------------
|
|||
|
// | github开源项目:https://github.com/zoujingli/WeChatDeveloper
|
|||
|
// +----------------------------------------------------------------------
|
|||
|
|
|||
|
namespace WeMini;
|
|||
|
|
|||
|
use WeChat\Contracts\BasicWeChat;
|
|||
|
|
|||
|
/**
|
|||
|
* 小程序物流助手
|
|||
|
* Class Logistics
|
|||
|
* @package WeMini
|
|||
|
*/
|
|||
|
class Logistics extends BasicWeChat
|
|||
|
{
|
|||
|
/**
|
|||
|
* 生成运单
|
|||
|
* @param array $data
|
|||
|
* @return array
|
|||
|
* @throws \WeChat\Exceptions\InvalidResponseException
|
|||
|
* @throws \WeChat\Exceptions\LocalCacheException
|
|||
|
*/
|
|||
|
public function addOrder($data)
|
|||
|
{
|
|||
|
$url = 'https://api.weixin.qq.com/cgi-bin/express/business/order/add?access_token=ACCESS_TOKEN';
|
|||
|
return $this->callPostApi($url, $data, true);
|
|||
|
}
|
|||
|
|
|||
|
/**
|
|||
|
* 取消运单
|
|||
|
* @param array $data
|
|||
|
* @return array
|
|||
|
* @throws \WeChat\Exceptions\InvalidResponseException
|
|||
|
* @throws \WeChat\Exceptions\LocalCacheException
|
|||
|
*/
|
|||
|
public function cancelOrder($data)
|
|||
|
{
|
|||
|
$url = 'https://api.weixin.qq.com/cgi-bin/express/business/order/cancel?access_token=ACCESS_TOKEN';
|
|||
|
return $this->callPostApi($url, $data, true);
|
|||
|
}
|
|||
|
|
|||
|
/**
|
|||
|
* 获取支持的快递公司列表
|
|||
|
* @return array
|
|||
|
* @throws \WeChat\Exceptions\InvalidResponseException
|
|||
|
* @throws \WeChat\Exceptions\LocalCacheException
|
|||
|
*/
|
|||
|
public function getAllDelivery()
|
|||
|
{
|
|||
|
$url = 'https://api.weixin.qq.com/cgi-bin/express/business/delivery/getall?access_token=ACCESS_TOKEN';
|
|||
|
return $this->callGetApi($url);
|
|||
|
}
|
|||
|
|
|||
|
/**
|
|||
|
* 获取运单数据
|
|||
|
* @param array $data
|
|||
|
* @return array
|
|||
|
* @throws \WeChat\Exceptions\InvalidResponseException
|
|||
|
* @throws \WeChat\Exceptions\LocalCacheException
|
|||
|
*/
|
|||
|
public function getOrder($data)
|
|||
|
{
|
|||
|
$url = 'https://api.weixin.qq.com/cgi-bin/express/business/order/get?access_token=ACCESS_TOKEN';
|
|||
|
return $this->callPostApi($url, $data, true);
|
|||
|
}
|
|||
|
|
|||
|
/**
|
|||
|
* 查询运单轨迹
|
|||
|
* @param array $data
|
|||
|
* @return array
|
|||
|
* @throws \WeChat\Exceptions\InvalidResponseException
|
|||
|
* @throws \WeChat\Exceptions\LocalCacheException
|
|||
|
*/
|
|||
|
public function getPath($data)
|
|||
|
{
|
|||
|
$url = 'https://api.weixin.qq.com/cgi-bin/express/business/path/get?access_token=ACCESS_TOKEN';
|
|||
|
return $this->callPostApi($url, $data, true);
|
|||
|
}
|
|||
|
|
|||
|
/**
|
|||
|
* 获取打印员。若需要使用微信打单 PC 软件,才需要调用
|
|||
|
* @return array
|
|||
|
* @throws \WeChat\Exceptions\InvalidResponseException
|
|||
|
* @throws \WeChat\Exceptions\LocalCacheException
|
|||
|
*/
|
|||
|
public function getPrinter()
|
|||
|
{
|
|||
|
$url = 'https://api.weixin.qq.com/cgi-bin/express/business/printer/getall?access_token=ACCESS_TOKEN';
|
|||
|
return $this->callGetApi($url);
|
|||
|
}
|
|||
|
|
|||
|
/**
|
|||
|
* 获取电子面单余额。仅在使用加盟类快递公司时,才可以调用
|
|||
|
* @param array $data
|
|||
|
* @return array
|
|||
|
* @throws \WeChat\Exceptions\InvalidResponseException
|
|||
|
* @throws \WeChat\Exceptions\LocalCacheException
|
|||
|
*/
|
|||
|
public function getQuota($data)
|
|||
|
{
|
|||
|
$url = 'https://api.weixin.qq.com/cgi-bin/express/business/path/get?access_token=ACCESS_TOKEN';
|
|||
|
return $this->callPostApi($url, $data, true);
|
|||
|
}
|
|||
|
|
|||
|
/**
|
|||
|
* 模拟快递公司更新订单状态, 该接口只能用户测试
|
|||
|
* @param array $data
|
|||
|
* @return array
|
|||
|
* @throws \WeChat\Exceptions\InvalidResponseException
|
|||
|
* @throws \WeChat\Exceptions\LocalCacheException
|
|||
|
*/
|
|||
|
public function testUpdateOrder($data)
|
|||
|
{
|
|||
|
$url = 'https://api.weixin.qq.com/cgi-bin/express/business/test_update_order?access_token=ACCESS_TOKEN';
|
|||
|
return $this->callPostApi($url, $data, true);
|
|||
|
}
|
|||
|
|
|||
|
/**
|
|||
|
* 配置面单打印员,若需要使用微信打单 PC 软件,才需要调用
|
|||
|
* @param array $data
|
|||
|
* @return array
|
|||
|
* @throws \WeChat\Exceptions\InvalidResponseException
|
|||
|
* @throws \WeChat\Exceptions\LocalCacheException
|
|||
|
*/
|
|||
|
public function updatePrinter($data)
|
|||
|
{
|
|||
|
$url = 'https://api.weixin.qq.com/cgi-bin/express/business/printer/update?access_token=ACCESS_TOKEN';
|
|||
|
return $this->callPostApi($url, $data, true);
|
|||
|
}
|
|||
|
|
|||
|
/**
|
|||
|
* 获取面单联系人信息
|
|||
|
* @param array $data
|
|||
|
* @return array
|
|||
|
* @throws \WeChat\Exceptions\InvalidResponseException
|
|||
|
* @throws \WeChat\Exceptions\LocalCacheException
|
|||
|
*/
|
|||
|
public function getContact($data)
|
|||
|
{
|
|||
|
$url = 'https://api.weixin.qq.com/cgi-bin/express/delivery/contact/get?access_token=ACCESS_TOKEN';
|
|||
|
return $this->callPostApi($url, $data, true);
|
|||
|
}
|
|||
|
|
|||
|
/**
|
|||
|
* 预览面单模板。用于调试面单模板使用
|
|||
|
* @param array $data
|
|||
|
* @return array
|
|||
|
* @throws \WeChat\Exceptions\InvalidResponseException
|
|||
|
* @throws \WeChat\Exceptions\LocalCacheException
|
|||
|
*/
|
|||
|
public function previewTemplate($data)
|
|||
|
{
|
|||
|
$url = 'https://api.weixin.qq.com/cgi-bin/express/delivery/template/preview?access_token=ACCESS_TOKEN';
|
|||
|
return $this->callPostApi($url, $data, true);
|
|||
|
}
|
|||
|
|
|||
|
/**
|
|||
|
* 更新商户审核结果
|
|||
|
* @param array $data
|
|||
|
* @return array
|
|||
|
* @throws \WeChat\Exceptions\InvalidResponseException
|
|||
|
* @throws \WeChat\Exceptions\LocalCacheException
|
|||
|
*/
|
|||
|
public function updateBusiness($data)
|
|||
|
{
|
|||
|
$url = 'https://api.weixin.qq.com/cgi-bin/express/delivery/service/business/update?access_token=ACCESS_TOKEN';
|
|||
|
return $this->callPostApi($url, $data, true);
|
|||
|
}
|
|||
|
|
|||
|
/**
|
|||
|
* 更新运单轨迹
|
|||
|
* @param array $data
|
|||
|
* @return array
|
|||
|
* @throws \WeChat\Exceptions\InvalidResponseException
|
|||
|
* @throws \WeChat\Exceptions\LocalCacheException
|
|||
|
*/
|
|||
|
public function updatePath($data)
|
|||
|
{
|
|||
|
$url = 'https://api.weixin.qq.com/cgi-bin/express/delivery/path/update?access_token=ACCESS_TOKEN';
|
|||
|
return $this->callPostApi($url, $data, true);
|
|||
|
}
|
|||
|
}
|