xiaogang 3 anni fa
parent
commit
7d8417c3bd

+ 1 - 1
app/Admin/Controllers/NoticeController.php

xqd
@@ -96,7 +96,7 @@ class NoticeController extends AdminController
                     'content' => $res->content,
                     //设备标识,跟设备相关
                     'reg_id' => $registrationIds,
-                    'image' => "https://zhengda.oss-accelerate.aliyuncs.com/chengluApp/image_cropper_1628325545267_compressed4883651550324666535.jpg",
+//                    'image' => "https://zhengda.oss-accelerate.aliyuncs.com/chengluApp/image_cropper_1628325545267_compressed4883651550324666535.jpg",
                     //扩展字段
                     'extras' => [
                         'type' => 'notice',

+ 10 - 0
app/Services/DynamicService.php

xqd xqd
@@ -146,6 +146,15 @@ class DynamicService
         $registrationIds = array_column($push_users,'registrationId');
 
         $user_info = UserInfoModel::query()->where('user_id',$user->id)->first();
+
+        //设置推送的图标
+        if(count($dynamicParam->img_url)>0){
+            $image = ($dynamicParam->img_url)[0];
+        }else{
+            $image = $user_info->avatar;
+        }
+
+
         JPushService::pushNotify([
             //标题
             'title' => "@".$user_info->nickname."发布了新动态,来打个招呼吧~",
@@ -153,6 +162,7 @@ class DynamicService
             'content' => $dynamicParam->content,
             //设备标识,跟设备相关
             'reg_id' => $registrationIds,
+            'image' => $image,
             //扩展字段
             'extras' => [
                 'type' => 'notice',