| xqd
@@ -13,6 +13,7 @@ use App\Models\DynamicTag;
|
|
|
use App\Models\DynamicZanModel;
|
|
|
use App\Models\User;
|
|
|
use App\Models\UserBlacklistModel;
|
|
|
+use App\Models\UserInfoModel;
|
|
|
use App\Models\UserReportModel;
|
|
|
use App\Models\UserVipLimit;
|
|
|
use Illuminate\Support\Facades\DB;
|
| xqd
@@ -130,9 +131,38 @@ class DynamicService
|
|
|
"longitude"=>$dynamicParam->longitude,
|
|
|
];
|
|
|
DynamicModel::create($data);
|
|
|
+
|
|
|
+ //推送消息
|
|
|
+ if($user->sex==1){
|
|
|
+ $push_users = User::query()->where(['notice_status'=>1,'sex'=>2])->whereNotNull('registrationId')->get(['id','registrationId'])->toArray();
|
|
|
+ }elseif($user->sex==2){
|
|
|
+ $push_users = User::query()->where(['notice_status'=>1,'sex'=>1])->whereNotNull('registrationId')->get(['id','registrationId'])->toArray();
|
|
|
+ }
|
|
|
+
|
|
|
+ $registrationIds = array_column($push_users,'registrationId');
|
|
|
+
|
|
|
+ $user_info = UserInfoModel::query()->where('user_id',$user->id)->first();
|
|
|
+ JPushService::pushNotify([
|
|
|
+ //标题
|
|
|
+ 'title' => "@".$user_info->nickname."发布了新动态,来打个招呼吧~",
|
|
|
+ //内容
|
|
|
+ 'content' => $dynamicParam->content,
|
|
|
+ //设备标识,跟设备相关
|
|
|
+ 'reg_id' => $registrationIds,
|
|
|
+ //扩展字段
|
|
|
+ 'extras' => [
|
|
|
+ 'type' => 'notice',
|
|
|
+ ],
|
|
|
+ //推送类型
|
|
|
+ 'type' => JPushService::PUSH_TYPE_REG_ID,
|
|
|
+ ]);
|
|
|
+
|
|
|
+
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+
|
|
|
/**
|
|
|
* 动态列表
|
|
|
*/
|