didsms.php 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: Administrator
  5. * Date: 2022/11/28 0028
  6. * Time: 9:17
  7. */
  8. require_once(ONU_ROOT . 'application/lib/data/adminAction.php');
  9. class ONUService{
  10. // WK AS Y H 老系统 https://edm.alipearl.net/
  11. // wiggins AP 新系统一 http://email.alipearl.net/
  12. // AP 新系统二 http://marketing.alipearl.net/
  13. public function westkissDid(){
  14. $data = $_REQUEST;
  15. if($data['messageId']){
  16. $this->results($data);
  17. echo 'success';
  18. }else{
  19. echo 'error';
  20. }
  21. }
  22. public function results($data){
  23. $messageid =$data['messageId'];
  24. $cmessageid = explode('-',$messageid);
  25. $cmessageid=$cmessageid[0];
  26. $data['group_dr_id']=$cmessageid;
  27. $admin = new AdvertAdminAction();
  28. //根据DID号判断站点
  29. $uid =$this->getUid($data['toPhone']);
  30. $data['status']=1;
  31. $data['uid']=$uid;
  32. $data['mobile']=$this->checkMobileCode($data['fromPhone']);
  33. if(stripos($data['content'],'stop')!==false){//客户取消订阅
  34. $data['status']=2;
  35. $is_send =2;
  36. if($uid){
  37. $admin->upDidSmsCustomer($is_send,$data['mobile'],$uid);
  38. }
  39. }
  40. $admin->addDidLog($data);
  41. }
  42. public function getUid($mobile){
  43. $mobile= str_replace('-', '', $mobile);
  44. $mobile= str_replace('_', '', $mobile);
  45. $mobile= str_replace('(', '', $mobile);
  46. $mobile= str_replace(')', '', $mobile);
  47. $mobile= str_replace('+', '', $mobile);
  48. $mobile= str_replace(' ', '', $mobile);
  49. $mobile=trim($mobile);
  50. $uid=0;
  51. if($mobile==18445081893){//--牛信云 alipearlhair
  52. $uid=1;
  53. }
  54. if($mobile==18332604755){//--牛信云 yolissahair
  55. $uid=7;
  56. }
  57. if($mobile==18332359525){//--牛信云 asteriahair
  58. $uid=5;
  59. }
  60. if($mobile==18444796463){//--牛信云 supernovahair
  61. $uid=6;
  62. }
  63. if($mobile==18444797525){//--牛信云 westkisshair
  64. $uid=3;
  65. }
  66. if($mobile==18337593782){//--牛信云 wigginshair
  67. $uid=4;
  68. }
  69. return $uid;
  70. }
  71. public function checkMobileCode($mobile){
  72. $mobile= str_replace('-', '', $mobile);
  73. $mobile= str_replace('_', '', $mobile);
  74. $mobile= str_replace('(', '', $mobile);
  75. $mobile= str_replace(')', '', $mobile);
  76. $mobile= str_replace('+', '', $mobile);
  77. $mobile= str_replace(' ', '', $mobile);
  78. $mobile=trim($mobile);
  79. $frist =(int)substr($mobile, 0, 1 );
  80. $lenth=strlen($mobile);
  81. if($lenth==11&&$frist==1){//例:14696305087
  82. $mobile =substr($mobile , 1 , 10);
  83. }
  84. return $mobile;
  85. }
  86. public function getCount($key){
  87. $redis=$this->redis();
  88. $count = $redis->exists($key) ? $redis->get($key) : 0;
  89. $redis->set($key, ++$count);
  90. return $count;
  91. }
  92. //http://email.alipearl.net/
  93. public function wigginsDid(){
  94. $data = $_REQUEST;
  95. if($data['messageId']){
  96. $this->results($data);
  97. echo 'success';
  98. }else{
  99. echo 'error';
  100. }
  101. }
  102. public function alipearlDid(){
  103. $data = $_REQUEST;
  104. if($data['messageId']){
  105. $this->results($data);
  106. echo 'success';
  107. }else{
  108. echo 'error';
  109. }
  110. }
  111. public function redis(){
  112. $redis = new Redis();
  113. $redis->connect('127.0.0.1', 6379);
  114. $redis->select(8);
  115. return $redis;
  116. /* $count = $redis->exists('count') ? $redis->get('count') : 1;
  117. echo $count;
  118. $redis->set('count', ++$count);*/
  119. }
  120. }