📄 myqamatchmate.jsp
字号:
<!--
*@目敲霸烙 娄茫扁
*@Author : 弥眠岿 (2008-6-06)
*@Images : 其捞瘤 救俊 甸绢啊绰 捞固瘤
1) bg_01.png - 抛捞喉 弥惑窜 硅版捞固瘤(仟弗祸)
-->
<%@ page import='java.io.*,java.text.*,java.util.Date,java.util.Vector, javax.servlet.http.HttpSession,java.sql.*, com.entaz.lib.db.*, com.entaz.relay.net.*' contentType='text/html;charset=euc-kr'%>
<%@ include file="../imgpath.jsp"%>
<%@ include file="../common_func.jsp"%>
<%@ include file="../makeKOR.jsp"%>
<%
/***********************************************************************
@ Page Description
霸烙 皋牢 其捞瘤
@ Parameter
***********************************************************************/
/*------------------------------------------------------------------------------------------------------
+ 扁夯 颇扼固磐
-------------------------------------------------------------------------------------------------------*/
String mphone= request.getParameter("mphone");
String gphone= request.getParameter("gphone");
String name= java.net.URLDecoder.decode(makeKOR(request.getParameter("name")));
String ox[] = new String[5];
String qa[] = new String[5];
String qidx[]=new String [5];
/*------------------------------------------------------------------------------------------------------
+ 傈开 函荐
-------------------------------------------------------------------------------------------------------*/
long Guest_phone = 0;
int Attention_point = 0;
String nickname = "";
String dianhua = "";
int sex =0;
int year =0;
int nyear =0;
int age =0;
int Match_point = 0;
double answercount =0.0;
int cont1 =0;
double allcont =0.0;
int starAttentionfull =0;
int starAttentionemp = 0;
int starMatchfull =0;
int starMatchemp =0;
double percent =0;
String[] title =new String[5];
String[] quizidx = new String[5];
int flag =0;
int idx = 0;
/*------------------------------------------------------------------------------------------------------
+ DB 包访 函荐
-------------------------------------------------------------------------------------------------------*/
PreparedStatement pstmt = null;
Connection con = null;
Statement stmt = null;
ResultSet rs = null;
String query1 = null;
try
{
/*------------------------------------------------------------------------------------------------
* DB 目池记
-------------------------------------------------------------------------------------------------*/
%><%@ include file="../getConnection.jsp"%><%
/*------------------------------------------------------------------------------------------------
*
-------------------------------------------------------------------------------------------------*/
for(int i=0;i<5;i++)
{
if(request.getParameter("ox"+i)!=null){
ox[i]=request.getParameter("ox"+i);
qa[i] = makeKOR(request.getParameter("qa"+i));
qidx[i] = request.getParameter("qidx"+i);
query1="insert into GT_LUCKY_QUIZ_MYLOG (Quiz_idx,title,answer,phonenum,Guest_phone)"+
"values(?,?,?,?,?)";
pstmt= con.prepareStatement(query1);
pstmt.setInt(1,Integer.parseInt(qidx[i]));
pstmt.setString(2,qa[i]);
pstmt.setInt(3,Integer.parseInt(ox[i]));
pstmt.setLong(4,Long.parseLong(mphone));
pstmt.setLong(5,Long.parseLong(mphone));
pstmt.executeUpdate();
pstmt.close();
}
}
/*------------------------------------------------------------------------------------------------
* 唱客 嘎绰 荤恩
-------------------------------------------------------------------------------------------------*/
query1 = "select top 1 Guest_phone,Attention_point from GT_LUCKY_ATTENTION_POINT where phonenum in("+
" select distinct Guest_phone from gt_lucky_quiz_mylog where phonenum =?) "+" order by Attention_point desc";
pstmt = con.prepareStatement(query1);
pstmt.setLong(1,Long.parseLong(mphone));
rs = pstmt.executeQuery();
if(rs.next())
{
Guest_phone = rs.getLong("Guest_phone");
Attention_point = rs.getInt("Attention_point");
}
starAttentionfull = Attention_point/4;
starAttentionemp = (Attention_point%4)/2;
rs.close();
pstmt.close();
/*------------------------------------------------------------------------------------------------
* 唱客 嘎绰 荤恩狼 扁夯 沥焊
-------------------------------------------------------------------------------------------------*/
query1="select nickname,sex,year,phonenum from gt_user_info where phonenum = '0"+Guest_phone+"'";
pstmt = con.prepareStatement(query1);
rs = pstmt.executeQuery();
if(rs.next())
{
nickname = rs.getString("nickname");
sex = rs.getInt("sex");
year = rs.getInt("year");
dianhua = rs.getString("phonenum");
}
rs.close();
pstmt.close();
Calendar calendar=Calendar.getInstance();
nyear=calendar.get(Calendar.YEAR);
age = nyear-year;
/*------------------------------------------------------------------------------------------------
* 唱客 嘎绰 荤恩狼 概莫档
-------------------------------------------------------------------------------------------------*/
query1="select Match_point from GT_LUCKY_MATCH_POINT where phonenum =? and Guest_phone = ?";
pstmt = con.prepareStatement(query1);
pstmt.setLong(1,Long.parseLong(mphone));
pstmt.setLong(2,Guest_phone);
rs = pstmt.executeQuery();
if(rs.next())
{
Match_point = rs.getInt("Match_point");
}
starMatchfull = Match_point/4;
starMatchemp = (Match_point%4)/2;
rs.close();
pstmt.close();
/*------------------------------------------------------------------------------------------------
* 唱客 嘎绰 荤恩 沥翠 荐
-------------------------------------------------------------------------------------------------*/
query1 = " select count(a.idx) answercount from gt_lucky_quiz_mylog a,gt_lucky_quiz_mylog c"+
" where a.quiz_idx=c.quiz_idx and a.answer = c.answer"+
" and a.phonenum =? and a.guest_phone =?"+
" and c.phonenum =?"+" and c.guest_phone =?";
pstmt = con.prepareStatement(query1);
pstmt.setLong(1,Long.parseLong(mphone));
pstmt.setLong(2,Guest_phone);
pstmt.setLong(3,Long.parseLong(mphone));
pstmt.setLong(4,Long.parseLong(mphone));
rs = pstmt.executeQuery();
if(rs.next())
{
answercount = rs.getInt("answercount");
}
rs.close();
pstmt.close();
/*------------------------------------------------------------------------------------------------
* 唱客 嘎绰 荤恩 翠函 荐
-------------------------------------------------------------------------------------------------*/
query1="select count(idx) as allcont from GT_LUCKY_QUIZ_MYLOG where phonenum =? and Guest_phone =? ";
pstmt = con.prepareStatement(query1);
pstmt.setLong(1,Long.parseLong(mphone));
pstmt.setLong(2,Guest_phone);
rs = pstmt.executeQuery();
if(rs.next())
{
allcont = rs.getInt("allcont");
}
percent = (answercount/allcont) * 100;
if(percent > 100){
percent = 100;
}
/*------------------------------------------------------------------------------------------------
* 唱客 嘎绰 荤恩 荐
-------------------------------------------------------------------------------------------------*/
query1="select count(distinct Guest_phone)as cont1 from gt_lucky_quiz_mylog where phonenum =? and guest_phone != ?";
pstmt = con.prepareStatement(query1);
pstmt.setLong(1,Long.parseLong(mphone));
pstmt.setLong(2,Long.parseLong(mphone));
rs = pstmt.executeQuery();
if(rs.next())
{
cont1 = rs.getInt("cont1");
}
rs.close();
pstmt.close();
/*------------------------------------------------------------------------------------------------
* 钱绢焊瘤 臼篮 巩力
-------------------------------------------------------------------------------------------------*/
//query1 = "select distinct top 5 a.title,a.idx from GT_LUCKY_QUIZ a,GT_LUCKY_QUIZ_MYLOG b where a.idx = b.Quiz_idx"+
// " and a.flag = 1 and b.Quiz_idx not in(select quiz_idx from GT_LUCKY_QUIZ_MYLOG where Guest_phone =?)"+
// " order by a.idx desc";
query1 = "select distinct top 5 title,idx from GT_LUCKY_QUIZ where flag = 1 and idx not in(select quiz_idx from GT_LUCKY_QUIZ_MYLOG where phonenum = ? and Guest_phone = ?) order by idx desc";
pstmt = con.prepareStatement(query1);
pstmt.setLong(1,Long.parseLong(mphone));
pstmt.setLong(2,Long.parseLong(mphone));
rs = pstmt.executeQuery();
for(int i=0;rs.next();i++)
{
title[i] = rs.getString("title");
quizidx[i] = rs.getString("idx");
flag = i+1;
}
rs.close();
pstmt.close();
// QVGA HTML
//
if( isQVGA )
{
%><%@ include file="/html/MYQAmatchMate.jsp"%><%
}
// QCIF HTML
//
else
{
%><%@ include file="/html/qcif/MYQAmatchMate.jsp"%><%
}
}catch(Exception e)
{
out.println(e);
}
finally
{
if(rs != null) try{ rs.close(); }catch(Exception se){}
if(pstmt != null) try{ pstmt.close(); }catch(Exception se){}
if(stmt != null) try{ stmt.close(); }catch(Exception se){}
if(con != null) try{ con.close(); }catch(Exception se){}
}
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -