From cc862741dcd729d5660c7ceb9b7d00248ad1706e Mon Sep 17 00:00:00 2001 From: kuaifan Date: Wed, 28 Feb 2024 15:04:31 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=8E=A8=E9=80=81=E6=A0=87=E9=A2=98?= =?UTF-8?q?=E5=AD=98=E5=9C=A8=E6=8D=A2=E8=A1=8C=E6=97=B6=E4=B8=8D=E6=98=BE?= =?UTF-8?q?=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Models/UmengAlias.php | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/app/Models/UmengAlias.php b/app/Models/UmengAlias.php index 761eb702e..d01e109b4 100644 --- a/app/Models/UmengAlias.php +++ b/app/Models/UmengAlias.php @@ -31,6 +31,16 @@ class UmengAlias extends AbstractModel { protected $table = 'umeng_alias'; + /** + * 推送内容处理 + * @param $string + * @return string + */ + private static function specialCharacters($string) + { + return str_replace(["\r\n", "\r", "\n"], '', $string); + } + /** * 获取推送配置 * @return array|false @@ -73,9 +83,9 @@ class UmengAlias extends AbstractModel return false; } // - $title = $array['title'] ?: ''; // 标题 - $subtitle = $array['subtitle'] ?: ''; // 副标题(iOS) - $body = $array['body'] ?: ''; // 通知内容 + $title = self::specialCharacters($array['title'] ?: ''); // 标题 + $subtitle = self::specialCharacters($array['subtitle'] ?: ''); // 副标题(iOS) + $body = self::specialCharacters($array['body'] ?: ''); // 通知内容 $description = $array['description'] ?: 'no description'; // 描述 $extra = is_array($array['extra']) ? $array['extra'] : []; // 额外参数 $seconds = intval($array['seconds']) ?: 86400; // 有效时间(单位:秒)