fuint-application/application-service/src/main/java/com/fuint/application/service/sms/SmsPlatformSendSms.java
(开头部分) 3KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
package com.fuint.application.service.sms;
import com.fuint.application.dao.entities.MtSmsSendedLog;
import com.fuint.application.dao.repositories.MtSmsSendedLogRepository;
import com.fuint.base.dao.pagination.PaginationRequest;
import com.fuint.base.dao.pagination.PaginationResponse;
import com.fuint.exception.BusinessCheckException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* 短信平台 - 发送短信
* Created by FSQ
* Contact wx fsq_better
* Site https://www.fuint.cn
*/
@Service
public class SmsPlatformSendSms implements SendSmsInterface {
private static final Logger logger = LoggerFactory.getLogger(SmsPlatformSendSms.class);
@Resource
private SmsPlatformService smsPlatformService;
@Autowired
private MtSmsSendedLogRepository smsSendedLogRepository;
@Autowired
private Environment env;
@Override
public Map<Boolean,List<String>> sendSms(String templateUname, List<String> phones, Map<String, String> contentParams) throws Exception {
logger.info("使用短信平台发送短信.....");
Integer mode = Integer.parseInt(env.getProperty("ALIYUN.SMS.mode"));
if (templateUname != null && !CollectionUtils.isEmpty(phones)) {
Map<Boolean,List<String>> result = new HashMap<>();
try{
if (mode != null && mode.intValue() == 1) {
// 手机号以","分隔拼接
String mobilePhones = phones.stream().collect(Collectors.joining(","));
MessageResInfo res = smsPlatformService.sendMessage(mobilePhones, templateUname, contentParams);
result.put(res.getResult(),phones);
} else {
result.put(Boolean.TRUE,phones);
logger.info("模拟短信平台发送短信.....");
}
} catch (Exception e) {
result.put(Boolean.FALSE,phones);
logger.error("推送至短信平台出错...参数[smscontent={},phones={}]", templateUname, phones);
logger.error(e.getMessage(),e);
}
return result;
后面还有 18 行代码,购买后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。