<!--#include file="../inc/Bll.asp"-->
<!--#include file="../inc/Constant.asp"-->
<!--#include file="../inc/Md5.asp"-->
<!--#include file="../inc/App.asp"-->

<%
dim Re
if Request.QueryString("ac")="Day" then 
	RS_End
	'1天内收入排行
	Set RS=DB_CONN.EXECUTE("select top 20 b.[i_User_Face], b.[i_User_NickName],(select [i_User_IncomeLevel_Style] from [i_User_IncomeLevel] where [i_User_IncomeNum]>=[i_User_IncomeLevel_MinNum] and [i_User_IncomeNum]<[i_User_IncomeLevel_MaxNum]) as 'iclass',sum(a.[i_User_Gift_SendRecord_GiftTotalPrice]) as [allpay],(select [i_Sys_Room_ID] from [i_Sys_Room] where [i_User_Gift_SendRecord_GUID]=[i_Sys_Room_AdminUserID]) as 'roomid' from [i_User_Gift_SendRecord] a join [i_User_Info] b on a.[i_User_Gift_SendRecord_GUID]=b.[i_User_ID] where DATEDIFF(D,i_User_Gift_SendRecord_Time,getdate())<1 group by b.[i_User_NickName],b.[i_User_Face],a.[i_User_Gift_SendRecord_GUID],[i_User_IncomeNum] order by [allpay] desc")
	Re="var TopListRe"&Request.QueryString("ac")&"=""{data1:["
	while (not RS.eof)
		if k>0 then Re=Re&","'//roomid,face,nick,iclass,fansnum
		Re=Re&"{roomid:'"&RS("roomid")&"',face:'"&RS("i_User_Face")&"',nick:'"&RS("i_User_NickName")&"',iclass:'"&RS("iclass")&"'}"
		k=k+1
		RS.MoveNext
	Wend
	Re=Re&"],"
	RS_End
	k=0
	'1天内消费排行
	Set RS=DB_CONN.EXECUTE("select top 20  b.[i_User_Face],b.[i_User_NickName],sum(a.[i_User_ConsumeRecord_PayNum]) as [allpay],(select [i_Sys_Room_ID] from [i_Sys_Room] where [i_User_ID]=[i_Sys_Room_AdminUserID]) as 'roomid',(select [i_User_PaymentLevel_Style] from [i_User_PaymentLevel] where [i_User_PayNum]>=[i_User_PaymentLevel_MinNum] and [i_User_PayNum]<[i_User_PaymentLevel_MaxNum]) as 'iclass' from [i_User_ConsumeRecord] a join [i_User_Info] b on a.[i_User_ConsumeRecord_UID]=b.[i_User_ID] where DATEDIFF(D,i_User_ConsumeRecord_Time,getdate())<1 group by b.[i_User_NickName], b.[i_User_Face],b.[i_User_ID],b.[i_User_PayNum] order by allpay desc")
	Re=Re&"data2:["
	while (not RS.eof)
		if k>0 then Re=Re&","
		Re=Re&"{roomid:'"&RS("roomid")&"',face:'"&RS("i_User_Face")&"',nick:'"&RS("i_User_NickName")&"',iclass:'"&RS("iclass")&"'}"
		k=k+1
		RS.MoveNext
	Wend
	Re=Re&"],"
	RS_End
	k=0
	'1天内人气排行
	Set RS=DB_CONN.EXECUTE("select top 20 count(a.i_User_Attention_GUID) as [fansnum],[i_user_face],[i_user_nickname],(select [i_Sys_Room_ID] from [i_sys_room] where [i_Sys_Room_AdminUserID]=[i_User_Attention_GUID]) as [roomid],(select [i_User_IncomeLevel_Style] from [i_User_IncomeLevel] where [i_User_IncomeNum]>=[i_User_IncomeLevel_MinNum] and [i_User_IncomeNum]<[i_User_IncomeLevel_MaxNum]) as [iclass] from [i_User_Attention] a join [i_user_info] b on [i_User_Attention_GUID]=[i_User_ID] where DATEDIFF(D,i_User_Attention_Date,getdate())<1 group by [i_User_Attention_GUID],[i_user_face],[i_user_nickname],[i_User_IncomeNum] order by [fansnum] desc")
	Re=Re&"data3:["
	while (not RS.eof)
		if k>0 then Re=Re&","
		Re=Re&"{roomid:'"&RS("roomid")&"',face:'"&RS("i_User_Face")&"',nick:'"&RS("i_User_NickName")&"',iclass:'"&RS("iclass")&"',fansnum:'"&RS("fansnum")&"'}"
		k=k+1
		RS.MoveNext
	Wend
	Re=Re&"],CreatTime:'"&formatdate(now(),"1")&"'}"";"
	RS_End
	CreatFile "/d/js/TopDay20.js",Re
