Solo usuarios registrados pueden comentar y agradecer, Logueate o Registrate

Autor Topic: Problema cash Shop Nametech  (Visto 1747 veces)

0 Miembros and 1 Guest are viewing this topic.

Offline Odisk Posteado: December 26, 2017, 04:55:27 PM | Modificado: December 28, 2017, 07:05:12 PM by RASTAA

  • Colaborador
  • 0 puntos por ventas
  • *
  • Rank: Puto amo
  • Posts: 879
  • Gracias recibida: 12367
  • pr
Hola chicos

tengo una problema los files de nametech compro un seal da 0 exp 0 drop y y al desconectarme y volver a conectarme no aparece el seal que compre alguna forma de arreglar eso ? gracias ante mano

img



one day

Gracias:


Offline conejowolf #1 Posteado: December 27, 2017, 02:19:58 PM

  • 0 puntos por ventas
  • *
  • Rank: Principiante
  • Posts: 0
  • Gracias recibida: 2234
  • at
@Odisk 
Ningun Source amigo. Yo en su momento tambien renegue con esto, y encontre la solucion..

Te paso dos querys, se que una es la que lo arregla , pero no me acuerdo bien cual es.
Por las dudas corre una sola, probas, y si no anda probas la otra si?

Code: [Select]
USE MuOnline
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[T_PeriodItem_Data]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[T_PeriodItem_Data]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[T_CashShop_LOG]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[T_CashShop_LOG]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[WZ_PeriodItemDelete]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[WZ_PeriodItemDelete]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[WZ_PeriodItemInsert]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[WZ_PeriodItemInsert]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[WZ_PeriodItemSelect]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[WZ_PeriodItemSelect]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[WZ_PeriodItemUpdate]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[WZ_PeriodItemUpdate]
GO

CREATE TABLE [dbo].[T_PeriodItem_Data](
[memb_guid] [int] NOT NULL,
[memb__char] [varchar](10) NOT NULL,
[ItemCode] [int] NOT NULL,
[ItemEffect1] [int] NOT NULL,
[ItemEffect2] [int] NOT NULL,
[UseTime] [int] NOT NULL,
[ExpireDate] [datetime] NOT NULL
) ON [PRIMARY]
GO

CREATE TABLE [T_CashShop_LOG] (
[AccountID] [varchar] (10) NULL ,
[Character] [varchar] (10) NULL ,
[ItemType] [int] NULL ,
[ItemIndex] [int] NULL ,
[Level] [int] NULL ,
[Skill] [int] NULL ,
[Luck] [int] NULL ,
[JoL] [int] NULL ,
[ExcOp] [int] NULL ,
[Dur] [int] NULL ,
[Serial] [varchar] (8) NULL ,
[DateBuy] [char] (10) NULL ,
[TimeBuy] [char] (8) NULL
) ON [PRIMARY]
GO

SET NOCOUNT OFF

GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO

/*
1) Procedure : WZ_PeriodItemDelete
2) Data : 29/01/2009
3) Revisão : 3.1
4) Detalhes: Corrigido bug ao executar a procedure através do dataserver
4) Descrição:
Remove o item de período quando deleta o personagem

*/

CREATE PROCEDURE [dbo].[WZ_PeriodItemDelete]
@memb_guid int,
@memb__char varchar(10)
AS
BEGIN
SET NOCOUNT ON
Declare @Result int
Set @Result = 1

Begin Transaction

DELETE FROM T_PeriodItem_Data WHERE memb__char = @memb__char and memb_guid = @memb_guid

If @@Error <> 0
begin
Set @Result = 0 -- DB Error
goto PROBLEM
end
else goto SUCESS
PROBLEM:
rollback transaction

SUCESS:
commit transaction

-- °á°ú¸¦ RETURN
SELECT @Result As Result
SET NOCOUNT OFF

END

SET NOCOUNT OFF

GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO

/*
1) Procedure : WZ_PeriodItemInsert
2) Data : 25/11/2008
3) Revisão : 3.0
4) Detalhes: Corrigido o bug ao inserir valores no banco de dados
4) Descrição:
Insere o item de período no personagem
OBS: Logo após a compra do item, os valores retornados para o gameserver
não são corretos! Bug Próprio da WebZen

*/

CREATE PROCEDURE [dbo].[WZ_PeriodItemInsert]
@memb_guid int,
@memb__char varchar(10),
@ItemCode int,
@ItemEffect1 int,
@ItemEffect2 int,
@ItemUseTime int,
@DateTime varchar(20)
AS
BEGIN
BEGIN TRANSACTION
SET NOCOUNT ON

DECLARE @CurUseTime int
SET @CurUseTime = 0

IF EXISTS(SELECT memb_guid FROM T_PeriodItem_Data WITH (READUNCOMMITTED)
WHERE memb_guid = @memb_guid AND memb__char = @memb__char)
BEGIN
SELECT @CurUseTime = UseTime FROM T_PeriodItem_Data WHERE memb_guid = @memb_guid AND memb__char = @memb__char

IF @CurUseTime <> 0
BEGIN
SELECT 2 AS QueryResult
END
ELSE
BEGIN
UPDATE T_PeriodItem_Data SET
ItemCode = @ItemCode,
ItemEffect1 = @ItemEffect1,
ItemEffect2 = @ItemEffect2,
UseTime = @ItemUseTime,
ExpireDate = @DateTime
WHERE memb_guid = @memb_guid AND memb__char = @memb__char
SELECT 0 AS QueryResult
END
END
ELSE
BEGIN
INSERT INTO T_PeriodItem_Data (memb_guid,memb__char,ItemCode,ItemEffect1,ItemEffect2,UseTime,ExpireDate) VALUES
(@memb_guid,@memb__char,@ItemCode,@ItemEffect1,@ItemEffect2,@ItemUseTime,@DateTime)
SELECT 0 AS QueryResult
END

