当前位置: 首页>>代码示例>>PHP>>正文


PHP Sms::save方法代码示例

本文整理汇总了PHP中Sms::save方法的典型用法代码示例。如果您正苦于以下问题:PHP Sms::save方法的具体用法?PHP Sms::save怎么用?PHP Sms::save使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Sms的用法示例。


在下文中一共展示了Sms::save方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: create

 public function create($content, $user = null, $cuser = 0, $stime = 0)
 {
     $model = new Sms();
     $model->year = date('Y', time());
     $model->month = date('m', time());
     $model->day = date('d', time());
     $model->message = $content;
     $model->ctime = time();
     $model->stime = $stime;
     $model->user_id = $cuser;
     if (empty($user)) {
         $model->send_all = 1;
         $model->save();
     } else {
         $model->save();
         if (is_array($user)) {
             foreach ($user as $u) {
                 $sms_user = new SmsToUser();
                 $sms_user->sms_id = $model->id;
                 $sms_user->user_id = $u;
                 $sms_user->save();
             }
         } else {
             $sms_user = new SmsToUser();
             $sms_user->sms_id = $model->id;
             $sms_user->user_id = $user;
             $sms_user->save();
         }
     }
     if (empty($stime)) {
         Task::add('sms');
     } else {
         Task::add('sms,' . $stime);
     }
     return true;
 }
开发者ID:zt123,项目名称:Base-System,代码行数:36,代码来源:Sms.php

示例2: actionSendtogroup

 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionSendtogroup()
 {
     $model = new Sms();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['Sms'])) {
         $model->attributes = $_POST['Sms'];
         if ($model->validate()) {
             if ($model->uid == 'parent') {
                 $userlist = Guardians::model()->findAll();
             }
             if ($model->uid == 'teacher') {
                 $userlist = Employees::model()->findAll();
             }
             if ($userlist != NULL) {
                 foreach ($userlist as $user) {
                     if ($user->mobile_phone) {
                         // $status = SmsSettings::model()->sendSms($user->mobile_phone,0,$model->message) ;
                         $mobile_phone = $user->mobile_phone;
                     } else {
                         $status = 0;
                         $mobile_phone = 0;
                     }
                     $Sms = new Sms();
                     $Sms->uid = $user->uid;
                     $Sms->phone_number = $mobile_phone;
                     $Sms->message = $model->message;
                     $Sms->status = $status;
                     $Sms->save();
                 }
             }
             $this->redirect(array('index'));
         }
     }
     $this->render('create', array('model' => $model));
 }
开发者ID:akilraj1255,项目名称:rajeshwari,代码行数:40,代码来源:SendbatchController.php

示例3: actionIndex

 public function actionIndex()
 {
     if (Yii::app()->request->isAjaxRequest) {
         $response = array('status' => 'failed');
         if (isset($_POST['sms']) && 0) {
             if (isset($_POST['message']) and $_POST['message'] != "") {
                 $message = $_POST['message'];
                 if (isset($_POST['recipients']) and $_POST['recipients'] != "") {
                     $recipients = $_POST['recipients'];
                     $recipients_data = explode(',', $recipients);
                     foreach ($recipients_data as $recipient_data) {
                         $parts = explode(':', $recipient_data);
                         if (count($parts) > 0) {
                             $name = count($parts) > 1 ? $parts[0] : NULL;
                             $phone_number = end($parts);
                             $hello = '';
                             $hello .= $name == NULL ? "Hi," : "Hi " . $name . ",";
                             // $status 			= SmsSettings::model()->sendSms($phone_number, 0, $hello.$message);
                             $Sms = new Sms();
                             $Sms->phone_number = $phone_number;
                             $Sms->message = $hello . $message;
                             $Sms->status = $status;
                             $Sms->save();
                         }
                     }
                     $response['status'] = 'success';
                     $response['message'] = 'Message sent';
                 } else {
                     $response['message'] = 'Enter numbers to send SMS';
                 }
             } else {
                 $response['message'] = 'Enter message to send SMS';
             }
         } else {
             $response['message'] = 'Invalid request';
         }
         echo json_encode($response);
         Yii::app()->end();
     } else {
         //registering js files
         Yii::app()->clientScript->registerScriptFile(Yii::app()->assetManager->publish(Yii::getPathOfAlias('application.modules.sms.assets') . '/js/ajaxupload/ajaxupload.js'));
         Yii::app()->clientScript->registerScript('browseActionPath', 'var browseActionPath="' . $this->createUrl('/sms/send/browse') . '"', CClientScript::POS_BEGIN);
         Yii::app()->clientScript->registerScriptFile(Yii::app()->assetManager->publish(Yii::getPathOfAlias('application.modules.sms.assets') . '/js/ajaxupload/download.js'));
         $this->render('send');
     }
 }