end if

if Request.QueryString("ac")="Week" then 
	RS_End
	'1周内收入排行
	Set RS=DB_CONN.EXECUTE("select top 20  b.[i_User_Face],b.[i_User_NickName],(select [i_User_IncomeLevel_Style] from [i_User_IncomeLevel] where [i_User_IncomeNum]>=[i_User_IncomeLevel_MinNum] and [i_User_IncomeNum]<[i_User_IncomeLevel_MaxNum]) as 'iclass',sum(a.[i_User_Gift_SendRecord_GiftTotalPrice]) as [allpay],(select [i_Sys_Room_ID] from [i_Sys_Room] where [i_User_Gift_SendRecord_GUID]=[i_Sys_Room_AdminUserID]) as 'roomid' from [i_User_Gift_SendRecord] a join [i_User_Info] b on a.[i_User_Gift_SendRecord_GUID]=b.[i_User_ID] where DATEDIFF(D,i_User_Gift_SendRecord_Time,getdate())<7 group by b.[i_User_NickName], b.[i_User_Face],a.[i_User_Gift_SendRecord_GUID],[i_User_IncomeNum] order by [allpay] desc")
	Re="var TopListRe"&Request.QueryString("ac")&"=""{data1:["
	while (not RS.eof)
		if k>0 then Re=Re&","
		Re=Re&"{roomid:'"&RS("roomid")&"',face:'"&RS("i_User_Face")&"',nick:'"&RS("i_User_NickName")&"',iclass:'"&RS("iclass")&"'}"
		k=k+1
		RS.MoveNext
	Wend
	Re=Re&"],"
	RS_End
	k=0
	'1周内消费排行
	Set RS=DB_CONN.EXECUTE("select top 20  b.[i_User_Face],b.[i_User_NickName],sum(a.[i_User_ConsumeRecord_PayNum]) as [allpay],(select [i_Sys_Room_ID] from [i_Sys_Room] where [i_User_ID]=[i_Sys_Room_AdminUserID]) as 'roomid',(select [i_User_PaymentLevel_Style] from [i_User_PaymentLevel] where [i_User_PayNum]>=[i_User_PaymentLevel_MinNum] and [i_User_PayNum]<[i_User_PaymentLevel_MaxNum]) as 'iclass' from [i_User_ConsumeRecord] a join [i_User_Info] b on a.[i_User_ConsumeRecord_UID]=b.[i_User_ID] where DATEDIFF(D,i_User_ConsumeRecord_Time,getdate())<7 group by  b.[i_User_Face],b.[i_User_NickName],b.[i_User_ID],b.[i_User_PayNum] order by allpay desc")
	Re=Re&"data2:["
	while (not RS.eof)
		if k>0 then Re=Re&","
		Re=Re&"{roomid:'"&RS("roomid")&"',face:'"&RS("i_User_Face")&"',nick:'"&RS("i_User_NickName")&"',iclass:'"&RS("iclass")&"'}"
		k=k+1
		RS.MoveNext
	Wend
	Re=Re&"],"
	RS_End
	k=0
	'1周内人气排行
	Set RS=DB_CONN.EXECUTE("select top 20 count(a.i_User_Attention_GUID) as [fansnum],[i_user_face],[i_user_nickname],(select [i_Sys_Room_ID] from [i_sys_room] where [i_Sys_Room_AdminUserID]=[i_User_Attention_GUID]) as [roomid],(select [i_User_IncomeLevel_Style] from [i_User_IncomeLevel] where [i_User_IncomeNum]>=[i_User_IncomeLevel_MinNum] and [i_User_IncomeNum]<[i_User_IncomeLevel_MaxNum]) as [iclass] from [i_User_Attention] a join [i_user_info] b on [i_User_Attention_GUID]=[i_User_ID] where DATEDIFF(D,i_User_Attention_Date,getdate())<7 group by [i_User_Attention_GUID],[i_user_face],[i_user_nickname],[i_User_IncomeNum] order by [fansnum] desc")
	Re=Re&"data3:["
	while (not RS.eof)
		if k>0 then Re=Re&","
		Re=Re&"{roomid:'"&RS("roomid")&"',face:'"&RS("i_User_Face")&"',nick:'"&RS("i_User_NickName")&"',iclass:'"&RS("iclass")&"',fansnum:'"&RS("fansnum")&"'}"
		k=k+1
		RS.MoveNext
	Wend
	Re=Re&"],CreatTime:'"&formatdate(now(),"1")&"'}"";"
	RS_End
	CreatFile "/d/js/TopWeek20.js",Re
