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

<%
Auto_Login2()

if Request.QueryString("ac")="SendGift" then 
	dim RGuid,Gunick,RGunick,GiftID,GiftNum,StoreMoney,GiftPrice,GiftSumParice,GiftName
	if Request.QueryString("guid")="" then REND
	if not IsNumeric(Request.QueryString("guid")) then REND
	if Request.QueryString("giftid")="" then REND
	if not IsNumeric(Request.QueryString("giftid")) then REND
	if Request.QueryString("giftnum")="" then REND
	if not IsNumeric(Request.QueryString("giftnum")) then REND
	RGuid = Request.QueryString("guid")
	GiftID = Request.QueryString("giftid")
	GiftNum = Request.QueryString("giftnum")
	GiftName = GetGiftInfo(GiftID,"i_User_Gift_Name")
	if Session(Session_UserID_Arg)="" then RW "SgRe='操作超时请重新登录！';":Rend
	RS_End
	RGunick = tGUInfo(RGuid,"i_User_NickName")
	Gunick = Session(Session_UserNickName_Arg)
	RS_End
	StoreMoney =  Clng(GUInfo("i_User_Money"))
	RS_End
	GiftPrice = GetGiftInfo(GiftID,"i_User_Gift_Price")
	if GiftPrice=false then RW "SgRe='您要赠送的礼物,系统记录中不存在！';":Rend
	GiftSumParice = Clng(GiftPrice)*Clng(GiftNum)
	'RW StoreMoney&"--"&GiftSumParice
	if StoreMoney<GiftSumParice then RW "SgRe='余额不足，请充值！';":Rend
	RS_End
	RS.Open "select * from [i_User_Info] where [i_User_ID]="&Session(Session_UserID_Arg), DB_CONN , 1 , 3
		RS("i_User_Money")=StoreMoney-GiftSumParice
		RS("i_User_PayNum")=Clng(RS("i_User_PayNum"))+GiftSumParice
		'RS("i_User_Gift_SendRecord_GiftTotalPrice")=GiftSumParice
		RS.Update()
		LogSnedGift RGuid,GiftID,GiftNum,GiftSumParice
		RecordConsume 0,GiftSumParice*CDbl(SysConfig("i_Sys_Config_ExtractionPercent")),Gunick&" 赠送 "&GiftNum&" 个 "&Trim(GiftName)&"，收入"&Trim(Cstr(GiftSumParice*CDbl(SysConfig("i_Sys_Config_ExtractionPercent")))),RGuid
		RecordConsume GiftSumParice,0,"向 "&RGunick&"（"&RGuid&"） 赠送 "&GiftNum&" 个 "&Trim(GiftName)&"，支出"&Trim(Cstr(GiftSumParice)),Session(Session_UserID_Arg)
		RW "SgRe=true;SgShowType="&GetGiftInfo(GiftID,"i_User_Gift_ShowType")&";SgPlayTime="&GetGiftInfo(GiftID,"i_User_Gift_PlayTime")&"000;SgSwfUrl='"&GetGiftInfo(GiftID,"i_User_Gift_SwfUrl")&"';Money="&StoreMoney-GiftSumParice&";"
	RS_End
	Rend
end if

%>