开发者ID:akilraj1255,项目名称:rajeshwari,代码行数:46,代码来源:SendController.php

示例4: actionIndex

 function actionIndex($oid)
 {
     $ri = $_COOKIE['ri'];
     $log = $_COOKIE['login'];
     if (!isset($ri)) {
         header('Location: /' . SITE_DIR . '/auth/showAuth');
     }
     $zagol = array('Просчет', 'Материал', 'Распил', 'ЧПУ', 'Кромка', 'Присадка', 'Гнутье', 'Эмаль', 'ПВХ', 'Фотопечать', 'Пескоструй', 'Витраж', 'oracal', 'Фасады', 'Упакован', 'Отгружен');
     $db = array("tech_end", "mater", "raspil", "cpu", "kromka", "pris_end", "gnutje", "emal", "pvh", "photo", "pesok", "vitrag", "oracal", "fas", "upak_end", "otgruz_end");
     $order = Order::getOrderById($oid);
     $order_stan = OrderStan::getOrdersByPole('oid', $oid);
     $stan = $order_stan[$oid];
     $us_dis = Users::getUserById($order['designer']);
     $dis = $us_dis['name'];
     $us_tech = Users::getUserById($order['technologist']);
     $tech = $us_tech['name'];
     //сборщик
     $mount = Mounting::getMountingLast($oid);
     if (!$mount) {
         $coll = '';
         $date_mount = '';
         $m_phone = '';
     } else {
         $coll_id = $mount['uid'];
         $user = Users::getUserById($coll_id);
         $coll = $user['name'];
         $m_phone = $user['tel'];
         $date_mount = date("d.m.y", strtotime($mount['m_date']));
     }
     //шаблоны смс
     $sample = Sms::getSamples();
     $search = array('%name%', '%con%', '%date%', '%m_date%', '%collector%', '%phone%');
     $replace = array($order['name'], $order['contract'], date("d.m.y", strtotime($stan['plan'])), $date_mount, $coll, $m_phone);
     foreach ($sample as $key => $sampleone) {
         $str = $sampleone['text_sms'];
         $newstr = str_replace($search, $replace, $str);
         $sample[$key]['text_sms'] = $newstr;
     }
     $notes = Notes::getNotesByOid($oid);
     if (isset($_POST['sendsms'])) {
         $phone = $_POST['phone'];
         $message = $_POST['message'];
         $sms = Sms::send($phone, $message);
         $errorsms = array();
         switch ($sms) {
             case 100:
                 $errorsms[] = 'Сообщение отправлено';
                 Sms::save($oid, $message);
                 break;
             case 201:
                 $errorsms[] = 'Не хватает средств на лицевом счету';
                 break;
             case 202:
                 $errorsms[] = 'Неправильно указан получатель';
                 break;
             case 203:
                 $errorsms[] = 'Нет текста сообщения';
                 break;
             case 205:
                 $errorsms[] = 'Сообщение слишком длинное (превышает 8 СМС)';
                 break;
             case 206:
                 $errorsms[] = 'Будет превышен или уже превышен дневной лимит на отправку сообщений';
                 break;
             case 207:
                 $errorsms[] = 'На этот номер (или один из номеров) нельзя отправлять сообщения';
                 break;
             case 220:
                 $errorsms[] = 'Сервис временно недоступен, попробуйте чуть позже';
                 break;
             default:
                 $errorsms[] = 'Сообщение не отправлено, обратитесь к администратору';
         }
     }
     $page = SITE_PATH . 'views/order.php';
     include SITE_PATH . 'views/layout.php';
     return true;
 }
开发者ID:kittiwake,项目名称:gm2,代码行数:78,代码来源:Controller_order.php


注:本文中的Sms::save方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。