$data['title'], 'content' => $data['content'], 'msg_type' => $data['msg_type'], 'custom_uid' => $data['custom_uid'], ]; $Notices_id = $this->insertGetId($insert_data); return $Notices_id; } /** * 写入数据 * @author 唐远望 * @version 1.0 * @date 2025-12-29 * @param $data * @return bool */ public function addNotices($data) { DB::beginTransaction(); try { $this->addNotices_content($data); DB::commit(); return true; // 成功处理... } catch (\Exception $e) { DB::rollBack(); // 错误处理... return false; } } /** * 编辑内容 * @author 唐远望 * @version 1.0 * @date 2025-12-29 * @param $data * @return bool */ public function editNotices_content($where, $data) { $Notices = $this->where($where)->first(); if (!$Notices) { return false; } $Notices->title = $data['title']; $Notices->content = $data['content']; $Notices->msg_type = $data['msg_type']; $Notices->custom_uid = $data['custom_uid']; $Notices->save(); return true; } /** * 更新数据 * @author 唐远望 * @version 1.0 * @date 2025-12-29 * @param $data * @return bool */ public function updateNotices($where, $data) { DB::beginTransaction(); try { $this->editNotices_content($where, $data); DB::commit(); return true; // 成功处理... } catch (\Exception $e) { DB::rollBack(); // 错误处理... return false; } } /** * 删除数据 * @author 唐远望 * @version 1.0 * @date 2025-12-29 * @param $id * @return bool */ public function deleteNotices($where) { $Notices = $this->where($where)->first(); if (!$Notices) { return false; } $Notices->delete(); return true; } }