zoukankan      html  css  js  c++  java
  • atitit 短信验证码的源码实现  .docx

    atitit 短信验证码的源码实现  .docx

     

     

    参考 Atitit usrQBM1603短信验证码规范1

    主要方法1

    源码实现1

     

     

    参考 Atitit usrQBM1603短信验证码规范

     

     

    主要方法

    Line 27: public class SmsCaptchaService extends CaptchaService {

    Line 36: public static void main(String[] args) {

    Line 49: public static SmsCaptchaService buildAsYuntonsyon() {

    Line 57: public static SmsCaptchaService buildAsSms1xinxi() {

    Line 65: public Object send(String mobile) {

    Line 86: public Object send(String mobile, String content) {

    Line 103: public boolean check(String captcha) throws CapchCheckFailEx {

     

     

    源码实现

     

    package com.attilax.captcha;

     

    import java.util.Set;

     

    import javax.servlet.http.HttpSession;

     

    import com.attilax.captcha.CaptchaService;

    import com.attilax.corePkg.RandomX;

    import com.attilax.json.AtiJson;

    import com.attilax.lang.Global;

    import com.attilax.net.requestImp;

    import com.attilax.secury.AesV2q421;

    import com.attilax.sms.Sms1xinxi;

    import com.attilax.sms.SmsService;

    import com.attilax.sms.SmsServiceYyuntongxunImp;

    import com.attilax.web.sessionImp;

    import com.csmy.my.center.util.RequestUtil;

    import com.google.common.collect.Sets;

    import com.google.inject.Inject;

     

    /**

     * com.attilax.sms.SmsCaptchaService

     *

     * @author Administrator

     *

     */

    public class SmsCaptchaService extends CaptchaService {

    @Inject

    CaptchaService captSvs;

     

    @Inject

    SmsService smsSrv;

    // @Inject

    RandomX rdmx = new RandomX();

     

    public static void main(String[] args) {

    // System.out.println( new SmsCaptchaService().send("18573344543",

    // "xxcontent"));

    requestImp ri=new requestImp();

    sessionImp si=new sessionImp();

    ri.setSession(si);

    Global.req.set(ri);

    SmsCaptchaService SmsCaptchaService1 = SmsCaptchaService.buildAsYuntonsyon();

    //System.out.println(SmsCaptchaService1.send("18867311166" ));;

     SmsCaptchaService1.send("18573344543" );

     

    }

     

    public static SmsCaptchaService buildAsYuntonsyon() {

     

    SmsService smsS = new SmsServiceYyuntongxunImp();

    SmsCaptchaService svs = new SmsCaptchaService();

    svs.smsSrv = smsS;

    return svs;

    }

    public static SmsCaptchaService buildAsSms1xinxi() {

     

    SmsService smsS = new Sms1xinxi();

    SmsCaptchaService svs = new SmsCaptchaService();

    svs.smsSrv = smsS;

    return svs;

    }

    public Object send(String mobile) {

     

     String Capt= super.setCapt();

    Object sendRzt = smsSrv.send(mobile, String.valueOf(Capt));

    return sendRzt;

    }

     

    public Object send(String mobile, String content) {

    int rdm = new RandomX().randomNum(1000, 9999);

     

    content = content.replace("$capt$", String.valueOf(rdm));

    // if(smsSrv==null)

    //Sms1xinxi smsSrv = new Sms1xinxi();

    Object send = smsSrv.send(mobile, content);

    HttpSession session = Global.req.get().getSession();

    Set<String> st = (Set<String>) session.getAttribute("captSet");

    if (st == null)

    st = Sets.newHashSet();

    st.add(String.valueOf(rdm));

    session.setAttribute("captSet", st);

    session.setAttribute("capt", String.valueOf(rdm));

    return send;

    }

     

     

     

    }

    作者:: 绰号:老哇的爪子 ( 全名::Attilax Akbar Al Rapanui 阿提拉克斯 阿克巴 阿尔 拉帕努伊 ) 

    汉字名:艾提拉(艾龙)   EMAIL:1466519819@qq.com

    转载请注明来源: http://www.cnblogs.com/attilax/

    Atiend

     

  • 相关阅读:
    分治算法
    【原创】KFold函数 __init__() got an unexpected keyword argument 'n_folds' or 'n_splits'
    【原创】【Mac】创建可以双击执行Shell脚本文件(类似windows批处理脚本)
    【原创】【Python】随机生成中文姓名
    【原创】【word】两步搞定姓名2个字加空格对齐
    数据结构与算法——冒泡排序及其各种优化变形详解
    CobaltStrike去除流量特征
    Fastjson1.2.24RCE漏洞复现
    Redis奇怪的姿势
    Apache Druid 远程代码执行 CVE-2021-25646 漏洞复现
  • 原文地址:https://www.cnblogs.com/attilax/p/6090847.html
Copyright © 2011-2022 走看看