📄 gamematchlist.jsp.svn-base
字号:
<!--------------------------------------------------------------------------------------------------------------
*@霸烙皋牢
*@Author : zhou peng(2008-05-23)
--------------------------------------------------------------------------------------------------------------->
<%@ page import='java.io.*,java.text.*,java.util.Date,java.util.Vector, 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"%>
<%!
public static String isNull(String str)
{
if (str == null)
return "";
else
return str;
}
%>
<%
/**
*
*
* @ version : 1.0.0
* @ author : zhou peng ( pengzhou@isoftstone.com )
* @ last modified : 2008-05-23
*/
/*------------------------------------------------------------------------------------------------------
+ 扁夯 颇扼固磐
-------------------------------------------------------------------------------------------------------*/
String mphone= request.getParameter("mphone");
//String gphone= request.getParameter("gphone");
String gphone= mphone;
//mphone = "13269404";
//String gphone = "1051697";
/*------------------------------------------------------------------------------------------------------
+ 傈开 函荐
-------------------------------------------------------------------------------------------------------*/
String szCount = null;
String strNickname = null;
String gScore = null;
String myScore = null;
int gameidx = 0;
String strGuestphone = null;
String strGuestNickname = null;
String strGametitle = null;
int type = 0;
int winFlag = 0;
String pageurl = null;
String YourStrname = "";
// 其捞瘤 备泅 眠啊 函荐
int pagesize = 5; // 茄其捞瘤寸 10俺 免仿拱
// 傈开 函荐肺 急攫.. 其捞瘤 备泅 何盒俊 犁荤侩
int pageNUM = 1; // 其捞瘤 锅龋
int pagecount = 1 ; // 其捞瘤 肮荐 瘤沥 函荐
int absolutepage = 1; // 例措 困摹 其捞瘤 锅龋
int dbcount = 0; // DB 救俊 臂 肮荐 历厘 函荐
int isNoPage = 0; //茄俺档 绝蠢衬.. 绝栏搁0, 乐栏搁1
int insertNum = 0;
String strPhoneNum = null;
int firstLink = 0;
if(request.getParameter("firstLink")!=null) firstLink=Integer.parseInt(request.getParameter("firstLink")); else firstLink=0;
int game_idx = 0; //霸烙 绊蜡锅龋
//0724
if(!isNull(request.getParameter("game_idx")).equals("") )//茫扁肺 甸绢柯 版快促.
{
game_idx = Integer.parseInt(request.getParameter("game_idx"));
}
else game_idx = 1;
//game_idx = 1;
String gamePlayType = null;
if(request.getParameter("gamePlayType")!=null) gamePlayType=request.getParameter("gamePlayType"); else gamePlayType="0";
if(request.getParameter("insertNum")!=null) insertNum=Integer.parseInt(request.getParameter("insertNum")); else insertNum=0;
/*------------------------------------------------------------------------------------------------------
+ DB 包访 函荐
-------------------------------------------------------------------------------------------------------*/
Connection con = null;
PreparedStatement pstmt = null;
Statement stmt = null;
ResultSet rs = null;
ResultSet pageset = null;
try
{
/*------------------------------------------------------------------------------------------------
* DB 目池记
-------------------------------------------------------------------------------------------------*/
%><%@ include file="../getConnection.jsp"%><%
/*------------------------------------------------------------------------------------------------
* My winFlag && type
-------------------------------------------------------------------------------------------------*/
szCount = " select top 1 winFlag ,type from GT_GameMatch WHERE phonenum=? and guest_phone=? and game_idx=? order by regdate desc " ;
pstmt = con.prepareStatement(szCount);
pstmt.setString(1,mphone);
pstmt.setString(2,gphone);
pstmt.setInt(3,game_idx);
rs = pstmt.executeQuery();
if( rs.next() )
{
winFlag = rs.getInt("winFlag");
type = rs.getInt("type");
}
rs.close();
pstmt.close();
/*------------------------------------------------------------------------------------------------
* +1 point or -1 point
-------------------------------------------------------------------------------------------------*/
String query1 = "select nickname,sex from GT_user_info where phonenum = '"+gphone+"'";
pstmt = con.prepareStatement(query1);
rs = pstmt.executeQuery();
if(rs.next())
{
YourStrname = rs.getString("nickname");
}
rs.close();
if (firstLink != 1){
if (insertNum == 0){
insertNum++;
if (winFlag == 0){
szCount="update GT_gamerank_"+game_idx+" SET gamerank_score=gamerank_score-1 where phonenum='"+mphone+"'";
pstmt = con.prepareStatement(szCount);
pstmt.executeUpdate();
pstmt.close();
szCount="update GT_gamerank_"+game_idx+" SET gamerank_score=gamerank_score+1 where phonenum='"+gphone+"'";
pstmt = con.prepareStatement(szCount);
pstmt.executeUpdate();
pstmt.close();
}else if (winFlag == 1){
szCount="update GT_gamerank_"+game_idx+" SET game_hit=game_hit+1 where phonenum='"+mphone+"'";
pstmt = con.prepareStatement(szCount);
pstmt.executeUpdate();
pstmt.close();
szCount="update GT_gamerank_"+game_idx+" SET gamerank_score=gamerank_score-1 where phonenum='"+gphone+"'";
pstmt = con.prepareStatement(szCount);
pstmt.executeUpdate();
pstmt.close();
}
}
}
/*------------------------------------------------------------------------------------------------
* opponent's score
-------------------------------------------------------------------------------------------------*/
szCount = " select gamerank_today from GT_GameRank_"+game_idx+" WHERE phonenum='"+gphone+"'" ;
pstmt = con.prepareStatement(szCount);
rs = pstmt.executeQuery();
if( rs.next() )
{
gScore = rs.getString("gamerank_today");
}
rs.close();
pstmt.close();
/*------------------------------------------------------------------------------------------------
* my score
-------------------------------------------------------------------------------------------------*/
szCount = "select gamerank_today from GT_gamerank_"+game_idx+" where phonenum='"+mphone+"'";
pstmt = con.prepareStatement(szCount);
rs = pstmt.executeQuery();
if( rs.next() )
{
myScore = rs.getString("gamerank_today");
}
rs.close();
pstmt.close();
/*------------------------------------------------------------------------------------------------
* opponent nickName
-------------------------------------------------------------------------------------------------*/
szCount = " select nickname from GT_User_Info WHERE phonenum='"+gphone+"'";
pstmt = con.prepareStatement(szCount);
rs = pstmt.executeQuery();
if( rs.next() )
{
strNickname = rs.getString("nickname");
}
rs.close();
pstmt.close();
/*------------------------------------------------------------------------------------------------
* pageCount
-------------------------------------------------------------------------------------------------*/
szCount = " select count(game_idx) countNum from";
szCount = szCount + "(select b.game_idx,b.guest_phone guestphone,c.nickname nickname,d.game_title,b.type,b.winFlag ";
szCount = szCount + "from gt_user_info a join gt_gameMatch b on a.phonenum=b.phonenum join gt_user_info c on b.guest_phone=c.phonenum ";
szCount = szCount + "join gt_game d on b.game_idx=d.game_idx where b.regdate between DateAdd(day,-6,getdate()) and getdate() and b.phonenum = "+gphone+" ) countNum " ;
pstmt = con.prepareStatement(szCount);
pageset = pstmt.executeQuery();
if(pageset.next()){
dbcount = pageset.getInt(1); // 臂 醚 肮荐
pageset.close();
}
if(dbcount%pagesize == 0)
pagecount = dbcount/(pagesize); // 醚 其捞瘤荐 备窍扁
else
pagecount = dbcount/(pagesize)+1; // 醚 其捞瘤荐 备窍扁
if(request.getParameter("pageNUM")!=null)
{
pageNUM=Integer.parseInt(request.getParameter("pageNUM"));//瘤沥等 其捞瘤 焊咯林扁
absolutepage=(pageNUM-1)*pagesize+1;
}
/*------------------------------------------------------------------------------------------------
* gameListLog
-------------------------------------------------------------------------------------------------*/
szCount = " select b.game_idx,b.guest_phone guestphone,c.nickname nickname,d.game_title,b.type,b.winFlag ";
szCount = szCount + "from gt_user_info a join gt_gameMatch b ";
szCount = szCount + "on a.phonenum=b.phonenum ";
szCount = szCount + "join gt_user_info c on b.guest_phone=c.phonenum ";
szCount = szCount + "join gt_game d on b.game_idx=d.game_idx ";
szCount = szCount + "where b.regdate between DateAdd(day,-6,getdate()) and getdate() and b.phonenum = "+gphone+" order by b.regdate desc " ;
pstmt = con.prepareStatement(szCount);
rs = pstmt.executeQuery();
if(!rs.next()) // 蔼捞 绝阑锭
{
isNoPage = 1;
pagesize=0;
}
else // 蔼捞 乐阑锭 //rs.absolute(absolutepage);
{
for(int s=0; s<absolutepage-1; s++)
rs.next();
}
%>
<html>
<head>
<link href="http://entaz.mugeta.com/client/mugeta_v2_test/web/user/mobile.css" rel="stylesheet" type="text/css">
<title>档傈霸烙郴开</title>
</head>
<body>
<!--剧侥
<tr>
<td>
<table width="176" border="0" cellspacing="0" cellpadding="0">
<tr>
<td></td>
</tr>
</table>
</td>
</tr>
-->
<table width="176" border="0" cellspacing="0" cellpadding="0">
<!--鸥捞撇 矫累-->
<tr>
<td>
<table width="176" border="0" cellspacing="0" cellpadding="0">
<tr>
<td colspan="2" height="2" bgcolor="#a8bfff"></td>
</tr>
<tr>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -