request->post(); if (isset($post['id'])) { $otherInfo = CaseService::getCaseQuery() ->andWhere(["and", ['title' => $post['title']], ['<>', 'id', $post['id']]]) ->one(); if ($otherInfo) { return $this->asJson([], 1, "案件名称已存在!"); //通知前端 } return $this->asJson([]); } if ($post['category'] == 'title') { $info = CaseService::getCaseQuery()->andWhere(['title' => $post['title']]) ->one(); if ($info) { return $this->asJson([], 1, "案件名称已存在!"); //通知前端 } } return $this->asJson([]); } }