日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

spring boot 整合 云之讯 demo

發布時間:2023/12/20 编程问答 45 豆豆
生活随笔 收集整理的這篇文章主要介紹了 spring boot 整合 云之讯 demo 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
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";@Autowiredprivate RestTemplate restTemplate;@RequestMapping("/send")@ResponseBodypublic 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);} }

項目結構:

?

?

直接用。

git:https://gitee.com/xxoo0_297/SMS.git

?

---恢復內容結束---

posted on 2018-12-21 22:55 zhouixi 閱讀(...) 評論(...) 編輯 收藏

轉載于:https://www.cnblogs.com/1-Admin/p/10159423.html

總結

以上是生活随笔為你收集整理的spring boot 整合 云之讯 demo的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。