信呼OA是一套為企業構建一個基于互聯網的企業管理平臺, 對企業中溝通與互動,協作與管理的全方位整合,并且免費開源系統,易于二次開發及維護。小編對他還是比較了解。今天就以替換短信接口為例告訴大家如何進行二次開發,使用的短信接口是我們短信寶短信群發平臺的接口,我們短信寶短信群發平臺非常穩定,發送速度快,注冊就送測試短信,推薦大家使用。
1:打開項目:\webmain\system\sms\rock_sms_cog.php 在206行新增下代碼
1
2
3
4
5
6
7
8
|
<tr> <td align= "right" >短信寶賬號</td> <td class= "tdinput" ><input id= "sms_bnum_{rand}" maxlength= "50" placeholder= "填寫短信寶賬號" class= "form-control" ><div style= "padding-top:0" ><a target= "_blank" href= "http://www.gjrencai.com/reg" >還沒有注冊?立即注冊</a></div></td> </tr> <tr> <td align= "right" >短信寶密碼</td> <td class= "tdinput" ><input id= "sms_bpwd_{rand}" type= "password" maxlength= "50" placeholder= "填寫短信寶密碼" class= "form-control" ><div style= "padding-top:0" ></div></td> </tr> |
2:打開項目:\webmain\system\sms\smsAction.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
|
public function gettotalAjax() { $barr = $ this ->smsobj->getdata( 'sms' , 'smstotal' ); $barr[ 'sms_iscb' ] = $ this ->option->getval( 'sms_iscb' , '0' ); $barr[ 'sms_cbnum' ] = $ this ->option->getval( 'sms_cbnum' , 'defnum' ); $barr[ 'sms_apikey' ] = $ this ->option->getval( 'sms_apikey' ); $barr[ 'sms_txnum' ] = $ this ->option->getval( 'sms_txnum' ); $barr[ 'sms_mknum' ] = $ this ->option->getval( 'sms_mknum' ); $barr[ 'sms_qmnum' ] = $ this ->option->getval( 'sms_qmnum' ); $barr[ 'sms_dirtype' ] = $ this ->option->getval( 'sms_dirtype' ); $barr[ 'sms_yanzm' ] = $ this ->option->getval( 'sms_yanzm' ); $barr[ 'pingtarr' ] = $ this ->option->getdata( 'syssmsplat' ); $barr[ 'sms_bnum' ] = $ this ->option->getval( 'sms_bnum' ); $barr[ 'sms_bpwd' ] = $ this ->option->getval( 'sms_bpwd' ); return $barr; } //保存設置 public function cogsaveAjax() { $sms_dirtype = $ this ->post( 'sms_dirtype' ); if (isempt($sms_dirtype) || $sms_dirtype== 'null' )$sms_dirtype = '' ; $ this ->option->setval( 'sms_iscb' , $ this ->post( 'sms_iscb' , '0' )); $ this ->option->setval( 'sms_cbnum' , $ this ->post( 'sms_cbnum' )); //催辦編號 $ this ->option->setval( 'sms_apikey' , $ this ->post( 'sms_apikey' )); $ this ->option->setval( 'sms_txnum' , $ this ->post( 'sms_txnum' )); //審批提醒模塊編號 $ this ->option->setval( 'sms_mknum' , $ this ->post( 'sms_mknum' )); //要提醒的模塊編號 $ this ->option->setval( 'sms_qmnum' , $ this ->post( 'sms_qmnum' )); //簽名 $ this ->option->setval( 'sms_dirtype' , $sms_dirtype); $ this ->option->setval( 'sms_yanzm' , $ this ->post( 'sms_yanzm' )); //驗證碼的短信編號 $ this ->option->setval( 'sms_bnum' , $ this ->post( 'sms_bnum' )); //短信寶賬號 $ this ->option->setval( 'sms_bpwd' , $ this ->post( 'sms_bpwd' )); //短信寶密碼 } |
3:打開項目:\include\chajian 新增smsbaoChajian.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
|
<?php class smsbaoChajian extends Chajian{ /** * 短信模版寫這里的 */ protected function initChajian() { $mobian[ 'defyzm' ] = '歡迎使用,您的短信驗證碼為:#code#,為保障系統安全,請勿將驗證碼和辦公系統網址提供給他人,祝您工作愉快。' ; $mobian[ 'defsucc' ] = '您提交單據(#modename#,單號:#sericnum#)已全部處理完成,可登錄系統查看詳情。' ; $mobian[ 'default' ] = '您有單據(#modename#,單號:#sericnum#)需要處理,請登錄系統及時去處理。' ; $mobian[ 'birthday' ] = '尊敬的#name#,今天是#dt#,農歷#dtnong#,是您的生日,我們在這里祝您生日快樂。' ; $mobian[ 'defnum' ] = '您有#applyname#的(#modename#)單據需要您處理,詳情:#url#' ; $mobian[ 'defurls' ] = '您有單據(#modename#,單號:#sericnum#)需要處理,請及時去處理,詳情:#url#。' ; $mobian[ 'gongsms' ] = '您收到一條“#title#”的通知,詳情:#url#' ; $mobian[ 'meetapply' ] = '#optname#發起會議“#title#”在#hyname#,時間#startdt#至#enddt#' ; $mobian[ 'meetcancel' ] = '#optname#取消會議“#title#”,時間#startdt#至#enddt#,請悉知。' ; $mobian[ 'meettodo' ] = '會議“#title#”將在#fenz#分鐘后的#time#開始請做好準備,在會議室“#hyname#”' ; //上面加你的模版 $ this ->mobianarr = $mobian; } /** * 批量發送短信 * $mobiles 接收人手機號多個,分開 * $qianm 簽名 * $tplid 模版編號,在上面initChajian()數組中查找 * $cans 模版中的參數數組 * 例子:c('mysms')->send('15800000000,15800000001','信呼', 'default', array('modename'=>'模塊名','sericnum'=>'單號')); 這例子是不需要自己調用,只要短信設置下切換為“我的短信服務”就可以了 */ public function send($mobiles, $qianm, $tplid, $cans=array()) { //要發送短信的內容 $text = arrvalue($ this ->mobianarr, $tplid); if (isempt($text)) return returnerror( '模版' .$tplid. '不存在' ); foreach($cans as $k=>$v)$text = str_replace( '#' .$k. '#' , $v, $text); if (isempt($qianm)) return returnerror( '沒有設置短信簽名' ); $text = '【' .$qianm. '】' .$text. '' ; //發的短信 $where = array( 'num' => 'sms_bnum' ); $where1 = array( 'num' => 'sms_bpwd' ); $user = DB::table( 'option' )->getone($where, 'value' )[ 'value' ]; //短信平臺帳號 $pass = DB::table( 'option' )->getone($where1, 'value' )[ 'value' ]; $pass = md5($pass); //短信平臺密碼 $content=$text; //要發送的短信內容 $phone = $mobiles; //要發送短信的手機號碼 $sendurl = $smsapi. "sms?u=" .$user. "&p=" .$pass. "&m=" .$phone. "&c=" .urlencode($content); $result =file_get_contents($sendurl) ; if ($result == 0 ) return returnerror( '發送成功' ); if ($result != 0 ) return returnerror( '發送失敗' ); } } |
好了經過以上的添加,短信寶信呼OAV1.9.8系統增加手機驗證就已經安裝成功,可以正常使用了
報備一下短信寶的VIP模板,這樣就可以走短信寶的優質通道了,即便遇到敏感文字我們都不會人工審核,短信內容3~5秒就可送達。
另外:我們已經開發好完整的信呼OAV1.9.8系統短信寶插件,點擊此鏈接 下載及查看安裝流程。
最新更新
電商類
CMS類
微信類