$params['user_id'], 'title' => $params['title'], 'content' => $params['content'], 'notice_type' => $params['notice_type'] ]); Db::commit(); return true; } catch (\Exception $e) { Db::rollback(); self::setError($e->getMessage()); return false; } } /** * @notes 编辑用户消息 * @param array $params * @return bool * @author BD * @date 2024/05/26 00:36 */ public static function edit(array $params): bool { Db::startTrans(); try { UserNotice::where('id', $params['id'])->update([ ]); Db::commit(); return true; } catch (\Exception $e) { Db::rollback(); self::setError($e->getMessage()); return false; } } /** * @notes 删除用户消息 * @param array $params * @return bool * @author BD * @date 2024/05/26 00:36 */ public static function delete(array $params): bool { return UserNotice::destroy($params['id']); } /** * @notes 获取用户消息详情 * @param $params * @return array * @author BD * @date 2024/05/26 00:36 */ public static function detail($params): array { return UserNotice::findOrEmpty($params['id'])->toArray(); } }