网狐荣耀之微星棋牌系列,NET_PW_AgentBalance存储过程源码

许多小白 拿到棋牌源码后,很高兴,但是不知道如何使用,而且,数据库的存储过程,是加密的,并且有一两个存储过程始终没有源码,我把他们破解后,现在公布一下

USE RYTreasureDB
GO
SET ANSI_NULLS, QUOTED_IDENTIFIER ON
GO

----------------------------------------------------------------------------------------------------------------
-- 代理结算
CREATE PROCEDURE NET_PW_AgentBalance
	@dwUserID			INT,					-- 用户标识
	@strClientIP		NVARCHAR(15),			-- 操作地址
	@strErrorDescribe	NVARCHAR(127) OUTPUT	-- 输出信息
  AS


-- 属性设置
SET NOCOUNT ON

-- 基本信息
DECLARE @UserID				INT

-- 帐号状态
DECLARE @Nullity BIT
DECLARE @StunDown BIT

-- 代理信息
DECLARE @MinBalanceScore BIGINT   -- 最低结算金额

-- 执行逻辑
BEGIN
	-- 用户资料
	SELECT	@UserID=UserID,@Nullity=Nullity,@StunDown=StunDown
	FROM RYAccountsDBLink.RYAccountsDB.dbo.AccountsInfo
	WHERE UserID=@dwUserID

	-- 查询用户
	IF @UserID IS NULL
	BEGIN
		SET @strErrorDescribe= N'您的帐号不存在或者密码输入有误,请查证后再次尝试登录!'
		RETURN 1
	END

	-- 帐号禁止
	IF @Nullity<>0
	BEGIN
		SET @strErrorDescribe=N'您的帐号暂时处于冻结状态,请联系客户服务中心了解详细情况!'
		RETURN 2
	END	

	-- 帐号关闭
	IF @StunDown<>0
	BEGIN
		SET @strErrorDescribe=N'您的帐号使用了安全关闭功能,必须重新开通后才能继续使用!'
		RETURN 3
	END	

	-- -- 最小结算金额
	-- SELECT @MinBalanceScore=StatusValue FROM RYAccountsDBLink.RYAccountsDB.dbo.SystemStatusInfo WHERE StatusName='AgentBalance'
	-- IF @MinBalanceScore IS NULL
	-- BEGIN
	-- 	SET @MinBalanceScore=10
	-- END
	-- IF @dwBalance < @MinBalanceScore
	-- BEGIN
	-- 	SET @strErrorDescribe=N'非常抱歉,您每笔结算的数目必须大于' + Convert(NVARCHAR(30), @MinBalanceScore) + '金币!'
	-- 	RETURN 4
	-- END

	-- 查询代理余额
	DECLARE @DateID INT =CAST(CAST(GETDATE() AS FLOAT) AS INT)
	DECLARE @AgentRevenue DECIMAL(18,2) -- 税收分成
	SELECT @AgentRevenue=ISNULL(SUM(AgentRevenue),0) FROM RecordUserRevenue WHERE AgentUserID=@dwUserID AND DateID < @DateID
	-- 已提现金额
	DECLARE @AgentOut DECIMAL(18,2)
	SELECT @AgentOut=ISNULL(-SUM(Score),0) FROM RecordAgentInfo WHERE UserID=@dwUserID AND TypeID=3
	SET @AgentRevenue=@AgentRevenue-@AgentOut
	IF @AgentRevenue <= 0
	BEGIN
		SET @strErrorDescribe=N'当日佣金必须次日方可领取,您的佣金余额不足'
		RETURN 5
	END

	-- 查询银行金币
	DECLARE @Score DECIMAL(18,2)
	SELECT @Score=Score FROM GameScoreInfo(NOLOCK) WHERE UserID = @dwUserID
	IF @Score IS NULL
	BEGIN
		SET @Score=0
	END

	-- 结算记录
	INSERT INTO RecordAgentInfo(UserID,TypeID,Score,InsureScore,CollectIP) VALUES(@dwUserID,3,-@AgentRevenue,@Score,@strClientIP)

	-- 更新银行金币
	UPDATE GameScoreInfo SET Score = Score+@AgentRevenue
	WHERE UserID = @UserID
	IF @@ROWCOUNT = 0 
	BEGIN
		INSERT INTO GameScoreInfo(UserID,Score,RegisterIP,LastLogonIP)
		VALUES(@UserID,@AgentRevenue,@strClientIP,@strClientIP)
	END
	DECLARE @CurrentAgentRevenue DECIMAL(18,2) -- 税收分成
	SELECT @AgentOut=ISNULL(-SUM(Score),0) FROM RecordAgentInfo WHERE UserID=@dwUserID AND TypeID=3
	SELECT @CurrentAgentRevenue=ISNULL(SUM(AgentRevenue),0) FROM RecordUserRevenue WHERE AgentUserID=@dwUserID
	SET @CurrentAgentRevenue = @CurrentAgentRevenue - @AgentOut
	SELECT @AgentRevenue AS Score,@CurrentAgentRevenue AS Revenue
END
RETURN 0
GO

 

你可能感兴趣的:(棋牌游戏)