phpyun人才系統在招聘人才系統中也是佼佼者,最近小編知道了php云人才系統更新到7.0版本了,之前的短信插件也無法使用了,小編也整理了一下,下面帶著大家一起進行新版本的替換。我們使用的短信接口是我們短信寶短信群發平臺的短信接口,我們短信寶短信平臺十分穩定,發送速度快,注冊就送測試短信,推薦大家使用。
1:打開項目:app\template\admin\tool\message\component\messageshow.vue 修改35行左右 新增短信寶相關配置
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
|
<tr> <td> <div class= "TableTite" >短信寶賬號</div> </td> <td> <div class= "TableInpt" > <el-input placeholder= "請輸入短信寶賬號" v-model= "sy_msg_appkey" ></el-input> </div> </td> <td> <div class= "TableShuom" > </span> </div> </td> </tr> <tr> <td> <div class= "TableTite" >短信寶密碼</div> </td> <td> <div class= "TableInpt" > <el-input placeholder= "請輸入短信寶密碼" v-model= "sy_msg_appsecret" ></el-input> </div> </td> <td> <div class= "TableShuom" > <span> </span> </div> </td> </tr> <tr> <td> <div class= "TableTite" >單IP每日最大發送</div> </td> <td> <div class= "TableInpt" > <el-input placeholder= "請輸入內容" v-model= "ip_msgnum" @input= "inputIntNumber($event, 'ip_msgnum')" > <template slot= "append" >條</template> </el-input> </div> </td> <td> <div class= "TableShuom" > <span> </span> </div> </td> </tr> |
2:打開項目:admin\model\tool\messageset.class.php 增加查詢短信接口 大概第8行
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
|
function index_action(){ $msgnum = $businessnum = $khnum = 0; if (!empty($ this ->config[ 'sy_msg_appkey' ]) && !empty($ this ->config[ 'sy_msg_appsecret' ])) { //短信檢測 $url .= '?u=' . $ this ->config[ 'sy_msg_appkey' ] . '&p=' . md5($ this ->config[ 'sy_msg_appsecret' ]); if (extension_loaded( 'curl' )) { $ return = CurlGet($url); } else if (function_exists( 'file_get_contents' )) { $ return = file_get_contents($url); } if ($ return ) { $msgInfo = explode( ',' , $ return ); if (is_array($msgInfo)){ $msgnum = $msgInfo[1]; } unset($ return ); } } if (!empty($ this ->config[ 'sy_kh_appkey' ]) && !empty($ this ->config[ 'sy_kh_appsecret' ])) { //空號檢測 $url .= '?appKey=' . $ this ->config[ 'sy_kh_appkey' ] . '&appSecret=' . $ this ->config[ 'sy_kh_appsecret' ]; if (extension_loaded( 'curl' )) { $ return = CurlGet($url); } else if (function_exists( 'file_get_contents' )) { $ return = file_get_contents($url); } if ($ return ) { $msgInfo = json_decode($ return , true ); if ($msgInfo[ 'code' ] == '200' ) { $khnum = $msgInfo[ 'num' ]; } unset($ return ); } } if (!empty($ this ->config[ 'sy_tyc_appkey' ]) && !empty($ this ->config[ 'sy_tyc_appsecret' ])) { //天眼查檢測 $url .= '?appKey=' . $ this ->config[ 'sy_tyc_appkey' ] . '&appSecret=' . $ this ->config[ 'sy_tyc_appsecret' ]; if (extension_loaded( 'curl' )) { $ return = CurlGet($url); } else if (function_exists( 'file_get_contents' )) { $ return = file_get_contents($url); } if ($ return ) { $msgInfo = json_decode($ return , true ); if ($msgInfo[ 'code' ] == '200' ) { $businessnum = $msgInfo[ 'num' ]; } } } $data = array( 'sy_msg_isopen' => $ this ->config[ 'sy_msg_isopen' ], 'sy_msg_appkey' => $ this ->config[ 'sy_msg_appkey' ], 'sy_msg_appsecret' => $ this ->config[ 'sy_msg_appsecret' ], 'ip_msgnum' => $ this ->config[ 'ip_msgnum' ], 'moblie_msgnum' => $ this ->config[ 'moblie_msgnum' ], 'cert_msgtime' => $ this ->config[ 'cert_msgtime' ], 'moblie_codetime' => $ this ->config[ 'moblie_codetime' ], 'sy_kh_isopen' => $ this ->config[ 'sy_kh_isopen' ], 'sy_kh_appkey' => $ this ->config[ 'sy_kh_appkey' ], 'sy_kh_appsecret' => $ this ->config[ 'sy_kh_appsecret' ], 'sy_kh_city' => $ this ->config[ 'sy_kh_city' ], 'sy_tyc_appkey' => $ this ->config[ 'sy_tyc_appkey' ], 'sy_tyc_appsecret' => $ this ->config[ 'sy_tyc_appsecret' ], 'rest_msgnum' => $msgnum, 'rest_businessnum' => $businessnum, 'rest_khnum' => $khnum, ); $ this ->render_json(0, 'ok' , $data); } |
3:打開項目:app\model\notice.model.php 修改短信發送函數 大概260行
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
function postSMS($type= 'msgsend' ,$data= '' ){ $sign = $ this ->config[ 'sy_webname' ]; $data[ 'content' ] = str_replace(array( " " , " " , "\t" , "\n" , "\r" ),array( "" , "" , "" , "" , "" ),$data[ 'content' ]); $url.= '?u=' .$data[ 'appkey' ]. '&p=' .md5($data[ 'appsecret' ]). '&m=' .$data[ 'phone' ]. '&c=' . '【' .$sign. '】' .$data[ 'content' ]; if (extension_loaded( 'curl' )){ $file_contents = CurlGet($url); } else if (function_exists( 'file_get_contents' )){ $file_contents = file_get_contents($url); } return [ 'code' =>$file_contents === '0' ? 200 : 501, 'message' =>$file_contents === '0' ? '發送成功' : '發送失敗' ]; } |
經過上面的替換,短信寶的短信平臺已經替換成功了,可以正常使用了。進行測試發送:
報備一下短信寶的VIP模板,這樣就可以走短信寶的優質通道了,即便遇到敏感文字我們都不會人工審核,短信內容3~5秒就可送達。
另外:我們已經開發好完整的phpyun7.0系統短信寶插件,點擊此鏈接?下載及查看安裝流
最新更新
電商類
CMS類
微信類