request->isAjax) { $params = $this->request->getQueryParams(); $service = new SupplysService(['mall_id' => $this->mall_id]); return $this->success('ok', $service->getSupplysList($params)); } return $this->render('index'); } /** * 供应链编辑及添加 * * @return void */ public function actionEdit() { $id = $this->request->getQueryParam('id'); $service = new SupplysService(['mall_id' => $this->mall_id]); if ($this->request->isPost) { $data = $this->request->post('setting'); return $service->save($id, $data) ? $this->success('保存成功') : $this->error($service->error); } if ($this->request->isAjax) { return $this->success('ok', $service->getInfo($id)); } return $this->render('edit'); } /** * 供应商列表 * * @return string */ public function actionSuppliers() { $supply_id = $this->request->get('supply_id') ?? 0; $api = ApiService::getConnect($this->mall_id, $supply_id); $list = $api->getSuppliers(); return $this->success('ok', $list); } }