Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
quxiu
Overview
Overview
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
冷斌
quxiu
Commits
53479b99
Commit
53479b99
authored
Jun 12, 2020
by
冷斌
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix bug
parent
fd50520a
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
123 additions
and
42 deletions
+123
-42
application/Common/Common/function.php
+123
-42
No files found.
application/Common/Common/function.php
View file @
53479b99
...
@@ -2430,6 +2430,64 @@ function sp_delete_physics_img($imglist){
...
@@ -2430,6 +2430,64 @@ function sp_delete_physics_img($imglist){
/* 发送验证码 -- 容联云 */
/* 发送验证码 -- 容联云 */
function
sendCode
(
$mobile
,
$code
){
function
sendCode
(
$mobile
,
$code
){
// $rs = array('code' => 0, 'msg' => '', 'info' => array());
//
// $config = getConfigPri();
//
// if(!$config['sendcode_switch']){
// $rs['code']=667;
// $rs['msg']='123456';
// return $rs;
// }
//
// require_once SITE_PATH.'sdk/ronglianyun/CCPRestSDK.php';
//
// //主帐号
// $accountSid= $config['ccp_sid'];
// //主帐号Token
// $accountToken= $config['ccp_token'];
// //应用Id
// $appId=$config['ccp_appid'];
// //请求地址,格式如下,不需要写https://
// $serverIP='app.cloopen.com';
// //请求端口
// $serverPort='8883';
// //REST版本号
// $softVersion='2013-12-26';
//
// $tempId=$config['ccp_tempid'];
//
// file_put_contents(SITE_PATH.'data/sendCode_ccp_'.date('Y-m-d').'.txt',date('Y-m-d H:i:s').' 提交参数信息 post_data: accountSid:'.$accountSid.";accountToken:{$accountToken};appId:{$appId};tempId:{$tempId}\r\n",FILE_APPEND);
//
// $rest = new \REST($serverIP,$serverPort,$softVersion);
// $rest->setAccount($accountSid,$accountToken);
// $rest->setAppId($appId);
//
// $datas=[];
// $datas[]=$code;
//
// $result = $rest->sendTemplateSMS($mobile,$datas,$tempId);
// file_put_contents(SITE_PATH.'data/sendCode_ccp_'.date('Y-m-d').'.txt',date('Y-m-d H:i:s').' 提交参数信息 result:'.json_encode($result)."\r\n",FILE_APPEND);
//
// if($result == NULL ) {
// $rs['code']=1002;
// $rs['msg']="获取失败";
// return $rs;
// }
// if($result->statusCode!=0) {
// //echo "error code :" . $result->statusCode . "<br>";
// //echo "error msg :" . $result->statusMsg . "<br>";
// //TODO 添加错误处理逻辑
// $rs['code']=1002;
// //$rs['msg']=$gets['SubmitResult']['msg'];
// $rs['msg']="获取失败";
// return $rs;
// }
// $content=$code;
// setSendcode(array('type'=>'1','account'=>$mobile,'content'=>$content));
//
// return $rs;
$rs
=
array
(
'code'
=>
0
,
'msg'
=>
''
,
'info'
=>
array
());
$rs
=
array
(
'code'
=>
0
,
'msg'
=>
''
,
'info'
=>
array
());
$config
=
getConfigPri
();
$config
=
getConfigPri
();
...
@@ -2440,53 +2498,76 @@ function sp_delete_physics_img($imglist){
...
@@ -2440,53 +2498,76 @@ function sp_delete_physics_img($imglist){
return
$rs
;
return
$rs
;
}
}
require_once
SITE_PATH
.
'sdk/ronglianyun/CCPRestSDK.php'
;
try
{
require_once
dirname
(
dirname
(
__DIR__
))
.
'/vendor/autoload.php'
;
//主帐号
/* 必要步骤:
$accountSid
=
$config
[
'ccp_sid'
];
* 实例化一个认证对象,入参需要传入腾讯云账户密钥对 secretId 和 secretKey
//主帐号Token
* 本示例采用从环境变量读取的方式,需要预先在环境变量中设置这两个值
$accountToken
=
$config
[
'ccp_token'
];
* 您也可以直接在代码中写入密钥对,但需谨防泄露,不要将代码复制、上传或者分享给他人
//应用Id
* CAM 密钥查询:https://console.cloud.tencent.com/cam/capi */
$appId
=
$config
[
'ccp_appid'
];
//请求地址,格式如下,不需要写https://
$cred
=
new
\TencentCloud\Common\Credential
(
"AKIDSffQItBMHwMXTM6LTKvG7phKgqksn6Ax"
,
"f4JHbu3wYv3ycIsEJ8hzCIH4c1FD9zd4"
);
$serverIP
=
'app.cloopen.com'
;
//$cred = new Credential(getenv("TENCENTCLOUD_SECRET_ID"), getenv("TENCENTCLOUD_SECRET_KEY"));
//请求端口
$serverPort
=
'8883'
;
// 实例化一个 http 选项,可选,无特殊需求时可以跳过
//REST版本号
$httpProfile
=
new
\TencentCloud\Common\Profile\HttpProfile
();
$softVersion
=
'2013-12-26'
;
$httpProfile
->
setReqMethod
(
"GET"
);
// POST 请求(默认为 POST 请求)
$httpProfile
->
setReqTimeout
(
30
);
// 请求超时时间,单位为秒(默认60秒)
$tempId
=
$config
[
'ccp_tempid'
];
$httpProfile
->
setEndpoint
(
"sms.tencentcloudapi.com"
);
// 指定接入地域域名(默认就近接入)
file_put_contents
(
SITE_PATH
.
'data/sendCode_ccp_'
.
date
(
'Y-m-d'
)
.
'.txt'
,
date
(
'Y-m-d H:i:s'
)
.
' 提交参数信息 post_data: accountSid:'
.
$accountSid
.
";accountToken:
{
$accountToken
}
;appId:
{
$appId
}
;tempId:
{
$tempId
}
\r\n
"
,
FILE_APPEND
);
// 实例化一个 client 选项,可选,无特殊需求时可以跳过
$clientProfile
=
new
\TencentCloud\Common\Profile\ClientProfile
();
$rest
=
new
\REST
(
$serverIP
,
$serverPort
,
$softVersion
);
$clientProfile
->
setSignMethod
(
"TC3-HMAC-SHA256"
);
// 指定签名算法(默认为 HmacSHA256)
$rest
->
setAccount
(
$accountSid
,
$accountToken
);
$clientProfile
->
setHttpProfile
(
$httpProfile
);
$rest
->
setAppId
(
$appId
);
// 实例化 SMS 的 client 对象,clientProfile 是可选的
$datas
=
[];
$client
=
new
\TencentCloud\Sms\V20190711\SmsClient
(
$cred
,
"ap-shanghai"
,
$clientProfile
);
$datas
[]
=
$code
;
// 实例化一个 sms 发送短信请求对象,每个接口都会对应一个 request 对象。
$result
=
$rest
->
sendTemplateSMS
(
$mobile
,
$datas
,
$tempId
);
$req
=
new
\TencentCloud\Sms\V20190711\Models\SendSmsRequest
();
file_put_contents
(
SITE_PATH
.
'data/sendCode_ccp_'
.
date
(
'Y-m-d'
)
.
'.txt'
,
date
(
'Y-m-d H:i:s'
)
.
' 提交参数信息 result:'
.
json_encode
(
$result
)
.
"
\r\n
"
,
FILE_APPEND
);
/* 填充请求参数,这里 request 对象的成员变量即对应接口的入参
if
(
$result
==
NULL
)
{
* 您可以通过官网接口文档或跳转到 request 对象的定义处查看请求参数的定义
$rs
[
'code'
]
=
1002
;
* 基本类型的设置:
$rs
[
'msg'
]
=
"获取失败"
;
* 帮助链接:
return
$rs
;
* 短信控制台:https://console.cloud.tencent.com/smsv2
* sms helper:https://cloud.tencent.com/document/product/382/3773 */
/* 短信应用 ID: 在 [短信控制台] 添加应用后生成的实际 SDKAppID,例如1400006666 */
$req
->
SmsSdkAppid
=
"1400380328"
;
/* 短信签名内容: 使用 UTF-8 编码,必须填写已审核通过的签名,可登录 [短信控制台] 查看签名信息 */
$req
->
Sign
=
"趣秀直播"
;
/* 短信码号扩展号: 默认未开通,如需开通请联系 [sms helper] */
$req
->
ExtendCode
=
"0"
;
/* 下发手机号码,采用 e.164 标准,+[国家或地区码][手机号]
* 例如+8613711112222, 其中前面有一个+号 ,86为国家码,13711112222为手机号,最多不要超过200个手机号*/
$req
->
PhoneNumberSet
=
array
(
"+86"
.
$mobile
);
/* 国际/港澳台短信 senderid: 国内短信填空,默认未开通,如需开通请联系 [sms helper] */
$req
->
SenderId
=
""
;
/* 用户的 session 内容: 可以携带用户侧 ID 等上下文信息,server 会原样返回 */
$req
->
SessionContext
=
""
;
/* 模板 ID: 必须填写已审核通过的模板 ID。可登录 [短信控制台] 查看模板 ID */
$req
->
TemplateID
=
$tempId
;
/* 模板参数: 若无模板参数,则设置为空*/
$req
->
TemplateParamSet
=
array
(
$code
);
// 通过 client 对象调用 SendSms 方法发起请求。注意请求方法名与请求对象是对应的
$resp
=
$client
->
SendSms
(
$req
);
// 输出 JSON 格式的字符串回包
// var_dump($resp->toJsonString());
// 可以取出单个值,您可以通过官网接口文档或跳转到 response 对象的定义处查看返回字段的定义
$content
=
$code
;
setSendcode
(
array
(
'type'
=>
'1'
,
'account'
=>
$mobile
,
'content'
=>
$content
));
}
}
if
(
$result
->
statusCode
!=
0
)
{
catch
(
\TencentCloud\Common\Exception\TencentCloudSDKException
$e
)
{
//echo "error code :" . $result->statusCode . "<br>";
//echo "error msg :" . $result->statusMsg . "<br>";
//TODO 添加错误处理逻辑
$rs
[
'code'
]
=
1002
;
$rs
[
'code'
]
=
1002
;
//$rs['msg']=$gets['SubmitResult']['msg'];
$rs
[
'msg'
]
=
$e
->
getMessage
();
$rs
[
'msg'
]
=
"获取失败"
;
return
$rs
;
}
}
$content
=
$code
;
setSendcode
(
array
(
'type'
=>
'1'
,
'account'
=>
$mobile
,
'content'
=>
$content
));
return
$rs
;
return
$rs
;
}
}
/**导出Excel 表格
/**导出Excel 表格
...
...
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