CSFramework版本自动升级程序AutoUpgrader增加日志Log功能
作者:作者不详  发布日期:2020-04-13 17:43:50
  CSFramework版本自动升级程序AutoUpgrader增加日志Log功能

CSFramework版本自动升级程序AutoUpgrader增加日志Log功能


SELECT * FROM sys_Log


贴图图片-AutoUpgrader增加日志Log功能


日志表:sys_Log

SQL Code:

CREATE TABLE [dbo].[sys_Log](
  
[isid] [int] IDENTITY(1,1) NOT NULL,
  
[LogType] [varchar](10) NULL,
  
[LogTime] [datetime] NULL,
  
[LogText] [nvarchar](250) NULL,
  
[PkgFileName] [varchar](250) NULL,
  
[IPLocal] [varchar](50) NULL,
  
[IPInterNet] [varchar](50) NULL,
  
[SystemName] [varchar](50) NULL,
  
CONSTRAINT [PK_sys_UpgradingHistory] PRIMARY KEY CLUSTERED
  (
    
[isid] ASC
    )
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
    )
ON [PRIMARY]
    
    
    
//来源:C/S框架网 | www.csframework.com | QQ:23404761



日志存储过程:


SQL Code:

ALTER PROCEDURE USP_AUTOUP_LOG
  
@Log NVARCHAR(500),
  
@PkgFileName VARCHAR(100),
  
@IPLocal VARCHAR(50),
  
@IPInternet VARCHAR(50)
AS
BEGIN
  
  
/*****************************************************************
  添加CSFramework版本自动升级程序日志
  
  SELECT * FROM sys_Log
  
  SELECT * FROM dbo.sys_PackageTable
  SELECT * FROM dbo.sys_UpgraderVersion
  
  USP_AUTOUP_LOG 'test','','127.0.0.1','162.248,1,22'
  USP_AUTOUP_LOG 'test','pack_20191211115018.pkg','127.0.0.1','162.248,1,22'
  
  *****************************************************************
*/
  
  
DECLARE @LogType VARCHAR(20)
  
DECLARE @SystemName VARCHAR(20)
  
  
IF ISNULL(@PkgFileName,'')<>''
  
BEGIN
  
SET @LogType='Download' --下载升级包
  

  
--版本号或升级包文件名
  
SELECT @SystemName=SystemName FROM sys_PackageTable
  
WHERE FileName=@PkgFileName OR VersionNo=@PkgFileName
  
END
  
ELSE
  
SET @LogType='Log' --日志
  

  
INSERT INTO dbo.sys_Log
  ( LogType ,
    LogTime ,
    LogText ,
    PkgFileName ,
    IPLocal ,
    IPInterNet,
    SystemName
  )
  
SELECT @LogType,GETDATE(),@Log,@PkgFileName,@IPLocal,@IPInternet,@SystemName
  
  
END;
  
  
//来源:C/S框架网 | www.csframework.com | QQ:23404761




C/S框架网|原创精神.创造价值.打造精品

扫一扫加微信
C/S框架网作者微信 C/S框架网|原创作品.质量保障.竭诚为您服务

上一篇 下一篇