end if

if Request.QueryString("ac")="Month" then 
	RS_End
	'1月内收入排行
	Set RS=DB_CONN.EXECUTE("select top 20  b.[i_User_Face],b.[i_User_NickName],(select [i_User_IncomeLevel_Style] from [i_User_IncomeLevel] where [i_User_IncomeNum]>=[i_User_IncomeLevel_MinNum] and [i_User_IncomeNum]<[i_User_IncomeLevel_MaxNum]) as 'iclass',sum(a.[i_User_Gift_SendRecord_GiftTotalPrice]) as [allpay],(select [i_Sys_Room_ID] from [i_Sys_Room] where [i_User_Gift_SendRecord_GUID]=[i_Sys_Room_AdminUserID]) as 'roomid' from [i_User_Gift_SendRecord] a join [i_User_Info] b on a.[i_User_Gift_SendRecord_GUID]=b.[i_User_ID] where DATEDIFF(D,i_User_Gift_SendRecord_Time,getdate())<31 group by b.[i_User_NickName],a.[i_User_Gift_SendRecord_GUID], b.[i_User_Face],[i_User_IncomeNum] order by [allpay] desc")
	Re="var TopListRe"&Request.QueryString("ac")&"=""{data1:["
	while (not RS.eof)
		if k>0 then Re=Re&","
		Re=Re&"{roomid:'"&RS("roomid")&"',face:'"&RS("i_User_Face")&"',nick:'"&RS("i_User_NickName")&"',iclass:'"&RS("iclass")&"'}"
		k=k+1
		RS.MoveNext
	Wend
	Re=Re&"],"
	RS_End
	k=0
	'1月内消费排行
	Set RS=DB_CONN.EXECUTE("select top 20  b.[i_User_Face],b.[i_User_NickName],sum(a.[i_User_ConsumeRecord_PayNum]) as [allpay],(select [i_Sys_Room_ID] from [i_Sys_Room] where [i_User_ID]=[i_Sys_Room_AdminUserID]) as 'roomid',(select [i_User_PaymentLevel_Style] from [i_User_PaymentLevel] where [i_User_PayNum]>=[i_User_PaymentLevel_MinNum] and [i_User_PayNum]<[i_User_PaymentLevel_MaxNum]) as 'iclass' from [i_User_ConsumeRecord] a join [i_User_Info] b on a.[i_User_ConsumeRecord_UID]=b.[i_User_ID] where DATEDIFF(D,i_User_ConsumeRecord_Time,getdate())<31 group by b.[i_User_NickName],b.[i_User_ID], b.[i_User_Face],b.[i_User_PayNum] order by allpay desc")
	Re=Re&"data2:["
	while (not RS.eof)
		if k>0 then Re=Re&","
		Re=Re&"{roomid:'"&RS("roomid")&"',face:'"&RS("i_User_Face")&"',nick:'"&RS("i_User_NickName")&"',iclass:'"&RS("iclass")&"'}"
		k=k+1
		RS.MoveNext
	Wend
	Re=Re&"],"
	RS_End
	k=0
	'1月内人气排行
	Set RS=DB_CONN.EXECUTE("select top 20 count(a.i_User_Attention_GUID) as [fansnum],[i_user_face],[i_user_nickname],(select [i_Sys_Room_ID] from [i_sys_room] where [i_Sys_Room_AdminUserID]=[i_User_Attention_GUID]) as [roomid],(select [i_User_IncomeLevel_Style] from [i_User_IncomeLevel] where [i_User_IncomeNum]>=[i_User_IncomeLevel_MinNum] and [i_User_IncomeNum]<[i_User_IncomeLevel_MaxNum]) as [iclass] from [i_User_Attention] a join [i_user_info] b on [i_User_Attention_GUID]=[i_User_ID] where DATEDIFF(D,i_User_Attention_Date,getdate())<31 group by [i_User_Attention_GUID],[i_user_face],[i_user_nickname],[i_User_IncomeNum] order by [fansnum] desc")
	Re=Re&"data3:["
	while (not RS.eof)
		if k>0 then Re=Re&","
		Re=Re&"{roomid:'"&RS("roomid")&"',face:'"&RS("i_User_Face")&"',nick:'"&RS("i_User_NickName")&"',iclass:'"&RS("iclass")&"',fansnum:'"&RS("fansnum")&"'}"
		k=k+1
		RS.MoveNext
	Wend
	Re=Re&"],CreatTime:'"&formatdate(now(),"1")&"'}"";"
	RS_End
	CreatFile "/d/js/TopMonth20.js",Re
