Code:
USE [ACCOUNT_DBF]
GO
/****** Object: StoredProcedure [dbo].[usp_BAN_UNBAN] Script Date: 02/19/2010 10:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER proc [dbo].[usp_BAN_UNBAN]
@section int, -- 1 : BAN, 2 : UNBAN
@account varchar(32),
@gPotatoID int, -- Not Used
@reason varchar(500),
@length char(8)
as
/*
Created By soondai@aeonsoft.co.kr
Create Date : 2008-01-24
@section => 1 : BAN, 2 : UNBAN
@gPotatoID => Not Used Parameter for Flyff
@length => length of ban
*/
set nocount on
set xact_abort on
-- Check Account
if not exists (select * from ACCOUNT_TBL where account = @account)
begin
select -1 -- The account does not exist
end
else
begin
/*****************************************************
BAN
*****************************************************/
if (@section = 1)
begin
update ACCOUNT_TBL_DETAIL
set BlockTime = @length, WebTime = '21000101'
where account = @account
-- LOGGING
insert into TBL_LOG_BLOCK_ACCOUNT
(account, code1, code2, code3, old_block_day, old_web_day, block_day, web_day, input_id, input_day, reason)
values (@account, 0, 0, 3, '', '', @length, @length, 'Ban', getdate(), @reason)
-- return results
if @@error <> 0
begin
select 'BAN Error : ' + @@error -- Error
end
else
begin
select 1 -- Success
end
end
/*****************************************************
UNBAN
*****************************************************/
if (@section = 2)
begin
update ACCOUNT_TBL_DETAIL
set BlockTime = convert(char(8), dateadd(d, -1, getdate()), 112), WebTime = convert(char(8), dateadd(d, -1, getdate()), 112)
where account = @account
-- LOGGING
update TBL_LOG_BLOCK_ACCOUNT
set old_block_day = block_day, old_web_day = web_day
, r_web_day = convert(char(8), dateadd(d, -1, getdate()), 112), r_block_day = convert(char(8), dateadd(d, -1, getdate()), 112)
, r_input_day = getdate(), r_reason = @reason, r_input_id = '1'
where account = @account
and num = (select max(num) from TBL_LOG_BLOCK_ACCOUNT where account = @account)
-- return results
if @@error <> 0
begin
select 'UNBAN Error : ' + @@error -- Error
end
else
begin
select 1 -- Success
end
end
end