Example #1
0
 public function duanxin()
 {
     $data = $this->View('public');
     $start = $this->input->get_post('start');
     $offset = $this->input->get_post('offset');
     $step = 1;
     if (empty($start)) {
         $start = '0';
         $offset = $step;
     }
     $uId = $this->input->get_post('str');
     $con = $this->input->get_post('content');
     $uIdArr = explode('-', base64_decode($uId));
     $countNum = count($uIdArr);
     $content = base64_decode(str_replace(" ", "+", $con));
     $this->load->library('sms');
     foreach ($uIdArr as $value) {
         $uIdStr .= $value . ',';
     }
     $uIdStr = rtrim($uIdStr, ',');
     $arr_phone = $this->EmailModel->emailPhoneNews($uIdStr);
     foreach ($arr_phone as $key => $val) {
         if ($key >= $start && $key < $offset) {
             if (!empty($val["phone"])) {
                 $res = Sms::SendSms($val["phone"], $content);
                 if (strpos($res, 'Result=0') === false) {
                     continue;
                 }
             }
         }
         $start += $step;
         $offset += $step;
         if ($offset > $countNum) {
             $this->showMsg(1, '短信发送成功', '/public/EmailController/emailListView/');
             exit;
         } else {
             header("Location: http://erm.xkhouse.com/index.php/public/EmailController/duanxin/?start={$start}&offset={$offset}&str={$uId}&content={$con}");
         }
     }
 }