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


PHP sms::setText方法代码示例

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


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

示例1: addOrderHistory

 public function addOrderHistory($order_id, $data)
 {
     $this->db->query("UPDATE `" . DB_PREFIX . "order` SET order_status_id = '" . (int) $data['order_status_id'] . "', date_modified = NOW() WHERE order_id = '" . (int) $order_id . "'");
     $this->db->query("INSERT INTO " . DB_PREFIX . "order_history SET order_id = '" . (int) $order_id . "', order_status_id = '" . (int) $data['order_status_id'] . "', notify = '" . (isset($data['notify']) ? (int) $data['notify'] : 0) . "', comment = '" . $this->db->escape(strip_tags($data['comment'])) . "', date_added = NOW()");
     $order_info = $this->getOrder($order_id);
     // Send out any gift voucher mails
     if ($this->config->get('config_complete_status_id') == $data['order_status_id']) {
         $this->load->model('sale/voucher');
         $results = $this->getOrderVouchers($order_id);
         foreach ($results as $result) {
             $this->model_sale_voucher->sendVoucher($result['voucher_id']);
         }
     }
     if ($data['notify']) {
         $language = new Language($order_info['language_directory']);
         $language->load($order_info['language_filename']);
         $language->load('mail/order');
         $subject = sprintf($language->get('text_subject'), $order_info['store_name'], $order_id);
         $message = $language->get('text_order') . ' ' . $order_id . "\n";
         $message .= $language->get('text_date_added') . ' ' . date($language->get('date_format_short'), strtotime($order_info['date_added'])) . "\n\n";
         $order_status_query = $this->db->query("SELECT * FROM " . DB_PREFIX . "order_status WHERE order_status_id = '" . (int) $data['order_status_id'] . "' AND language_id = '" . (int) $order_info['language_id'] . "'");
         if ($order_status_query->num_rows) {
             $message .= $language->get('text_order_status') . "\n";
             $message .= $order_status_query->row['name'] . "\n\n";
         }
         if ($order_info['customer_id']) {
             $message .= $language->get('text_link') . "\n";
             $message .= html_entity_decode($order_info['store_url'] . 'index.php?route=account/order/info&order_id=' . $order_id, ENT_QUOTES, 'UTF-8') . "\n\n";
         }
         if ($data['comment']) {
             $message .= $language->get('text_comment') . "\n\n";
             $message .= strip_tags(html_entity_decode($data['comment'], ENT_QUOTES, 'UTF-8')) . "\n\n";
         }
         $message .= $language->get('text_footer');
         $mail = new Mail();
         $mail->protocol = $this->config->get('config_mail_protocol');
         $mail->parameter = $this->config->get('config_mail_parameter');
         $mail->hostname = $this->config->get('config_smtp_host');
         $mail->username = $this->config->get('config_smtp_username');
         $mail->password = $this->config->get('config_smtp_password');
         $mail->port = $this->config->get('config_smtp_port');
         $mail->timeout = $this->config->get('config_smtp_timeout');
         $mail->setTo($order_info['email']);
         $mail->setFrom($this->config->get('config_email'));
         $mail->setSender($order_info['store_name']);
         $mail->setSubject(html_entity_decode($subject, ENT_QUOTES, 'UTF-8'));
         $mail->setText(html_entity_decode($message, ENT_QUOTES, 'UTF-8'));
         $mail->send();
     }
     // start SMS Module
     if ($data['notifysms'] && $this->config->get('rajasmsindo_statussms')) {
         $language = new Language($order_info['language_directory']);
         $language->load($order_info['language_filename']);
         $language->load('module/rajasmsindo');
         $message = sprintf($language->get('text_subject'), $order_info['store_name'], $order_id) . "\n";
         $message .= $language->get('text_order') . ' ' . $order_id . "\n";
         $message .= $language->get('text_date_added') . ' ' . date($language->get('date_format_short'), strtotime($order_info['date_added'])) . "\n";
         $order_status_query = $this->db->query("SELECT * FROM " . DB_PREFIX . "order_status WHERE order_status_id = '" . (int) $data['order_status_id'] . "' AND language_id = '" . (int) $order_info['language_id'] . "'");
         if ($order_status_query->num_rows) {
             $message .= $language->get('text_order_status') . "\n";
             $message .= $order_status_query->row['name'] . "\n";
         }
         if ($order_info['customer_id']) {
             $message .= $language->get('text_link') . "\n";
             $message .= html_entity_decode($order_info['store_url'] . 'index.php?route=account/order/info&order_id=' . $order_id, ENT_QUOTES, 'UTF-8') . "\n";
         }
         if ($data['comment']) {
             $message .= $language->get('text_comment') . "\n";
             $message .= strip_tags(html_entity_decode($data['comment'], ENT_QUOTES, 'UTF-8')) . "\n\n";
         }
         $message .= $language->get('text_footer');
         $sms = new sms();
         $sms->key = $this->config->get('rajasmsindo_key');
         $sms->phone = $this->config->get('rajasmsindo_smsphone');
         $sms->username = $this->config->get('rajasmsindo_user');
         $sms->password = $this->config->get('rajasmsindo_password');
         $sms->smsmode = $this->config->get('rajasmsindo_smsmode');
         $sms->modem = $this->config->get('rajasmsindo_modem');
         $sms->setTo($data['telephone']);
         $sms->setText($message);
         $sms->send();
     }
     // end SMS Module
     $this->load->model('payment/amazon_checkout');
     $this->model_payment_amazon_checkout->orderStatusChange($order_id, $data);
 }
