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
78732a7d
Commit
78732a7d
authored
Dec 06, 2017
by
hujun
Committed by
hujun
Dec 07, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
sms
parent
6aa85d59
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
167 additions
and
78 deletions
+167
-78
User.php
application/api/controller/User.php
+103
-0
Message.php
application/api/untils/Message.php
+64
-0
RongLianYun.php
application/api/untils/RongLianYun.php
+0
-78
No files found.
application/api/controller/User.php
0 → 100644
View file @
78732a7d
<?php
namespace
app\api\controller
;
use
think\Controller
;
use
think\Request
;
use
app\api\extend\Basic
;
use
app\api\untils\Message
;
class
User
extends
Basic
{
public
function
login
(
Request
$request
)
{
$post
=
$request
->
param
();
$phone
=
18521095897
;
$_code
=
mt_rand
(
1000
,
9999
)
.
''
;
$message
=
new
Message
();
$result
=
$message
->
sendCCPSMS
(
$phone
,
array
(
$_code
,
'5'
),
79972
);
if
(
$result
[
'statusCode'
]
==
0
)
{
}
return
$this
->
response
(
$result
[
'statusMsg'
],
$result
[
'statusCode'
],
$_code
);
}
/**
* 显示资源列表
*
* @return \think\Response
*/
public
function
index
()
{
//
}
/**
* 显示创建资源表单页.
*
* @return \think\Response
*/
public
function
create
()
{
//
}
/**
* 保存新建的资源
*
* @param \think\Request $request
* @return \think\Response
*/
public
function
save
(
Request
$request
)
{
//
}
/**
* 显示指定的资源
*
* @param int $id
* @return \think\Response
*/
public
function
read
(
$id
)
{
//
}
/**
* 显示编辑资源表单页.
*
* @param int $id
* @return \think\Response
*/
public
function
edit
(
$id
)
{
//
}
/**
* 保存更新的资源
*
* @param \think\Request $request
* @param int $id
* @return \think\Response
*/
public
function
update
(
Request
$request
,
$id
)
{
//
}
/**
* 删除指定资源
*
* @param int $id
* @return \think\Response
*/
public
function
delete
(
$id
)
{
//
}
}
application/api/untils/Message.php
0 → 100644
View file @
78732a7d
<?php
/**
* Created by NetBeans.
* User : hj
* Date : 2017.12.6
* Time : 16:14
* Intro:
*/
namespace
app\api\untils
;
class
Message
{
public
function
__construct
()
{
}
/**
* 短信验证码
* 容云通讯
*
* @param $to
* @param $datas
* @param string $tempId
* @return SimpleXMLElement[]
*/
public
function
sendCCPSMS
(
$to
,
$datas
,
$tempId
=
'79972'
)
{
import
(
'CCPRestSDK'
,
EXTEND_PATH
,
'.php'
);
$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
);
$result
=
(
array
)
$rest
->
sendTemplateSMS
(
$to
,
$datas
,
$tempId
);
if
(
$result
==
NULL
)
{
$data
[
'statusMsg'
]
=
'短信接口无返回'
;
$data
[
'statusCode'
]
=
-
1
;
}
if
(
$result
[
'statusCode'
]
!=
0
)
{
$data
[
'statusCode'
]
=
$result
[
'statusCode'
];
$data
[
'statusMsg'
]
=
$result
[
'statusMsg'
];
}
else
{
$data
[
'statusCode'
]
=
$result
[
'statusCode'
];
$data
[
'statusMsg'
]
=
$result
[
'statusMsg'
];
$data
[
'TemplateSMS'
]
=
$result
[
'TemplateSMS'
];
$data
[
'dateCreated'
]
=
$result
[
'dateCreated'
];
$data
[
'smsMessageSid'
]
=
$result
[
'smsMessageSid'
];
}
return
$data
;
}
}
application/api/untils/RongLianYun.php
deleted
100644 → 0
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