$params['project_id'], 'company_id' => $params['company_id'], 'qualification_name' => $params['qualification_name'], 'qualification_number' => $params['qualification_number'], 'get_date' => !empty($params['get_date']) ? strtotime($params['get_date']) : 0, 'effective_date' => !empty($params['effective_date']) ? strtotime($params['effective_date']) : 0, 'qualification_status' => $params['qualification_status'], 'remark' => $params['remark'], 'annex' => $params['annex'] ? json_encode($params['annex']) : null, ]); 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/26 14:03 */ public static function edit(array $params): bool { Db::startTrans(); try { SupervisionParticipatingUnitsQualifications::where('id', $params['id'])->update([ 'project_id' => $params['project_id'], 'company_id' => $params['company_id'], 'qualification_name' => $params['qualification_name'], 'qualification_number' => $params['qualification_number'], 'get_date' => !empty($params['get_date']) ? strtotime($params['get_date']) : 0, 'effective_date' => !empty($params['effective_date']) ? strtotime($params['effective_date']) : 0, 'qualification_status' => $params['qualification_status'], 'remark' => $params['remark'], 'annex' => $params['annex'] ? json_encode($params['annex']) : null, '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/26 14:03 */ public static function delete(array $params): bool { return SupervisionParticipatingUnitsQualifications::destroy($params['id']); } /** * @notes 获取工程监理--参建单位资质详情 * @param $params * @return array * @author likeadmin * @date 2024/02/26 14:03 */ public static function detail($params): array { $data = SupervisionParticipatingUnitsQualifications::withoutField('create_time,update_time,delete_time')->findOrEmpty($params['id']); $project = SupervisionProject::field('project_name')->where('id',$data['project_id'])->findOrEmpty(); $company = SupervisionParticipatingUnits::field('unit_name')->where('id',$data['company_id'])->findOrEmpty(); $data['project_name'] = $project['project_name']; $data['company_name'] = $company['unit_name']; $data['qualification_status_text'] = $data->qualification_one_status_text; return $data->toArray(); } }