开发者ID:bukastudio,项目名称:themes-2016,代码行数:86,代码来源:order.php

示例2: send


//.........这里部分代码省略.........
             } else {
                 $page = 1;
             }
             $telephone_total = 0;
             $telephones = array();
             switch ($this->request->post['to']) {
                 case 'newsletter':
                     $customer_data = array('filter_newsletter' => 1, 'start' => ($page - 1) * 10, 'limit' => 10);
                     $telephone_total = $this->model_sale_customer->getTotalCustomers($customer_data);
                     $results = $this->model_sale_customer->getCustomers($customer_data);
                     foreach ($results as $result) {
                         $telephones[] = $result['telephone'];
                     }
                     break;
                 case 'customer_all':
                     $customer_data = array('start' => ($page - 1) * 10, 'limit' => 10);
                     $telephone_total = $this->model_sale_customer->getTotalCustomers($customer_data);
                     $results = $this->model_sale_customer->getCustomers($customer_data);
                     foreach ($results as $result) {
                         $telephones[] = $result['telephone'];
                     }
                     break;
                 case 'customer_group':
                     $customer_data = array('filter_customer_group_id' => $this->request->post['customer_group_id'], 'start' => ($page - 1) * 10, 'limit' => 10);
                     $telephone_total = $this->model_sale_customer->getTotalCustomers($customer_data);
                     $results = $this->model_sale_customer->getCustomers($customer_data);
                     foreach ($results as $result) {
                         $telephones[$result['customer_id']] = $result['telephone'];
                     }
                     break;
                 case 'customer':
                     if (!empty($this->request->post['customer'])) {
                         foreach ($this->request->post['customer'] as $customer_id) {
                             $customer_info = $this->model_sale_customer->getCustomer($customer_id);
                             if ($customer_info) {
                                 $telephones[] = $customer_info['telephone'];
                             }
                         }
                     }
                     break;
                 case 'affiliate_all':
                     $affiliate_data = array('start' => ($page - 1) * 10, 'limit' => 10);
                     $telephone_total = $this->model_sale_affiliate->getTotalAffiliates($affiliate_data);
                     $results = $this->model_sale_affiliate->getAffiliates($affiliate_data);
                     foreach ($results as $result) {
                         $telephones[] = $result['telephone'];
                     }
                     break;
                 case 'affiliate':
                     if (!empty($this->request->post['affiliate'])) {
                         foreach ($this->request->post['affiliate'] as $affiliate_id) {
                             $affiliate_info = $this->model_sale_affiliate->getAffiliate($affiliate_id);
                             if ($affiliate_info) {
                                 $telephones[] = $affiliate_info['telephone'];
                             }
                         }
                     }
                     break;
                 case 'product':
                     if (isset($this->request->post['product'])) {
                         $telephone_total = $this->model_sale_order->getTotalEmailsByProductsOrdered($this->request->post['product']);
                         $results = $this->model_sale_order->getEmailsByProductsOrdered($this->request->post['product'], ($page - 1) * 10, 10);
                         foreach ($results as $result) {
                             $telephones[] = $result['telephone'];
                         }
                     }
                     break;
             }
             $telephones = array_unique($telephones);
             if ($telephones) {
                 $start = ($page - 1) * 10;
                 $end = $start + 10;
                 if ($end < $telephone_total) {
                     $json['success'] = sprintf($this->language->get('text_sent'), $start, $telephone_total);
                 } else {
                     $json['success'] = $this->language->get('text_success');
                 }
                 if ($end < $telephone_total) {
                     $json['next'] = str_replace('&amp;', '&', $this->url->link('module/rajasmsmassindo/send', 'token=' . $this->session->data['token'] . '&page=' . ($page + 1)));
                 } else {
                     $json['next'] = '';
                 }
                 $message = $store_name . ' ' . html_entity_decode($this->request->post['message'], ENT_QUOTES, 'UTF-8');
                 foreach ($telephones as $nohp) {
                     $sms = new sms();
                     $sms->key = $this->config->get('rajasmsindo_key');
                     $sms->phone = $this->config->get('rajasmsindo_smsphone');
                     $sms->username = $this->config->get('rajasmsindo_user');
                     $sms->password = $this->config->get('rajasmsindo_password');
                     $sms->smsmode = $this->config->get('rajasmsindo_smsmode');
                     $sms->modem = $this->config->get('rajasmsindo_modem');
                     $sms->setTo($nohp);
                     $sms->setText($message);
                     $sms->send();
                 }
             }
         }
     }
     $this->response->setOutput(json_encode($json));
 }
开发者ID:bukastudio,项目名称:themes-2016,代码行数:101,代码来源:rajasmsmassindo.php


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