|
|
@@ -90,7 +90,9 @@ class Aatest extends Start_Controller {
|
|
|
//定义方法的调用规则 获取URI第二段值
|
|
|
public function _remap($arg,$arg_array)
|
|
|
{
|
|
|
- die;
|
|
|
+ die;
|
|
|
+ $this->jiai($arg_array);
|
|
|
+
|
|
|
|
|
|
|
|
|
//$this->_print();
|
|
|
@@ -105,7 +107,59 @@ class Aatest extends Start_Controller {
|
|
|
exit('No direct script access allowed');
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+ private function jiai($arg_array){
|
|
|
+ $key = "6amg!pnfrlbpnjgirv"; //加密所需要到的key
|
|
|
+ $iv = "6ook4k!2w94m6jtm";//加密所需要到的iv
|
|
|
+
|
|
|
+ $time = time();
|
|
|
+ $data = array(
|
|
|
+ "order_no" => $arg_array[0],
|
|
|
+ "shop" => "3",
|
|
|
+ "time"=>time()
|
|
|
+
|
|
|
+ );
|
|
|
+ $decrypt = "alipearlhair+".$data['time'];
|
|
|
+ $key = openssl_encrypt($decrypt,'AES-128-CBC',$key,0,$iv);
|
|
|
+
|
|
|
+ $data['key'] = $key;
|
|
|
+
|
|
|
+ // 将PHP数组编码为JSON字符串
|
|
|
+ $jsonData = json_encode($data);
|
|
|
+
|
|
|
+
|
|
|
+ $url = "https://1.wepolicy.cn/apiexpress/search";
|
|
|
+ // 初始化cURL
|
|
|
+ $ch = curl_init($url);
|
|
|
+
|
|
|
+ // 设置cURL选项
|
|
|
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
|
|
+ curl_setopt($ch, CURLOPT_POST, true);
|
|
|
+ // 直接传入JSON字符串作为POST数据
|
|
|
+ curl_setopt($ch, CURLOPT_POSTFIELDS, $jsonData);
|
|
|
+
|
|
|
+ // 关键:设置HTTP头,声明内容类型为JSON
|
|
|
+ curl_setopt($ch, CURLOPT_HTTPHEADER, array(
|
|
|
+ 'Content-Type: application/json',
|
|
|
+ 'Content-Length: ' . strlen($jsonData) // 可选项,设置数据长度
|
|
|
+ ));
|
|
|
+
|
|
|
+ // 执行请求
|
|
|
+ $response = curl_exec($ch);
|
|
|
+
|
|
|
+ // 检查cURL执行是否出错
|
|
|
+ if (curl_errno($ch)) {
|
|
|
+ $error_msg = curl_error($ch);
|
|
|
+ // 处理错误
|
|
|
+ }
|
|
|
+
|
|
|
+ // 关闭cURL会话
|
|
|
+ curl_close($ch);
|
|
|
+
|
|
|
+ // 处理API返回的JSON响应
|
|
|
+ $responseData = json_decode($response, true);
|
|
|
+ echo "<pre>";
|
|
|
+ print_r($response);
|
|
|
+ }
|
|
|
private function _ttexpress(){
|
|
|
$info = $this->logic_order->getInfo("number = 'TT-KISS-251021-001'");
|
|
|
$res = $this->express_tt->get_data($info,'FBT');
|