拍拍推商城系统是汇总淘宝天猫京东等等十多家主流电商平台免费试用商品,每天上万件新品供试客免费申请试用,无需退还,还赚佣金的商城。小编对他还是比较了解的,今天小编就以新增短信接口为例,给大家讲解一下如何进行二次开发,我们今天讲解的是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
|
<?phpnamespace 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类
微信类