Joke Collection Website - Blessing messages - Which file is the SMS interface provided by ecshop?

Which file is the SMS interface provided by ecshop?

Analysis of ecshop SMS sending function

ecshop SMS sending function is a highlight of ecshop. We are in the process of secondary development of ecshop. The SMS interface of ecshop is often processed. Even modify the ecshop SMS sending core library file. So what are the specific principles and processing mechanisms of ecshop’s SMS sending function. We will combine the ecshop backend and frontend code. Let’s talk about the ecshop SMS sending function.

We enter the ecshop backend. In the system settings. There is a text message setting where you can set the merchant’s mobile phone number. and the control process for sending text messages. This setting information is recorded in the shop_config table of the ecshop database. The fields inside are respectively. sms_shop_mobile, sms_order_placed, sms_order_payed, sms_order_shipped. The three parameters respectively indicate whether to send short messages to customers when placing orders, paying and shipping.

The ecshop SMS system is mainly distributed in the several states mentioned above. It is impossible for us to meaningfully enumerate this function. We will talk about it in conjunction with the code flow.php in the shopping cart.

First in the done action of placing an order. We will see the following code.

if ($_CFG['sms_order_placed'] == '1' && $_CFG['sms_shop_mobile'] != '')

{

include_once ('includes/cls_sms.php');

$sms = new sms();

$msg = $order['pay_status'] == PS_UNPAYED ?

$_LANG['order_placed_sms'] : $_LANG['order_placed_sms'] . '[' . $_LANG['sms_paid'] . ']';

$sms->send($_CFG ['sms_shop_mobile'], sprintf($msg, $order['consignee'], $order['tel']), 0);

}

This code tells us . Determine whether to send information to the customer by obtaining the configuration information in $_CFG. Then send text messages by calling the SMS API interface include/cls_sms.php. First, a $sms object is declared. This object has a method send() method.

The following is the function description of the send() function of the ecshop SMS system.

/**

* Send short message

*

* @access public

* @param string $phone Which mobile phone numbers to send to? Multiple numbers are separated by half-width commas

* @param string $msg The content of the message sent

* @param string $send_date Timing Send time

* @return boolean Returns true if the message is sent successfully, false if it fails.

*/

function send($phone, $msg, $send_date = '', $send_num = 1)

All ecshop calls to send short messages place. All are achieved through this method. Of course we can combine some of the usage requirements of ecshop.