$params['data_id'], 'data_type' => $params['data_type'], 'problem_cate' => $params['problem_cate'], 'problem_description' => $params['problem_description'], 'problem_name' => $params['problem_name'], 'create_user' => $admin_id, ]); Db::commit(); return true; } catch (\Exception $e) { Db::rollback(); self::setError($e->getMessage()); return false; } } /** * @notes 编辑问题跟踪台账 * @param array $params * @return bool * @author likeadmin * @date 2024/02/28 09:19 */ public static function edit(array $params): bool { Db::startTrans(); try { SupervisionProblem::where('id', $params['id'])->update([ 'data_id' => $params['data_id'], 'data_type' => $params['data_type'], 'problem_cate' => $params['problem_cate'], 'problem_description' => $params['problem_description'], 'problem_name' => $params['problem_name'], 'update_time' => time(), ]); Db::commit(); return true; } catch (\Exception $e) { Db::rollback(); self::setError($e->getMessage()); return false; } } /** * @notes 检查验收问题跟踪台账 * @param array $params * @return bool * @author likeadmin * @date 2024/02/28 09:19 */ public static function check(array $params): bool { Db::startTrans(); try { SupervisionProblem::where('id', $params['id'])->update([ 'rectification_time' => !empty($params['rectification_time']) ? strtotime($params['rectification_time']) : 0, 'rectification_user' => $params['rectification_user'], 'rectification_result' => $params['rectification_result'], 'rectification_opinion' => $params['rectification_opinion'], 'rectification_annex' => $params['rectification_annex'] ? json_encode($params['rectification_annex']) : null, 'is_rectification' => $params['rectification_result']==0 ? 1 : 0, 'update_time' => time(), ]); Db::commit(); return true; } catch (\Exception $e) { Db::rollback(); self::setError($e->getMessage()); return false; } } /** * @notes 删除问题跟踪台账 * @param array $params * @return bool * @author likeadmin * @date 2024/02/28 09:19 */ public static function delete(array $params): bool { return SupervisionProblem::destroy($params['id']); } /** * @notes 获取问题跟踪台账详情 * @param $params * @return array * @author likeadmin * @date 2024/02/28 09:19 */ public static function detail($params): array { $data = SupervisionProblem::withoutField('update_time,delete_time')->findOrEmpty($params['id']); $create_user = Admin::field('name')->where('id',$data['create_user'])->findOrEmpty(); $data['create_user_name'] = $create_user['name']; $data['problem_cate_text'] = $data->problem_cate_text; $data['rectification_result_text'] = $data->rectification_result_text; $data['is_rectification_text'] = $data->is_rectification_text; return $data->toArray(); } }