33 lines
890 B
Java
33 lines
890 B
Java
package com.tiesheng.demo.service;
|
|
|
|
import cn.hutool.core.date.DateUtil;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.tiesheng.message.config.aliyun.AliyunSmsHandler;
|
|
import com.tiesheng.message.config.aliyun.AliyunTempParam;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
import java.util.Objects;
|
|
|
|
@Service
|
|
public class DemoSmsHandler implements AliyunSmsHandler {
|
|
|
|
@Override
|
|
public AliyunTempParam handler(JSONObject obj) {
|
|
|
|
String action = obj.getString("action");
|
|
|
|
AliyunTempParam param = new AliyunTempParam();
|
|
param.setSignName("智慧校园");
|
|
|
|
if (Objects.equals(action, "sms-visitor-invite")) {
|
|
param.setTemplateCode("SMS_276125463");
|
|
|
|
JSONObject object = new JSONObject();
|
|
object.put("date", DateUtil.today());
|
|
param.setTemplateParam(object);
|
|
}
|
|
|
|
return param;
|
|
}
|
|
}
|