From 2f13a58b2030c364697c6c0f504dd58a56994b4d Mon Sep 17 00:00:00 2001 From: liaofei <136327134@qq.com> Date: Mon, 5 Jun 2023 16:50:10 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=B8=80=E5=8F=B7=E9=80=9A?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E9=80=82=E9=85=8Dv2.0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../services/AccessTokenServeService.php | 12 +++++----- .../services/express/storage/Express.php | 24 +++++++++++-------- .../crmeb/services/sms/storage/Yihaotong.php | 18 +++++++------- 3 files changed, 29 insertions(+), 25 deletions(-) diff --git a/crmeb/crmeb/services/AccessTokenServeService.php b/crmeb/crmeb/services/AccessTokenServeService.php index 7eb874a41..51beb57b0 100644 --- a/crmeb/crmeb/services/AccessTokenServeService.php +++ b/crmeb/crmeb/services/AccessTokenServeService.php @@ -61,12 +61,12 @@ class AccessTokenServeService extends HttpService * 沙盒模式 * @var bool */ - protected $sandBox = false; + protected $sandBox = true; /** * 登录接口 */ - const USER_LOGIN = "user/login"; + const USER_LOGIN = "v2/user/login"; /** @@ -105,11 +105,11 @@ class AccessTokenServeService extends HttpService */ public function getToken() { - $accessTokenKey = md5($this->account . '_' . $this->secret . $this->cacheTokenPrefix); + $accessTokenKey = md5($this->account . '_v2_' . $this->secret . $this->cacheTokenPrefix); $cacheToken = $this->cache->get($accessTokenKey); if (!$cacheToken) { $getToken = $this->getTokenFromServer(); - $this->cache->set($accessTokenKey, $getToken['access_token'], 300); + $this->cache->set($accessTokenKey, $getToken['access_token'], $getToken['expires_in'] - 60); $cacheToken = $getToken['access_token']; } $this->accessToken = $cacheToken; @@ -125,8 +125,8 @@ class AccessTokenServeService extends HttpService public function getTokenFromServer() { $params = [ - 'account' => $this->account, - 'secret' => $this->secret, + 'access_key' => $this->account, + 'secret_key' => $this->secret, ]; $response = $this->postRequest($this->get(self::USER_LOGIN), $params); $response = json_decode($response, true); diff --git a/crmeb/crmeb/services/express/storage/Express.php b/crmeb/crmeb/services/express/storage/Express.php index f33187506..38c7b9b6b 100644 --- a/crmeb/crmeb/services/express/storage/Express.php +++ b/crmeb/crmeb/services/express/storage/Express.php @@ -24,36 +24,36 @@ class Express extends BaseExpress /** * 注册服务 */ - const EXPRESS_OPEN = 'expr/open'; + const EXPRESS_OPEN = 'v2/expr/open'; /** * 电子面单模版 */ - const EXPRESS_TEMP = 'expr/temp'; + const EXPRESS_TEMP = 'v2/expr/temp'; /** * 快递公司 */ - const EXPRESS_LIST = 'expr/express'; + const EXPRESS_LIST = 'v2/expr/express'; /** * 快递查询 */ - const EXPRESS_QUERY = 'expr/query'; + const EXPRESS_QUERY = 'v2/expr/query'; /** * 面单打印 */ - const EXPRESS_DUMP = 'expr/dump'; + const EXPRESS_DUMP = 'v2/expr/dump'; //获取物流公司信息 - const SHIPMENT_KUAIDI_NUMS = 'shipment/get_kuaidi_coms'; + const SHIPMENT_KUAIDI_NUMS = 'v2/shipment/get_kuaidi_coms'; //创建商家寄件订单 - const SHIPMENT_CREATE_ORDER = 'shipment/create_order'; + const SHIPMENT_CREATE_ORDER = 'v2/v2/shipment/create_order'; //取消商家寄件 - const SHIPMENT_CANCEL_ORDER = 'shipment/cancel_order'; + const SHIPMENT_CANCEL_ORDER = 'v2/shipment/cancel_order'; //获取商家寄件订单列表 - const SHIPMENT_INDEX = 'shipment/index'; + const SHIPMENT_INDEX = 'v2/shipment/index'; /** 初始化 * @param array $config @@ -260,7 +260,11 @@ class Express extends BaseExpress if (!$data['siid']) { $param['print_type'] = 'IMAGE'; } - return $this->accessToken->httpRequest(self::EXPRESS_DUMP, $param, 'POST', true, ['version:v1.1']); + $header = []; + if (!sys_config('config_export_siid')) { + $header = ['version:v1.1']; + } + return $this->accessToken->httpRequest(self::EXPRESS_DUMP, $param, 'POST', true, $header); } } diff --git a/crmeb/crmeb/services/sms/storage/Yihaotong.php b/crmeb/crmeb/services/sms/storage/Yihaotong.php index 502070e03..8ecd95beb 100644 --- a/crmeb/crmeb/services/sms/storage/Yihaotong.php +++ b/crmeb/crmeb/services/sms/storage/Yihaotong.php @@ -26,47 +26,47 @@ class Yihaotong extends BaseSms /** * 开通 */ - const SMS_OPEN = 'sms_v2/open'; + const SMS_OPEN = 'v2/sms_v2/open'; /** * 修改签名 */ - const SMS_MODIFY = 'sms_v2/modify'; + const SMS_MODIFY = 'v2/sms_v2/modify'; /** * 用户信息 */ - const SMS_INFO = 'sms_v2/info'; + const SMS_INFO = 'v2/sms_v2/info'; /** * 发送短信 */ - const SMS_SEND = 'sms_v2/send'; + const SMS_SEND = 'v2/sms_v2/send'; /** * 短信模板 */ - const SMS_TEMPS = 'sms_v2/temps'; + const SMS_TEMPS = 'v2/sms_v2/temps'; /** * 申请模板 */ - const SMS_APPLY = 'sms_v2/apply'; + const SMS_APPLY = 'v2/sms_v2/apply'; /** * 模板记录 */ - const SMS_APPLYS = 'sms_v2/applys'; + const SMS_APPLYS = 'v2/sms_v2/applys'; /** * 发送记录 */ - const SMS_RECORD = 'sms_v2/record'; + const SMS_RECORD = 'v2/sms_v2/record'; /** * 获取短信发送状态 */ - const SMS_STSTUS = 'sms/status'; + const SMS_STSTUS = 'v2/sms/status'; /** * 短信签名