123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130 |
- <?php
- /**
- * Created by PhpStorm.
- * User: Administrator
- * Date: 2022/11/28 0028
- * Time: 9:17
- */
- require_once(ONU_ROOT . 'application/lib/data/adminAction.php');
- class ONUService{
- // WK AS Y H 老系统 https://edm.alipearl.net/
- // wiggins AP 新系统一 http://email.alipearl.net/
- // AP 新系统二 http://marketing.alipearl.net/
- public function westkissDid(){
- $data = $_REQUEST;
- if($data['messageId']){
- $this->results($data);
- echo 'success';
- }else{
- echo 'error';
- }
- }
- public function results($data){
- $messageid =$data['messageId'];
- $cmessageid = explode('-',$messageid);
- $cmessageid=$cmessageid[0];
- $data['group_dr_id']=$cmessageid;
- $admin = new AdvertAdminAction();
- //根据DID号判断站点
- $uid =$this->getUid($data['toPhone']);
- $data['status']=1;
- $data['uid']=$uid;
- $data['mobile']=$this->checkMobileCode($data['fromPhone']);
- if(stripos($data['content'],'stop')!==false){//客户取消订阅
- $data['status']=2;
- $is_send =2;
- if($uid){
- $admin->upDidSmsCustomer($is_send,$data['mobile'],$uid);
- }
- }
- $admin->addDidLog($data);
- }
- public function getUid($mobile){
- $mobile= str_replace('-', '', $mobile);
- $mobile= str_replace('_', '', $mobile);
- $mobile= str_replace('(', '', $mobile);
- $mobile= str_replace(')', '', $mobile);
- $mobile= str_replace('+', '', $mobile);
- $mobile= str_replace(' ', '', $mobile);
- $mobile=trim($mobile);
- $uid=0;
- if($mobile==18445081893){//--牛信云 alipearlhair
- $uid=1;
- }
- if($mobile==18332604755){//--牛信云 yolissahair
- $uid=7;
- }
- if($mobile==18332359525){//--牛信云 asteriahair
- $uid=5;
- }
- if($mobile==18444796463){//--牛信云 supernovahair
- $uid=6;
- }
- if($mobile==18444797525){//--牛信云 westkisshair
- $uid=3;
- }
- if($mobile==18337593782){//--牛信云 wigginshair
- $uid=4;
- }
- return $uid;
- }
- public function checkMobileCode($mobile){
- $mobile= str_replace('-', '', $mobile);
- $mobile= str_replace('_', '', $mobile);
- $mobile= str_replace('(', '', $mobile);
- $mobile= str_replace(')', '', $mobile);
- $mobile= str_replace('+', '', $mobile);
- $mobile= str_replace(' ', '', $mobile);
- $mobile=trim($mobile);
- $frist =(int)substr($mobile, 0, 1 );
- $lenth=strlen($mobile);
- if($lenth==11&&$frist==1){//例:14696305087
- $mobile =substr($mobile , 1 , 10);
- }
- return $mobile;
- }
- public function getCount($key){
- $redis=$this->redis();
- $count = $redis->exists($key) ? $redis->get($key) : 0;
- $redis->set($key, ++$count);
- return $count;
- }
- //http://email.alipearl.net/
- public function wigginsDid(){
- $data = $_REQUEST;
- if($data['messageId']){
- $this->results($data);
- echo 'success';
- }else{
- echo 'error';
- }
- }
- public function alipearlDid(){
- $data = $_REQUEST;
- if($data['messageId']){
- $this->results($data);
- echo 'success';
- }else{
- echo 'error';
- }
- }
- public function redis(){
- $redis = new Redis();
- $redis->connect('127.0.0.1', 6379);
- $redis->select(8);
- return $redis;
- /* $count = $redis->exists('count') ? $redis->get('count') : 1;
- echo $count;
- $redis->set('count', ++$count);*/
- }
- }
|