<%

	Function GetBody(url)
		 on error resume next
		  dim Retrieval
		  Set Retrieval = CreateObject("Microsoft.XMLHTTP")
		  With Retrieval
			  .Open "Get", url, False, "", ""
			  .Send
			  GetBody = bytes2BSTR(.ResponseBody)
		  End With
		  Set Retrieval = Nothing
	End Function 

	Private Function bytes2BSTR(vIn)        '转换编码的函数
		dim StrReturn,ThisCharCode,i,NextCharCode
		strReturn = ""
		For i = 1 To LenB(vIn)
				ThisCharCode = AscB(MidB(vIn,i,1))
				If ThisCharCode < &H80 Then
						strReturn = strReturn & Chr(ThisCharCode)
				Else
						NextCharCode = AscB(MidB(vIn,i+1,1))
						strReturn = strReturn & Chr(CLng(ThisCharCode) * &H100 + CInt(NextCharCode))
						i = i + 1
				End If
		Next
		bytes2BSTR = strReturn
	End Function



server.ScriptTimeout=3600
template_class = FSOFileRead("pay.html")


Sub createtypelist(class_id)




'response.write "正在生成分类：<font color=""#ff0000""><b>"&wooolName&"</b></font><br>"




str_sql = "Select * From [L_woool] where id="&class_id&" order by id desc"
Set rsq = Server.CreateObject("ADODB.Recordset")
rsq.Open str_sql,Conn,1,3
if rsq.eof then
	Call WriteErr("抱歉,此充值服务不存在!","1")
html=""
html=html&"抱歉,此充值服务不存在!"

else

userid=rsq("userid")
rsq("GameID")=0
rsq.Update


end if


SQL = "Select * From member Where id="&userid
Set Ress = conn.execute(SQL)
if ress.eof then
	Call WriteErr("抱歉,此商户不存在!","1")
html=""
html=html&"无此商户!"
else
if  ress("state")<>1 then
	Call WriteErr("此商户非正常状态,不能进行充值!","1")
html=""
html=html&"此商户非正常状态,不能进行充值!"
else

	wooolname=rsq("wooolname")
	mbjz=rsq("mbjz")
	yuanbao=rsq("yuanbao")
	wooolid=rsq("id")
	userid=userid