IF(@@Error <> 0 )
ROLLBACK TRANSACTION
ELSE
COMMIT TRANSACTION
END

SET NOCOUNT OFF

GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO

/*
1) Procedure : WZ_PeriodItemSelect
2) Data : 09/11/2008
3) Revisão : 4.0
4) Detalhes: Corrigido o bug ao selecionar valores e colunas no banco de dados
4) Descrição:
Seleciona o item de período do personagem

*/

CREATE PROCEDURE [dbo].[WZ_PeriodItemSelect]
@memb_guid int,
@memb__char varchar(10)
AS
BEGIN
BEGIN TRANSACTION
SET NOCOUNT ON

DECLARE @iCount int
DECLARE @ExpireDate datetime
DECLARE @ItemCode int
DECLARE @ItemEffect1 int
DECLARE @ItemEffect2 int
DECLARE @iLeftTime int
SET @iCount = 0
SET @iLeftTime = 0

SELECT @iCount = count(*) FROM T_PeriodItem_Data WHERE memb_guid = @memb_guid AND memb__char = @memb__char

IF @iCount = 0
BEGIN
SELECT 0
END
ELSE IF @iCount <> 1
BEGIN
SELECT -1
END
ELSE
BEGIN
SELECT @ItemCode = ItemCode,@ItemEffect1 = ItemEffect1,@ItemEffect2 = ItemEffect2,@ExpireDate = ExpireDate FROM T_PeriodItem_Data WHERE memb__char = @memb__char
SET @iLeftTime = datediff(minute,getdate(),@ExpireDate)

IF @iLeftTime > 0
BEGIN
SELECT memb_guid,
ItemCode,
ItemEffect1,
ItemEffect2,
ExpireDate,
@iLeftTime FROM T_PeriodItem_Data where memb__char = @memb__char

END
ELSE
BEGIN
UPDATE T_PeriodItem_Data SET UseTime = 0 WHERE memb__char = @memb__char
SELECT -2
END
END

IF(@@Error <> 0 )
ROLLBACK TRANSACTION
ELSE
COMMIT TRANSACTION
END

SET NOCOUNT OFF

GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO

/*
1) Procedure : WZ_PeriodItemUpdate
2) Data : 09/11/2008
3) Revisão : 1.0
4) Detalhes:
4) Descrição:
Atualiza o tempo do item de período no personagem

*/

CREATE PROCEDURE [dbo].[WZ_PeriodItemUpdate]
@memb_guid int,
@memb__char varchar(10),
@ItemCode int,
@ItemUseTime int,
@ItemLeftTime int
AS
BEGIN
BEGIN TRANSACTION
SET NOCOUNT ON
DECLARE @dbLeftTime int
DECLARE @DateExpire datetime
DECLARE @iLeftTime int

IF EXISTS(SELECT memb_guid FROM T_PeriodItem_Data WHERE memb_guid = @memb_guid AND memb__char = @memb__char AND ItemCode = @ItemCode)
BEGIN
SELECT @DateExpire = ExpireDate FROM T_PeriodItem_Data WHERE memb__char = @memb__char
SET @iLeftTime = datediff(minute,getdate(),@DateExpire)

IF @iLeftTime > 0
BEGIN
UPDATE T_PeriodItem_Data SET
UseTime = @iLeftTime WHERE memb__char = @memb__char
SELECT 1
END
ELSE
BEGIN
UPDATE T_PeriodItem_Data SET
UseTime = 0 WHERE memb__char = @memb__char
SELECT 3
END
END
ELSE
BEGIN
SELECT 0
END

IF(@@Error <> 0 )
ROLLBACK TRANSACTION
ELSE
COMMIT TRANSACTION
END


LA OTRA

Code: [Select]


CREATE TABLE [T_PeriodItemInfo] (
[PeriodIndex] [int] IDENTITY (1, 1) NOT NULL ,
[UserGuid] [int] NOT NULL ,
[CharacterName] [char] (10) COLLATE Korean_Wansung_CI_AS NOT NULL ,
[ItemCode] [int] NOT NULL ,
[EffectType1] [tinyint] NOT NULL ,
[EffectType2] [tinyint] NULL ,
[UsedTime] [int] NOT NULL CONSTRAINT [DF_T_PeriodItemInfo_UsedTime] DEFAULT (0),
[LeftTime] [int] NOT NULL ,
[BuyDate] [smalldatetime] NOT NULL ,
[ExpireDate] [smalldatetime] NOT NULL ,
[UsedInfo] [tinyint] NOT NULL CONSTRAINT [DF_T_PeriodItemInfo_UsedInfo] DEFAULT (0),
[OptionType] [tinyint] NOT NULL CONSTRAINT [DF_T_PeriodItemInfo_OptionType] DEFAULT (2)
) ON [PRIMARY]
GO


SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO


CREATE PROCEDURE dbo.WZ_PeriodItemDelete
@UserGuid int,
@CharacterName varchar(10)
AS BEGIN
DECLARE @ErrorCode int
DECLARE @ItemInfoCount int

SET @ErrorCode = 0
SET @ItemInfoCount = 0

SET nocount on

SELECT @ItemInfoCount = COUNT(*) FROM T_PeriodItemInfo where UserGuid = @UserGuid AND CharacterName = @CharacterName

IF( @ItemInfoCount < 1 )
BEGIN
SET @ErrorCode = 1
END

IF( @ErrorCode <> 1 )
BEGIN
UPDATE T_PeriodItemInfo SET UsedInfo = 0 WHERE UserGuid = @UserGuid AND CharacterName = @CharacterName
END

SELECT @ErrorCode

SET nocount off
END




GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO


