123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121 |
- <?php
- namespace App\HttpController;
- use EasySwoole\Http\AbstractInterface\Controller;
- use App\Com\JdSdk;
- class ProductService extends Controller
- {
- private $JdSdk;
- public function __construct()
- {
- $this->JdSdk = new JdSdk();
- }
-
- public function skuState()
- {
-
- $data = $this->request()->getRequestParam();
- var_dump($data);
-
- $this->response()->write($data . PHP_EOL);
- $skuArr = $data['skuArr'];
- $sku = implode(',', $skuArr);
- $response = $this->JdSdk->api_product_sku_state($sku);
-
- return $response;
- }
-
- public function getNewStockById()
- {
-
- $data = $this->request()->getRequestParam();
- $skuNums = $data['skuArr'];
- $area = $data['area'];
- $response = $this->JdSdk->api_stock_get_new_stock_by_id($skuNums, $area);
- return $response;
- }
-
- function api_price_get_price()
- {
-
- $data = $this->request()->getRequestParam();
- $sku = $data['sku'];
- $response = $this->JdSdk->api_price_get_price($sku);
- return $response;
- }
-
- protected function actionNotFound(?string $action)
- {
- $this->response()->withStatus(404);
- $file = EASYSWOOLE_ROOT.'/vendor/easyswoole/easyswoole/src/Resource/Http/404.html';
- if(!is_file($file)){
- $file = EASYSWOOLE_ROOT.'/src/Resource/Http/404.html';
- }
- $this->response()->write(file_get_contents($file));
- }
-
- public function onException(\Throwable $throwable): void
- {
- parent::onException($throwable);
- }
- }
|