lssueModel = $lssueModel; } /** * 列表 * @time 2022年07月26日 16:16 * @param Request $request */ public function index(Request $request): \think\Response { return CatchResponse::paginate($this->lssueModel->getList()); } /** * 保存信息 * @time 2022年07月26日 16:16 * @param Request $request */ public function save(Request $request): \think\Response { $data = $request->post(); $this->lssueModel->storeBy($request->post()); $list = ModelHydEquipment::alias('e')->leftJoin('hydraulic h', 'e.id = h.eq_id') ->where('e.id', 'in', $data['equ_ids'])->column('h.imei'); if ($data['directive'] == 'File') { $content = [ 'file_name' => $data['file_name'] ]; } else if ($data['directive'] == 'Config') { $content = json_decode($data['file_name'], true); if (json_last_error() != 0) { return CatchResponse::fail(json_last_error_msg()); } } else if ($data['directive'] = 'SysCMD') { $content = [ 'cmd_content' => trim($data['file_name']) ]; } Directive::Issued($data['type'], $content, $data['directive'], $list); // $this->lssueModel->IssueAll($content); return CatchResponse::success(); } /** * 读取 * @time 2022年07月26日 16:16 * @param $id */ public function read($id): \think\Response { return CatchResponse::success($this->lssueModel->findBy($id)); } /** * 更新 * @time 2022年07月26日 16:16 * @param Request $request * @param $id */ public function update(Request $request, $id): \think\Response { return CatchResponse::success($this->lssueModel->updateBy($id, $request->post())); } /** * 删除 * @time 2022年07月26日 16:16 * @param $id */ public function delete($id): \think\Response { return CatchResponse::success($this->lssueModel->deleteBy($id, true)); } }