Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- USE [MuOnline]
- GO
- /****** Object: StoredProcedure [dbo].[WZ_CONNECT_MEMB] Script Date: 06/14/2018 20:33:25 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --
- -- Definition for stored procedure WZ_CONNECT_MEMB :
- --
- ALTER PROCEDURE [dbo].[WZ_CONNECT_MEMB]
- @memb___id varchar(10),
- @ServerName varchar(50),
- @IP varchar(20)
- AS
- Begin
- set nocount on
- Declare @find_id varchar(10)
- Declare @ConnectStat tinyint
- Declare @disconnect_time varchar(20)
- Declare @vip_till_time varchar(20)
- Declare @vip_ends_at varchar(20)
- Set @find_id = 'NOT'
- Set @disconnect_time = 'NOT'
- Set @vip_till_time = 'NOT'
- Set @vip_ends_at = 'NOT'
- Set @ConnectStat = 1 -- ?? ?? ? 1 = ??, 0 = ??X
- select @find_id = S.memb___id from MEMB_STAT S INNER JOIN MEMB_INFO I ON S.memb___id = I.memb___id
- where I.memb___id = @memb___id
- if( @find_id = 'NOT' )
- begin
- insert into MEMB_STAT (memb___id,ConnectStat,ServerName,IP,ConnectTM, DisConnectTM)
- values(@memb___id, @ConnectStat, @ServerName, @IP, getdate(), getdate())
- end
- else
- update MEMB_STAT set ConnectStat = @ConnectStat,
- ServerName = @ServerName,IP = @IP,
- ConnectTM = getdate()
- where memb___id = @memb___id
- select @disconnect_time = DisConnectTM from MEMB_STAT where memb___id = @memb___id
- if ( @disconnect_time != 'NOT' )
- begin
- SELECT @vip_till_time = DATEADD(mi, (DATEDIFF(mi, @disconnect_time, getdate()) / 10), getdate())
- SELECT @vip_ends_at = AccountExpireDate FROM MEMB_INFO WHERE memb___id = @memb___id
- if ((DATEDIFF(mi, @disconnect_time, getdate()) / 15) > 5)
- begin
- if (DATEDIFF(mi, @vip_till_time, @vip_ends_at) > 0)
- begin
- SELECT @vip_till_time = DATEADD(mi, (DATEDIFF(mi, @disconnect_time, getdate()) / 10), @vip_ends_at)
- UPDATE MEMB_INFO SET AccountLevel = 1,AccountExpireDate = @vip_till_time WHERE memb___id = @memb___id
- end
- else
- UPDATE MEMB_INFO SET AccountLevel = 1,AccountExpireDate = @vip_till_time WHERE memb___id = @memb___id
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement