1
0

JPushChajian.php 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. <?php
  2. /**
  3. * 最新系统推送1.9.7后
  4. * 软件:信呼OA
  5. * 最后更新:2021-10-09
  6. */
  7. class JPushChajian extends Chajian{
  8. //-------------最新原生app推送app是1.2.3版本 和 最新app+---------------
  9. public function push($title, $desc, $cont, $palias)
  10. {
  11. $alias = $palias['alias'];
  12. $xmalias = $palias['xmalias']; //小米的
  13. $newalias = $palias['newalias']; //最新使用的
  14. $oldalias = $palias['oldalias']; //一般自己编译
  15. $uids = $palias['uids'];
  16. $alias2019 = $palias['alias2019'];
  17. $pushuids = $palias['pushuids']; //可以推送的用户ID
  18. $xmpush = c('xmpush');
  19. $hwpush = c('hwpush');
  20. //可推送判断
  21. $ketualia = array();
  22. foreach($alias2019 as $ali1){
  23. $ali1aa = explode('|', $ali1);
  24. $_uid = $ali1aa[2];
  25. if(in_array($_uid, $pushuids))$ketualia[] = $ali1;
  26. }
  27. $alias2019 = $ketualia;
  28. //$this->rock->debugs($palias,'pushalias');//判断能不能推送,打印这个
  29. $xharr = array(
  30. 'uids' => $uids,
  31. 'title' => $this->rock->jm->base64encode($title),
  32. 'cont' => $this->rock->jm->base64encode($cont),
  33. 'desc' => $desc,
  34. 'systype'=> getconfig('systype')
  35. );
  36. $isuguanw = false;
  37. //没有设置推送(走的信呼官网渠道)
  38. if(!$xmpush->sendbool() && !$hwpush->sendbool()){
  39. if($xmalias || $newalias || $oldalias || $alias2019){
  40. if($xmalias)$xharr['xmalias'] = join(',', $xmalias);
  41. if($newalias)$xharr['newalias'] = join(',', $newalias);
  42. if($oldalias)$xharr['oldalias'] = join(',', $oldalias);
  43. if($alias2019)$xharr['alias2019'] = join(',', $alias2019);
  44. $isuguanw = true;
  45. }
  46. }else{
  47. $desc = $this->rock->jm->base64decode($desc);
  48. $xmarr = array();//小米的人员
  49. $othar = array();//其他人用
  50. $iosar = array(); //IOS
  51. $hwarr = array(); //华为
  52. $iospas= array();
  53. if($alias2019)foreach($alias2019 as $ali1){
  54. $ali1aa = explode('|', $ali1);
  55. $regid = $ali1aa[0];
  56. $sjlxx = $ali1aa[1];
  57. if(contain($sjlxx,'xiaomi')){
  58. $xmarr[] = $regid;
  59. }else if(contain($sjlxx,'huawei')){
  60. if(isset($ali1aa[3]) && $ali1aa[3])$hwarr[] = $ali1aa[3];
  61. }else if(contain($sjlxx,'iphone')){
  62. $iosar[] = $regid;
  63. $iospas[]= $ali1;
  64. }else{
  65. $othar[] = $regid;
  66. }
  67. }
  68. $msg = $msg1 = $msg2 = '';
  69. if($oldalias)$msg = $xmpush->androidsend($oldalias, $title, $desc, $cont);
  70. if($xmarr)$msg = $xmpush->androidsend($xmarr, $title, $desc);
  71. if($iosar){
  72. if(!$xmpush->jpushiosbool()){
  73. $xharr['alias2019'] = join(',', $iospas);
  74. $isuguanw = true;
  75. }else{
  76. $msg1= $xmpush->jpushiossend($iosar, $title, $desc);
  77. }
  78. }
  79. if($hwarr)$msg2= $hwpush->androidsend($hwarr, $title, $desc);
  80. $msg5 = $msg.$msg1.$msg2;
  81. if($msg5)$this->rock->debugs($msg5,'mypush');
  82. }
  83. if($isuguanw){
  84. $runurl = c('xinhu')->geturlstr('jpushplat', $xharr);
  85. c('curl')->getcurl($runurl);
  86. }
  87. }
  88. }
粤ICP备19079148号