短信
This commit is contained in:
@ -53,7 +53,7 @@ public class SmsController {
|
|||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
@GetMapping("/send")
|
@GetMapping("/send")
|
||||||
public SmsSendResponseDTO sendSms(@RequestParam String[] mobiles, @RequestParam String templateId, @RequestParam String[] datas) {
|
public BaseResponse<SmsSendResponseDTO.TemplateSMS> sendSms(@RequestParam String[] mobiles, @RequestParam String templateId, @RequestParam String[] datas) {
|
||||||
// String[] datas = new String[]{"测试内容"}; // 模板参数
|
// String[] datas = new String[]{"测试内容"}; // 模板参数
|
||||||
// return smsService.sendTemplateSms(
|
// return smsService.sendTemplateSms(
|
||||||
// "18686879363", // 接收手机号
|
// "18686879363", // 接收手机号
|
||||||
@ -64,12 +64,17 @@ public class SmsController {
|
|||||||
// );
|
// );
|
||||||
// 字符串数组转逗号拼接字符串
|
// 字符串数组转逗号拼接字符串
|
||||||
String mobileStr = String.join(",", mobiles);
|
String mobileStr = String.join(",", mobiles);
|
||||||
return smsService.sendTemplateSms(
|
SmsSendResponseDTO smsSendResponseDTO = smsService.sendTemplateSms(
|
||||||
mobileStr, // 接收手机号
|
mobileStr, // 接收手机号
|
||||||
templateId, // 模板ID
|
templateId, // 模板ID
|
||||||
datas, // 模板参数
|
datas, // 模板参数
|
||||||
null, // 子扩展码
|
null, // 子扩展码
|
||||||
null // 自定义消息ID
|
null // 自定义消息ID
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if (!SMS_SUCCESS_CODE.equals(smsSendResponseDTO.getStatusCode())) {
|
||||||
|
return BaseResponse.fail(SMS_ERRER_DESC + smsSendResponseDTO.getStatusCode() + SmsErrorEnum.getMessageByCode(smsSendResponseDTO.getStatusCode()), smsSendResponseDTO.getTemplateSMS());
|
||||||
|
}
|
||||||
|
return BaseResponse.success(smsSendResponseDTO.getTemplateSMS());
|
||||||
}
|
}
|
||||||
}
|
}
|
Reference in New Issue
Block a user