定义短信回调的结果
parent
0d0110ec08
commit
c91833a504
@ -1,16 +0,0 @@
|
||||
package cn.iocoder.dashboard.framework.sms.core.enums;
|
||||
|
||||
/**
|
||||
* 短信相关常量类
|
||||
*
|
||||
* @author zzf
|
||||
* @date 2021/3/5 10:42
|
||||
*/
|
||||
public interface SmsConstants {
|
||||
|
||||
|
||||
String COMMA = ",";
|
||||
|
||||
String SUCCESS = "SUCCESS";
|
||||
|
||||
}
|
||||
@ -0,0 +1,34 @@
|
||||
package cn.iocoder.dashboard.modules.system.controller.sms;
|
||||
|
||||
import cn.hutool.core.util.URLUtil;
|
||||
import cn.iocoder.dashboard.common.pojo.CommonResult;
|
||||
import cn.iocoder.dashboard.framework.sms.core.enums.SmsChannelEnum;
|
||||
import cn.iocoder.dashboard.modules.system.service.sms.SysSmsService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
@Api(tags = "短信回调")
|
||||
@RestController
|
||||
@RequestMapping("/system/sms/callback")
|
||||
public class SmsCallbackController {
|
||||
|
||||
@Resource
|
||||
private SysSmsService smsService;
|
||||
|
||||
@PostMapping("/sms/yunpian")
|
||||
@ApiOperation(value = "云片短信的回调", notes = "参见 https://www.yunpian.com/official/document/sms/zh_cn/domestic_push_report 文档")
|
||||
@ApiImplicitParam(name = "sms_status", value = "发送状态", required = true, example = "[{具体内容}]", dataTypeClass = Long.class)
|
||||
public CommonResult<Boolean> receiveYunpianSmsStatus(@RequestParam("sms_status") String smsStatus) throws Throwable {
|
||||
String text = URLUtil.decode(smsStatus); // decode 解码参数,因为它被 encode
|
||||
smsService.receiveSmsStatus(SmsChannelEnum.YUN_PIAN.getCode(), text);
|
||||
return CommonResult.success(true);
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,48 +0,0 @@
|
||||
package cn.iocoder.dashboard.modules.system.controller.sms;
|
||||
|
||||
import cn.iocoder.dashboard.modules.system.service.sms.SysSmsService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.ServletRequest;
|
||||
|
||||
/**
|
||||
* 短信默认回调接口
|
||||
*
|
||||
* @author zzf
|
||||
* @date 2021/3/5 8:59
|
||||
*/
|
||||
@Api(tags = "短信回调api")
|
||||
@RestController
|
||||
@RequestMapping("/sms/callback")
|
||||
public class SmsDefaultCallbackController {
|
||||
|
||||
@Resource
|
||||
private SysSmsService smsService;
|
||||
|
||||
|
||||
@ApiOperation(value = "短信发送回调接口")
|
||||
@PostMapping("/sms-send")
|
||||
public Object sendSmsCallback(ServletRequest request) {
|
||||
return smsService.smsSendCallbackHandle(request);
|
||||
}
|
||||
|
||||
/*
|
||||
@Resource
|
||||
private SmsSendStreamProducer smsSendStreamProducer;
|
||||
|
||||
@ApiOperation("redis stream测试")
|
||||
@GetMapping("/test/redis/stream")
|
||||
public void test() {
|
||||
SmsBody smsBody = new SmsBody();
|
||||
smsBody.setSmsLogId(1L);
|
||||
smsBody.setTemplateCode("sdf");
|
||||
smsBody.setTemplateContent("sdf");
|
||||
smsSendStreamProducer.sendSmsSendMessage(smsBody, "18216466755");
|
||||
}*/
|
||||
|
||||
}
|
||||
Loading…
Reference in New Issue