发送短信验证码 @param platformUserId 平台用户Id @param countryCode 区号 国外号码含有+号,国内号码为空 @param mobile 手机号 @param code 验证码 @return
(String platformUserId,String countryCode,String mobile,String code)
| 85 | * @return |
| 86 | */ |
| 87 | public String sendSms_code(String platformUserId,String countryCode,String mobile,String code){ |
| 88 | String errorInfo = null; |
| 89 | SystemSetting systemSetting = settingRepository.findSystemSetting_cache(); |
| 90 | if(systemSetting.getUserSentSmsCount() != null && systemSetting.getUserSentSmsCount() >0){ |
| 91 | int count = smsCacheManager.addSentSmsCount(platformUserId, 0);//先查询发送次数 |
| 92 | if(count >= systemSetting.getUserSentSmsCount()){ |
| 93 | errorInfo = "超出每用户每24小时内发送短信限制次数"; |
| 94 | } |
| 95 | } |
| 96 | if(errorInfo == null){//如果没有错误 |
| 97 | SmsInterface smsInterface = smsRepository.findEnableInterface_cache(); |
| 98 | if(smsInterface != null){ |
| 99 | if(smsInterface.getInterfaceProduct().equals(1)){//1.阿里大于 |
| 100 | String accessKeyId=null; |
| 101 | String accessKeySecret=null; |
| 102 | //阿里云国内短信签名 |
| 103 | String aliyun_signName=null; |
| 104 | //阿里云国内短信模板代码 |
| 105 | String aliyun_templateCode=null; |
| 106 | //阿里云国际短信签名 |
| 107 | String aliyun_internationalSignName=null; |
| 108 | //阿里云国际短信模板代码 |
| 109 | String aliyun_internationalTemplateCode=null; |
| 110 | |
| 111 | Integer serviceId = null; |
| 112 | |
| 113 | if(smsInterface.getDynamicParameter() != null && !smsInterface.getDynamicParameter().trim().isEmpty()){ |
| 114 | Alidayu alidayu = jsonComponent.toObject(smsInterface.getDynamicParameter(), Alidayu.class); |
| 115 | if(alidayu != null){ |
| 116 | accessKeyId = alidayu.getAccessKeyId(); |
| 117 | accessKeySecret=alidayu.getAccessKeySecret(); |
| 118 | } |
| 119 | |
| 120 | |
| 121 | } |
| 122 | if(smsInterface.getSendService() != null && !smsInterface.getSendService().trim().isEmpty()){ |
| 123 | List<SendService> _sendServiceList = jsonComponent.toGenericObject(smsInterface.getSendService(), new TypeReference< List<SendService> >(){}); |
| 124 | if(_sendServiceList != null && _sendServiceList.size() >0){ |
| 125 | for(SendService _sendService : _sendServiceList){ |
| 126 | if(_sendService.getServiceId().equals(1) && smsInterface.isEnable()){//1.绑定手机服务 |
| 127 | aliyun_signName = _sendService.getAlidayu_signName(); |
| 128 | aliyun_templateCode = _sendService.getAlidayu_templateCode(); |
| 129 | aliyun_internationalSignName = _sendService.getAlidayu_internationalSignName(); |
| 130 | aliyun_internationalTemplateCode = _sendService.getAlidayu_internationalTemplateCode(); |
| 131 | |
| 132 | serviceId = _sendService.getServiceId(); |
| 133 | } |
| 134 | } |
| 135 | } |
| 136 | } |
| 137 | |
| 138 | if(accessKeyId == null || accessKeyId.isEmpty()){ |
| 139 | errorInfo = "请配置用户密钥"; |
| 140 | } |
| 141 | if(accessKeySecret == null || accessKeySecret.isEmpty()){ |
| 142 | errorInfo = "请配置用户密钥"; |
| 143 | } |
| 144 | if(countryCode == null || countryCode.trim().isEmpty()){//国内 |
no test coverage detected