sms.php 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  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>40){//失败数量大于40条 删除待发送
  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. if($data['status']){
  59. $this->results($data);
  60. echo 'success';
  61. }else{
  62. echo 'error';
  63. }
  64. }
  65. public function alipearlDr(){
  66. $data = $_REQUEST;
  67. if($data['status']){
  68. $this->results($data);
  69. echo 'success';
  70. }else{
  71. echo 'error';
  72. }
  73. }
  74. public function redis(){
  75. $redis = new Redis();
  76. $redis->connect('127.0.0.1', 6379);
  77. $redis->select(8);
  78. return $redis;
  79. /* $count = $redis->exists('count') ? $redis->get('count') : 1;
  80. echo $count;
  81. $redis->set('count', ++$count);*/
  82. }
  83. }