|
@@ -12,6 +12,7 @@ use Darabonba\OpenApi\Models\Config;
|
|
|
use think\admin\model\SystemConfig;
|
|
|
use app\common\library\QRcode;
|
|
|
use PhpOffice\PhpWord\TemplateProcessor;
|
|
|
+use JPush\Client as jpush;
|
|
|
|
|
|
function systemConfig($name,$value=null){
|
|
|
$nameArr=array_filter(explode('.',$name));
|
|
@@ -369,4 +370,48 @@ function num_to_rmb($num){
|
|
|
}else{
|
|
|
return $c . "整";
|
|
|
}
|
|
|
+}
|
|
|
+
|
|
|
+/**
|
|
|
+ * @消息推送(最新版本)
|
|
|
+ */
|
|
|
+function push5($uid,$content,$alias){
|
|
|
+ $app_key = '9dd98f61eb4ad58dca4c8214';
|
|
|
+ $master_secret = 'f7cac744173f8ace703719cf';
|
|
|
+ $client = new JPush($app_key, $master_secret);
|
|
|
+ try {
|
|
|
+ $response = $client->push()
|
|
|
+ ->setPlatform(array('ios', 'android'))
|
|
|
+ ->addAlias($alias)
|
|
|
+ // ->addRegistrationId($registration_id)
|
|
|
+ ->setNotificationAlert($content)
|
|
|
+ ->iosNotification($content,array(
|
|
|
+ 'sound'=>'default',
|
|
|
+ 'badge' => 2,
|
|
|
+ 'content-available' => true,
|
|
|
+ 'category' => 'jiguang',
|
|
|
+ 'extras' => ['user_id'=>$uid,'alias'=>$alias]
|
|
|
+ )
|
|
|
+ )
|
|
|
+ ->androidNotification($content,array(
|
|
|
+ 'title' => $content,
|
|
|
+ 'build_id' => 2,
|
|
|
+ 'extras' => array(
|
|
|
+ "user_id"=>$uid,"alias"=>$alias),
|
|
|
+ )
|
|
|
+ )
|
|
|
+ ->options([
|
|
|
+ 'sendno' => 100,
|
|
|
+ 'time_to_live' => 86400,
|
|
|
+ 'apns_production' => false,
|
|
|
+ 'big_push_duration' => 0
|
|
|
+ ])
|
|
|
+ ->send();
|
|
|
+ return 1;
|
|
|
+ }catch (APIRequestException $e) {
|
|
|
+ return 2;
|
|
|
+ } catch (APIConnectionException $e) {
|
|
|
+ return 3;
|
|
|
+ }
|
|
|
+
|
|
|
}
|