phpyun人才系統(tǒng)在招聘人才系統(tǒng)中也是佼佼者,最近小編知道了php云人才系統(tǒng)更新到5.0版本了,之前的短信插件也無法使用了,小編也整理了一下,下面帶著大家一起進(jìn)行新版本的替換。我們使用的短信接口是我們短信寶短信群發(fā)平臺的短信接口,我們短信寶短信平臺十分穩(wěn)定,發(fā)送速度快,注冊就送測試短信,推薦大家使用
1:打開項目:app\template\admin\admin_msg_config.htm 在66行新增短信寶頁面
1
2
3
4
5
6
7
8
9
10
11
12
|
<tr class= "admin_table_trbg" > <th width= "200" >短信寶用戶名:</th> <td><input type= "text" class= "input-text tips_class" name= "smsbao_user" id= "smsbao_user" value= "{yun:}$config.smsbao_user{/yun}" size= "50" maxlength= "255" ></td> </tr> <tr class= "admin_table_trbg" > <th width= "200" >短信寶密碼:</th> <td><input type= "password" class= "input-text tips_class" name= "smsbao_pass" id= "smsbao_pass" value= "{yun:}$config.smsbao_pass{/yun}" size= "50" maxlength= "255" ></td> </tr> <tr class= "admin_table_trbg" > <th width= "200" >短信寶簽名:</th> <td><input type= "text" class= "input-text tips_class" name= "smsbao_sign" id= "smsbao_sign" value= "{yun:}$config.smsbao_sign{/yun}" size= "50" maxlength= "255" ></td> </tr> |
2:打開項目:app\model\notice.model.php 修改sendSMS和postSMS方法
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
|
private function postSMS($type= "msgsend" ,$data= '' ){ $data[ 'content' ] = str_replace(array( " " , " " , "\t" , "\n" , "\r" ),array( "" , "" , "" , "" , "" ),$data[ 'content' ]); $url.= '?u=' .$data[ 'uid' ]. '&p=' .md5($data[ 'pwd' ]). '&m=' .$data[ 'mobile' ]. '&c=【' .$data[ 'key' ]. '】' .$data[ 'content' ]; if (function_exists( 'file_get_contents' )){ $file_contents = 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); $file_contents = curl_exec($ch); curl_close($ch); } return $file_contents; } public function sendSMS($data) { if (!$ this ->config[ "sy_msguser" ] || !$ this ->config[ "sy_msgpw" ] || !$ this ->config[ "sy_msgkey" ]||$ this ->config[ 'sy_msg_isopen' ]!= '1' ){ return array( 'status' => -1, 'msg' => "還沒有配置短信,請聯(lián)系管理員!" ); } $data[ 'mobile' ] = $data[ 'moblie' ] ? $data[ 'moblie' ] : $data[ 'mobile' ]; if ($ this ->_isKey( 'mobile' , $data) == fasle || CheckMoblie($data[ 'mobile' ]) == false ){ return array( 'status' => -1, 'msg' => '手機號錯誤' ); } if ($ this ->_isKey( 'content' , $data) == fasle || $data[ 'content' ] == "" ){ return array( 'status' => -1, 'msg' => '短信內(nèi)容為空' ); } $msguser=$ this ->config[ "smsbao_user" ]; $msgpw= $ this ->config[ "smsbao_pass" ]; $msgkey=$ this ->config[ "smsbao_sign" ]; $time = $data[ 'time' ] ? $data[ 'time' ] : '' ; $mid = $data[ 'mid' ] ? $data[ 'mid' ] : '' ; $row = array( 'uid' =>$msguser, 'pwd' =>$msgpw, 'key' =>$msgkey, 'mobile' =>$data[ 'mobile' ], 'content' =>$data[ 'content' ], 'time' =>$time, 'mid' =>$mid ); $re= $ this ->postSMS( "msgsend" ,$row); $sql_data[ "uid" ] = $data[ 'uid' ]; $sql_data[ "name" ] = $data[ 'name' ]; $sql_data[ "cuid" ] = $data[ 'cuid' ]; $sql_data[ 'cname' ] = $data[ 'cname' ] ? $data[ 'cname' ] : '系統(tǒng)' ; $sql_data[ "moblie" ] = $data[ 'mobile' ]; $sql_data[ "ctime" ] = time(); $sql_data[ "content" ] = $data[ 'content' ]; if (trim($re) == '0' ){ include_once( 'warning.model.php' ); $warning = new warning_model($ this ->db,$ this ->def, array( 'uid' =>$ this ->uid, 'username' =>$ this ->username, 'usertype' =>$ this ->usertype)); $warning->warning(5); $sql_data[ 'state' ]= "0" ; $sql_data[ 'ip' ]=fun_ip_get(); $sqlResult = $ this ->insert_into( "moblie_msg" ,$sql_data); return array( 'status' => 1, 'msg' => "發(fā)送成功!" ); } else { $sql_data[ "state" ] = $re; $ this ->insert_into( "moblie_msg" ,$sql_data); include(CONFIG_PATH. "db.data.php" ); if ($arr_data[ 'msgreturn' ][$re]){ return array( 'status' => -1, 'msg' => "發(fā)送失敗!狀態(tài):" .$arr_data[ 'msgreturn' ][$re]); } else { return array( 'status' => -1, 'msg' => "發(fā)送失敗!狀態(tài):" .$re ); } } } |
3:打開項目:admin\model\msgconfig.class.php 在100行新增下代碼
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
function get_restnums_action(){ $user = trim($_POST[ 'smsbao_user' ]); $pass = trim($_POST[ 'smsbao_pass' ]); $url.= '?u=' .$user. '&p=' .md5($pass); if (function_exists( 'file_get_contents' )){ $file_contents = 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); $file_contents = curl_exec($ch); curl_close($ch); } $result = explode( "," , $file_contents); echo $result[ '1' ]; } |
好了經(jīng)過以上的添加,短信寶phpyunV5.0系統(tǒng)增加手機驗證就已經(jīng)安裝成功,可以正常使用了
報備一下短信寶的VIP模板,這樣就可以走短信寶的優(yōu)質(zhì)通道了,即便遇到敏感文字我們都不會人工審核,短信內(nèi)容3~5秒就可送達(dá)。
另外:我們已經(jīng)開發(fā)好完整的phpyunV5.0系統(tǒng)短信寶插件,點擊此鏈接 下載及查看安裝流程。
最新更新
電商類
CMS類
微信類