CREATE procedure dbo.WZ_PeriodItemInsert
@UserGuid int,
@CharacterName varchar(10),
@ItemCode int,
@OptionType tinyint,
@EffectType1 tinyint,
@EffectType2 tinyint,
@TotalUsePeriod int,
@ExpireDate varchar(20)
as
BEGIN
DECLARE @ErrorCode int
DECLARE @PeriodItemIndex int

SET @ErrorCode = 0
SET @PeriodItemIndex = 0

SET XACT_ABORT ON
Set nocount on
begin transaction

-- OptionType? ?? ???? ???? ??? ????.
SELECT  @PeriodItemIndex = PeriodIndex FROM T_PeriodItemInfo WHERE UserGuid = @UserGuid AND CharacterName = @CharacterName AND OptionType = @OptionType AND UsedInfo = 1

IF ( @PeriodItemIndex != 0 )
BEGIN
UPDATE T_PeriodItemInfo SET UsedInfo = 0 WHERE UserGuid = @UserGuid AND CharacterName = @CharacterName AND OptionType = @OptionType AND UsedInfo = 1
END

INSERT INTO T_PeriodItemInfo (UserGuid, CharacterName, ItemCode, OptionType, EffectType1, EffectType2, LeftTime, BuyDate, ExpireDate, UsedInfo) VALUES
( @UserGuid, @CharacterName, @ItemCode, @OptionType, @EffectType1, @EffectType2, @TotalUsePeriod, GETDATE(), @ExpireDate, 1 )
IF( @@Error <> 0 )
BEGIN
SET @ErrorCode = 2
END

IF ( @ErrorCode  <> 0 )
rollback transaction
ELSE
commit transaction

SELECT @ErrorCode

Set nocount off
SET XACT_ABORT OFF
END




GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO


CREATE procedure dbo.WZ_PeriodItemSelect
@UserGuid int,
@CharacterName varchar(10)
as
BEGIN
DECLARE @ErrorCode int
DECLARE @ItemInfoCount int
DECLARE @PeriodIndex int
DECLARE @ExpireDate smalldatetime
DECLARE @UsedInfo tinyint

SET @PeriodIndex = 0
SET @ErrorCode = 0
SET @ItemInfoCount = 0
SET @UsedInfo = 0

Set nocount on

-- ?? ??? ?? ???? ??? ?? ???.
DECLARE CUR CURSOR FOR SELECT [PeriodIndex], [ExpireDate], [UsedInfo]  FROM T_PeriodItemInfo WHERE UserGuid = @UserGuid AND CharacterName = @CharacterName AND UsedInfo = 1 FOR UPDATE
OPEN CUR
FETCH NEXT FROM CUR INTO @PeriodIndex, @ExpireDate, @UsedInfo
WHILE( @@fetch_status <> -1 )
BEGIN
IF( @@fetch_status <> -2 )
BEGIN
IF( @ExpireDate < GetDate() )
BEGIN
UPDATE T_PeriodItemInfo SET UsedInfo = 0 WHERE PeriodIndex = @PeriodIndex
END
END
FETCH NEXT FROM CUR INTO @PeriodIndex, @ExpireDate, @UsedInfo
END

-- ??? ?? ??? ?? ???? ??????.

SELECT *, DATEDIFF( minute, BuyDate, GETDATE() ) AS UsedMinutes, DATEDIFF( minute, GETDATE(), ExpireDate ) AS LeftMinutes FROM T_PeriodItemInfo where UserGuid = @UserGuid AND CharacterName = @CharacterName AND UsedInfo = 1
--SELECT * FROM T_PeriodItemInfo where UserGuid = @UserGuid AND CharacterName = @CharacterName AND UsedInfo = 1
IF( @@Error <> 0 )
BEGIN
SET @ErrorCode = -1
END

CLOSE CUR
DEALLOCATE CUR

Set nocount off
END




GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO


CREATE procedure dbo.WZ_PeriodItemUpdate
@UserGuid int,
@CharacterName varchar(10),
@ItemCode int,
@UsedTime int,
@LeftTime int
as
BEGIN
DECLARE @ErrorCode int
DECLARE @ItemInfoCount int
DECLARE @RetLeftTime int

SET @ErrorCode = 0
SET @ItemInfoCount = 0
SET @RetLeftTime = 0

SET XACT_ABORT ON

Set nocount on

begin transaction

SELECT @ItemInfoCount = COUNT(*) FROM T_PeriodItemInfo where UserGuid = @UserGuid AND CharacterName = @CharacterName AND UsedInfo = 1

IF( @ItemInfoCount <> 1 )
BEGIN
SET @ErrorCode = 1
END
ELSE
BEGIN
UPDATE T_PeriodItemInfo SET UsedTime = UsedTime + @UsedTime, LeftTime = @LeftTime WHERE UserGuid = @UserGuid AND CharacterName = @CharacterName AND ItemCode = @ItemCode AND UsedInfo = 1
IF( @@Error <> 0 )
BEGIN
SET @ErrorCode = 2
END
END

SELECT @RetLeftTime = LeftTime FROM T_PeriodItemInfo where UserGuid = @UserGuid AND CharacterName = @CharacterName AND ItemCode = @ItemCode AND UsedInfo = 1
IF ( @RetLeftTime <= 0 )
BEGIN
UPDATE T_PeriodItemInfo SET UsedInfo = 0, LeftTime = 0 WHERE UserGuid = @UserGuid AND CharacterName = @CharacterName AND ItemCode = @ItemCode AND UsedInfo = 1
SET @ErrorCode = 3
END

IF ( @ErrorCode  <> 0  AND @ErrorCode <> 3 )
rollback transaction
ELSE
commit transaction

select @ErrorCode

Set nocount off
SET XACT_ABORT OFF
END




GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO

[code]

salu8


No se crear cosas, no soy PROGRAMADOR.
Se romper las cosas, empezando a ser CRACKER

