المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : Daily Reward System مشكله


alieleraky
21-05-2018, 03:01 PM
اتمنى مراجعه هذا الكود
اعرف انه طويل ولكن لا اعرف اين المشكله

if (@EventID = 4)
begin
exec [dbo].[_DailyRew]
end


USE [SRO_VT_SHARDLOG]
GO

Object StoredProcedure [dbo].[_DailyRew] Script Date 10282014 104519 PM
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE PROCEDURE [dbo].[_DailyRew]
@CharID int,
@Eventid int
AS
if @EventID = '4'
BEGIN
DECLARE @CharN VARCHAR(52) = (SELECT CharName16 FROM SRO_VT_SHARD.dbo._Char WHERE CharID = @CharID)
DECLARE @Date Date = GETDATE() -1
DECLARE @JID int = (SELECT UserJID FROM SRO_VT_SHARD.dbo._User where CharID = @CharID)
DECLARE @AccountID varchar (25) = (SELECT AccountID FROM SRO_VT_SHARD.dbo._AccountJID As ID INNER JOIN SRO_VT_SHARD.dbo._User as JID ON Id.JID = JID.UserJID where CharID = @CharID)
DECLARE @RewardGiven varchar(52) = 'ITEM_ETC_SILK_250'
DECLARE @DayReward INT = (SELECT IsDay FROM _DailyReward WHERE JID = @JID and LoginDate = @Date)
DECLARE @RefObjID int
DECLARE @DATEN Date = GETDATE()
select @RefObjID = RefObjID from SRO_VT_SHARD.dbo._Char with (nolock) where CharName16 = 'UnDeath'
DECLARE @RealDate date = (Select [LoginDate] from _DailyReward where Jid = @JID)
UPDATE _DailyReward set IsLogin = 'ON' where JID = @JID
IF NOT EXISTS (SELECT FROM _DailyReward WHERE JID = @JID)
BEGIN
INSERT INTO _DailyReward (JID,IsLogin,LoginDate,IsMSent,IsRecivce,IsDay)
VALUES (@JID,'ON',GETDATE(),'NO','NO','1')
END

ELSE IF @DayReward BETWEEN '1' and '2'
BEGIN
UPDATE _DailyReward SET IsMSent = 'YES',IsRecivce = 'YES',IsDay += 1, LoginDate=GETDATE(),IsLogin = 'ON' WHERE JID = @JID
exec SRO_VT_SHARD.dbo._ADD_ITEM_EXTERN_CHEST @AccountID, @RewardGiven, 1, 0
INSERT INTO SRO_VT_SHARD.dbo._Memo (CharID,FromCharName,[Message],[Date],[Status],RefObjID)
VALUES (@CharID,'DailyReward','Thank you for visiting us again, please check the storage you will find your gift and its not our problem if there is no place in the storage to add the gift, Collect them and exchange them for good gift.',GETDATE(),'0',@RefObjID)
END
ELSE IF @DayReward BETWEEN '3' and '4'
BEGIN
UPDATE _DailyReward SET IsMSent = 'YES',IsRecivce = 'YES',IsDay += 1, LoginDate=GETDATE(),IsLogin = 'ON' WHERE JID = @JID
exec SRO_VT_SHARD.dbo._ADD_ITEM_EXTERN_CHEST @AccountID, @RewardGiven, 8, 0
INSERT INTO SRO_VT_SHARD.dbo._Memo (CharID,FromCharName,[Message],[Date],[Status],RefObjID)
VALUES (@CharID,'DailyReward','Thank you for visiting us again, please check the storage you will find your gift and its not our problem if there is no place in the storage to add the gift, Collect them and exchange them for good gift.',GETDATE(),'0',@RefObjID)
END

ELSE IF @DayReward BETWEEN '5' and '6'
BEGIN
UPDATE _DailyReward SET IsMSent = 'YES',IsRecivce = 'YES',IsDay += 1, LoginDate=GETDATE(),IsLogin = 'ON' WHERE JID = @JID
exec SRO_VT_SHARD.dbo._ADD_ITEM_EXTERN_CHEST @AccountID, @RewardGiven, 12, 0
INSERT INTO SRO_VT_SHARD.dbo._Memo (CharID,FromCharName,[Message],[Date],[Status],RefObjID)
VALUES (@CharID,'DailyReward','Thank you for visiting us again, please check the storage you will find your gift and its not our problem if there is no place in the storage to add the gift, Collect them and exchange them for good gift.',GETDATE(),'0',@RefObjID)
END

ELSE IF @DayReward = '7' -- 2nd week
BEGIN
UPDATE _DailyReward SET IsMSent = 'YES',IsRecivce = 'YES',IsDay += 1, LoginDate=GETDATE(),IsLogin = 'ON' WHERE JID = @JID
exec SRO_VT_SHARD.dbo._ADD_ITEM_EXTERN_CHEST @AccountID, @RewardGiven, 14, 0
INSERT INTO SRO_VT_SHARD.dbo._Memo (CharID,FromCharName,[Message],[Date],[Status],RefObjID)
VALUES (@CharID,'DailyReward','Thank you for visiting us again, please check the storage you will find your gift and its not our problem if there is no place in the storage to add the gift, Collect them and exchange them for good gift.',GETDATE(),'0',@RefObjID)
END

