|
@@ -5,9 +5,11 @@ namespace App\HttpController;
|
|
|
|
|
|
|
|
|
|
use EasySwoole\Http\AbstractInterface\Controller;
|
|
use EasySwoole\Http\AbstractInterface\Controller;
|
|
|
|
+use App\Com\JdSdk;
|
|
|
|
|
|
class Index extends Controller
|
|
class Index extends Controller
|
|
{
|
|
{
|
|
|
|
+ protected $JdSdk;
|
|
|
|
|
|
public function index()
|
|
public function index()
|
|
{
|
|
{
|
|
@@ -29,19 +31,15 @@ class Index extends Controller
|
|
{
|
|
{
|
|
// 获取 `POST` 或者 `GET` 提交的所有参数
|
|
// 获取 `POST` 或者 `GET` 提交的所有参数
|
|
$data = $this->request()->getRequestParam();
|
|
$data = $this->request()->getRequestParam();
|
|
-//var_dump($data);
|
|
|
|
-
|
|
|
|
- // 返回给客户端
|
|
|
|
- //$this->response()->write($data . PHP_EOL);
|
|
|
|
|
|
|
|
$skuArr = $data['skuArr'];
|
|
$skuArr = $data['skuArr'];
|
|
|
|
|
|
- //$sku = implode(',', $skuArr);
|
|
|
|
$this->JdSdk = new JdSdk();
|
|
$this->JdSdk = new JdSdk();
|
|
-//var_dump($skuArr);
|
|
|
|
|
|
+
|
|
$response = $this->JdSdk->api_product_sku_state($skuArr);
|
|
$response = $this->JdSdk->api_product_sku_state($skuArr);
|
|
- print_r($response);
|
|
|
|
|
|
+
|
|
$this->response()->write($response . PHP_EOL);
|
|
$this->response()->write($response . PHP_EOL);
|
|
|
|
+
|
|
//$response = json_decode($response, true);
|
|
//$response = json_decode($response, true);
|
|
// =====$response=====
|
|
// =====$response=====
|
|
// { "success": true, "resultMessage": "操作成功", "resultCode": "0000", "result": [ { "state": 0, "sku": 5729524 } ], "code": 200 }
|
|
// { "success": true, "resultMessage": "操作成功", "resultCode": "0000", "result": [ { "state": 0, "sku": 5729524 } ], "code": 200 }
|
|
@@ -50,6 +48,55 @@ class Index extends Controller
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 6.2 批量获取库存接口(建议订单详情页、下单使用)
|
|
|
|
+ *
|
|
|
|
+ * @param $skuNums
|
|
|
|
+ * @param $area
|
|
|
|
+ * $skuNums商品和数量 此是个String 再重构吧 [{skuId: 569172,num:101}], $area格式:1_0_0 (分别代表1、2、3级地址)
|
|
|
|
+ * @return mixed
|
|
|
|
+ */
|
|
|
|
+ public function skuStock()
|
|
|
|
+ {
|
|
|
|
+ // 获取 `POST` 或者 `GET` 提交的所有参数
|
|
|
|
+ $data = $this->request()->getRequestParam();
|
|
|
|
+
|
|
|
|
+ $skuArr = $data['skuArr'];
|
|
|
|
+
|
|
|
|
+ $area = $data['area'];
|
|
|
|
+
|
|
|
|
+ $this->JdSdk = new JdSdk();
|
|
|
|
+
|
|
|
|
+ $response = $this->JdSdk->api_stock_get_new_stock_by_id($skuArr, $area);
|
|
|
|
+
|
|
|
|
+ $this->response()->write($response . PHP_EOL);
|
|
|
|
+
|
|
|
|
+ //return $response;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * TODO 待测 5.2 批量查询协议价价格
|
|
|
|
+ * HTTPS请求方式:POST
|
|
|
|
+ *
|
|
|
|
+ * @return string
|
|
|
|
+ */
|
|
|
|
+ function skuPrice()
|
|
|
|
+ {
|
|
|
|
+ // 获取 `POST` 或者 `GET` 提交的所有参数
|
|
|
|
+ $data = $this->request()->getRequestParam();
|
|
|
|
+
|
|
|
|
+ $skuArr = $data['skuArr'];
|
|
|
|
+
|
|
|
|
+ $this->JdSdk = new JdSdk();
|
|
|
|
+
|
|
|
|
+ $response = $this->JdSdk->api_price_get_price($skuArr);
|
|
|
|
+
|
|
|
|
+ $this->response()->write($response . PHP_EOL);
|
|
|
|
+
|
|
|
|
+ //return $response;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
function test()
|
|
function test()
|
|
{
|
|
{
|
|
$this->response()->write('this is test');
|
|
$this->response()->write('this is test');
|