把RYGameMatchDB的存储过程复制到RYGameScoreDB即可,GSP_GS_InsertGameMatchItem和GSP_GS_DeleteGameMatchItem也一样
由于存储过程是加密了的,可以用SqlDecryptor解密
推荐用
dbForge-SqlDecryptor
下载地址:
http://download.csdn.net/download/windy8848/9801966
----------------------------------------------------------------------------------------------------
-- 插入比赛
CREATE PROCEDURE dbo.GSP_GS_InsertGameMatchItem
-- 基本信息
@wKindID INT, -- 类型标识
@strMatchName NVARCHAR(32), -- 比赛名称
@strMatchDate NVARCHAR(64), -- 比赛时间
@cbMatchType TINYINT, -- 比赛类型
-- 报名信息
@cbFeeType TINYINT, -- 费用类型
@cbDeductArea TINYINT, -- 扣费区域
@lSignupFee BIGINT, -- 比赛费用
@cbSignupMode TINYINT, -- 报名方式
@cbJoinCondition TINYINT, -- 参赛条件
@cbMemberOrder TINYINT, -- 会员等级
@lExperience INT, -- 经验等级
@dwFromMatchID INT, -- 比赛标识
@cbFilterType TINYINT, -- 筛选方式
@wMaxRankID SMALLINT, -- 最大名次
@MatchEndDate DATETIME, -- 开始日期
@MatchStartDate DATETIME, -- 开始日期
-- 排名信息
@cbRankingMode TINYINT, -- 排名方式
@wCountInnings SMALLINT, -- 统计局数
@cbFilterGradesMode TINYINT, -- 筛选方式
-- 配桌信息
@cbDistributeRule TINYINT, -- 分配规则
@wMinDistributeUser SMALLINT, -- 分组人数
@wDistributeTimeSpace SMALLINT, -- 分组间隔
@wMinPartakeGameUser SMALLINT, -- 最小人数
@wMaxPartakeGameUser SMALLINT, -- 最大人数
-- 比赛奖励
@strRewardGold NVARCHAR(512), -- 金币奖励
@strRewardIngot NVARCHAR(512), -- 元宝奖励
@strRewardExperience NVARCHAR(512), -- 经验奖励
-- 扩展配置
@strMatchRule NVARCHAR(1024), -- 比赛规则
@strServiceMachine NCHAR(32), -- 服务机器
@strErrorDescribe NVARCHAR(127) OUTPUT -- 输出信息
WITH ENCRYPTION AS
-- 设置属性
SET NOCOUNT ON
-- 执行逻辑
BEGIN
-- 插入配置
INSERT INTO RYGameMatchDB.dbo.MatchPublic(KindID,MatchName,MatchType,SignupMode,FeeType,SignupFee,DeductArea,JoinCondition,MemberOrder,
Experience,FromMatchID,FilterType,MaxRankID,MatchEndDate,MatchStartDate,RankingMode,CountInnings,FilterGradesMode,DistributeRule,MinDistributeUser,
DistributeTimeSpace,MinPartakeGameUser,MaxPartakeGameUser,MatchRule,ServiceMachine,CollectDate)
VALUES(@wKindID,@strMatchName,@cbMatchType,@cbSignupMode,@cbFeeType,@lSignupFee,@cbDeductArea,@cbJoinCondition,@cbMemberOrder,
@lExperience,@dwFromMatchID,@cbFilterType,@wMaxRankID,@MatchEndDate,@MatchStartDate,@cbRankingMode,@wCountInnings,@cbFilterGradesMode,@cbDistributeRule,@wMinDistributeUser,
@wDistributeTimeSpace,@wMinPartakeGameUser,@wMaxPartakeGameUser,@strMatchRule,@strServiceMachine,GETDATE())
-- 比赛标识
DECLARE @dwMatchID INT
SET @dwMatchID=SCOPE_IDENTITY()
-- 存在判断
IF NOT EXISTS(SELECT * FROM RYGameMatchDB.dbo.MatchPublic WHERE MatchID=@dwMatchID)
BEGIN
SET @strErrorDescribe=N'由于数据库异常,比赛创建失败,请稍后再试!'
RETURN 1
END
-- 即时赛状态
IF @cbMatchType=1
BEGIN
-- 修改状态
UPDATE RYGameMatchDB.dbo.MatchPublic SET MatchStatus=0x02 WHERE MatchID=@dwMatchID
END
-- 比赛信息
INSERT INTO RYGameMatchDB.dbo.MatchInfo(MatchID,MatchName,MatchDate) VALUES (@dwMatchID,@strMatchName,@strMatchDate)
-- 拆分奖励
SELECT * INTO #tmpGold FROM RYGameMatchDB.dbo.WF_SplitStr(@strRewardGold,'|')
SELECT * INTO #tmpIngot FROM RYGameMatchDB.dbo.WF_SplitStr(@strRewardIngot,'|')
SELECT * INTO #tmpExperience FROM RYGameMatchDB.dbo.WF_SplitStr(@strRewardExperience,'|')
-- 变量定义
DECLARE @Index INT
DECLARE @RewardGold BIGINT
DECLARE @RewardIngot BIGINT
DECLARE @RewardExperience BIGINT
-- 插入奖励
SELECT @Index=COUNT(id) FROM #tmpGold
WHILE @Index > 0
BEGIN
-- 查询数据
SELECT @RewardGold=rs FROM #tmpGold WHERE id=@Index
SELECT @RewardIngot=rs FROM #tmpIngot WHERE id=@Index
SELECT @RewardExperience=rs FROM #tmpExperience WHERE id=@Index
-- 插入数据
INSERT INTO RYGameMatchDB.dbo.MatchReward(MatchID,MatchRank,RewardGold,RewardIngot,RewardExperience,RewardDescibe)
VALUES(@dwMatchID,@Index,@RewardGold,@RewardIngot,@RewardExperience,'')
SET @Index=@Index-1
END
-- 删临时表
DROP TABLE #tmpGold,#tmpIngot,#tmpExperience
-- 查询比赛
EXEC GSP_GS_LoadGameMatchItem @wKindID,@dwMatchID,@strServiceMachine,N''
END
RETURN 0
GO
---------------------------------------------------------------------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------
-- 删除比赛
CREATE PROCEDURE dbo.GSP_GS_DeleteGameMatchItem
@dwMatchID INT -- 比赛标识
AS
-- 设置属性
SET NOCOUNT ON
-- 执行逻辑
BEGIN
-- 查询类型
DECLARE @cbMatchType SMALLINT
SELECT @cbMatchType=MatchType FROM RYGameMatchDB.dbo.MatchPublic WHERE MatchID=@dwMatchID
-- 存在判断
IF @cbMatchType IS NULL RETURN 1
-- 删除配置
DELETE RYGameMatchDB.dbo.MatchPublic WHERE MatchID=@dwMatchID
-- 删除奖励
DELETE RYGameMatchDB.dbo. MatchReward WHERE MatchID=@dwMatchID
END
RETURN 0
---------------------------------------------------------------------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------
-- 加载比赛
CREATE PROCEDURE GSP_GS_LoadGameMatchItem
@wKindID INT, -- 类型标识
@dwMatchID INT, -- 比赛标识
@strServiceMachine NCHAR(32), -- 服务机器
@strErrorDescribe NVARCHAR(127) OUTPUT -- 输出信息
AS
-- 设置属性
SET NOCOUNT ON
-- 执行逻辑
BEGIN
-- 加载比赛
SELECT * FROM RYGameMatchDB.dbo.MatchPublic WHERE ((KindID=@wKindID AND MatchID=@dwMatchID) OR (@dwMatchID=0 AND KindID=@wKindID AND ServiceMachine=@strServiceMachine)) AND Nullity=0
END
RETURN 0
GO