Browse Source

提交测

lvhao 6 days ago
parent
commit
bd10072c97
1 changed files with 29 additions and 34 deletions
  1. 29 34
      core/CoreApp/controllers/Shop.php

+ 29 - 34
core/CoreApp/controllers/Shop.php

@@ -9,7 +9,6 @@ class Shop extends Start_Controller {
 		$this->load->_model('Model_warehouse','warehouse');
 		$this->load->_model('Model_warehouse','warehouse');
 		$this->load->_model('Model_productprice','productprice');
 		$this->load->_model('Model_productprice','productprice');
 		$this->load->_model('Model_apiyy','apiyy');
 		$this->load->_model('Model_apiyy','apiyy');
-		$this->load->_model('Model_apismt','apismt');
 	}
 	}
 	//定义方法的调用规则 获取URI第二段值
 	//定义方法的调用规则 获取URI第二段值
     public function _remap($arg,$arg_array)
     public function _remap($arg,$arg_array)
@@ -343,41 +342,37 @@ class Shop extends Start_Controller {
 			}
 			}
 
 
 			$code = $_GET['code'];
 			$code = $_GET['code'];
-			$res = $this->apismt->getAccessToken($code);
-			echo "<pre>";
-			print_r($res);
-			// $setting['appkey'] = '26004389';
-			// $time = (int)time()."000";
-			// $params = [
-			// 	"app_key" =>$setting['appkey'],
-			// 	"code" => $code,
-			// 	"sign_method" =>"sha256",
-			// 	"simplify" => "true",
-			// 	"timestamp" => $time
-			// ];
-			// $sign = $this->signApiRequest($params, $setting['secret'], 'sha256','/auth/token/create');
-			// $url = "http://api-sg.aliexpress.com/rest/auth/token/create";
+			$time = (int)time()."000";
+			$params = [
+				"app_key" =>$setting['appkey'],
+				"code" => $code,
+				"sign_method" =>"sha256",
+				"simplify" => "true",
+				"timestamp" => $time
+			];
+			$sign = $this->signApiRequest($params, $setting['secret'], 'sha256','/auth/token/create');
+			$url = "http://api-sg.aliexpress.com/rest/auth/token/create";
 			
 			
-			// $params['sign'] = $sign;
-			// echo "<pre>";
-			// print_r($params);
+			$params['sign'] = $sign;
+			echo "<pre>";
+			print_r($params);
 			
 			
-			// $headerA = [
-			// 	"Content-Type: application/json;;charset=utf-8",
-			// ];
-			// $ch = curl_init();
-			// curl_setopt($ch, CURLOPT_URL, $url);
-			// curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
-			// curl_setopt($ch, CURLOPT_HTTPHEADER, $headerA);
-			// curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, 0);
-			// curl_setopt ($ch, CURLOPT_SSL_VERIFYHOST, 0);
-			// //指定post数据
-			// curl_setopt($ch, CURLOPT_POST, true);
-			// //添加变量
-        	// curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($params))	;
-			// $output = curl_exec($ch);
-			// $output = json_decode($output,true);
-			// print_r($output);
+			$headerA = [
+				"Content-Type: application/json;;charset=utf-8",
+			];
+			$ch = curl_init();
+			curl_setopt($ch, CURLOPT_URL, $url);
+			curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
+			curl_setopt($ch, CURLOPT_HTTPHEADER, $headerA);
+			curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, 0);
+			curl_setopt ($ch, CURLOPT_SSL_VERIFYHOST, 0);
+			//指定post数据
+			curl_setopt($ch, CURLOPT_POST, true);
+			//添加变量
+        	curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($params))	;
+			$output = curl_exec($ch);
+			$output = json_decode($output,true);
+			print_r($output);
 
 
 
 
 			// $code = $_GET['code'];
 			// $code = $_GET['code'];