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


待發(fā)短信

在線客服
產(chǎn)品支持 短信寶客服
合作渠道 渠道合作
服務咨詢

4001-021-502

工作時間

9:00-21:00

DSMall商城_新增短信寶短信接口

DSMall基于國內(nèi)優(yōu)秀開源框架THinkPHP、打造出的一套開源的B2B2C電子商務系統(tǒng)。小編帶著大家一起開發(fā)DSMall商城3.0.1的短信寶插件接口。我們使用的短信接口是我們短信寶短信群發(fā)平臺的短信接口,我們短信寶短信群發(fā)平臺非常穩(wěn)定,發(fā)送速度快,注冊就送測試短信,推薦大家使用。

首先打開項目:\application\admin\view\message\mobile.html文件,替換17~37行左右的代碼。

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
 <tr class="noborder">
      <td class="required w120">短信寶用戶名</td>
      <td class="vatop rowform">
      <input type="text" name="smscf_wj_username" id="smscf_wj_username" value="{$list_config.smscf_wj_username}" class="w200"/>
        </td>
      <td class="vatop tips"></td>
  </tr>
  <tr class="noborder">
         <td class="required w120">短信寶密碼</td>
         <td class="vatop rowform">
         <input type="text" name="smscf_wj_key" id="smscf_wj_key" value="{$list_config.smscf_wj_key}" class="w200"/>
          <a href="http://www.gjrencai.com/reg" target="_blank" class="btn btn-blue btn-mini">立即申請</a>
          </td>
          <td class="vatop tips"></td>
  </tr>
  {notempty name='smscf_wj_num'}
  <tr class="noborder">
         <td class="required w120">可用短信條數(shù)</td>
         <td>{$smscf_wj_num}</td>
         <td class="vatop tips"></td>
  </tr>

接著打開項目:\application\admin\controller\Message.php文件,替換50~87行代碼。

?
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
 /**
     * 短信平臺設置
     */
    public function mobile() {
        $config_model = model('config');
        if (!(request()->isPost())) {
            $list_config $config_model->getConfigList();
            
            $smscf_wj_num '';
            if(!empty($list_config['smscf_wj_username'])&&!empty($list_config['smscf_wj_key'])){
                //如果配置了信息,可以查看具體可用短信條數(shù)
                $smscf_wj_num = http_request('http://api.smsbao.com/query?u='.$list_config['smscf_wj_username'].'&p='.md5($list_config['smscf_wj_key']),'get');
                if ($smscf_wj_num) {
                    $smscf_wj_num explode(','$smscf_wj_num);
                    $smscf_wj_num $smscf_wj_num[1];
                }else{
                    $smscf_wj_num '';
                }
            }
            $this->assign('smscf_wj_num'$smscf_wj_num);
            $this->assign('list_config'$list_config);
            
            $this->setAdminCurItem('mobile');
            return $this->fetch('mobile');
        else {
            $update_array array();
            $update_array['smscf_wj_username'] = input('post.smscf_wj_username');
            $update_array['smscf_wj_key'] = input('post.smscf_wj_key');
            $update_array['sms_register'] = input('post.sms_register');
            $update_array['sms_login'] = input('post.sms_login');
            $update_array['sms_password'] = input('post.sms_password');
            $result $config_model->editConfig($update_array);
            if ($result === true) {
                $this->log(lang('ds_edit') . lang('mobile_set'), 1);
                $this->success(lang('ds_common_save_succ'));
            else {
                $this->log(lang('ds_edit') . lang('mobile_set'), 0);
                $this->error(lang('ds_common_save_fail'));
            }
        }
    }

最后打開項目:\extend\sendmsg\Sms.php文件,替換35~64行代碼。

?
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
private function mysend_sms($mobile$content)
    {
        $user_id = urlencode(config('smscf_wj_username')); // 這里填寫用戶名
        $key = urlencode(config('smscf_wj_key')); // 這里填接口安全密鑰
        if (!$mobile || !$content || !$user_id || !$key)
            return false;
        if (is_array($mobile)) {
            $mobile = implode(","$mobile);
        }
        $mobile=urlencode($mobile);
        $content=urlencode($content);
        $url 'http://api.smsbao.com/sms?u='.$user_id.'&p='.md5($key).'&m='.$mobile.'&c='.$content;
        if (function_exists('file_get_contents')) {
            $res file_get_contents($url);
        }
        else {
            $ch = curl_init();
            $timeout = 5;
            curl_setopt($ch, CURLOPT_URL, $url);
            curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
            curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
            $res = curl_exec($ch);
            curl_close($ch);
        }
        if ($res == 0) {
            return true;
        }
        return false;
 
    }

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

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

另外:我們已經(jīng)開發(fā)好完整的DsMall商城系統(tǒng)短信寶插件,點擊此鏈接 下載及查看安裝流程。

開源插件

最新更新

電商類

CMS類

微信類

文章標簽