end if

if Request.QueryString("ac")="Supper" then 
	RS_End
	'所有收入排行
	Set RS=DB_CONN.EXECUTE("select top 20  b.[i_User_Face],b.[i_User_NickName],(select [i_User_IncomeLevel_Style] from [i_User_IncomeLevel] where [i_User_IncomeNum]>=[i_User_IncomeLevel_MinNum] and [i_User_IncomeNum]<[i_User_IncomeLevel_MaxNum]) as 'iclass',sum(a.[i_User_Gift_SendRecord_GiftTotalPrice]) as [allpay],(select [i_Sys_Room_ID] from [i_Sys_Room] where [i_User_Gift_SendRecord_GUID]=[i_Sys_Room_AdminUserID]) as 'roomid' from [i_User_Gift_SendRecord] a join [i_User_Info] b on a.[i_User_Gift_SendRecord_GUID]=b.[i_User_ID]  group by b.[i_User_NickName], b.[i_User_Face],a.[i_User_Gift_SendRecord_GUID],[i_User_IncomeNum] order by [allpay] desc")
	Re="var TopListRe"&Request.QueryString("ac")&"=""{data1:["
	while (not RS.eof)
		if k>0 then Re=Re&","
		Re=Re&"{roomid:'"&RS("roomid")&"',face:'"&RS("i_User_Face")&"',nick:'"&RS("i_User_NickName")&"',iclass:'"&RS("iclass")&"'}"
		k=k+1
		RS.MoveNext
	Wend
	Re=Re&"],"
	RS_End
	k=0
	'所有消费排行
	Set RS=DB_CONN.EXECUTE("select top 20  b.[i_User_Face],b.[i_User_NickName],sum(a.[i_User_ConsumeRecord_PayNum]) as [allpay],(select [i_Sys_Room_ID] from [i_Sys_Room] where [i_User_ID]=[i_Sys_Room_AdminUserID]) as 'roomid',(select [i_User_PaymentLevel_Style] from [i_User_PaymentLevel] where [i_User_PayNum]>=[i_User_PaymentLevel_MinNum] and [i_User_PayNum]<[i_User_PaymentLevel_MaxNum]) as 'iclass' from [i_User_ConsumeRecord] a join [i_User_Info] b on a.[i_User_ConsumeRecord_UID]=b.[i_User_ID]  group by b.[i_User_NickName], b.[i_User_Face],b.[i_User_ID],b.[i_User_PayNum] order by allpay desc")
	Re=Re&"data2:["
	while (not RS.eof)
		if k>0 then Re=Re&","
		Re=Re&"{roomid:'"&RS("roomid")&"',face:'"&RS("i_User_Face")&"',nick:'"&RS("i_User_NickName")&"',iclass:'"&RS("iclass")&"'}"
		k=k+1
		RS.MoveNext
	Wend
	Re=Re&"],"
	RS_End
	k=0
	'人气排行
	Set RS=DB_CONN.EXECUTE("select top 20 count(a.i_User_Attention_GUID) as [fansnum],[i_user_face],[i_user_nickname],(select [i_Sys_Room_ID] from [i_sys_room] where [i_Sys_Room_AdminUserID]=[i_User_Attention_GUID]) as [roomid],(select [i_User_IncomeLevel_Style] from [i_User_IncomeLevel] where [i_User_IncomeNum]>=[i_User_IncomeLevel_MinNum] and [i_User_IncomeNum]<[i_User_IncomeLevel_MaxNum]) as [iclass] from [i_User_Attention] a join [i_user_info] b on [i_User_Attention_GUID]=[i_User_ID] group by [i_User_Attention_GUID],[i_user_face],[i_user_nickname],[i_User_IncomeNum] order by [fansnum] desc")
	Re=Re&"data3:["
	while (not RS.eof)
		if k>0 then Re=Re&","
		Re=Re&"{roomid:'"&RS("roomid")&"',face:'"&RS("i_User_Face")&"',nick:'"&RS("i_User_NickName")&"',iclass:'"&RS("iclass")&"',fansnum:'"&RS("fansnum")&"'}"
		k=k+1
		RS.MoveNext
	Wend
	Re=Re&"],CreatTime:'"&formatdate(now(),"1")&"'}"";"
	RS_End
	CreatFile "/d/js/TopSupper20.js",Re
end if






%>