| | |
| | | package com.java110.core.factory; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.java110.dto.smsConfig.SmsConfigDto; |
| | | import com.java110.dto.sms.SmsConfigDto; |
| | | import com.java110.utils.cache.MappingCache; |
| | | import com.java110.vo.ResultVo; |
| | | import com.tencentcloudapi.common.Credential; |
| | |
| | | import com.tencentcloudapi.sms.v20190711.models.SendSmsRequest; |
| | | import com.tencentcloudapi.sms.v20190711.models.SendSmsResponse; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import com.java110.core.log.LoggerFactory; |
| | | import org.springframework.http.HttpStatus; |
| | | import org.springframework.http.ResponseEntity; |
| | | |
| | | import java.util.Random; |
| | | /* |
| | |
| | | sendSmsRequest.setTemplateParamSet(templateParam); |
| | | sendSmsRequest.setSign(MappingCache.getValue(TENCENT_SMS_DOMAIN, "Sign")); //签名内容,不是填签名id,见《创建短信签名和模版》小节 |
| | | SendSmsResponse sendSmsResponse = null; |
| | | String errMsg= "发送短信失败:"; |
| | | try { |
| | | sendSmsResponse = smsClient.SendSms(sendSmsRequest); //发送短信 |
| | | } catch (TencentCloudSDKException e) { |
| | | logger.error("发送短信失败", e); |
| | | errMsg = e.getMessage(); |
| | | } |
| | | |
| | | logger.debug("腾讯短信验证码发送,请求报文" + JSONObject.toJSONString(sendSmsRequest) + ",返回日志" + (sendSmsResponse != null ? JSONObject.toJSONString(sendSmsResponse) : "")); |
| | | LogFactory.saveOutLog("SMS", JSONObject.toJSONString(sendSmsRequest), new ResponseEntity((sendSmsResponse != null ? JSONObject.toJSONString(sendSmsResponse) : errMsg), HttpStatus.OK)); |
| | | |
| | | |
| | | } |