<%@ page language="java" import="java.util.regex.Pattern,com.letousky.lottery.action.UserRegisteredAction,java.util.*,com.letousky.lottery.action.MemberCenter,com.letousky.exception.LotteryException" pageEncoding="UTF-8"%>
<%
	
	String[] params = new String[4];
	params[0] = request.getParameter("lotName");
	params[1] =request.getParameter("userNikeName");
	params[2] =request.getParameter("canyuNikeName");
	params[3] =request.getParameter("message");
	
	//查找用户是否存在
	 boolean b = Pattern.matches("[\\u4E00-\\u9FA5]+", params[2]);
	 boolean b1 = Pattern.matches("[\\u4E00-\\u9FA5]+", params[1]);
     if(!b){
	     params[2]=new String(params[2].getBytes("ISO-8859-1"), "utf-8");//解决乱码用的
     }
     if(!b1){
    	   params[1]=new String(params[1].getBytes("ISO-8859-1"), "utf-8");//解决乱码用的
     }
     
	String[] param = new String[]{params[2]};
	
	try{
	    String str=new UserRegisteredAction().checkUser(param);
		String[] result=new MemberCenter().taryAddSingleUser(params);//返回0表示用户不存在
		//out.print("{\"result\":\"0000\"}");
		out.print("{\"result\":\""+str+"\"}");
	}catch(LotteryException e){
		
		out.print("{\"result\":\""+e.getMessage()+"\"}");
	}
%>