request->isAjax()) { $get = $this->request->get(); return JsonServer::success('获取成功', SubsidyLogic::lists($get)); } return view(); } public function add() { if ($this->request->isAjax()) { $post = $this->request->post(); (new SubsidyValidate())->goCheck(); if (SubsidyLogic::add($post)) { return JsonServer::success('操作成功'); } return JsonServer::error(SubsidyLogic::getError() ?: '操作失败'); } return view(); } public function edit() { $id = $this->request->get('id'); if ($this->request->isAjax()) { $post = $this->request->post(); (new SubsidyValidate())->goCheck(); if (SubsidyLogic::edit($post)) { return JsonServer::success('操作成功'); } return JsonServer::error(SubsidyLogic::getError() ?: '操作失败'); } return view('', [ 'detail' => GoodsSubsidy::find($id), ]); } public function del() { if ($this->request->isAjax()) { $id = $this->request->post('id'); if (SubsidyLogic::del($id)) { return JsonServer::success('操作成功'); } return JsonServer::error(SubsidyLogic::getError() ?: '操作失败'); } } }