Ejemplo n.º 1
0
 public function actionSms($type = 'send', $batch = 0, $to = '', $content = '', $cardno = '', $cardpwd = '', $num = 2000, $once = 1)
 {
     $result = array();
     $sms = new Sms();
     switch ($type) {
         case 'register':
             $result = $sms->register();
             break;
         case 'send':
             if (empty($batch)) {
                 $result = $sms->send($to, $content);
             } else {
                 $result = $this->sendToAll($to, $content, $batch, $num, $once);
             }
             break;
         case 'receive':
             $result = $sms->receive();
             if ($result['code'] == 200) {
                 $this->saveSmsReply($result['data']);
             }
             break;
         case 'balance':
             $result = $sms->balance();
             break;
         case 'chargup':
             $result = $sms->chargUp($cardno, $cardpwd);
             break;
         default:
             break;
     }
     var_dump($result);
 }