$origins, 'destinations' => $destinations, 'output' => 'json', 'tactics' => 11, 'ak' => commonUtils::$AK); //var_dump($data);exit(); $res = commonUtils::send_get(commonUtils::$URL, $data); $shortTimeList = json_decode($res, true); if (isset($shortTimeList['status']) && $shortTimeList['status'] == 0) { foreach ($shortTimeList['result'] as $res) { if (count($shortTimeList['result']) > 1) { $time[] = ceil(($res['duration']['value']) / 60); } else { $time = ceil(($res['duration']['value']) / 60); } } return $time; } else { return false; } } /** * 提供从地址到经纬度坐标或者从经纬度坐标到地址的转换服务 */ static function GeocodingAPI($location) { $data = array('location' => $location, 'output' => 'json', 'tactics' => 11, 'ak' => commonUtils::$AK); $res = commonUtils::send_get(commonUtils::$GeocodingUrl, $data); $addressList = json_decode($res, true); if (isset($addressList['status']) && $addressList['status'] == 0) { $res = $addressList['result']['addressComponent']; //$country = $res['country']; //$province = $res['province']; $city = $res['city']; return $city; } else { return false; } } /** * 生成订单号 * @param $num */ static function produceOrderId($num) { require_once __DIR__.'/../../config/Mysql.php'; $pdo = conn(); $sql = "SELECT FUNC_GET_UNIQUE_ID(1,{$num}) AS order_id"; if (is_object($pdo)) { $result = $pdo->query($sql); $json = $result->fetchAll(PDO::FETCH_ASSOC); $result->closeCursor(); } return $json[0]['order_id']; } }