91成人在线播放_欧美一区二区视频在线观看_91精品国产高清久久久久久_国产精品久久亚洲不卡4k岛国


待發短信

在線客服
產品支持 短信寶客服
合作渠道 渠道合作
服務咨詢

4001-021-502

工作時間

9:00-21:00

PHPSHE商城新增短信寶短信接口

今天小編為大家更新phpshe商城系統1.7版本的短信插件,之前的版本插件已不能使用。下面帶著大家一起進行新版本的替換,我們使用的短信接口是我們短信寶短信群發平臺的短信接口,我們短信寶短信群發平臺非常穩定,發送速度快,注冊就送測試短信,推薦大家使用。

首先我們打開項目\template\default\admin\setting_sms.html文件,替換為以下代碼:

?
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
<!--{include(pe_tpl('header.html'));}-->
<div class="right">
 <!--{include(pe_tpl('setting_menu.html'));}-->
 <div class="right_main">
  <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" /> 還沒有賬號? <a href="http://www.gjrencai.com/reg" style="color: red;">請點擊注冊</a></td>
  </tr>
  <tr>
   <td align="right" width="150">短信寶密碼:</td>
   <td><input type="text" name="info[sms_password]" value="{$info['sms_password']['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" />
    <a href="javascript:;" class="admin_btn mal10" id="sms_test" />發送測試短信</a>
    <span class="c888">(用于接收訂單通知,多個用“,”隔開)</span
   </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>
 <div class="now">
  <a href="javascript:;" class="sel">短信通知<i></i></a>
 </div>
 <!--{foreach(array('user'=>'會員', 'admin'=>'管理員') as $user_type=>$user_name):}-->
 <div class="right_main">
  <table width="100%" border="0" cellspacing="0" cellpadding="0" class="list">
  <tr>
   <th class="bgtt" width="50">序號</th>
   <th class="bgtt" width="">通知類型</th>
   <th class="bgtt" width="250">通知用戶</th>
   <th class="bgtt" width="250">通知模板</th>
   <th class="bgtt" width="250">啟用狀態</th>
  </tr>
  <!--{$num=1}-->
  <!--{foreach($notice_list[$user_type] as $k=>$v):}-->
  <tr>
   <td>{$num++}</td>
   <td>{$v['notice_name']}</td>
   <td>{$user_name}</td>
   <td>
    <a href="admin.php?mod=notice&act=edit&type=sms&id={$v['notice_id']}" class="admin_edit" onclick="return pe_dialog(this, '修改短信模板', 850, 500, 'notice')">編輯</a>
   </td>
   <td class="layui-form">
    <input type="checkbox" <!--{if($v['notice_sms_state']):}-->checked<!--{endif;}--> lay-skin="switch" lay-text="開啟|關閉" url="admin.php?mod=notice&act=sms_state&id={$v['notice_id']}&token={$pe_token}" />
   </td>
  </tr>
  <!--{endforeach;}-->
  </table>
 </div>
 <!--{endforeach;}-->
</div>
<link rel="stylesheet" href="{$pe['host_root']}include/plugin/layui/css/layui.css">
<script src="{$pe['host_root']}include/plugin/layui/layui.js"></script>
<script type="text/javascript">
$(function(){
 $("#sms_test").click(function(){
  $(this).attr("href", "admin.php?mod=setting&act=sms_test&user="+$(":input[name='info[sms_admin]']").val()+"&token={$pe_token}");
 })
})
layui.use(['form'], function(){
 form = layui.form;
 form.on('switch', function(data){
  var url = $(this).attr("url") + "&value=" + (this.checked ? 1 : 0)
  pe_getinfo(url);
 });
});
</script>
<!--{include(pe_tpl('footer.html'));}-->

接著我們打開項目\module\admin\setting.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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
<?php
/**
 
 
 */
$menumark 'setting';
pe_lead('hook/cache.hook.php');
switch ($act) {
 //####################// 積分設置 //####################//
 case 'point':
  if (isset($_p_pesubmit)) {
   pe_token_match();
   $sql "update `".dbpre."setting` set `setting_value` = case `setting_key`
    when 'point_state' then '".pe_dbhold($_p_info['point_state'])."'
    when 'point_money' then '".pe_dbhold($_p_info['point_money'])."'
    when 'point_reg' then '".pe_dbhold($_p_info['point_reg'])."'
    when 'point_login' then '".pe_dbhold($_p_info['point_login'])."'
    when 'point_comment' then '".pe_dbhold($_p_info['point_comment'])."' else `setting_value` end";
   if ($db->sql_update($sql)) {
    cache_write('setting');
    pe_success('設置成功!');
   }
   else {
    pe_error('設置失敗...');
   }
  }
  $info $db->index('setting_key')->pe_selectall('setting');  
  $seo = pe_seo($menutitle='積分設置''''''admin');
  include(pe_tpl('setting_point.html'));  
 break;
 //####################// 短信設置 //####################//
 case 'sms':
  if (isset($_p_pesubmit)) {
   pe_token_match();
   $sql "update `".dbpre."setting` set `setting_value` = case `setting_key`
    when 'sms_key' then '".pe_dbhold($_p_info['sms_key'])."'
    when 'sms_password' then '".pe_dbhold($_p_info['sms_password'])."'
    when 'sms_sign' then '".pe_dbhold($_p_info['sms_sign'])."'
    when 'sms_admin' then '".pe_dbhold($_p_info['sms_admin'])."' else `setting_value` end";
   if ($db->sql_update($sql)) {
    cache_write('setting');
    pe_success('設置成功!');
   }
   else {
    pe_error('設置失敗...');
   }
  }
  $info $db->index('setting_key')->pe_selectall('setting'); 
  $notice_list $db->index('notice_obj|notice_type')->pe_selectall('notice');
  $seo = pe_seo($menutitle='短信設置''''''admin');
  include(pe_tpl('setting_sms.html'));
 break;
 //####################// 短信測試 //####################//
 case 'sms_test':
  pe_token_match();
  if (!$_g_user) pe_error('管理員手機號未填寫...');
  foreach (explode(','$_g_useras $k=>$v) {
   if (!$vcontinue;
   $sql_set[$k]['noticelog_type'] = 'sms';
   $sql_set[$k]['noticelog_user'] = pe_dbhold($v);
   $sql_set[$k]['noticelog_name'] = '';
   $sql_set[$k]['noticelog_text'] = "尊敬的用戶:您好,這是一條測試短信";
   $sql_set[$k]['noticelog_atime'] = time();   
  }
  if ($db->pe_insert('noticelog'$sql_set)) {
   pe_success('發送成功!');
  }
  else {
   pe_error('發送失敗...');
  }
 break;
 //####################// 郵箱設置 //####################//
 case 'email':
  if (isset($_p_pesubmit)) {
   pe_token_match();
   $sql "update `".dbpre."setting` set `setting_value` = case `setting_key`
    when 'email_smtp' then '".pe_dbhold($_p_info['email_smtp'])."'
    when 'email_ssl' then '".pe_dbhold($_p_info['email_ssl'])."'
    when 'email_port' then '".pe_dbhold($_p_info['email_port'])."'
    when 'email_name' then '".pe_dbhold($_p_info['email_name'])."'
    when 'email_pw' then '".pe_dbhold($_p_info['email_pw'])."'
    when 'email_nname' then '".pe_dbhold($_p_info['email_nname'])."'
    when 'email_admin' then '".pe_dbhold($_p_info['email_admin'])."' else `setting_value` end";
   if ($db->sql_update($sql)) {
    cache_write('setting');
    pe_success('設置成功!');
   }
   else {
    pe_error('設置失敗...');
   }
  }
  $info $db->index('setting_key')->pe_selectall('setting');
  $notice_list $db->index('notice_obj|notice_type')->pe_selectall('notice');   
  $seo = pe_seo($menutitle='郵箱設置''''''admin');
  include(pe_tpl('setting_email.html'));  
 break;
 //####################// 郵件測試 //####################//
 case 'email_test':
  pe_token_match();
  if (!$_g_user) pe_error('管理員郵箱未填寫...');
  foreach (explode(','$_g_useras $k=>$v) {
   if (!$vcontinue;
   $sql_set[$k]['noticelog_type'] = 'email';
   $sql_set[$k]['noticelog_user'] = pe_dbhold($v);
   $sql_set[$k]['noticelog_name'] = 'PHPSHE商城系統測試郵件';
   $sql_set[$k]['noticelog_text'] = '尊敬的用戶:您好,歡迎使用簡好網絡旗下軟件 - PHPSHE商城系統<br/><br/>簡好網絡官網:http://www.phpshe.com<br/><br/>郵件發送日期:'.pe_date(time());
   $sql_set[$k]['noticelog_atime'] = time();   
  }
  if ($db->pe_insert('noticelog'$sql_set)) {
   pe_success('發送成功!');
  }
  else {
   pe_error('發送失敗...');
  
 break;
 //####################// 會員設置 //####################//
 case 'user':
  if (isset($_p_pesubmit)) {
   pe_token_match();
   if ($_p_info['cashout_min'] <= 0) $_p_info['cashout_min'] = 0.1;
   $sql "update `".dbpre."setting` set `setting_value` = case `setting_key`
    when 'web_guestbuy' then '".intval($_p_info['web_guestbuy'])."'
    when 'web_checkphone' then '".intval($_p_info['web_checkphone'])."'
    when 'web_checkemail' then '".intval($_p_info['web_checkemail'])."'
    when 'cashout_min' then '".round($_p_info['cashout_min'], 1)."'
    when 'cashout_fee' then '".(round($_p_info['cashout_fee'], 2)/100)."'
    when 'tg_state' then '".intval($_p_info['tg_state'])."'
    when 'tg_fc1' then '".(round($_p_info['tg_fc1'], 2)/100)."'
    when 'tg_fc2' then '".(round($_p_info['tg_fc2'], 2)/100)."'
    when 'tg_fc3' then '".(round($_p_info['tg_fc3'], 2)/100)."' else `setting_value` end";
   if ($db->sql_update($sql)) {
    cache_write('setting');
    pe_success('設置成功!');
   }
   else {
    pe_error('設置失敗...');
   }
  }
  $info $db->index('setting_key')->pe_selectall('setting');
  $seo = pe_seo($menutitle='會員設置''''''admin');
  include(pe_tpl('setting_user.html'));
 break;
 //####################// 網站設置 //####################//
 default:
  if (isset($_p_pesubmit)) {
   pe_token_match();
   if ($_FILES['web_logo']['size']) {
    pe_lead('include/class/upload.class.php');
    $upload new upload($_FILES['web_logo']);
    $_p_info['web_logo'] = $upload->filehost;
    $sqlset .= "when 'web_logo' then '{$upload->filehost}'";
   }
   if ($_FILES['wap_logo']['size']) {
    pe_lead('include/class/upload.class.php');
    $upload new upload($_FILES['wap_logo']);
    $_p_info['wap_logo'] = $upload->filehost;
    $sqlset .= "when 'wap_logo' then '{$upload->filehost}'";
   }
   if ($_FILES['web_qrcode']['size']) {
    pe_lead('include/class/upload.class.php');
    $upload new upload($_FILES['web_qrcode']);
    $_p_info['web_qrcode'] = $upload->filehost;
    $sqlset .= "when 'web_qrcode' then '{$upload->filehost}'";
   }
   $sql "update `".dbpre."setting` set `setting_value` = case `setting_key` {$sqlset}
    when 'web_title' then '".pe_dbhold($_p_info['web_title'])."'
    when 'web_keywords' then '".pe_dbhold($_p_info['web_keywords'])."'
    when 'web_description' then '".pe_dbhold($_p_info['web_description'])."'
    when 'web_copyright' then '".pe_dbhold($_p_info['web_copyright'])."'
    when 'web_icp' then '".pe_dbhold($_p_info['web_icp'])."'
    when 'web_phone' then '".pe_dbhold($_p_info['web_phone'])."'
    when 'web_qq' then '".pe_dbhold($_p_info['web_qq'])."'
    when 'web_hotword' then '".pe_dbhold($_p_info['web_hotword'])."'
    when 'web_wlname' then '".pe_dbhold($_p_info['web_wlname'])."'
    when 'web_tongji' then '".pe_dbhold($_p_info['web_tongji'], 'all')."' else `setting_value` end";
   if ($db->sql_update($sql)) {
    cache_write('setting');
    pe_success('設置成功!');
   }
   else {
    pe_error('設置失敗...');
   }
  
  $info $db->index('setting_key')->pe_selectall('setting');
  $seo = pe_seo($menutitle='網站設置''''''admin');
  include(pe_tpl('setting_base.html'));
 break;
}
?>

接著我們打開項目\hook\qunfa.hook.php文件,替換qunfa_sms方法:

?
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
function qunfa_sms($phone$text$qunfa_id = 0) {
 global $db$cache_setting;
 
  $url 'http://api.smsbao.com/sms?u='.$cache_setting['sms_key'].'&p='.md5($cache_setting['sms_password']).'&m='.$phone.'&c=【'.$cache_setting['sms_sign'].'】'.$text;
  $result file_get_contents($url);
 
 //更新或插入發送日志
 $sql_set['noticelog_stime'] = time();
 if ($result == 0) {
  $results['result'] = true;
  $results['show'] = '發送成功';
  $sql_set['noticelog_state'] = 'success';   
 }
 else {
  $sql_set['noticelog_state'] = 'fail';   
  $sql_set['noticelog_error'] = $result;
 }
 if ($qunfa_id) {
  $db->pe_update('noticelog'array('noticelog_id'=>$qunfa_id), pe_dbhold($sql_set));
 }
 else {
  $sql_set['noticelog_type'] = 'sms';
  $sql_set['noticelog_user'] = $phone;   
  $sql_set['noticelog_name'] = '';
  $sql_set['noticelog_text'] = $text;
  $sql_set['noticelog_atime'] = time();
  $db->pe_insert('noticelog', pe_dbhold($sql_set));
 }
 return $results;
}

最后我們在項目的根目錄下創建smsbao.php文件,代碼如下:

?
1
2
3
4
5
6
7
8
9
10
11
<?php
 
/**
 * Smsbao.php
 * 短信寶插件安裝,增加密碼字段
 */
include('./common.php');
$sql_set['setting_key'] = 'sms_password'
$sql_set['setting_value'] = ''
$db->pe_insert('setting',$sql_set);
echo '短信寶插件安裝成功,請刪除smsbao.php文件';

經過上面的替換,短信寶的短信平臺已經替換成功了,可以正常使用了。進行測試發送:

報備一下短信寶的VIP模板,這樣就可以走短信寶的優質通道了,即便遇到敏感文字我們都不會人工審核,短信內容3~5秒就可送達。

另外:我們已經開發好完整的phpshe商城系統短信寶插件,點擊此鏈接 下載及查看安裝流程。

開源插件

最新更新

電商類

CMS類

微信類

文章標簽