Offline Odisk #2 Posteado: December 27, 2017, 04:47:04 PM

  • Colaborador
  • 0 puntos por ventas
  • *
  • Rank: Puto amo
  • Posts: 879
  • Gracias recibida: 12367
  • pr
@Odisk 
Ningun Source amigo. Yo en su momento tambien renegue con esto, y encontre la solucion..

Te paso dos querys, se que una es la que lo arregla , pero no me acuerdo bien cual es.
Por las dudas corre una sola, probas, y si no anda probas la otra si?

Code: [Select]
USE MuOnline
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[T_PeriodItem_Data]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[T_PeriodItem_Data]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[T_CashShop_LOG]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[T_CashShop_LOG]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[WZ_PeriodItemDelete]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[WZ_PeriodItemDelete]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[WZ_PeriodItemInsert]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[WZ_PeriodItemInsert]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[WZ_PeriodItemSelect]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[WZ_PeriodItemSelect]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[WZ_PeriodItemUpdate]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[WZ_PeriodItemUpdate]
GO

CREATE TABLE [dbo].[T_PeriodItem_Data](
[memb_guid] [int] NOT NULL,
[memb__char] [varchar](10) NOT NULL,
[ItemCode] [int] NOT NULL,
[ItemEffect1] [int] NOT NULL,
[ItemEffect2] [int] NOT NULL,
[UseTime] [int] NOT NULL,
[ExpireDate] [datetime] NOT NULL
) ON [PRIMARY]
GO

CREATE TABLE [T_CashShop_LOG] (
[AccountID] [varchar] (10) NULL ,
[Character] [varchar] (10) NULL ,
[ItemType] [int] NULL ,
[ItemIndex] [int] NULL ,
[Level] [int] NULL ,
[Skill] [int] NULL ,
[Luck] [int] NULL ,
[JoL] [int] NULL ,
[ExcOp] [int] NULL ,
[Dur] [int] NULL ,
[Serial] [varchar] (8) NULL ,
[DateBuy] [char] (10) NULL ,
[TimeBuy] [char] (8) NULL
) ON [PRIMARY]
GO

SET NOCOUNT OFF

GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO

/*
1) Procedure : WZ_PeriodItemDelete
2) Data : 29/01/2009
3) Revisão : 3.1
4) Detalhes: Corrigido bug ao executar a procedure através do dataserver
4) Descrição:
Remove o item de período quando deleta o personagem

*/

CREATE PROCEDURE [dbo].[WZ_PeriodItemDelete]
@memb_guid int,
@memb__char varchar(10)
AS
BEGIN
SET NOCOUNT ON
Declare @Result int
Set @Result = 1

Begin Transaction

DELETE FROM T_PeriodItem_Data WHERE memb__char = @memb__char and memb_guid = @memb_guid

If @@Error <> 0
begin
Set @Result = 0 -- DB Error
goto PROBLEM
end
else goto SUCESS
PROBLEM:
rollback transaction

SUCESS:
commit transaction

-- °á°ú¸¦ RETURN
SELECT @Result As Result
SET NOCOUNT OFF

END

SET NOCOUNT OFF

GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO

/*
1) Procedure : WZ_PeriodItemInsert
2) Data : 25/11/2008
3) Revisão : 3.0
4) Detalhes: Corrigido o bug ao inserir valores no banco de dados
4) Descrição:
Insere o item de período no personagem
OBS: Logo após a compra do item, os valores retornados para o gameserver
não são corretos! Bug Próprio da WebZen

*/

CREATE PROCEDURE [dbo].[WZ_PeriodItemInsert]
@memb_guid int,
@memb__char varchar(10),
@ItemCode int,
@ItemEffect1 int,
@ItemEffect2 int,
@ItemUseTime int,
@DateTime varchar(20)
AS
BEGIN
BEGIN TRANSACTION
SET NOCOUNT ON

DECLARE @CurUseTime int
SET @CurUseTime = 0

IF EXISTS(SELECT memb_guid FROM T_PeriodItem_Data WITH (READUNCOMMITTED)
WHERE memb_guid = @memb_guid AND memb__char = @memb__char)
BEGIN
SELECT @CurUseTime = UseTime FROM T_PeriodItem_Data WHERE memb_guid = @memb_guid AND memb__char = @memb__char

IF @CurUseTime <> 0
BEGIN
SELECT 2 AS QueryResult
END
ELSE
BEGIN
UPDATE T_PeriodItem_Data SET
ItemCode = @ItemCode,
ItemEffect1 = @ItemEffect1,
ItemEffect2 = @ItemEffect2,
UseTime = @ItemUseTime,
ExpireDate = @DateTime
WHERE memb_guid = @memb_guid AND memb__char = @memb__char
SELECT 0 AS QueryResult
END
END
ELSE
BEGIN
INSERT INTO T_PeriodItem_Data (memb_guid,memb__char,ItemCode,ItemEffect1,ItemEffect2,UseTime,ExpireDate) VALUES
(@memb_guid,@memb__char,@ItemCode,@ItemEffect1,@ItemEffect2,@ItemUseTime,@DateTime)
SELECT 0 AS QueryResult
END

IF(@@Error <> 0 )
ROLLBACK TRANSACTION
ELSE
COMMIT TRANSACTION
END

SET NOCOUNT OFF

GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO

/*
1) Procedure : WZ_PeriodItemSelect
2) Data : 09/11/2008
3) Revisão : 4.0
4) Detalhes: Corrigido o bug ao selecionar valores e colunas no banco de dados
4) Descrição:
Seleciona o item de período do personagem

*/

CREATE PROCEDURE [dbo].[WZ_PeriodItemSelect]
@memb_guid int,
@memb__char varchar(10)
AS
BEGIN
BEGIN TRANSACTION
SET NOCOUNT ON

DECLARE @iCount int
DECLARE @ExpireDate datetime
DECLARE @ItemCode int
DECLARE @ItemEffect1 int
DECLARE @ItemEffect2 int
DECLARE @iLeftTime int
SET @iCount = 0
SET @iLeftTime = 0

SELECT @iCount = count(*) FROM T_PeriodItem_Data WHERE memb_guid = @memb_guid AND memb__char = @memb__char

IF @iCount = 0
BEGIN
SELECT 0
END
ELSE IF @iCount <> 1
BEGIN
SELECT -1
END
ELSE
BEGIN
SELECT @ItemCode = ItemCode,@ItemEffect1 = ItemEffect1,@ItemEffect2 = ItemEffect2,@ExpireDate = ExpireDate FROM T_PeriodItem_Data WHERE memb__char = @memb__char
SET @iLeftTime = datediff(minute,getdate(),@ExpireDate)

IF @iLeftTime > 0
BEGIN
SELECT memb_guid,
ItemCode,
ItemEffect1,
ItemEffect2,
ExpireDate,
@iLeftTime FROM T_PeriodItem_Data where memb__char = @memb__char

END
ELSE
BEGIN
UPDATE T_PeriodItem_Data SET UseTime = 0 WHERE memb__char = @memb__char
SELECT -2
END
END

IF(@@Error <> 0 )
ROLLBACK TRANSACTION
ELSE
COMMIT TRANSACTION
END

SET NOCOUNT OFF

GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO

/*
1) Procedure : WZ_PeriodItemUpdate
2) Data : 09/11/2008
3) Revisão : 1.0
4) Detalhes:
4) Descrição:
Atualiza o tempo do item de período no personagem

*/

CREATE PROCEDURE [dbo].[WZ_PeriodItemUpdate]
@memb_guid int,
@memb__char varchar(10),
@ItemCode int,
@ItemUseTime int,
@ItemLeftTime int
AS
BEGIN
BEGIN TRANSACTION
SET NOCOUNT ON
DECLARE @dbLeftTime int
DECLARE @DateExpire datetime
DECLARE @iLeftTime int

IF EXISTS(SELECT memb_guid FROM T_PeriodItem_Data WHERE memb_guid = @memb_guid AND memb__char = @memb__char AND ItemCode = @ItemCode)
BEGIN
SELECT @DateExpire = ExpireDate FROM T_PeriodItem_Data WHERE memb__char = @memb__char
SET @iLeftTime = datediff(minute,getdate(),@DateExpire)

IF @iLeftTime > 0
BEGIN
UPDATE T_PeriodItem_Data SET
UseTime = @iLeftTime WHERE memb__char = @memb__char
SELECT 1
END
ELSE
BEGIN
UPDATE T_PeriodItem_Data SET
UseTime = 0 WHERE memb__char = @memb__char
SELECT 3
END
END
ELSE
BEGIN
SELECT 0
END

IF(@@Error <> 0 )
ROLLBACK TRANSACTION
ELSE
COMMIT TRANSACTION
END


LA OTRA

Code: [Select]


CREATE TABLE [T_PeriodItemInfo] (
[PeriodIndex] [int] IDENTITY (1, 1) NOT NULL ,
[UserGuid] [int] NOT NULL ,
[CharacterName] [char] (10) COLLATE Korean_Wansung_CI_AS NOT NULL ,
[ItemCode] [int] NOT NULL ,
[EffectType1] [tinyint] NOT NULL ,
[EffectType2] [tinyint] NULL ,
[UsedTime] [int] NOT NULL CONSTRAINT [DF_T_PeriodItemInfo_UsedTime] DEFAULT (0),
[LeftTime] [int] NOT NULL ,
[BuyDate] [smalldatetime] NOT NULL ,
[ExpireDate] [smalldatetime] NOT NULL ,
[UsedInfo] [tinyint] NOT NULL CONSTRAINT [DF_T_PeriodItemInfo_UsedInfo] DEFAULT (0),
[OptionType] [tinyint] NOT NULL CONSTRAINT [DF_T_PeriodItemInfo_OptionType] DEFAULT (2)
) ON [PRIMARY]
GO


SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO


CREATE PROCEDURE dbo.WZ_PeriodItemDelete
@UserGuid int,
@CharacterName varchar(10)
AS BEGIN
DECLARE @ErrorCode int
DECLARE @ItemInfoCount int

SET @ErrorCode = 0
SET @ItemInfoCount = 0

SET nocount on

SELECT @ItemInfoCount = COUNT(*) FROM T_PeriodItemInfo where UserGuid = @UserGuid AND CharacterName = @CharacterName

IF( @ItemInfoCount < 1 )
BEGIN
SET @ErrorCode = 1
END

IF( @ErrorCode <> 1 )
BEGIN
UPDATE T_PeriodItemInfo SET UsedInfo = 0 WHERE UserGuid = @UserGuid AND CharacterName = @CharacterName
END

SELECT @ErrorCode

SET nocount off
END




GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO


CREATE procedure dbo.WZ_PeriodItemInsert
@UserGuid int,
@CharacterName varchar(10),
@ItemCode int,
@OptionType tinyint,
@EffectType1 tinyint,
@EffectType2 tinyint,
@TotalUsePeriod int,
@ExpireDate varchar(20)
as
BEGIN
DECLARE @ErrorCode int
DECLARE @PeriodItemIndex int

SET @ErrorCode = 0
SET @PeriodItemIndex = 0

SET XACT_ABORT ON
Set nocount on
begin transaction

-- OptionType? ?? ???? ???? ??? ????.
SELECT  @PeriodItemIndex = PeriodIndex FROM T_PeriodItemInfo WHERE UserGuid = @UserGuid AND CharacterName = @CharacterName AND OptionType = @OptionType AND UsedInfo = 1

