平常工作最麻烦的就是游戏玩家的银子丢了之后,我要判断是他断线丢的还是输给别人他自己搞错了。
虽然还没有好的思路,还是一直打算写个方便点的程序,节约劳动,今天有空,就写了下,虽然效果还不太好,不过功能上大体满足了。
代码如下:
--用户银子分析
--Designed by whbo
--Designed at 2005-10-19
--Modified by
--Modified at
Declare @intWantedamount int
Declare @intUserID int,@intTax real
Declare @BgnDateTime DATETIME,@EndDateTime DATETIME
Declare @chvLoginName varchar(64)
set @chvLoginName='liuyun512' --用户名 <1>
set @intUserID=10322057 --用户ID
if @chvLoginName<>''
select @intUserid=[UserID] from UserCenter.dbo.AllUser where [LoginName]=@chvLoginName
set @intWantedamount=0 --丢失银子
set @BgnDateTime='2005-10-19' --开始时间 <2>
set @EndDateTime='2005-10-19 20:00:00' --终止时间
if @intWantedAmount=0
set @intWantedamount=40000 -- <3>
/*
目前的税收说明:
0.03-----------苏州麻将:(觅渡桥 : 10062) ; (山塘街 :10071)
南京麻将:(新街口(300倍):10080);
关牌 :(万年桥(32倍) :10067) ; (血战到底(32倍):10073)
0.05-----------包分 :(接驾桥(150倍):10034) ; (金鸡湖(150倍) :10063) ;网师园(150倍) : 10055
0.00-----------其他游戏无税收
*/
--从下面选择一种税收
set @intTax=0.97
--set @intTax=0.95
if @BgnDateTime=''
set @BgnDateTime=convert(varchar(10),GetDate())
if @EndDateTime=''
set @EndDateTime=GetDate()
select userid [用户ID],wantedamount [丢失银子],convert(int,wantedamount*@inttax) as [税后银子],sourcename [游戏服务器编号],remark [游戏服务器],writetime [时间] from moneylog where userid=@intUserID and writetime >@BgnDateTime and wantedamount<-@intWantedamount
and modename not in ('管理员','保险箱') order by writetime
set @BgnDateTime='2005-10-19 13:33:00' --<S1>
set @EndDateTime='2005-10-19 19:15:00' --<S2>
Declare @chvSourceName table(SourceName varchar(20))
insert into @chvSourceName select sourcename from moneylog where userid=@intUserID and writetime >@BgnDateTime and wantedamount<-@intWantedamount order by writetime
select a.userid [用户ID],a.wantedamount [获得银子],a.sourcename [游戏服务器编号],a.remark [游戏服务器],a.writetime [时间] from moneylog a
inner join @chvSourceName b on a.sourcename=b.sourcename and a.wantedamount>@intWantedamount and a.writetime between @BgnDateTime and @EndDateTime
order by a.writetime