request->isAjax) { $params = $this->request->getBodyParams(); unset($params['_csrf']); $service = new SpuService(['mall_id' => $this->mall_id]); $data = $service->getSpuList($params); return $data ? $this->success('ok', $data) : $this->error($service->error); } return $this->render($this->action->id); } /** * 获取分类 * * @return string */ public function actionCategory() { if ($this->request->isAjax) { $pid = $this->request->getQueryParam('pid', 0); $service = new CategorysService(['mall_id' => $this->mall_id]); return $this->success('ok', $service->list($pid)); } } /** * 商品导入 * * @return string */ public function actionStorageAdd() { if ($this->request->isAjax) { $ids = $this->request->getBodyParam('ids'); $service = new SpuService(['mall_id' => $this->mall_id]); return $service->import($ids) ? $this->success('ok') : $this->error($service->error); } } }