<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<%option explicit%>
<!--#include file="../Conn.asp"-->
<!--#include file="TaskConfig.asp"-->
<!--#include file="../HSK_Cls/HSK.MemberCls.asp"-->
<%
Dim KSCls
Set KSCls = New BinDingJieShouHao
KSCls.Run()
Set KSCls = Nothing

Class BinDingJieShouHao
	Private HSK
	Private KS,KSUser
	Private ComeUrl,LoginTF,Action,Tid,ID,KS_BuyDate
	
	Private Sub Class_Initialize()
		Set KS = New PublicCls
		Set KSUser = New UserCls
		Set HSK = CreateObject("ASP_AiCaiBa.AiCaiBa")
		Set HSK = HSK.AiCaiBa (TaskConfig,1003)
	End Sub
	
	Private Sub Class_Terminate()
		Call CloseConn()
		Set KS=Nothing
		Set KSUser=Nothing
		HSK.Class_Terminate()
		Set HSK=Nothing
	End Sub

	Public Sub Run()
		ComeUrl=Request.ServerVariables("HTTP_REFERER")
		LoginTF=Cbool(KSUser.UserLoginChecked)
		IF LoginTF=false  Then
		  GCls.ComeUrl=ComeUrl	'GCls.GetUrl()
		  Response.Redirect("/user/login/")
		  Exit Sub
		End If
	
	'================= Action 动作、ID 判断START =================================
	Action = KS.CheckXSS(KS.R(KS.S("Action")))
	ID = KS.ChkClng(KS.CheckXSS(KS.R(KS.S("ID"))))
	Tid= KS.CheckXSS(KS.R(KS.S("TID")))
	IF (Action<>"BinDing" And Action<>"DoSave") Or ID = 0 Or KS.IsNul(Tid) Then
		KS.Die "参数有误，请重新打开！如果是登录超时，请重新登录！谢谢！"
	End IF	
	Call HSK.CheckTask()
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>绑定接手买号</title>
<link href="/style/css/task.css" type="text/css" rel="stylesheet"/>
<script type="text/javascript" src="/style/js/common_def.js"></script>
<script type="text/javascript" src="/style/js/task_def.js"></script>
<style type="text/css">
body {background:#ffffff url(/style/images/body_bg.gif) repeat-x 0 0;}
.binding {}
.binding td { color:#20537A; font-size:12px; line-height:22px;
}
.binding .err { color:blue; font-size:12px; line-height:22px;
}
.binding .orange { color:#FF5500; font-size:14px; line-height:22px; font-weight:bold;
}
</style>
</head>
<body>
<%
	Select Case Action
		Case "BinDing"	Call HSK.Mainlist()
		Case "DoSave"	Call DoSave()
		Case Else		Call HSK.Mainlist()
	End Select
%>
</body>
</html>
<%
End Sub

Sub DoSave()
Dim Rs,ShopName,I
ShopName = KS.CheckXSS(KS.R(KS.s("KS_ShopName")))
	If Not KS.IsNul(ShopName) Then
		Call HSK.CheckBinDing()
		Set Rs = Conn.Execute("Select Top 1 ID From KS_U_sxyrw Where (KS_BuyUserName = '"& KSUser.UserName &"') And (KS_BuyShopName IS Null) And (KS_BuyDate IS NOT Null) And KS_Status=1 And ID=" & ID)
		If Not Rs.Eof Then
			Conn.Execute("UPDate KS_U_sxyrw Set KS_BuyShopName='" & ShopName & "', KS_BuyUserIP='" & KS.GetIP() & "', KS_BuyDate=" & SqlNowString & " Where (KS_BuyUserName = '"& KSUser.UserName &"') And KS_Status=1 And ID=" & ID)
			KS_BuyDate = Now()
			Call BinDingSucceedMsg()
		Else
			KS.Echo "<div class=""border"">抱歉！提交的数据有误！请检查该任务是否已经绑定买号！或者重新登录再选择绑定!</div>"
		End If
		Set Rs = Nothing
	Else
		KS.Echo "<div class=""border"">抱歉！提交的数据有误！请检查该任务是否已经绑定买号！或者重新登录再选择绑定!</div>"
	End IF
End Sub

Sub BinDingSucceedMsg()
%>
<!-- 绑定成功后内容 start -->
<table align="center" width="100%" border="0" cellspacing="8" cellpadding="0" class="binding">
  <tr>
    <td height="35" class="orange"> <img src="/style/images/ok.jpg" align="absmiddle" />&nbsp; 绑定买号成功！</td>
  </tr>
  <tr>
    <td height="6" align="center"></td>
  </tr>
  <tr>
    <td>
      <p>1. 您已经成功为该任务选择了买号，请用该买号登陆<%= left(KS.C_C(tid,1),2)%>网，再购买对方的商品；
        <br />
        2. 接手任务后，请按任务要求在20分钟内拍下宝贝并完成支付，20分钟后双方均可退出任务；
        <br />
        3. 如果发现商品价格（包含运费）与任务担保价不一致，请联系发布方修改价格与延长时间； <br />
        <span class="err">4. 如果你在<%= left(KS.C_C(tid,1),2)%>上已经给对方支付了，请在平台20分钟读秒结束前点击【已经支付】按钮，否则您将可能损失在<%= left(KS.C_C(tid,1),2)%>上支付给对方的金额；
        <br />
      5. 平台每一步必须先在<%= left(KS.C_C(tid,1),2)%>严格核实后，再回到平台操作，保持同步! 
      </span>
      </p></td>
  </tr>
  <tr>
    <td height="60" align="center"><input type="image" name="returnbt" src="/style/images/binding_return.gif" onClick="parent.location.reload();parent.closeWindow();" /></td>
  </tr>
  <tr>
    <td height="24" align="center"><%
	If Pay_OverTime - DateDiff("s",KS_BuyDate,now) >= 0 Then
		KS.Echo "<span class=""blue"">您还剩余<script type=""text/javascript"">CheckTime(" & Pay_OverTime - DateDiff("s",KS_BuyDate,now) &");</script>支付时间</span>"
    End IF%></td>
  </tr>
</table>
<%
End Sub
End Class
%>