From 2a3a3902be50f466162abb5d596f7ccb57afedd7 Mon Sep 17 00:00:00 2001 From: liangkun Date: Tue, 29 Sep 2020 11:59:38 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8C=B9=E9=85=8D=E5=88=86=E5=B8=83=E5=BC=8Fwe?= =?UTF-8?q?bapi?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Modules/DesktopApi.cs | 31 +- .../DTImg/DTImgBLL.cs | 7 +- .../DTImg/DTImgEntity.cs | 4 + .../LearunApp-2.2.0/config.js | 4 +- .../LearunApp-2.2.0/pages/home.vue | 1142 +++++++++-------- 5 files changed, 632 insertions(+), 556 deletions(-) diff --git a/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/DesktopApi.cs b/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/DesktopApi.cs index 5ade39af5..5fa297f23 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/DesktopApi.cs +++ b/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/DesktopApi.cs @@ -35,7 +35,7 @@ namespace Learun.Application.WebApi.Modules { string ver = this.GetReqData();// 获取模板请求数据 var targetData = functionIBLL.GetDesktopList("1").OrderBy(m => m.F_Sort); - var listData = functionIBLL.GetDesktopList("2").OrderBy(m=>m.F_Sort); + var listData = functionIBLL.GetDesktopList("2").OrderBy(m => m.F_Sort); var chartData = functionIBLL.GetDesktopList("3").OrderBy(m => m.F_Sort); var data = new { target = targetData, list = listData, chart = chartData }; string md5 = Md5Helper.Encrypt(data.ToJson(), 32); @@ -78,7 +78,7 @@ namespace Learun.Application.WebApi.Modules var strSql = new StringBuilder(); // 添加委托信息 List delegateList = nWFProcessIBLL.GetDelegateProcess(userId); - strSql.Append(" AND 1=1"); + strSql.Append(" AND 1=1"); strSql.Append($" AND r1.F_UserId ='{userId}' "); foreach (var item in delegateList) { @@ -188,8 +188,31 @@ namespace Learun.Application.WebApi.Modules public Response GetImgIds(dynamic _) { - var data = dTImgIBLL.GetList().Where(m => m.F_EnabledMark == 1).Select(m => m.F_Id); - return Success(data); + //分布式部署 + if (string.IsNullOrEmpty(Request.Query["isDistributed"])) + { + var data = dTImgIBLL.GetList().Where(m => m.F_EnabledMark == 1).Select(m => m.F_Id); + return Success(data); + } + else + { + var data = dTImgIBLL.GetList().Where(m => m.F_EnabledMark == 1); + //分布式部署 + if (!string.IsNullOrEmpty(Request.Query["isDistributed"])) + { + //主站地址 + string webrootpath = Config.GetValue("webrootpath"); + string fileAppDTImg = Config.GetValue("fileAppDTImg"); + foreach (var imgitem in data) + { + if (fileAppDTImg.Contains("Resource")) + { + imgitem.DistributedUrl = string.Format("{0}/{1}/{2}{3}", webrootpath, fileAppDTImg.Substring(fileAppDTImg.LastIndexOf("Resource")), imgitem.F_Id, imgitem.F_FileName); + } + } + } + return Success(data.Select(m=>m.DistributedUrl)); + } } public Response GetImg(dynamic _) diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.AppMagager/DTImg/DTImgBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.AppMagager/DTImg/DTImgBLL.cs index cf023f1d5..2887ae51a 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.AppMagager/DTImg/DTImgBLL.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.AppMagager/DTImg/DTImgBLL.cs @@ -11,7 +11,7 @@ namespace Learun.Application.AppMagager /// 日 期:2018-07-02 15:31 /// 描 述:App首页图片管理 /// - public class DTImgBLL: DTImgIBLL + public class DTImgBLL : DTImgIBLL { private DTImgService dTImgService = new DTImgService(); @@ -170,9 +170,9 @@ namespace Learun.Application.AppMagager #region 扩展方法 /// - /// 获取图片 + /// 获取图片 当webapi与web不在同一台服务器上时,isDistributed应为true /// - /// 主键 + /// public void GetImg(string keyValue) { DTImgEntity entity = GetEntity(keyValue); @@ -182,6 +182,7 @@ namespace Learun.Application.AppMagager if (!string.IsNullOrEmpty(entity.F_FileName)) { string fileHeadImg = Config.GetValue("fileAppDTImg"); + string fileImg = string.Format("{0}/{1}{2}", fileHeadImg, entity.F_Id, entity.F_FileName); if (DirFileHelper.IsExistFile(fileImg)) { diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.AppMagager/DTImg/DTImgEntity.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.AppMagager/DTImg/DTImgEntity.cs index 533b95252..0a7d6e9b4 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.AppMagager/DTImg/DTImgEntity.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.AppMagager/DTImg/DTImgEntity.cs @@ -43,6 +43,10 @@ namespace Learun.Application.AppMagager /// [Column("F_SORTCODE")] public int? F_SortCode { get; set; } + + [NotMapped] + public string DistributedUrl { get; set; } + #endregion #region 扩展操作 diff --git a/Learun.Framework.Ultimate V7/LearunApp-2.2.0/config.js b/Learun.Framework.Ultimate V7/LearunApp-2.2.0/config.js index e4f9c373f..c6afe4a56 100644 --- a/Learun.Framework.Ultimate V7/LearunApp-2.2.0/config.js +++ b/Learun.Framework.Ultimate V7/LearunApp-2.2.0/config.js @@ -10,12 +10,14 @@ export default { "https://wx.qjkjedu.com/learun/adms" ], // "apiHost": [ - // "http://192.168.2.202:31173/learun/adms" + // "http://192.168.2.202:8083/learun/adms" // ], // 开发环境下自动填充登录账号密码,与接口地址一一对应,只在开发环境下显示 "devAccount": [ { username: "System", password: "0000" } ], + //是否分布式部署 指WebApi与Web不在一台服务器 + "isDistributed":true, // 开发环境使用的接口地址(数组索引) "devApiHostIndex": 0, // 生产环境使用的接口地址(数组索引) diff --git a/Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/home.vue b/Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/home.vue index 6277d8ca2..64ddce013 100644 --- a/Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/home.vue +++ b/Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/home.vue @@ -1,571 +1,617 @@