From ed15337c0eb7061a4ee607214041b4bd37ed2d2a Mon Sep 17 00:00:00 2001 From: Anyon Date: Mon, 8 May 2017 14:54:02 +0800 Subject: [PATCH] =?UTF-8?q?[=E6=9B=B4=E6=96=B0]=E4=BF=AE=E6=94=B9=E7=89=A9?= =?UTF-8?q?=E6=B5=81=E6=9F=A5=E8=AF=A2=E6=9C=8D=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- extend/service/ExpressService.php | 35 +------------------------------ 1 file changed, 1 insertion(+), 34 deletions(-) diff --git a/extend/service/ExpressService.php b/extend/service/ExpressService.php index 79697129e..ac327ad52 100644 --- a/extend/service/ExpressService.php +++ b/extend/service/ExpressService.php @@ -43,10 +43,7 @@ class ExpressService { 'DataSign' => base64_encode(md5($sendData . self::APPKEY)), ); $result = HttpService::post(self::APIURI, $data); - $resultJson = json_decode($result, true); - if (!$resultJson) { - die(var_export($result)); - } + !($resultJson = json_decode($result, true)) && die(var_export($result)); return self::response($resultJson); } @@ -72,37 +69,7 @@ class ExpressService { $status = "success"; $message = '此订单号有' . count($data) . '条跟踪记录'; } - return array('result' => $status, 'data' => $data, 'message' => $message); } - /** - * CURL模拟提交数据 - * @param $url string 提交的url - * @param $data array 要发送的数据 - * @return mixed 返回的数据 - */ - private static function curl_post($url, $data) { - $ch = curl_init(); - curl_setopt($ch, CURLOPT_URL, $url); - curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); - curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); - curl_setopt($ch, CURLOPT_POST, 1); - curl_setopt($ch, CURLOPT_POSTFIELDS, self::_encode_data($data)); - return curl_exec($ch); - } - - /** - * 进行数据的string字符串编码 - * @param type $datas - * @return type - */ - private static function _encode_data($datas) { - $temps = array(); - foreach ($datas as $key => $value) { - $temps[] = sprintf('%s=%s', $key, $value); - } - return join('&', $temps); - } - }