逍遙商城是一個以PHP+MySQL進行開發的開源B2C商城。在廣大站長里面挺受喜愛,小編對他還是很了解,今天小編就以新增短信接口為例,給大家講解一下如何進行二次開發,我們今天講解的是V1.1.1版本,使用的短信接口是我們短信寶短信群發平臺的短信接口,我們短信寶短信群發平臺的接口非常穩定,發送速度快,注冊就送測試短信,推薦大家使用。
1:打開項目:\admin\template\setting_sms.html 大概在10行修改為短信寶短信頁面
|
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
|
<div class="right"> <!--{include(pe_tpl('setting_menu.html','admin'));}--> <div class="right_main"> <div class="tixing corg"> <p>短信使用的是短信寶,可以先注冊一個短信寶的帳號<a href="http://smsbao.com/reg" class="cblue" target="_blank">申請帳號</a></p> </div> <form method="post" id="form"> <table width="100%" border="0" cellspacing="0" cellpadding="0" class="wenzhang mat20 mab20"> <tr> <td align="right" width="150">短信寶賬號:</td> <td><input type="text" name="info[sms_key]" value="{$info['sms_key']['setting_value']}" class="inputall input300" /></td> </tr> <tr> <td align="right" width="150">短信寶密碼:</td> <td><input type="text" name="info[sms_secret]" value="{$info['sms_secret']['setting_value']}" class="inputall input300" /></td> </tr> <tr> <td align="right">短信寶簽名:</td> <td><input type="text" name="info[sms_sign]" value="{$info['sms_sign']['setting_value']}" class="inputall input300" /> <span class="c999">(例:逍遙商城 要與短信寶中的簽名保持一致哦)</span></td> </tr> <tr> <td align="right">管理員手機號:</td> <td> <input type="text" name="info[sms_admin]" value="{$info['sms_admin']['setting_value']}" class="inputall input300" /> </td> </tr> <tr> <td></td> <td> <input type="hidden" name="pesubmit" /> <input type="hidden" name="pe_token" value="{$pe_token}" /> <input type="submit" value="提 交" class="tjbtn" /> </td> </tr> </table> </form> </div> |
2:打開項目:\hook\notice.hook.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
49
50
51
52
53
54
55
56
57
58
59
|
if ($notice['user']['notice_sms_state'] && $info['user_phone']) { $info_list['noticelog_type'] = 'sms'; $info_list['noticelog_user'] = $info['user_phone']; $info_list['noticelog_name'] = ''; $info_list['noticelog_text'] = "【{$cache_setting['sms_sign']}】".notice_tag_replace($notice['user']['notice_sms_text'], $info); $info_list['noticelog_atime'] = time(); if(isset($_SESSION['sms_param'])){ $sms_param = "{".rtrim($_SESSION['sms_param'],",")."}"; if (qunfa_sms($info['user_phone'],$sms_param,$notice['user']['notice_sms_text'])){ $info_list['noticelog_state'] = 'success'; }else{ $info_list['noticelog_state'] = 'fail'; } unset($_SESSION['sms_param']); } $sql_set[] = pe_dbhold($info_list); } //發送管理員短信通知 if ($notice['admin']['notice_sms_state'] && $cache_setting['sms_admin']) { foreach (explode(',', $cache_setting['sms_admin']) as $v) { $info_list['noticelog_type'] = 'sms'; $info_list['noticelog_user'] = $v; $info_list['noticelog_name'] = ''; $info_list['noticelog_text'] = "【{$cache_setting['sms_sign']}】".notice_tag_replace($notice['admin']['notice_sms_text'], $info); $info_list['noticelog_atime'] = time(); if(isset($_SESSION['sms_param'])){ $sms_param = '{'.rtrim($_SESSION['sms_param'],",").'}'; if (qunfa_sms($cache_setting['sms_admin'],$sms_param,$notice['admin']['notice_sms_text'])){ $info_list['noticelog_state'] = 'success'; }else{ $info_list['noticelog_state'] = 'fail'; } unset($_SESSION['sms_param']); } $sql_set[] = pe_dbhold($info_list); } } if (is_array($sql_set)) $db->pe_insert('noticelog', $sql_set); add_wechat_noticelog($user_id, $type, $info);}function remove_quote(&$str) { if (preg_match("/^\'/",$str)){ $str = substr($str, 1, strlen($str) - 1); } //判斷字符串是否以'"'結束 if (preg_match("/\'$/",$str)){ $str = substr($str, 0, strlen($str) - 1);; } return $str;} |
經過上面的替換,短信寶的短信平臺已經替換成功了,可以正常使用了。進行測試發送:

報備一下短信寶的VIP模板,這樣就可以走短信寶的優質通道了,即便遇到敏感文字我們都不會人工審核,短信內容3~5秒就可送達。
另外:我們已經開發好完整的AiJiaV9.0系統系統短信寶插件,點擊此鏈接 下載及查看安裝流程。
最新更新
電商類
CMS類
微信類