|
发表于 2017-11-16 21:20:55
|
显示全部楼层
CREATE PROCEDURE RMS_USEARTIFICIALMYSTERYPILL
@GameID varchar(14),
@WindowKind int,
@WindowIndex int
AS
set nocount on
declare @RemoveMysteryPillError int, @IncreaseBonusError int, @InsertLogError int
set @RemoveMysteryPillError = 1
set @IncreaseBonusError = 1
set @InsertLogError = 1
begin transaction
delete tblSpecialItem1 where ID in (select top 1 ID from tblSpecialItem1 where ItemKind = 6 AND ItemIndex = 74 AND Position = 1 AND GameID = @GameID AND WindowKind = @WindowKind AND WindowIndex = @WindowIndex)
if @@ROWCOUNT > 0 and @@ERROR = 0
begin
set @RemoveMysteryPillError = 0
end
update tblGameID1 set Bonus2 = Bonus2 + 2, STotalBonus = STotalBonus + 2 where GameID = @GameID
set @IncreaseBonusError = @@ERROR
declare @STotalBonus int
set @STotalBonus = 0
select @STotalBonus = STotalBonus from tblGameID1 where GameID = @GameID
insert tblBonus2Log1 (GameID, STotalBonus, Kind) values (@GameID, @STotalBonus, 4)
set @InsertLogError = @@ERROR
if @RemoveMysteryPillError = 0 AND @IncreaseBonusError = 0 AND @InsertLogError = 0
begin
commit transaction
end
else
begin
rollback transaction
end
GO |
|