Example #1
0
        /// <summary>
        /// 获取状态
        /// </summary>
        /// <returns></returns>
        public async Task <IActionResult> OnGetXncfStatAsync()
        {
            //所有已安装模块
            var installedXncfModules = await _xncfModuleServiceEx.GetFullListAsync(z => true);

            //未安装或待升级模块
            var updateXncfRegisters = _xncfModuleServiceEx.GetUnInstallXncfModule(installedXncfModules);
            //未安装货代升级模块的版本
            var newVersions = updateXncfRegisters.Select(z => _xncfModuleServiceEx.GetVersionDisplayName(installedXncfModules, z));
            //需要升级的版本号
            var newXncfCount = newVersions.Count(z => !z.Contains("->"));
            //全新未安装的版本号
            var updateVersionXncfCount = newVersions.Count() - newXncfCount;
            //安装后缺失的模块
            var xncfRegisterManager = new XncfRegisterManager(_serviceProvider);
            var missingXncfCount    = installedXncfModules.Count(z => !XncfRegisterManager.RegisterList.Exists(r => r.Uid == z.Uid));

            var data = new
            {
                success = true,
                data    = new
                {
                    installedXncfCount = installedXncfModules.Count,
                    updateVersionXncfCount,
                    newXncfCount,
                    missingXncfCount
                }
            };

            return(new JsonResult(data));
        }
Example #2
0
        /// <summary>
        /// 获取未安装模块模块 handler=UnMofules
        /// </summary>
        /// <returns></returns>
        public async Task <IActionResult> OnGetUnMofulesAsync()
        {
            //所有已安装的模块
            var oldXncfModules = await _xncfModuleServiceEx.GetObjectListAsync(0, 0, z => true, z => z.AddTime, Ncf.Core.Enums.OrderingType.Descending);

            //未安装或版本已更新(不同)的模块
            var newXncfRegisters = _xncfModuleServiceEx.GetUnInstallXncfModule(oldXncfModules);

            return(Ok(newXncfRegisters.Select(z => new
            {
                z.MenuName,
                z.Name,
                z.Uid,
                Version = _xncfModuleServiceEx.GetVersionDisplayName(oldXncfModules, z),
                z.Icon
            })));;
        }