mirror of
https://github.com/easychen/pushdeer.git
synced 2025-01-09 22:45:37 +08:00
增加goPush连接参数配置
This commit is contained in:
parent
a733beca4d
commit
d96ae05061
@ -64,18 +64,17 @@ function ios_send($is_clip, $device_token, $text, $desp = '', $dev = true)
|
|||||||
$notification->production = true;
|
$notification->production = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
$port = intval($is_clip) == 1 ? 8889 : 8888;
|
$port = intval($is_clip) == 1 ? config('services.go_push.ios_clip_port') : config('services.go_push.ios_port');
|
||||||
$topic = intval($is_clip) == 1 ? 'com.pushdeer.app.ios.Clip' : 'com.pushdeer.app.ios';
|
$topic = intval($is_clip) == 1 ? config('services.go_push.ios_clip_topic') : config('services.go_push.ios_topic');
|
||||||
$notification->topic = $topic;
|
$notification->topic = $topic;
|
||||||
$notification->sound = ['volume'=>2.0];
|
$notification->sound = ['volume'=>2.0];
|
||||||
|
|
||||||
$json = ['notifications'=>[$notification]];
|
$json = ['notifications'=>[$notification]];
|
||||||
$client = new GuzzleHttp\Client();
|
$client = new GuzzleHttp\Client();
|
||||||
$response = $client->post('http://127.0.0.1:'. $port .'/api/push', [
|
$response = $client->post('http://'.config('services.go_push.address').':'. $port .'/api/push', [
|
||||||
GuzzleHttp\RequestOptions::JSON => $json
|
GuzzleHttp\RequestOptions::JSON => $json
|
||||||
]);
|
]);
|
||||||
$ret = $response->getBody()->getContents();
|
$ret = $response->getBody()->getContents();
|
||||||
error_log('push error'. $ret);
|
error_log('push error'. $ret);
|
||||||
return $ret;
|
return $ret;
|
||||||
;
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user