IF ( @PeriodItemIndex != 0 )
BEGIN
UPDATE T_PeriodItemInfo SET UsedInfo = 0 WHERE UserGuid = @UserGuid AND CharacterName = @CharacterName AND OptionType = @OptionType AND UsedInfo = 1
END

INSERT INTO T_PeriodItemInfo (UserGuid, CharacterName, ItemCode, OptionType, EffectType1, EffectType2, LeftTime, BuyDate, ExpireDate, UsedInfo) VALUES
( @UserGuid, @CharacterName, @ItemCode, @OptionType, @EffectType1, @EffectType2, @TotalUsePeriod, GETDATE(), @ExpireDate, 1 )
IF( @@Error <> 0 )
BEGIN
SET @ErrorCode = 2
END

IF ( @ErrorCode  <> 0 )
rollback transaction
ELSE
commit transaction

SELECT @ErrorCode

Set nocount off
SET XACT_ABORT OFF
END




GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO


CREATE procedure dbo.WZ_PeriodItemSelect
@UserGuid int,
@CharacterName varchar(10)
as
BEGIN
DECLARE @ErrorCode int
DECLARE @ItemInfoCount int
DECLARE @PeriodIndex int
DECLARE @ExpireDate smalldatetime
DECLARE @UsedInfo tinyint

SET @PeriodIndex = 0
SET @ErrorCode = 0
SET @ItemInfoCount = 0
SET @UsedInfo = 0

Set nocount on

-- ?? ??? ?? ???? ??? ?? ???.
DECLARE CUR CURSOR FOR SELECT [PeriodIndex], [ExpireDate], [UsedInfo]  FROM T_PeriodItemInfo WHERE UserGuid = @UserGuid AND CharacterName = @CharacterName AND UsedInfo = 1 FOR UPDATE
OPEN CUR
FETCH NEXT FROM CUR INTO @PeriodIndex, @ExpireDate, @UsedInfo
WHILE( @@fetch_status <> -1 )
BEGIN
IF( @@fetch_status <> -2 )
BEGIN
IF( @ExpireDate < GetDate() )
BEGIN
UPDATE T_PeriodItemInfo SET UsedInfo = 0 WHERE PeriodIndex = @PeriodIndex
END
END
FETCH NEXT FROM CUR INTO @PeriodIndex, @ExpireDate, @UsedInfo
END

-- ??? ?? ??? ?? ???? ??????.

SELECT *, DATEDIFF( minute, BuyDate, GETDATE() ) AS UsedMinutes, DATEDIFF( minute, GETDATE(), ExpireDate ) AS LeftMinutes FROM T_PeriodItemInfo where UserGuid = @UserGuid AND CharacterName = @CharacterName AND UsedInfo = 1
--SELECT * FROM T_PeriodItemInfo where UserGuid = @UserGuid AND CharacterName = @CharacterName AND UsedInfo = 1
IF( @@Error <> 0 )
BEGIN
SET @ErrorCode = -1
END

CLOSE CUR
DEALLOCATE CUR

Set nocount off
END




GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO


CREATE procedure dbo.WZ_PeriodItemUpdate
@UserGuid int,
@CharacterName varchar(10),
@ItemCode int,
@UsedTime int,
@LeftTime int
as
BEGIN
DECLARE @ErrorCode int
DECLARE @ItemInfoCount int
DECLARE @RetLeftTime int

SET @ErrorCode = 0
SET @ItemInfoCount = 0
SET @RetLeftTime = 0

SET XACT_ABORT ON

Set nocount on

begin transaction

SELECT @ItemInfoCount = COUNT(*) FROM T_PeriodItemInfo where UserGuid = @UserGuid AND CharacterName = @CharacterName AND UsedInfo = 1

IF( @ItemInfoCount <> 1 )
BEGIN
SET @ErrorCode = 1
END
ELSE
BEGIN
UPDATE T_PeriodItemInfo SET UsedTime = UsedTime + @UsedTime, LeftTime = @LeftTime WHERE UserGuid = @UserGuid AND CharacterName = @CharacterName AND ItemCode = @ItemCode AND UsedInfo = 1
IF( @@Error <> 0 )
BEGIN
SET @ErrorCode = 2
END
END

SELECT @RetLeftTime = LeftTime FROM T_PeriodItemInfo where UserGuid = @UserGuid AND CharacterName = @CharacterName AND ItemCode = @ItemCode AND UsedInfo = 1
IF ( @RetLeftTime <= 0 )
BEGIN
UPDATE T_PeriodItemInfo SET UsedInfo = 0, LeftTime = 0 WHERE UserGuid = @UserGuid AND CharacterName = @CharacterName AND ItemCode = @ItemCode AND UsedInfo = 1
SET @ErrorCode = 3
END

IF ( @ErrorCode  <> 0  AND @ErrorCode <> 3 )
rollback transaction
ELSE
commit transaction

select @ErrorCode

Set nocount off
SET XACT_ABORT OFF
END




GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO

[code]

salu8



Hice todo

El primero si lo ejecuta el SQL Pero no funciona se sigue desapareciendo el seal al reconnectarme


el segundo da el siguiente error

Mens 2714, Nivel 16, Estado 3, Procedimiento WZ_PeriodItemDelete, Línea 29
Ya hay un objeto con el nombre 'WZ_PeriodItemDelete' en la base de datos.
Mens 2714, Nivel 16, Estado 3, Procedimiento WZ_PeriodItemInsert, Línea 47
Ya hay un objeto con el nombre 'WZ_PeriodItemInsert' en la base de datos.
Mens 2714, Nivel 16, Estado 3, Procedimiento WZ_PeriodItemSelect, Línea 49
Ya hay un objeto con el nombre 'WZ_PeriodItemSelect' en la base de datos.
Mens 2714, Nivel 16, Estado 3, Procedimiento WZ_PeriodItemUpdate, Línea 55
Ya hay un objeto con el nombre 'WZ_PeriodItemUpdate' en la base de datos.