ELSE IF @DayReward BETWEEN '8' and '10'
BEGIN
UPDATE _DailyReward SET IsMSent = 'YES',IsRecivce = 'YES',IsDay += 1, LoginDate=GETDATE(),IsLogin = 'ON' WHERE JID = @JID
exec SRO_VT_SHARD.dbo._ADD_ITEM_EXTERN_CHEST @AccountID, @RewardGiven, 18, 0
INSERT INTO SRO_VT_SHARD.dbo._Memo (CharID,FromCharName,[Message],[Date],[Status],RefObjID)
VALUES (@CharID,'DailyReward','Thank you for visiting us again, please check the storage you will find your gift and its not our problem if there is no place in the storage to add the gift, Collect them and exchange them for good gift.',GETDATE(),'0',@RefObjID)
END

ELSE IF @DayReward BETWEEN '11' and '12'
BEGIN
UPDATE _DailyReward SET IsMSent = 'YES',IsRecivce = 'YES',IsDay += 1, LoginDate=GETDATE(),IsLogin = 'ON' WHERE JID = @JID
exec SRO_VT_SHARD.dbo._ADD_ITEM_EXTERN_CHEST @AccountID, @RewardGiven, 19, 0
INSERT INTO SRO_VT_SHARD.dbo._Memo (CharID,FromCharName,[Message],[Date],[Status],RefObjID)
VALUES (@CharID,'DailyReward','Thank you for visiting us again, please check the storage you will find your gift and its not our problem if there is no place in the storage to add the gift, Collect them and exchange them for good gift.',GETDATE(),'0',@RefObjID)
END

ELSE IF @DayReward = '15'
BEGIN
UPDATE _DailyReward SET IsMSent = 'YES',IsRecivce = 'YES',IsDay += 1, LoginDate=GETDATE(),IsLogin = 'ON' WHERE JID = @JID
exec SRO_VT_SHARD.dbo._ADD_ITEM_EXTERN_CHEST @AccountID, @RewardGiven, 20, 0
INSERT INTO SRO_VT_SHARD.dbo._Memo (CharID,FromCharName,[Message],[Date],[Status],RefObjID)
VALUES (@CharID,'DailyReward','Thank you for visiting us again, please check the storage you will find your gift and its not our problem if there is no place in the storage to add the gift, Collect them and exchange them for good gift.',GETDATE(),'0',@RefObjID)
END


ELSE IF @RealDate != @DATEN
AND @RealDate != @Date
BEGIN
UPDATE _DailyReward SET LoginDate = GETDATE(),IsDay = '1' WHERE JID = 9
END
END
GO


USE [SRO_VT_SHARDLOG]
GO

/****** Object: Table [dbo].[_DailyReward] Script Date: 10/28/2014 10:45:59 PM ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

SET ANSI_PADDING ON
GO

CREATE TABLE [dbo].[_DailyReward](
[ID] [int] IDENTITY(1,1) NOT NULL,
[JID] [int] NOT NULL,
[IsLogin] [varchar](16) NULL,
[LoginDate] [date] NULL,
[IsMSent] [varchar](16) NULL,
[IsRecivce] [varchar](16) NULL,
[IsDay] [int] NULL,
CONSTRAINT [PK__DailyReward] PRIMARY KEY CLUSTERED
(
[ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

SET ANSI_PADDING OFF
GO


USE [SRO_VT_SHARDLOG]
GO

/****** Object: Table [dbo].[_DailyGift] Script Date: 10/28/2014 10:46:14 PM ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

SET ANSI_PADDING ON
GO

CREATE TABLE [dbo].[_DailyGift](
[ID] [int] IDENTITY(1,1) NOT NULL,
[CodeName] [varchar](50) NULL,
[Count] [int] NULL,
[Day] [int] NULL,
CONSTRAINT [PK__DailyGift] PRIMARY KEY CLUSTERED
(
[ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

SET ANSI_PADDING OFF
GO

Hero
23-05-2018, 12:59 AM
ايه المشكله اللى بتقبلك يعنى من الكود

alieleraky
23-05-2018, 03:57 PM
ده الكود الى بيطلعلى
Msg 102, Level 15, State 1, Line 2
Incorrect syntax near 'dbo'.
Msg 156, Level 15, State 1, Procedure _DailyRew, Line 19
Incorrect syntax near the keyword 'FROM'.
Msg 156, Level 15, State 1, Procedure _DailyRew, Line 25
Incorrect syntax near the keyword 'ELSE'.

.Gamer.
20-06-2018, 01:03 AM
##