|
|
@@ -10,16 +10,13 @@ class JPushChajian extends Chajian{
|
|
|
//-------------最新原生app推送app是1.2.3版本 和 最新app+---------------
|
|
|
public function push($title, $desc, $cont, $palias)
|
|
|
{
|
|
|
-
|
|
|
- $alias = $palias['alias'];
|
|
|
- $xmalias = $palias['xmalias']; //小米的
|
|
|
- $newalias = $palias['newalias']; //最新使用的
|
|
|
- $oldalias = $palias['oldalias']; //一般自己编译
|
|
|
+
|
|
|
$uids = $palias['uids'];
|
|
|
$alias2019 = $palias['alias2019'];
|
|
|
$pushuids = $palias['pushuids']; //可以推送的用户ID
|
|
|
$xmpush = c('xmpush');
|
|
|
$hwpush = c('hwpush');
|
|
|
+ $getui = c('getui');
|
|
|
|
|
|
//可推送判断
|
|
|
$ketualia = array();
|
|
|
@@ -40,59 +37,129 @@ class JPushChajian extends Chajian{
|
|
|
'desc' => $desc,
|
|
|
'systype'=> getconfig('systype')
|
|
|
);
|
|
|
- $isuguanw = false;
|
|
|
|
|
|
-
|
|
|
- //没有设置推送(走的信呼官网渠道)
|
|
|
- if(!$xmpush->sendbool() && !$hwpush->sendbool()){
|
|
|
- if($xmalias || $newalias || $oldalias || $alias2019){
|
|
|
- if($xmalias)$xharr['xmalias'] = join(',', $xmalias);
|
|
|
- if($newalias)$xharr['newalias'] = join(',', $newalias);
|
|
|
- if($oldalias)$xharr['oldalias'] = join(',', $oldalias);
|
|
|
- if($alias2019)$xharr['alias2019'] = join(',', $alias2019);
|
|
|
- $isuguanw = true;
|
|
|
- }
|
|
|
- }else{
|
|
|
- $desc = $this->rock->jm->base64decode($desc);
|
|
|
- $xmarr = array();//小米的人员
|
|
|
- $othar = array();//其他人用
|
|
|
- $iosar = array(); //IOS
|
|
|
- $hwarr = array(); //华为
|
|
|
- $iospas= array();
|
|
|
- if($alias2019)foreach($alias2019 as $ali1){
|
|
|
- $ali1aa = explode('|', $ali1);
|
|
|
- $regid = $ali1aa[0];
|
|
|
- $sjlxx = $ali1aa[1];
|
|
|
- if(contain($sjlxx,'xiaomi')){
|
|
|
- $xmarr[] = $regid;
|
|
|
- }else if(contain($sjlxx,'huawei')){
|
|
|
- if(isset($ali1aa[3]) && $ali1aa[3])$hwarr[] = $ali1aa[3];
|
|
|
- }else if(contain($sjlxx,'iphone')){
|
|
|
- $iosar[] = $regid;
|
|
|
- $iospas[]= $ali1;
|
|
|
+ if(!$alias2019)return;
|
|
|
+
|
|
|
+ $getuiand = $getuiios = $mybyarr = $xmarr = $hwarr = $iosar = $puarr = array();
|
|
|
+ foreach($alias2019 as $k=>$ali1){
|
|
|
+ $ali1aa = explode('|', $ali1);
|
|
|
+ $regid = $ali1aa[0];
|
|
|
+ $_web = $ali1aa[1];
|
|
|
+ if(contain($_web,'custpile')){
|
|
|
+ $mybyarr[] = $k; //3
|
|
|
+ }else if(contain($_web,'getui')){
|
|
|
+ if(contain($_web,'iphone')){
|
|
|
+ $getuiios[] = $k; //3
|
|
|
}else{
|
|
|
- $othar[] = $regid;
|
|
|
+ $getuiand[] = $k; //3
|
|
|
}
|
|
|
+ }else if(contain($_web,'mi')){
|
|
|
+ $xmarr[] = $k; //0
|
|
|
+ }else if(contain($_web,'huawei')){
|
|
|
+ $hwarr[] = $k; //3
|
|
|
+ }else if(contain($_web,'iphone')){
|
|
|
+ $iosar[] = $k; //0
|
|
|
+ }else{
|
|
|
+ $puarr[] = $ali1;
|
|
|
}
|
|
|
- $msg = $msg1 = $msg2 = '';
|
|
|
- if($oldalias)$msg = $xmpush->androidsend($oldalias, $title, $desc, $cont);
|
|
|
- if($xmarr)$msg = $xmpush->androidsend($xmarr, $title, $desc);
|
|
|
- if($iosar){
|
|
|
- if(!$xmpush->jpushiosbool()){
|
|
|
- $xharr['alias2019'] = join(',', $iospas);
|
|
|
- $isuguanw = true;
|
|
|
- }else{
|
|
|
- $msg1= $xmpush->jpushiossend($iosar, $title, $desc);
|
|
|
- }
|
|
|
+ }
|
|
|
+
|
|
|
+ $mymsg = '';
|
|
|
+ $desc = $this->rock->jm->base64decode($desc);
|
|
|
+ if($xmarr){
|
|
|
+ if($xmpush->sendbool()){
|
|
|
+ $vstr = $this->getVal($alias2019, $xmarr, 0);
|
|
|
+ $msg = $xmpush->androidsend($vstr, $title, $desc);
|
|
|
+ if($msg)$mymsg.=chr(10).$msg;
|
|
|
+ }else{
|
|
|
+ $vsta = $this->getVala($alias2019, $xmarr);
|
|
|
+ foreach($vsta as $v)$puarr[] = $v;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if($hwarr){
|
|
|
+ if($hwpush->sendbool()){
|
|
|
+ $vstr = $this->getVal($alias2019, $hwarr, 3);
|
|
|
+ $msg = $hwpush->androidsend($vstr, $title, $desc);
|
|
|
+ if($msg)$mymsg.=chr(10).$msg;
|
|
|
+ }else{
|
|
|
+ $vsta = $this->getVala($alias2019, $hwarr);
|
|
|
+ foreach($vsta as $v)$puarr[] = $v;
|
|
|
}
|
|
|
- if($hwarr)$msg2= $hwpush->androidsend($hwarr, $title, $desc);
|
|
|
- $msg5 = $msg.$msg1.$msg2;
|
|
|
- if($msg5)$this->rock->debugs($msg5,'mypush');
|
|
|
}
|
|
|
|
|
|
- if($isuguanw){
|
|
|
+ if($iosar){
|
|
|
+ if($xmpush->jpushiosbool()){
|
|
|
+ $vstr = $this->getVal($alias2019, $iosar, 0);
|
|
|
+ $msg = $xmpush->jpushiossend($vstr, $title, $desc);
|
|
|
+ if($msg)$mymsg.=chr(10).$msg;
|
|
|
+ }else{
|
|
|
+ $vsta = $this->getVala($alias2019, $iosar);
|
|
|
+ foreach($vsta as $v)$puarr[] = $v;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if($getuiand){
|
|
|
+ if($getui->isandroid()){
|
|
|
+ $vstr = $this->getVal($alias2019, $getuiand, 3);
|
|
|
+ $msg = $getui->push($vstr, $title, $desc);
|
|
|
+ if($msg)$mymsg.=chr(10).$msg;
|
|
|
+ }else{
|
|
|
+ $vsta = $this->getVala($alias2019, $getuiand);
|
|
|
+ foreach($vsta as $v)$puarr[] = $v;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if($getuiios){
|
|
|
+ if($getui->isios()){
|
|
|
+ $vstr = $this->getVal($alias2019, $getuiios, 3);
|
|
|
+ $msg = $getui->push($vstr, $title, $desc);
|
|
|
+ if($msg)$mymsg.=chr(10).$msg;
|
|
|
+ }else{
|
|
|
+ $vsta = $this->getVala($alias2019, $getuiios);
|
|
|
+ foreach($vsta as $v)$puarr[] = $v;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if($mybyarr){
|
|
|
+ if($getui->sendbool()){
|
|
|
+ $vstr = $this->getVal($alias2019, $mybyarr, 3);
|
|
|
+ $msg = $getui->push($vstr, $title, $desc);
|
|
|
+ if($msg)$mymsg.=chr(10).$msg;
|
|
|
+ }else{
|
|
|
+ $msg = '自己编译未配置推送';
|
|
|
+ $mymsg.=chr(10).$msg;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if($mymsg)$this->rock->debugs($mymsg, 'mypush');
|
|
|
+
|
|
|
+
|
|
|
+ //需要官网隧道
|
|
|
+ if($puarr){
|
|
|
+ $xharr['alias2019'] = join(',', $puarr);
|
|
|
$runurl = c('xinhu')->geturlstr('jpushplat', $xharr);
|
|
|
c('curl')->getcurl($runurl);
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ private function getVal($alias2019, $new, $oi)
|
|
|
+ {
|
|
|
+ $stv = array();
|
|
|
+ foreach($new as $j){
|
|
|
+ $stra = explode('|', $alias2019[$j]);
|
|
|
+ if(isset($stra[$oi]))$stv[]= $stra[$oi];
|
|
|
+ }
|
|
|
+ return $stv;
|
|
|
+ }
|
|
|
+
|
|
|
+ private function getVala($alias2019, $new)
|
|
|
+ {
|
|
|
+ $stv = array();
|
|
|
+ foreach($new as $j){
|
|
|
+ $stv[] = $alias2019[$j];
|
|
|
+ }
|
|
|
+ return $stv;
|
|
|
+ }
|
|
|
}
|