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

上一篇:oraclejdbc


下一篇:Atitit. 破解  拦截 绕过 网站 手机 短信 验证码  方式 v2 attilax 总结