예제 #1
0
        /// <summary>
        /// 登陆业务
        /// </summary>
        /// <param name="UserNo">用户编号</param>
        /// <param name="UserName">用户名</param>
        /// <param name="Md5Pas">密码</param>
        /// <param name="LoginerInfo">登陆者信息</param>
        /// <param name="platform">平台code</param>
        /// <param name="info"></param>
        /// <returns></returns>
        public bool InsertLoginLog(LoginInfoForm loginForm, LoginResultType loginResultType)
        {
            Dictionary <string, object> keyValuePairs = new Dictionary <string, object>();

            keyValuePairs.Add("UserName", loginForm.UserName);
            keyValuePairs.Add("MdfPas", loginForm.MdfPas);
            keyValuePairs.Add("LoginerInfo", loginForm.LoginerInfo);
            keyValuePairs.Add("Platform", loginForm.Platform);
            string     message  = JsonConvert.SerializeObject(keyValuePairs);
            UcLoginLog loginLog = new UcLoginLog()
            {
                id            = AutoIDWorker.Example.GetAutoSequence(),
                Titile        = LogTypeEumns.Login.GetEnumDescription(),
                Message       = message,
                LogType       = LogTypeEumns.Login.ToString(),
                RequestUser   = loginForm.UserNo,
                RequestTime   = DateTime.Now,
                InputTime     = DateTime.Now,
                InputUser     = loginForm.UserNo,
                Status        = 0,
                HandleResult  = (int)loginResultType,
                HandleMessage = loginResultType.GetEnumDescription(),
                HandleTime    = DateTime.Now,
                HandleUser    = HandleUserEumns.UserCenter.ToString(),
                ExpiresIn     = 60 * 60 * 1000,
            };

            return(this.Insert(loginLog) > 0);
        }
예제 #2
0
        /// <summary>
        /// 执行发布命令
        /// </summary>
        /// <param name="project"></param>
        /// <param name="RequestUser"></param>
        /// <returns></returns>
        public bool RunPublishBat(PdProject project, string RequestUser)
        {
            if (project == null)
            {
                return(false);
            }
            string batPath = project.SourcePath + project.ProjectFile;

            if (File.Exists(batPath))
            {
                FileInfo fileInfo = new FileInfo(batPath);
                if (!fileInfo.Exists)
                {
                    return(false);
                }
                string        enlistmentRoot   = project.SourcePath;
                string        workingDirectory = fileInfo.Directory.ToString();
                string        repoUrl          = project.VersionUrl;
                string        gitBinPath       = project.MSBuildPath;
                GitBaseConfig config           = new GitAuthConfig(enlistmentRoot, workingDirectory, repoUrl, gitBinPath);
                GitProcess    process          = config.CreateGitProcess();
                int           exitCode         = -1;

                List <string> commandList = new List <string>();
                commandList.Add(fileInfo.Name);
                List <string> reulit = this.Shell("cmd.exe", "/k ", 5 * 60 * 1000, fileInfo.Directory.ToString(), out exitCode, commandList.ToArray());

                LoginResultType resultType    = exitCode == 0 && reulit.Contains("    0 个错误") ? LoginResultType.SUCCESS_PUBLISHCMD : LoginResultType.FAILED;
                string          message       = JsonConvert.SerializeObject(project);
                string          HandleUser    = ServerConstData.ServerName;
                int             HandleResult  = (int)resultType;
                string          HandleMessage = resultType == LoginResultType.SUCCESS_PUBLISHCMD ? resultType.GetEnumDescription() : String.Join(";", reulit);
                DataHandleManager.Instance().UcLoginLogHandle.
                InsertCommonLog(RequestUser, message, LogTypeEumns.PublishCmd, HandleUser, HandleResult, HandleMessage);
                if (exitCode == 0 && reulit.Contains("    0 个错误"))
                {
                    return(true);
                }
            }
            else
            {
                DataHandleManager.Instance().UcLoginLogHandle.
                InsertPublishDeployGitLog(RequestUser, "batPath:" + batPath, ServerConstData.ServerName, 400, "文件不存在;");
            }
            return(false);
        }