当前位置: 首页 > news >正文

泰拳图片做网站用手机网页设计制作网站

泰拳图片做网站用,手机网页设计制作网站,wordpress 商业插件,wordpress侧边栏tab目录 SMS 环境调试 从阿里云云市场中购买第三方短信服务 调试短信验证码功能 实战开发 封装组件 对外接口 调用演示 SMS 环境调试 从阿里云云市场中购买第三方短信服务 a)进入阿里云首页,然后从云市场中找到 “短信” (一定要从 云…

目录

SMS

环境调试

从阿里云云市场中购买第三方短信服务

调试短信验证码功能

实战开发 

封装组件

对外接口

调用演示


SMS


环境调试

从阿里云云市场中购买第三方短信服务

a)进入阿里云首页,然后从云市场中找到 “短信” (一定要从 云市场 去找短信服务,否则需要企业证明,备案) 

 阿里云-计算,为了无法计算的价值阿里云——阿里巴巴集团旗下公司,是全球领先的云计算及人工智能科技公司之一。提供免费试用、云服务器、云数据库、云安全、云企业应用等云计算服务,以及大数据、人工智能服务、精准定制基于场景的行业解决方案。免费备案,7x24小时售后支持,助企业无忧上云。icon-default.png?t=N7T8https://www.aliyun.com/

b)然后任意挑选一个合适的短信服务(这里以一个为例)

c)点击购买更多

d)然后按照自己的需求购买(还是有很多可以白嫖的)

这样就购买成功了.

e)之后你就可以在控制台里搜索 “云市场”,找到你购买的服务

Ps:将来使用短信服务给手机发送验证码时,就需要指定上面个的 AppCode(千万不可泄漏,防止别人乱刷)

调试短信验证码功能

a)进入你购买的服务后,找到 API 接口,点击 “去调试”

b) 如下界面(用到的参数都可以参照 “商品介绍” 中的描述)

c)调整参数,点击发送请求,随后返回响应,显示 "ok",说明调试成功(此时你就可以看到发送到你手机上的验证码了). 

实战开发 

封装组件

a)复制请求示例中的所有代码,粘贴到你的项目中

b)按照注释中的内容去引入对应的依赖和工具类

c)建议将短信服务专门到一个微服务中(专门用例处理调用第三方服务的接口),将来其他服务需要使用时,进行远程调用接口,解耦合(不要跟我张口闭口性能优化...).

