Browse Source

匹配分布式webapi

中职版本
liangkun 4 years ago
parent
commit
2a3a3902be
5 changed files with 632 additions and 556 deletions
  1. +27
    -4
      Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/DesktopApi.cs
  2. +4
    -3
      Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.AppMagager/DTImg/DTImgBLL.cs
  3. +4
    -0
      Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.AppMagager/DTImg/DTImgEntity.cs
  4. +3
    -1
      Learun.Framework.Ultimate V7/LearunApp-2.2.0/config.js
  5. +594
    -548
      Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/home.vue

+ 27
- 4
Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/DesktopApi.cs View File

@@ -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<UserInfo> 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 _)


+ 4
- 3
Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.AppMagager/DTImg/DTImgBLL.cs View File

@@ -11,7 +11,7 @@ namespace Learun.Application.AppMagager
/// 日 期:2018-07-02 15:31
/// 描 述:App首页图片管理
/// </summary>
public class DTImgBLL: DTImgIBLL
public class DTImgBLL : DTImgIBLL
{
private DTImgService dTImgService = new DTImgService();

@@ -170,9 +170,9 @@ namespace Learun.Application.AppMagager

#region 扩展方法
/// <summary>
/// 获取图片
/// 获取图片 当webapi与web不在同一台服务器上时,isDistributed应为true
/// </summary>
/// <param name="keyValue">主键</param>
/// <param name="keyValue"></param>
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))
{


+ 4
- 0
Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.AppMagager/DTImg/DTImgEntity.cs View File

@@ -43,6 +43,10 @@ namespace Learun.Application.AppMagager
/// <returns></returns>
[Column("F_SORTCODE")]
public int? F_SortCode { get; set; }

[NotMapped]
public string DistributedUrl { get; set; }

#endregion

#region 扩展操作


+ 3
- 1
Learun.Framework.Ultimate V7/LearunApp-2.2.0/config.js View File

@@ -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,
// 生产环境使用的接口地址(数组索引)


+ 594
- 548
Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/home.vue
File diff suppressed because it is too large
View File


Loading…
Cancel
Save