微擎是一款免費(fèi)開源的公眾平臺(tái)管理系統(tǒng),基于web2.0技術(shù)架構(gòu),他有很多的擴(kuò)展模塊,二次開發(fā)也非常方便,智慧送水是微擎應(yīng)用市場(chǎng)針對(duì)送水管理的一套應(yīng)用模塊,小編對(duì)他還是了解, 今天小編就以替換短信接口為例告訴大家如何進(jìn)行二次開發(fā),我們講解的是v1.0.7版本,使用的短信接口是我們短信寶短信群發(fā)平臺(tái)的接口,我們短信寶短信群發(fā)平臺(tái)非常穩(wěn)定,發(fā)送速度快,注冊(cè)就送測(cè)試短信,推薦大家使用。
1:打開項(xiàng)目:addons\lh_water\template\web\system\sms.html 增加短信寶頁(yè)面
|
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
|
<form class="form-horizontal form" action="" method="post" enctype="multipart/form-data"> <div class="admin_form_main"> <div class="fl">短信寶賬號(hào):</div> <div class="fr"><input name="appKey" type="text" class="input_text_default" maxlength="60" placeholder=" " value="{$infoArr['appKey']}" /> <a target="_blank" t href="http://www.980247.com/register.jhtml" style="color: red;text-decoration:none;">還沒有注冊(cè)賬號(hào)?立即注冊(cè)</a> </div> <div class="fl">短信寶密碼:</div> <div class="fr"><input name="appSecret" type="text" class="input_text_default" maxlength="60" placeholder=" " value="{$infoArr['appSecret']}" /></div> <div class="fl">短信寶簽名:</div> <div class="fr"><input name="sign" type="text" class="input_text_default" maxlength="60" placeholder=" " value="{$infoArr['sign']}" /></div> <div class="fl">驗(yàn)證碼模板</div> <div class="fr"><input name="templateId" type="text" class="input_text_default" maxlength="60" placeholder=" " value="{$infoArr['templateId']}" /> <span>模板示例:您的短信驗(yàn)證碼是%d。如非本人操作,請(qǐng)盡快修改密碼</span> </div> <div class="fl"></div> <div class="fr"> <input name="submit" type="submit" class="admin_submit big" id="J_edit" value="保存"/> <input type="hidden" name="token" value="{$_W['token']}"/> </div> <div class="clear"></div> </div> </form> |
2:打開項(xiàng)目:\addons\lh_water\inc\mobile\sms.inc.php 修改發(fā)送邏輯
|
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
|
<?php namespace Aliyun\DySDKLite\Sms; require_once IA_ROOT . "/addons/lh_water/common/settings.php"; require_once IA_ROOT . "/addons/lh_water/alisms/SignatureHelper.php"; use Aliyun\DySDKLite\SignatureHelper; $redirectUrl = $_GPC['redirectUrl']; $type = $_GPC['type']; $phone = $_GPC['phone']; if (empty($phone)) { echo '手機(jī)號(hào)不能為空'; } else { $infoArr = array(); $item = pdo_fetchall("SELECT * FROM ".tablename('lh_water_setting')." WHERE uniacid = :uniacid and type = 'sms'" , array(':uniacid' => $uniacid)); if (is_array($item)) { foreach ($item as $t) { $infoArr[$t['key']] = $t['value']; } } $appKey = $infoArr['appKey']; $appSecret = $infoArr['appSecret']; $sign = $infoArr['sign']; $templateId = $infoArr['templateId']; // 發(fā)送短信驗(yàn)證碼 $code = rand(100000, 999999); $params = array (); $accessKeyId = $appKey; $accessKeySecret = $appSecret; $params["PhoneNumbers"] = $phone; $params["SignName"] = $sign; $params["TemplateCode"] = $templateId;// $params['TemplateParam'] = Array (// "code" => $code// );//// if(!empty($params["TemplateParam"]) && is_array($params["TemplateParam"])) {// $params["TemplateParam"] = json_encode($params["TemplateParam"], JSON_UNESCAPED_UNICODE);// } $params['TemplateParam'] = sprintf($templateId,$code); $user = $appKey; //短信平臺(tái)帳號(hào) $pass = md5($appSecret); //短信平臺(tái)密碼 $content='【'.$params["SignName"].'】'.$params['TemplateParam'];//要發(fā)送的短信內(nèi)容 $phone = $phone;//要發(fā)送短信的手機(jī)號(hào)碼 $sendurl = $smsapi."sms?u=".$user."&p=".$pass."&m=".$phone."&c=".urlencode($content); $result =file_get_contents($sendurl) ; if ($result == '0'){ echo 'success'; } $_SESSION['sms' . $phone] = $code; } |
經(jīng)過(guò)上面的替換,短信寶的短信平臺(tái)已經(jīng)替換成功了,可以正常使用了。進(jìn)行測(cè)試發(fā)送:

報(bào)備一下短信寶的VIP模板,這樣就可以走短信寶的優(yōu)質(zhì)通道了,即便遇到敏感文字我們都不會(huì)人工審核,短信內(nèi)容3~5秒就可送達(dá)。
另外:我們已經(jīng)開發(fā)好完整的智慧送水v1.0.7系統(tǒng)短信寶插件,點(diǎn)擊此鏈接 下載及查看安裝流程。
最新更新
電商類
CMS類
微信類