one day

Offline conejowolf #3 Posteado: December 27, 2017, 05:21:09 PM

  • 0 puntos por ventas
  • *
  • Rank: Principiante
  • Posts: 0
  • Gracias recibida: 2234
  • at
@Odisk  baah que raro :/
Te juro, pero te juroo que hace poco, monte el server namech s2 en mi pc, y me puse a ver eso de los seals..
Al reconectar no lo guardaba, hasta q corri una de esas querys y ahi si lo guardaba...

mmmmm, una preg, lo hiciste con el server prendido?


No se crear cosas, no soy PROGRAMADOR.
Se romper las cosas, empezando a ser CRACKER

Offline Odisk #4 Posteado: December 27, 2017, 06:41:16 PM

  • Colaborador
  • 0 puntos por ventas
  • *
  • Rank: Puto amo
  • Posts: 879
  • Gracias recibida: 12367
  • pr
@Odisk  baah que raro :/
Te juro, pero te juroo que hace poco, monte el server namech s2 en mi pc, y me puse a ver eso de los seals..
Al reconectar no lo guardaba, hasta q corri una de esas querys y ahi si lo guardaba...

mmmmm, una preg, lo hiciste con el server prendido?

Primero si poro despues ivetado dañe la base datos y la volvi a restaurar y puse las query nueva mente ya con el server off me cree una cuenta nuenva y ect y era lo mismo

si tienes la base datos de esos sv que montaste la podria subir por favor

one day

Offline Odisk #5 Posteado: December 28, 2017, 07:02:33 PM

  • Colaborador
  • 0 puntos por ventas
  • *
  • Rank: Puto amo
  • Posts: 879
  • Gracias recibida: 12367
  • pr
@Odisk  baah que raro :/
Te juro, pero te juroo que hace poco, monte el server namech s2 en mi pc, y me puse a ver eso de los seals..
Al reconectar no lo guardaba, hasta q corri una de esas querys y ahi si lo guardaba...

mmmmm, una preg, lo hiciste con el server prendido?


solucion era camiar esto    @ExpireDate   varchar(20) a    @ExpireDate   date

Query lista
Code: [Select]
USE MuOnline
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[T_PeriodItem_Data]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[T_PeriodItem_Data]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[T_CashShop_LOG]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[T_CashShop_LOG]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[WZ_PeriodItemDelete]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[WZ_PeriodItemDelete]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[WZ_PeriodItemInsert]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[WZ_PeriodItemInsert]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[WZ_PeriodItemSelect]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[WZ_PeriodItemSelect]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[WZ_PeriodItemUpdate]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[WZ_PeriodItemUpdate]
GO

CREATE TABLE [dbo].[T_PeriodItem_Data](
[memb_guid] [int] NOT NULL,
[memb__char] [varchar](10) NOT NULL,
[ItemCode] [int] NOT NULL,
[ItemEffect1] [int] NOT NULL,
[ItemEffect2] [int] NOT NULL,
[UseTime] [int] NOT NULL,
[ExpireDate] [datetime] NOT NULL
) ON [PRIMARY]
GO

CREATE TABLE [T_CashShop_LOG] (
[AccountID] [varchar] (10) NULL ,
[Character] [varchar] (10) NULL ,
[ItemType] [int] NULL ,
[ItemIndex] [int] NULL ,
[Level] [int] NULL ,
[Skill] [int] NULL ,
[Luck] [int] NULL ,
[JoL] [int] NULL ,
[ExcOp] [int] NULL ,
[Dur] [int] NULL ,
[Serial] [varchar] (8) NULL ,
[DateBuy] [char] (10) NULL ,
[TimeBuy] [char] (8) NULL
) ON [PRIMARY]
GO

SET NOCOUNT OFF

GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO

/*
1) Procedure : WZ_PeriodItemDelete
2) Data : 29/01/2009
3) Revisão : 3.1
4) Detalhes: Corrigido bug ao executar a procedure através do dataserver
4) Descrição:
Remove o item de período quando deleta o personagem

*/

CREATE PROCEDURE [dbo].[WZ_PeriodItemDelete]
@memb_guid int,
@memb__char varchar(10)
AS
BEGIN
SET NOCOUNT ON
Declare @Result int
Set @Result = 1

Begin Transaction

DELETE FROM T_PeriodItem_Data WHERE memb__char = @memb__char and memb_guid = @memb_guid

If @@Error <> 0
begin
Set @Result = 0 -- DB Error
goto PROBLEM
end
else goto SUCESS
PROBLEM:
rollback transaction

SUCESS:
commit transaction

-- °á°ú¸¦ RETURN
SELECT @Result As Result
SET NOCOUNT OFF

END

SET NOCOUNT OFF

GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO

/*
1) Procedure : WZ_PeriodItemInsert
2) Data : 25/11/2008
3) Revisão : 3.0
4) Detalhes: Corrigido o bug ao inserir valores no banco de dados
4) Descrição:
Insere o item de período no personagem
OBS: Logo após a compra do item, os valores retornados para o gameserver
não são corretos! Bug Próprio da WebZen

*/

CREATE PROCEDURE [dbo].[WZ_PeriodItemInsert]
@memb_guid int,
@memb__char varchar(10),
@ItemCode int,
@ItemEffect1 int,
@ItemEffect2 int,
@ItemUseTime int,
@DateTime date
AS
BEGIN
BEGIN TRANSACTION
SET NOCOUNT ON

DECLARE @CurUseTime int
SET @CurUseTime = 0

