拍拍推商城系統是匯總淘寶天貓京東等等十多家主流電商平臺免費試用商品,每天上萬件新品供試客免費申請試用,無需退還,還賺傭金的商城。小編對他還是比較了解的,今天小編就以新增短信接口為例,給大家講解一下如何進行二次開發,我們今天講解的是V3.8.13版本,使用的短信接口是我們短信寶短信群發平臺的短信接口,我們短信寶短信群發平臺的接口非常穩定,發送速度快,注冊就送測試短信,推薦大家使用。
首先打開項目:\Application\Sms\Templates\setting.tpl.php文件 在73行左右新增短信寶頁面
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
<table class= "sms Smsbao table_form" style= "display:none;" > <tr class= "Smsbao" style= "display:none;" > <td>用戶名</td> <td><input type= "text" name= "setting[smsbao_username]" value= "<?php echo $sms_setting['smsbao_username'] ?>" > <a style= "cursor:pointer;" id= "smsBao" target= "_blank" >還沒有注冊賬號?立即注冊</a></td> </tr> <tr class= "Smsbao" style= "display:none;" > <td>密鑰</td> <td><input type= "text" name= "setting[smsbao_password]" value= "<?php echo $sms_setting['smsbao_password'] ?>" > (短信寶短信平臺 用戶密碼)</td> </tr> <tr class= "Smsbao" style= "display:none;" > <td>短信簽名:</td> <td><input type= "text" name= "setting[smsbao_target]" value= "<?php echo $sms_setting['smsbao_target'] ?>" > (短信簽名 ) </td> </tr> </table> |
打開項目:\Application\Sms\Api\Driver\ 新增Smsbao.class.php文件
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
<?php namespace Sms\Api\Driver; class Smsbao { private static $config = '' ; private static $setting = '' ; public static function getInstance() { self::$setting = getcache( 'setting' , 'sms' ); self::$config = array( 'account' => self::$setting[ 'smsbao_username' ], 'password' => self::$setting[ 'smsbao_password' ], 'target' => self::$setting[ 'smsbao_target' ], ); } public static function send($mobile,$atr = array(),$content = '' ) { if (empty(self::$config)){ self::getInstance(); } self::$config[ 'mobile' ] = $mobile; self::$config[ 'content' ] = '【' .self::$setting[ 'smsbao_target' ]. '】' .$content; $user = self::$config[ 'account' ]; //短信平臺帳號 $pass = md5(self::$setting[ 'smsbao_password' ]); //短信平臺密碼 $content=self::$config[ 'content' ]; //要發送的短信內容 $phone =$mobile; //要發送短信的手機號碼 $sendurl = $smsapi. "sms?u=" .$user. "&p=" .$pass. "&m=" .$phone. "&c=" .urlencode($content); $result =file_get_contents($sendurl) ; if ($result == 0) { return TRUE; } else { return FALSE; } } public static function get_num() { if (empty(self::$config)){ self::getInstance(); } $user = self::$config[ 'account' ]; //短信平臺帳號 $pass = md5(self::$setting[ 'smsbao_password' ]); //短信平臺密碼 $content=self::$config[ 'content' ]; //要發送的短信內容 $sendurl = $smsapi. "balance?u=" .$user. "&p=" .$pass; $result =file_get_contents($sendurl); $result = explode( ',' ,$result); return $result[1]; } } ?> |
打開項目:\Application\Sms\Api\SmsApi.class.php 替換下代碼
1
2
3
4
5
6
7
8
9
10
11
|
public static function init($type){ self::$setting = self::getSetting(); extract(self::$setting); $type = "Smsbao" ; $class = strpos($type, '\\' ) ? $type : 'Sms\\Api\\Driver\\' . ucwords(strtolower($type)); self::$handler = $class; self::$type = $type; if (!class_exists(self::$handler)) { return '接口不存在' ; } } |
經過上面的替換,短信寶的短信平臺已經替換成功了,可以正常使用了。
報備一下短信寶的VIP模板,這樣就可以走短信寶的優質通道了,即便遇到敏感文字我們都不會人工審核,短信內容3~5秒就可送達。
另外:我們已經開發好完整的拍拍推v3.8.13系統短信寶插件,點擊此鏈接 下載及查看安裝流程。
最新更新
電商類
CMS類
微信類