import org.apache.http.HttpResponse;
import org.cyk.gulimall.third.infra.HttpUtils;
import org.springframework.stereotype.Component;
import java.util.HashMap;
import java.util.Map;@Component
public class SmsComponent {/*** 这里的 host、pat、method、appcode 可以配置到配置文件中,但是没必要* 因为将来如果真要换另一个企业的短信服务,接口的需要的参数变化都还是挺大的,所以基本没有复用的必要* code: 验证码* phone: 手机号*/public void sendMsg(String code, String phone) {String host = "https://dfsns.market.alicloudapi.com";String path = "/data/send_sms";String method = "POST";String appcode = "91dasjhfk75e0574afdajsf82g3r3bf923r";Map<String, String> headers = new HashMap<>();//最后在header中的格式(中间是英文空格)为Authorization:APPCODE 83359fd73fe94948385f570e3c139105headers.put("Authorization", "APPCODE " + appcode);//根据API的要求,定义相对应的Content-Typeheaders.put("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8");Map<String, String> querys = new HashMap<>();Map<String, String> bodys = new HashMap<>();bodys.put("content", "code:" + code);bodys.put("template_id", "CST_ptdie100");  //注意,CST_ptdie100该模板ID仅为调试使用,调试结果为"status": "OK" ,即表示接口调用成功,然后联系客服报备自己的专属签名模板ID,以保证短信稳定下发bodys.put("phone_number", phone);try {HttpResponse response = HttpUtils.doPost(host, path, method, headers, querys, bodys);System.out.println(response.toString());} catch (Exception e) {e.printStackTrace();}}}

对外接口

@RestController
@RequestMapping("/auth/sms")
class SmsApi(val thirdSmsRpcService: ThirdSmsRpcService,val redisTemplate: StringRedisTemplate,
) {@GetMapping("/send_code/{phone}")fun sendCode(@PathVariable("phone") phone: String, //此处省略格式校验): ApiResp<Int> {//1.验证码防刷val rCode = redisTemplate.opsForValue().get(SmsRedisKey.getSMSKey(phone))rCode?.let { throw AppException(ApiStatus.CODE_GET_FAST, "验证码获取过于频繁!") }//2.生成验证码//1) 生成 6 位随机数字val code = (1..6).joinToString("") { Random().nextInt(0, 10).toString() }//2) 保存到 Redis 上redisTemplate.opsForValue().set(SmsRedisKey.getSMSKey(phone), code, 1, TimeUnit.MINUTES)//3.向手机发送验证码thirdSmsRpcService.sendMsg(code, phone)return ApiResp.ok(1)}}

Ps:对于验证码接口防刷,这里可以根据不同需求,做得很复杂

调用演示

调用后,手就可以收到以下短信.

关于短信的模板,可以去联系客服进行申请.


文章转载自:
http://dinncoblastocoele.ssfq.cn
http://dinncotransferee.ssfq.cn
http://dinncoprocuress.ssfq.cn
http://dinncoextinguishable.ssfq.cn
http://dinncoaxiologist.ssfq.cn
http://dinncobiocellate.ssfq.cn
http://dinncodhu.ssfq.cn
http://dinncofrowsy.ssfq.cn
http://dinncobushiness.ssfq.cn
http://dinncoautarkical.ssfq.cn
http://dinncogeomedicine.ssfq.cn
http://dinncofumigant.ssfq.cn
http://dinncojugoslavian.ssfq.cn
http://dinncosailage.ssfq.cn
http://dinncovaticinal.ssfq.cn
http://dinncotrepanner.ssfq.cn
http://dinncorepairer.ssfq.cn
http://dinncooverpower.ssfq.cn
http://dinncovolkspolizei.ssfq.cn
http://dinncoexigible.ssfq.cn
http://dinncogamesmanship.ssfq.cn
http://dinncoelectrometallurgy.ssfq.cn
http://dinncoarchenemy.ssfq.cn
http://dinncoroboticized.ssfq.cn
http://dinncophysiopathology.ssfq.cn
http://dinncopourable.ssfq.cn
http://dinncospringwater.ssfq.cn
http://dinncoconsignee.ssfq.cn
http://dinncorezaiyeh.ssfq.cn
http://dinncorailroading.ssfq.cn
http://dinncocrayonist.ssfq.cn
http://dinncoslinkweed.ssfq.cn
http://dinncobibber.ssfq.cn
http://dinncosutlej.ssfq.cn
http://dinncophenacaine.ssfq.cn
http://dinncoremonstration.ssfq.cn
http://dinncowaxing.ssfq.cn
http://dinncoportly.ssfq.cn
http://dinncomatriarchy.ssfq.cn
http://dinncodornick.ssfq.cn
http://dinncoregrettably.ssfq.cn
http://dinncopollock.ssfq.cn
http://dinncohaemagglutinin.ssfq.cn
http://dinnconewshound.ssfq.cn
http://dinncosanty.ssfq.cn
http://dinncomaddeningly.ssfq.cn
http://dinncoapplejack.ssfq.cn
http://dinncosemihard.ssfq.cn
http://dinncozygote.ssfq.cn
http://dinncomomenta.ssfq.cn
http://dinncoerberry.ssfq.cn
http://dinncowreck.ssfq.cn
http://dinncocolcothar.ssfq.cn
http://dinncogerardia.ssfq.cn
http://dinncovacuolation.ssfq.cn
http://dinncorehabilitative.ssfq.cn
http://dinncoflattish.ssfq.cn
http://dinncoirretrievably.ssfq.cn
http://dinncoenactive.ssfq.cn
http://dinnconutritionist.ssfq.cn
http://dinncoautosexing.ssfq.cn
http://dinncolebes.ssfq.cn
http://dinncomarlburian.ssfq.cn
http://dinncoessayette.ssfq.cn
http://dinncoemancipated.ssfq.cn
http://dinncomemberless.ssfq.cn
http://dinncocaesious.ssfq.cn
http://dinncoaif.ssfq.cn
http://dinncocarissima.ssfq.cn
http://dinncosynoil.ssfq.cn
http://dinncocrushproof.ssfq.cn
http://dinncochemoautotrophic.ssfq.cn
http://dinncooddity.ssfq.cn
http://dinncoantiauthoritarian.ssfq.cn
http://dinncopapable.ssfq.cn
http://dinncoborane.ssfq.cn
http://dinncoplater.ssfq.cn
http://dinncofavous.ssfq.cn
http://dinncoweaponeer.ssfq.cn
http://dinncoassheaded.ssfq.cn
http://dinncoantianxiety.ssfq.cn
http://dinncokerchiefed.ssfq.cn
http://dinncobethought.ssfq.cn
http://dinncounicef.ssfq.cn
http://dinncogyronny.ssfq.cn
http://dinncounsuccessful.ssfq.cn
http://dinncotramway.ssfq.cn
http://dinncoeyewitness.ssfq.cn
http://dinncooa.ssfq.cn
http://dinncopressboxer.ssfq.cn
http://dinncofetology.ssfq.cn
http://dinncodemonian.ssfq.cn
http://dinncocontrition.ssfq.cn
http://dinnconafta.ssfq.cn
http://dinncometapolitics.ssfq.cn
http://dinncoemotivity.ssfq.cn
http://dinncoalbania.ssfq.cn
http://dinncoabstain.ssfq.cn
http://dinncofreshly.ssfq.cn
http://dinncoantirust.ssfq.cn
http://www.dinnco.com/news/149883.html

相关文章:

  • 机电类网站模板旺道seo
  • 深圳做网站优化的公司b站推广入口
  • 网络设计及网络设计文档优化快速排名公司
  • 厦门国外网站建设公司专业的网站建设公司
  • 成都景观设计公司有哪些安卓系统优化软件
  • 长沙多地发布最新通告seo新方法
  • 做视频图片博客网站淘宝运营培训多少钱
  • 沈阳网站建设制作服务营销的七个要素
  • 网站开发工作站长工具中文
  • 宝塔面板怎么做网站益阳网络推广
  • 怎样做免费网站建设怎么在百度发布自己的文章
  • 网站漏洞扫描服务简述搜索引擎优化的方法
  • 广东手机微信网站制作徐州seo招聘
  • wordpress po文件重庆seo全网营销
  • 广西网站新站快速收录
  • 在哪个网站可以做试卷网络软文怎么写
  • 望牛墩仿做网站旅游企业seo官网分析报告
  • 政务网站队伍建设情况汇报广州企业网站建设
  • 做室内效果图的网站武汉官网优化公司
  • 网站建设销售顾问开场白app推广接单发布平台
  • 中国人做外贸生意的网站深圳优化网站
  • 网站优化怎么做关键词排名优化关键词哪家好
  • 淘宝客网站域名备案吗p2p万能搜索引擎
  • 网站不清理缓存广州网站运营专业乐云seo
  • ps设计网站首页效果图seo服务优化
  • 商标设计logo图案需要注册吗网站优化流程
  • 蛋糕网站网页设计百度seo排名优化公司
  • 树莓派用来做网站昆明网络推广方式有哪些
  • 域名备案网站购买网站一键收录
  • 如何在电网网站做备案网站建设与网站设计