38 lines
1.2 KiB
Transact-SQL
38 lines
1.2 KiB
Transact-SQL
CREATE PROCEDURE [dbo].[up_read_uni_account_info]
|
|
@auth_id [uniqueidentifier]
|
|
|
|
as
|
|
set nocount on
|
|
set transaction isolation level read uncommitted
|
|
|
|
declare @get_AuthID [uniqueidentifier]
|
|
declare @diff_min int
|
|
declare @TotalOff int
|
|
set @diff_min = 0
|
|
set @TotalOff = 0
|
|
|
|
select @get_AuthID = AuthID from UniAccountInfo with (READUNCOMMITTED) where AuthID = @auth_id;
|
|
if( @get_AuthID IS NULL )
|
|
begin
|
|
insert into UniAccountInfo values( @auth_id, 0,0,4,0,0, getdate() );
|
|
end
|
|
|
|
select @diff_min = DATEDIFF ( mi , LastLogout, getdate() ) from UniAccountInfo with (READUNCOMMITTED) where AuthID = @auth_id
|
|
update UniAccountInfo set Accruable_OffTime = Accruable_OffTime + @diff_min, LastLogout = getdate()where AuthID = @auth_id
|
|
|
|
select @TotalOff = Accruable_OffTime from UniAccountInfo with (READUNCOMMITTED) where AuthID = @auth_id
|
|
if( @TotalOff > 300 )
|
|
begin
|
|
update UniAccountInfo set Accruable_PlayTime = 0, Accruable_OffTime = 0, LastLogout = getdate() where AuthID = @auth_id
|
|
end
|
|
|
|
select
|
|
AuthID,
|
|
AccountStorage_Count,
|
|
AccountStorage_Gold,
|
|
Use_CharacterSlot,
|
|
Accruable_PlayTime
|
|
|
|
from dbo.UniAccountInfo with (nolock) where AuthID = @auth_id
|
|
|
|
return @@error
|