src/main/java/com/sulei/util/sms/SimpleSmsSender.java
(完整代码) 1KB/**
*
*/
package com.sulei.util.sms;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import org.springframework.stereotype.Component;
import java.util.HashMap;
import java.util.Map;
/**
* 短信
*/
@Slf4j
@Component
public class SimpleSmsSender {
@Autowired
private ThreadPoolTaskExecutor threadPoolTaskExecutor;
public boolean send(String action, String userid, String account, String password, String mobile, String msgContent) {
try {
Map<String, String> params = new HashMap<String, String>();
params.put("action", action);
params.put("userid", userid);
params.put("account", account);
params.put("password", password);
params.put("mobile", mobile);
params.put("content", msgContent);
RunnableSms runnable = new RunnableSms("http://sms.37037.com/sms.aspx", params);
this.threadPoolTaskExecutor.execute(runnable);
log.info("发送短信成功:" + mobile);
} catch (Exception e) {
log.error("发送短信失败", e);
return false;
}
return true;
}
}
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。