IF EXISTS(SELECT memb_guid FROM T_PeriodItem_Data WITH (READUNCOMMITTED)
WHERE memb_guid = @memb_guid AND memb__char = @memb__char)
BEGIN
SELECT @CurUseTime = UseTime FROM T_PeriodItem_Data WHERE memb_guid = @memb_guid AND memb__char = @memb__char

IF @CurUseTime <> 0
BEGIN
SELECT 2 AS QueryResult
END
ELSE
BEGIN
UPDATE T_PeriodItem_Data SET
ItemCode = @ItemCode,
ItemEffect1 = @ItemEffect1,
ItemEffect2 = @ItemEffect2,
UseTime = @ItemUseTime,
ExpireDate = @DateTime
WHERE memb_guid = @memb_guid AND memb__char = @memb__char
SELECT 0 AS QueryResult
END
END
ELSE
BEGIN
INSERT INTO T_PeriodItem_Data (memb_guid,memb__char,ItemCode,ItemEffect1,ItemEffect2,UseTime,ExpireDate) VALUES
(@memb_guid,@memb__char,@ItemCode,@ItemEffect1,@ItemEffect2,@ItemUseTime,@DateTime)
SELECT 0 AS QueryResult
END

IF(@@Error <> 0 )
ROLLBACK TRANSACTION
ELSE
COMMIT TRANSACTION
END

SET NOCOUNT OFF

GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO

/*
1) Procedure : WZ_PeriodItemSelect
2) Data : 09/11/2008
3) Revisão : 4.0
4) Detalhes: Corrigido o bug ao selecionar valores e colunas no banco de dados
4) Descrição:
Seleciona o item de período do personagem

*/

CREATE PROCEDURE [dbo].[WZ_PeriodItemSelect]
@memb_guid int,
@memb__char varchar(10)
AS
BEGIN
BEGIN TRANSACTION
SET NOCOUNT ON

DECLARE @iCount int
DECLARE @ExpireDate datetime
DECLARE @ItemCode int
DECLARE @ItemEffect1 int
DECLARE @ItemEffect2 int
DECLARE @iLeftTime int
SET @iCount = 0
SET @iLeftTime = 0

SELECT @iCount = count(*) FROM T_PeriodItem_Data WHERE memb_guid = @memb_guid AND memb__char = @memb__char

IF @iCount = 0
BEGIN
SELECT 0
END
ELSE IF @iCount <> 1
BEGIN
SELECT -1
END
ELSE
BEGIN
SELECT @ItemCode = ItemCode,@ItemEffect1 = ItemEffect1,@ItemEffect2 = ItemEffect2,@ExpireDate = ExpireDate FROM T_PeriodItem_Data WHERE memb__char = @memb__char
SET @iLeftTime = datediff(minute,getdate(),@ExpireDate)

IF @iLeftTime > 0
BEGIN
SELECT memb_guid,
ItemCode,
ItemEffect1,
ItemEffect2,
ExpireDate,
@iLeftTime FROM T_PeriodItem_Data where memb__char = @memb__char

END
ELSE
BEGIN
UPDATE T_PeriodItem_Data SET UseTime = 0 WHERE memb__char = @memb__char
SELECT -2
END
END

IF(@@Error <> 0 )
ROLLBACK TRANSACTION
ELSE
COMMIT TRANSACTION
END

SET NOCOUNT OFF

GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO

/*
1) Procedure : WZ_PeriodItemUpdate
2) Data : 09/11/2008
3) Revisão : 1.0
4) Detalhes:
4) Descrição:
Atualiza o tempo do item de período no personagem

*/

CREATE PROCEDURE [dbo].[WZ_PeriodItemUpdate]
@memb_guid int,
@memb__char varchar(10),
@ItemCode int,
@ItemUseTime int,
@ItemLeftTime int
AS
BEGIN
BEGIN TRANSACTION
SET NOCOUNT ON
DECLARE @dbLeftTime int
DECLARE @DateExpire datetime
DECLARE @iLeftTime int

IF EXISTS(SELECT memb_guid FROM T_PeriodItem_Data WHERE memb_guid = @memb_guid AND memb__char = @memb__char AND ItemCode = @ItemCode)
BEGIN
SELECT @DateExpire = ExpireDate FROM T_PeriodItem_Data WHERE memb__char = @memb__char
SET @iLeftTime = datediff(minute,getdate(),@DateExpire)

IF @iLeftTime > 0
BEGIN
UPDATE T_PeriodItem_Data SET
UseTime = @iLeftTime WHERE memb__char = @memb__char
SELECT 1
END
ELSE
BEGIN
UPDATE T_PeriodItem_Data SET
UseTime = 0 WHERE memb__char = @memb__char
SELECT 3
END
END
ELSE
BEGIN
SELECT 0
END

IF(@@Error <> 0 )
ROLLBACK TRANSACTION
ELSE
COMMIT TRANSACTION
END

one day

Gracias:


Offline -Rastaa.TSM☢ #6 Posteado: December 28, 2017, 07:04:53 PM

  • MAESTRO

  • US. DE HONOR

  • Super moderador
  • 0 puntos por ventas
  • *
  • Rank: Puto amo
  • Posts: 884
  • Gracias recibida: 25285
  • ve
Gracias amigo @Odisk  por dar la solución, cierro tema y doy por solucionado.


Solo usuarios registrados pueden comentar y agradecer, Logueate o Registrate


 

Related Topics

  Subject / Started by Replies Last post
2 Replies
2936 Views
Last post January 05, 2018, 12:32:40 PM
by Thedanier
7 Replies
1779 Views
Last post February 21, 2018, 01:55:58 PM
by Bakunec
4 Replies
1694 Views
Last post October 02, 2018, 03:52:56 PM
by [Midgard]
6 Replies
1851 Views
Last post April 27, 2020, 11:32:12 PM
by ArgentuX
5 Replies
1392 Views
Last post June 01, 2020, 04:05:16 PM
by jhbaby12