Commit 7e1e6485 by 冷斌

fix bug

parent df6d4c82
......@@ -248,7 +248,7 @@
/* 发送验证码 -- 容联云 */
function sendCode($mobile,$code, $tempId){
echo 1;die;
$rs = array('code' => 0, 'msg' => '', 'info' => array());
$config = getConfigPri();
......
......@@ -155,6 +155,90 @@ class InviteController extends HomebaseController {
}
}
protected function sendCode($mobile,$code,$tempId){
$rs = array('code' => 0, 'msg' => '', 'info' => array());
$config = getConfigPri();
if(!$config['sendcode_switch']){
$rs['code']=667;
$rs['msg']='123456';
return $rs;
}
try {
require_once dirname(dirname(dirname(__DIR__))) . '/vendor/autoload.php';
/* 必要步骤:
* 实例化一个认证对象,入参需要传入腾讯云账户密钥对 secretId 和 secretKey
* 本示例采用从环境变量读取的方式,需要预先在环境变量中设置这两个值
* 您也可以直接在代码中写入密钥对,但需谨防泄露,不要将代码复制、上传或者分享给他人
* CAM 密钥查询:https://console.cloud.tencent.com/cam/capi */
$cred = new \TencentCloud\Common\Credential("AKIDSffQItBMHwMXTM6LTKvG7phKgqksn6Ax", "f4JHbu3wYv3ycIsEJ8hzCIH4c1FD9zd4");
//$cred = new Credential(getenv("TENCENTCLOUD_SECRET_ID"), getenv("TENCENTCLOUD_SECRET_KEY"));
// 实例化一个 http 选项,可选,无特殊需求时可以跳过
$httpProfile = new \TencentCloud\Common\Profile\HttpProfile();
$httpProfile->setReqMethod("GET"); // POST 请求(默认为 POST 请求)
$httpProfile->setReqTimeout(30); // 请求超时时间,单位为秒(默认60秒)
$httpProfile->setEndpoint("sms.tencentcloudapi.com"); // 指定接入地域域名(默认就近接入)
// 实例化一个 client 选项,可选,无特殊需求时可以跳过
$clientProfile = new \TencentCloud\Common\Profile\ClientProfile();
$clientProfile->setSignMethod("TC3-HMAC-SHA256"); // 指定签名算法(默认为 HmacSHA256)
$clientProfile->setHttpProfile($httpProfile);
// 实例化 SMS 的 client 对象,clientProfile 是可选的
$client = new \TencentCloud\Sms\V20190711\SmsClient($cred, "ap-shanghai", $clientProfile);
// 实例化一个 sms 发送短信请求对象,每个接口都会对应一个 request 对象。
$req = new \TencentCloud\Sms\V20190711\Models\SendSmsRequest();
/* 填充请求参数,这里 request 对象的成员变量即对应接口的入参
* 您可以通过官网接口文档或跳转到 request 对象的定义处查看请求参数的定义
* 基本类型的设置:
* 帮助链接:
* 短信控制台: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));
}
catch(\TencentCloud\Common\Exception\TencentCloudSDKException $e) {
$rs['code']=1002;
$rs['msg']=$e->getMessage();
}
return $rs;
}
/* 手机登录 */
/* 手机验证码 */
public function getCode(){
......@@ -195,7 +279,7 @@ class InviteController extends HomebaseController {
$mobile_code = random(6,1);
echo "aaaaa";
//密码可以使用明文密码或使用32位MD5加密
$result = sendCode($mobile,$mobile_code,630425);
$result = $this->sendCode($mobile,$mobile_code,630425);
var_dump($result);
die;
if($result['code']===0){
......
......@@ -2430,8 +2430,6 @@ function sp_delete_physics_img($imglist){
/* 发送验证码 -- 容联云 */
function sendCode($mobile,$code,$tempId){
var_dump($mobile,$code,$tempId);
die;
// $rs = array('code' => 0, 'msg' => '', 'info' => array());
//
// $config = getConfigPri();
......
......@@ -604,7 +604,6 @@
/* 发送验证码 -- 容联云 */
function sendCode($mobile,$code){
echo 2;die;
$rs = array('code' => 0, 'msg' => '', 'info' => array());
$config = getConfigPri();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment