sms.php 2.2 KB

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