spring boot 整合 云之讯 demo
---恢复内容开始---
package com.zhourong.controller; import org.apache.commons.lang3.RandomStringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate; import com.zhourong.dto.SmsDto;
import com.zhourong.utils.Result;
import com.zhourong.vo.SmsVo; @RestController
@RequestMapping("/sms/")
public class SmsController {
private final String appid = "6d5ea3e7964341058f0cd1b31799eb27";
private final String sid = "b3cf37114ad3e0f61d66d5317306af70";
private final String token = "1a1e13a677e25df8ceadb8dd100d2fd3";
private final String templateid = "413092"; @Autowired
private RestTemplate restTemplate; @RequestMapping("/send")
@ResponseBody
public Result<SmsVo> send() {
String url = "https://open.ucpaas.com/ol/sms/sendsms";
SmsDto sms = new SmsDto();
String code = RandomStringUtils.randomNumeric(4);
sms.setAppid(appid);
sms.setMobile("18821962348");
sms.setSid(sid);
sms.setTemplateid(templateid);
sms.setToken(token);
sms.setParam(code);
ResponseEntity<SmsVo> smsVo = restTemplate.postForEntity(url,sms, SmsVo.class);
return new Result(200,"发送成功",smsVo); }
} 项目结构:

直接用。
---恢复内容结束---
spring boot 整合 云之讯 demo的更多相关文章
- Spring Boot 整合 Fisco Bcos(区块链)
简介 FISCO BCOS是由国内企业主导研发.对外开源.安全可控的企业级金融联盟链底层平台,由金链盟开源工作组协作打造,并于2017年正式对外开源. 目前,成熟的区块链的平台不少,之所以选择FISC ...
- Spring Kafka和Spring Boot整合实现消息发送与消费简单案例
本文主要分享下Spring Boot和Spring Kafka如何配置整合,实现发送和接收来自Spring Kafka的消息. 先前我已经分享了Kafka的基本介绍与集群环境搭建方法.关于Kafka的 ...
- spring boot 整合 百度ueditor富文本
百度的富文本没有提供Java版本的,只给提供了jsp版本,但是呢spring boot 如果是使用内置tomcat启动的话整合jsp是非常困难得,今天小编给大家带来spring boot整合百度富文本 ...
- Spring Boot初识(2)- Spring Boot整合Mybaties
一.本文介绍 首先读这篇文章之前如果没有接触过Spring Boot可以看一下之前的文章,并且读这篇文章还需要你至少能写基本的sql语句.我在写这篇文章之前也想过到底是选择JPA还是Mybaties作 ...
- spring boot整合slf4j-log日志
原文地址:https://blog.csdn.net/u011271894/article/details/75735915 版权声明:本文为博主原创文章,未经博主允许不得转载. https://bl ...
- Spring Boot 整合JDBC 实现后端项目开发
一.前言 二.新建Spring Boot 项目 三.Spring Boot 整合JDBC 与MySQL 交互 3.1 新建数据表skr_user 3.2 Jdbcproject 项目结构如下 3.3 ...
- activeMQ入门+spring boot整合activeMQ
最近想要学习MOM(消息中间件:Message Oriented Middleware),就从比较基础的activeMQ学起,rabbitMQ.zeroMQ.rocketMQ.Kafka等后续再去学习 ...
- Spring Boot 整合 Druid
Spring Boot 整合 Druid 概述 Druid 是阿里巴巴开源平台上的一个项目,整个项目由数据库连接池.插件框架和 SQL 解析器组成.该项目主要是为了扩展 JDBC 的一些限制,可以让程 ...
- RabbitMQ使用及与spring boot整合
1.MQ 消息队列(Message Queue,简称MQ)——应用程序和应用程序之间的通信方法 应用:不同进程Process/线程Thread之间通信 比较流行的中间件: ActiveMQ Rabbi ...
随机推荐
- 枚举转map
import java.util.HashMap; import java.util.Map; public enum PayType { ALIPAY("支付宝扫码", 15), ...
- bootstrap4.0
1.CDN库引用: <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4 ...
- ue4 StringTable
StringTable 用法很简单可以参考 https://blog.csdn.net/u012801153/article/details/80393531 这里只说说上面文章中没提到的小技巧 T ...
- 为s5pv210烧录镜像
1.使用九鼎提供的工具,在sd卡中烧录uboot 2.重启开发板,进入uboot命令行, fdisk -c 0 fastboot 3.电脑安装fastboot驱动 fastboot烧录镜像
- mysql入门学习笔记
MySQL的登陆和退出 mysql -u 用户名 -p 密码 #登陆 quit #退出(exit or \q) 具体参数: 参数 描述 -D,--database=name 打开指定数据库 -deli ...
- 【TensorFlow】tfdbg调试注意事项
按照网上的帖子开启tfdbg调试,可能因为没有安装curses和pyreadline包导致失败. 运行 python test001.py --debug 报错: ModuleNotFoundErro ...
- Javascript 使用postMessage对iframe跨域传值或通信
实现目标:两个网站页面实现跨域相互通信 当前例子依赖于 jQuery 3.0 父页面代码:www.a.com/a.html <iframe id="myIframe" src ...
- centos7 时间自动同步
设置开机自动同步Internet时间,并作定时同步任务1.修改时区 rm -rf /etc/localtime ln -s /usr/share/zoneinfo/Asia/Shanghai /etc ...
- js赋值后,不影响源变量的方法。
以前都没发现这个问题,特记录一下. var productListData={pages:001}; var data=productListData;//这样就会有问题. data=$.extend ...
- install chrome and chrome driver on ubuntu
sudo apt install python-minimal # python 2.7.xsudo apt install python-pip # https://www.ubuntuupdate ...