Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
tl_estate
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
hujun
tl_estate
Commits
6aa85d59
Commit
6aa85d59
authored
Dec 06, 2017
by
hujun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add ronglianyun
parent
88945735
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
78 additions
and
0 deletions
+78
-0
RongLianYun.php
application/api/untils/RongLianYun.php
+78
-0
No files found.
application/api/untils/RongLianYun.php
0 → 100644
View file @
6aa85d59
<?php
/**
* Created by NetBeans.
* User : hj
* Date : 2017.12.6
* Time : 16:14
* Intro:
*/
namespace
app\api\untils
;
class
RongLianYun
{
protected
$accountSid
;
protected
$accountToken
;
protected
$appId
;
//应用appid,第三方注册时分配
protected
$serverIP
;
protected
$serverPort
;
protected
$softVersion
;
public
function
__construct
(
$data_arr
)
{
$this
->
accountSid
=
$data
[
'accountSid'
];
$this
->
accountToken
=
$data
[
'accountToken'
];
$this
->
appId
=
$data
[
'appId'
];
$this
->
serverIP
=
$data
[
'serverIP'
];
$this
->
serverPort
=
$data
[
'serverPort'
];
$this
->
softVersion
=
$data
[
'softVersion'
];
}
/**
* 短信验证码
* qin 2017-05-03
* @param $to
* @param $datas
* @param string $tempId
* @return SimpleXMLElement[]
*/
function
sendTemplateSMS
(
$to
,
$datas
,
$tempId
=
'79972'
)
{
header
(
'Access-Control-Allow-Origin:*'
);
$this
->
layout
=
""
;
$this
->
autoRender
=
false
;
$accountSid
=
'8a48b55153eae51101540e763d3b3888'
;
$accountToken
=
'26b220de299d4a56a6f54dd5792a30e4'
;
$appId
=
'8a48b55153eae51101540e77d1603891'
;
$serverIP
=
'app.cloopen.com'
;
$serverPort
=
'8883'
;
$softVersion
=
'2013-12-26'
;
// 初始化REST SDK
//global $accountSid, $accountToken, $appId, $serverIP, $serverPort, $softVersion;
$rest
=
new
REST
(
$serverIP
,
$serverPort
,
$softVersion
);
$rest
->
setAccount
(
$accountSid
,
$accountToken
);
$rest
->
setAppId
(
$appId
);
// 发送模板短信
$this
->
log
(
"Sending TemplateSMS to
$to
"
);
$result
=
$rest
->
sendTemplateSMS
(
$to
,
$datas
,
$tempId
);
if
(
$result
==
NULL
)
{
$this
->
log
(
"result error!"
);
//exit;
}
if
(
$result
->
statusCode
!=
0
)
{
$this
->
log
(
"error code :"
.
$result
->
statusCode
.
""
);
$this
->
log
(
"error msg :"
.
$result
->
statusMsg
.
""
);
//TODO 添加错误处理逻辑
return
$result
->
statusCode
;
}
else
{
$this
->
log
(
"Sendind TemplateSMS success!"
);
// 获取返回信息
$smsmessage
=
$result
->
TemplateSMS
;
$this
->
log
(
"dateCreated:"
.
$smsmessage
->
dateCreated
.
""
);
$this
->
log
(
"smsMessageSid:"
.
$smsmessage
->
smsMessageSid
.
""
);
//TODO 添加成功处理逻辑
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment