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


待發短信

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

4001-021-502

工作時間

9:00-21:00

江湖家政短信接口替換

江湖上門家政服務O2O系統基于LBS定位服務,它是一款通過互聯網、通訊技術與傳統家政行業結合的新模式,提高家政行業在業務銷售、客戶管理、信息匹配、市場推廣等方面的效率,從而提升整個行業的服務質量和水平提升的軟件,他是php源碼開發支持二次開發,小編對于這款軟件還是比較了解的,今天就為大家分享一下如何進行二次開發,我以替換短信接口為例,一步步為大家講解如何進行二次開發,使用的接口是我們短信寶短信群發平臺的短信接口,我們短信寶短信群發平臺非常穩定,發送速度快,注冊就送測試短信,推薦大家使用。

進行短信接口替換,首先我們需要替換后臺的顯示頁面,打開項目/system/admin/view/config/sms.html,修改12~32行左右,替換代碼如下:

?
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
<div class="page-data">
    <h4 class="tip-notice">如有疑問,請咨詢短信寶<a href="http://wpa.b.qq.com/cgi/wpa.php?ln=1&key=XzkzODA0NjAyMV8yNTU0MzFfNDAwMDA5MDQ2NV8yXw" target="_blank">客服</a> </h4>
    <form action="?system/config-sms.html" mini-form="config-form" method="post" >
          <input type="hidden" name="K" value="sms" />
          <table width="100%" border="0" cellspacing="0" class="table-data form">
              <tr>
                  <th>顯示錯誤提示:</th>
                  <td>
                    <label><input type="radio" name="config[show_error]" <{if $config.show_error}>checked="checked"<{/if}> value="1"/>開啟</label>&nbsp;&nbsp;
                    <label><input type="radio" name="config[show_error]" <{if empty($config.show_error)}>checked="checked"<{/if}> value="0"/>關閉</label>
                    <span class="tip-comment">當短息發送失敗時,是否顯示相應的提示,建議在調試時打開</span>
                  </td>
              </tr>
              <tr>
                  <th>短信寶帳號:</th>
                  <td>
                      <input type="text" name="config[uname]" value="<{$config.uname|default:''}>" class="input w-200"/>沒有短信寶賬號?點擊<a href="http://www.gjrencai.com" target="_blank">免費注冊</a>
                  </td>
              </tr>
              <tr>
                  <th>短信寶密碼:</th>
                  <td>
                      <input type="password" name="config[passwd]" value="<{$config.passwd|default:''}>" class="input w-200"/>
                  </td>
              </tr>
              <tr>
                  <th>管理員手機:</th>
                  <td>
                      <input type="text" name="config[mobile]" value="<{$config.mobile|default:''}>" class="input w-200"/>
                      <span class="tip-comment">用于接收網站通知,多個手機號用英文,隔開</span>
                  </td>
              </tr>
              <tr>
                  <th class="clear-th-bottom"></th>
                  <td class="clear-td-bottom" colspan="10">
                      <input type="submit" class="bt-big" value="提交數據" />
                  </td>
              </tr>
          </table>
    </form>
</div>

接下來修改發送調用方法,打開項目/home/controller/mobile/passport.ctl.php文件,修改sendsms方法,代碼如下:

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
public function sendsms()
{
    if(isset($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest'){
        $phone $this->GP('mobile');
 
        if(!$a = K::M('verify/check')->mobile($phone)){
            $this->err->add('電話號碼有誤', 212);
        }else{
            $code = rand(100000,999999);
            $session =K::M('system/session')->start();
            $session->set('code_'.$phone$code,900); //15分鐘緩存
            $smsdata =  array('code'=>$code);
            if(K::M('sms/smsbao')->send($phone$smsdata)){
                $this->err->add('信息發送成功');
            }else{
                $this->err->add('信息發送失敗'.$code, 213);
            }
        }
     }else{
         $this->error(404);
     }
}

后臺顯示頁面修改完成后我們需要修改短信接口的配置文件,打開項目/system/schemas/config/sms.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
<?php
/**
 * Copy Right 99AIJIA.COM
 * Each engineer has a duty to keep the code elegant
 * Author @shzhrui<Anhuike@gmail.com>
 * $Id: sms.php 9343 2015-03-24 07:07:00Z youyi $
 */
 
if(!defined('__CORE_DIR')){
    exit("Access Denied");
}
 
return array (
  'uname' => 
  array (
    'label' => '帳號',
    'field' => 'uname',
    'type' => 'text',
    'default' => '',
    'comment' => '',
    'html' => false,
    'empty' => false,
  ),
  'passwd' => 
  array (
    'label' => '密碼',
    'field' => 'passwd',
    'type' => 'text',
    'default' => '',
    'comment' => '',
    'html' => false,
    'empty' => false,
  ),
    'mobile' => 
  array (
    'label' => '管理員接受短信的賬號',
    'field' => 'mobile',
    'type' => 'text',
    'default' => '',
    'comment' => '',
    'html' => false,
    'empty' => false,
  ),
);

修改完成后我們修改,接口的發送代碼,打開項目/sysytem/models/sms/smsbao.mdl.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
<?php
 
Import::I('sms');
class Mdl_Sms_smsbao implements Sms_Interface
{
 
    protected $_cfg array();
 
    public $lastmsg '';
    public $lastcode = 1;
 
     public function __construct($system)
    {
        $this->_sms = $system->config->get('sms');
        $this->_cfg = K::$system->config->get('site');
        $this->_sitetitle = $this->_cfg['title'];
        $this->_sitephone = $this->_cfg['phone'];
    }
 
    public function send($mobile,$code)
    {
        if ($this->_sms['show_error'] == 0) {
            return false;
        }else{
        $contents '【'.$this->_sitetitle.'】您的驗證碼為:code,該驗證碼3分鐘有效。';
 
        foreach ($code as $key => $value) {
 
        $content str_replace($key$value$contents);
        }
 
        $url 'http://api.smsbao.com/sms?u='.$this->_sms['uname'].'&p='.md5($this->_sms['passwd']).'&m='.$mobile.'&c='.$content;
        $ret file_get_contents($url);
            if ($ret == 0) {
             K::M('sms/log')->create(array('mobile'=>$mobile'content'=>$content'sms'=>'smsbao''status'=>1));
                return true;
            }else{
             K::M('sms/log')->create(array('mobile'=>$mobile'content'=>$content'sms'=>'smsbao''status'=>0));
                return false;
            }
 
 
        }
    }
}

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

報備一下短信寶的VIP模板,這樣就可以走短信寶的優質通道了,并且免審核了,短信內容3~5秒就可送達。
開源插件

最新更新

電商類

CMS類

微信類

文章標簽