sms.php 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  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 westkissDr(){
  14. $data = $_REQUEST;
  15. if($data['status']){
  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. $status=$data['status'];
  27. if($status!=2){//状态代码:2:成功下发,其他数字都未下发成功
  28. $key=$cmessageid.'error';
  29. }else{
  30. $key=$cmessageid.'success';
  31. }
  32. $data['group_dr_id']=$cmessageid;
  33. $admin = new AdvertAdminAction();
  34. $admin->addDrLog($data);
  35. $count=$this->getCount($key);
  36. if($status!=2&&$count>50){//失败数量大于50条 删除待发送
  37. $where =" where remarks='{$cmessageid}'" ;
  38. $list = $admin->select_smslog_new_query($where);//牛信云发送日志查询
  39. $uid =$list[0]['uid'];
  40. $wheres =" where uid='{$uid}'" ;
  41. $lists = $admin->select_sms_data_tmp_new($wheres);
  42. $fid=$lists[0]['fid'];//获取ly_sms_data_tmp_new fid
  43. $count=count($lists);
  44. if($fid) {
  45. $admin->delete_smslog_dr($uid,$fid,$count);
  46. }
  47. }
  48. }
  49. public function getCount($key){
  50. $redis=$this->redis();
  51. $count = $redis->exists($key) ? $redis->get($key) : 0;
  52. $redis->set($key, ++$count);
  53. return $count;
  54. }
  55. //http://email.alipearl.net/
  56. public function wigginsDr(){
  57. $data = $_REQUEST;
  58. $this->results($data);
  59. echo 'success';
  60. }
  61. public function alipearlDr(){
  62. $data = $_REQUEST;
  63. $this->results($data);
  64. echo 'success';
  65. }
  66. public function redis(){
  67. $redis = new Redis();
  68. $redis->connect('127.0.0.1', 6379);
  69. $redis->select(8);
  70. return $redis;
  71. /* $count = $redis->exists('count') ? $redis->get('count') : 1;
  72. echo $count;
  73. $redis->set('count', ++$count);*/
  74. }
  75. }