if rsq("gonggao")<>"" then
gonggao = "<script>alert('"&rsq("gonggao")&"');</script>"&chr(13)
'gonggao = rsq("gonggao")
Else
gonggao =""
End If
End If
End If

	rmbjiangli=""
	rmbjl=""
		  SQL = "Select * From H_rmbname order by id"
		  Set Res3 = Server.CreateObject("ADODB.Recordset")
		  Res3.Open SQL,Conn,1,2
		  Do While Not Res3.Eof
				set prs = GrateRs("Select * From L_rmbjiangli where UserID="&UserID&" and QuID="&cint(wooolID)&" and psortID="&Res3("id"),1)
				If not (prs.Eof and prs.Bof) Then
		  			If prs("jiangli")>0 Then

		  				rmbjiangli = rmbjiangli&"<li>充<span class='bonusPer'>"&Res3("rmb")&" </span><span class='bonusPercent'>多送"&prs("jiangli")&"%</span></li>"


					End if
				end if
				prs.close
		  Res3.Movenext
		  Loop


		  	If rmbjiangli<>"" Then				
				rmbjl = rmbjl&"<div id=""bonusdesc"">"
				rmbjl = rmbjl&"<span>为答谢新老玩家对本游戏的支持，报答大家的厚爱，您现在充值时，除了能获得不同充值方式带来的赠送比例以外，根据单次充值金额（不累计）您还能享受更多的赠送额度。</span>"
				rmbjl = rmbjl&"</div>"
				rmbjl = rmbjl&"<ul id=""bonuslist"">"
		  		rmbjl = rmbjl&rmbjiangli
				rmbjl = rmbjl&"</ul>"
				rmbjl = rmbjl&"<div class=""clear""></div>"
			End if



	wy=""
		  SQL = "Select * From [H_plist] Where fenzu=1 order by paixu"
		  Set pRes = Server.CreateObject("ADODB.Recordset")
		  pRes.Open SQL,Conn,1,2

		  
		  Do While Not pRes.Eof


		  set prs = GrateRs("Select * From L_jiangli where UserID="&UserID&" and QuID="&cint(wooolID)&" and psortID="&pRes("fenzu"),1)
		  If not (prs.Eof and prs.Bof) Then
		  	If prs("jiangli")>0 Then
		  		jiangli = "<span class=""t2""> "&prs("jiangli")&"% </span>"
			Else
				jiangli = "<span class=""t2""> 0% </span>"
			End if
		  else
		  	jiangli = "<span class=""t2""> 0% </span>"
		  end if




								wy = wy&"<li>"
								wy = wy&"<div class=""fl channelname""><input type='radio' name='paytype' id='channel"&pRes("id")&"' value='"&pRes("ID")&"' checked='checked' /><label for='channel"&pRes("id")&"'>"&pRes("Pname")&"<font color=#AAAAAA>"&pRes("shuoming")&"</font></label></div>"
								wy = wy&"<div class=""fl"">额外奖励 "&jiangli&"</div>"
								wy = wy&"<div class=""clear""></div>"
								wy = wy&"</li>"



			
			pRes.Movenext
		 Loop















	sjk=""
		  SQL = "Select * From [H_plist] Where fenzu=2 order by paixu"
		  Set pRes = Server.CreateObject("ADODB.Recordset")
		  pRes.Open SQL,Conn,1,2

		  
		  Do While Not pRes.Eof



		  set prs = GrateRs("Select * From L_jiangli where UserID="&UserID&" and QuID="&cint(wooolID)&" and psortID="&pRes("fenzu"),1)
		  If not (prs.Eof and prs.Bof) Then
		  	If prs("jiangli")>0 Then
		  		jiangli = "<span class=""t2""> "&prs("jiangli")&"% </span>"
			Else
				jiangli = "<span class=""t2""> 0% </span>"
			End if
		  else
		  	jiangli = "<span class=""t2""> 0% </span>"
		  end if



								sjk = sjk&"<li>"
								sjk = sjk&"<div class=""fl channelname""><input type='radio' name='paytype' id='channel"&pRes("id")&"' value='"&pRes("ID")&"' /><label for='channel"&pRes("id")&"'>"&pRes("Pname")&"<font color=#AAAAAA>"&pRes("shuoming")&"</font></label></div>"
								sjk = sjk&"<div class=""fl"">额外奖励 "&jiangli&"</div>"
								sjk = sjk&"<div class=""clear""></div>"
								sjk = sjk&"</li>"




			
			pRes.Movenext
		 Loop






	yxk=""
		  SQL = "Select * From [H_plist] Where fenzu=3 order by paixu"
		  Set pRes = Server.CreateObject("ADODB.Recordset")
		  pRes.Open SQL,Conn,1,2

		  
		  Do While Not pRes.Eof



		  set prs = GrateRs("Select * From L_jiangli where UserID="&UserID&" and QuID="&cint(wooolID)&" and psortID="&pRes("fenzu"),1)
		  If not (prs.Eof and prs.Bof) Then
		  	If prs("jiangli")>0 Then
		  		jiangli = "<span class=""t2""> "&prs("jiangli")&"% </span>"
			Else
				jiangli = "<span class=""t2""> 0% </span>"
			End if
		  else
		  	jiangli = "<span class=""t2""> 0% </span>"
		  end if




								yxk = yxk&"<li>"
								yxk = yxk&"<div class=""fl channelname""><input type='radio' name='paytype' id='channel"&pRes("id")&"' value='"&pRes("ID")&"' /><label for='channel"&pRes("id")&"'>"&pRes("Pname")&"<font color=#AAAAAA>"&pRes("shuoming")&"</font></label></div>"
								yxk = yxk&"<div class=""fl"">额外奖励 "&jiangli&"</div>"
								yxk = yxk&"<div class=""clear""></div>"
								yxk = yxk&"</li>"



	

			
			pRes.Movenext
		 Loop

















	html=""
	html_template = Replace(template_class,"$wooolname$",wooolname)
	html_template = Replace(html_template,"$mbjz$",mbjz)
	html_template = Replace(html_template,"$yuanbao$",yuanbao)
	html_template = Replace(html_template,"$wooolid$",wooolid)
	html_template = Replace(html_template,"$userid$",userid)
	html_template = Replace(html_template,"$gonggao$",gonggao)
	html_template = Replace(html_template,"$wy$",wy)
	html_template = Replace(html_template,"$sjk$",sjk)
	html_template = Replace(html_template,"$yxk$",yxk)
	html_template = Replace(html_template,"$rmbjl$",rmbjl)
	'html_template = Replace(html_template,CHR(10),"") 
	'html_template = Replace(html_template,CHR(13),"") 
	'html_template = Replace(html_template,"	","") 

	html=html&html_template



		m_class_path = "fenqu/"&class_id &".html"

	createhtml m_class_path,html
	'response.write "恭喜，生成成功！地址为：<a href="""&m_class_path&""" target=_blank>"&m_class_path&"</a><br>"
	response.flush

	'response.write "任务完成"


End Sub 

%>