Browse Source

【修改】新闻公告下发,下发官网修改;

长阳分支中职
dyy 1 week ago
parent
commit
a9fbea8ae7
3 changed files with 25 additions and 24 deletions
  1. +2
    -2
      Learun.Framework.Ultimate V7/Learun.Application.Web/XmlConfig/database.config
  2. +3
    -3
      Learun.Framework.Ultimate V7/Learun.Application.Web/XmlConfig/system.config
  3. +20
    -19
      Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.OA/News/NewsService.cs

+ 2
- 2
Learun.Framework.Ultimate V7/Learun.Application.Web/XmlConfig/database.config View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<connectionStrings>
<add name="BaseDb" connectionString="Server=8.141.155.183,53314;Initial Catalog=adms7ultimate2_枝江;User ID=sa;Password=bjqjkj@2014~2015!" providerName="System.Data.SqlClient" />
<add name="CollegeMIS" connectionString="Server=8.141.155.183,53314;Initial Catalog=CollegeMIS_枝江;User ID=sa;Password=bjqjkj@2014~2015!" providerName="System.Data.SqlClient" />
<add name="BaseDb" connectionString="Server=8.141.155.183,53314;Initial Catalog=adms7ultimate2_长阳;User ID=sa;Password=bjqjkj@2014~2015!" providerName="System.Data.SqlClient" />
<add name="CollegeMIS" connectionString="Server=8.141.155.183,53314;Initial Catalog=CollegeMIS_长阳;User ID=sa;Password=bjqjkj@2014~2015!" providerName="System.Data.SqlClient" />
<add name="hangfireString" connectionString="Server=8.141.155.183,53314;Initial Catalog=Hangfire;User ID=sa;Password=bjqjkj@2014~2015!" providerName="System.Data.SqlClient" />

</connectionStrings>

+ 3
- 3
Learun.Framework.Ultimate V7/Learun.Application.Web/XmlConfig/system.config View File

@@ -191,9 +191,9 @@

<!--下发新闻配置-->
<add key="SiteId" value="39"/>
<add key="ChannelId" value="49"/>
<add key="ChannelId" value="61"/>
<!--秘钥-->
<add key="ApiKey" value="fafc361a-40c1-4060-8eee-ea796640c39c"/>
<add key="ApiKey" value="b2ede71b-0e79-4d72-bb2d-39209583a5ca"/>
<!--CMS地址-->
<add key="Ports" value="192.168.50.127:8007"/>
<add key="Ports" value="192.168.10.65:8061"/>
</appSettings>

+ 20
- 19
Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.OA/News/NewsService.cs View File

@@ -202,20 +202,25 @@ namespace Learun.Application.OA
{
newEntity.F_Status = "0";
}
}
this.BaseRepository().Update(newEntity);
this.BaseRepository().Update(newEntity);

if (newEntity.IsSend == "1" && status == 2)
{
BaseRepository()
.ExecuteBySql("insert INTO LR_Base_Log(F_LogId,F_CategoryId,F_SourceContentJson) VALUES (newid(),2222,'准备开始run task') ");
Task.Run(async () => { sendNew(newEntity); });
if (newEntity.IsSend == "1" && status == 2)
{
BaseRepository().ExecuteBySql($"insert INTO LR_Base_Log(F_LogId,F_CategoryId,F_SourceContentJson,F_Module,F_OperateTime) VALUES (newid(),2222,'准备开始run task','{newEntity.F_NewsId}','{DateTime.Now}') ");
try
{
Task.Run(async () => { sendNew(newEntity); });
}
catch (Exception ex)
{
BaseRepository().ExecuteBySql($"insert INTO LR_Base_Log(F_LogId,F_CategoryId,F_SourceContentJson,F_Module,F_OperateTime) VALUES (newid(),2222,'run task 报错:{ex.Message}','{newEntity.F_NewsId}','{DateTime.Now}') ");
}
}
}

}
catch (Exception ex)
{
BaseRepository()
.ExecuteBySql("insert INTO LR_Base_Log(F_LogId,F_CategoryId,F_SourceContentJson) VALUES (newid(),2222,'run task 报错"+ex.Message+"') ");
if (ex is ExceptionEx)
{
throw;
@@ -242,8 +247,7 @@ namespace Learun.Application.OA
string ports = ConfigurationManager.AppSettings["Ports"];

#endregion
BaseRepository()
.ExecuteBySql("insert INTO LR_Base_Log(F_LogId,F_CategoryId,F_SourceContentJson) VALUES (newid(),2222,'准备开始组装实体') ");
BaseRepository().ExecuteBySql($"insert INTO LR_Base_Log(F_LogId,F_CategoryId,F_SourceContentJson,F_Module,F_OperateTime) VALUES (newid(),2222,'准备开始组装实体','{newEntity.F_NewsId}','{DateTime.Now}') ");
SemdNewList SendNew = new SemdNewList
{
Title = newEntity.F_FullHead,
@@ -259,12 +263,10 @@ namespace Learun.Application.OA
{
{ "X-SS-API-KEY", ApiKey }
};
BaseRepository()
.ExecuteBySql("insert INTO LR_Base_Log(F_LogId,F_CategoryId,F_SourceContentJson) VALUES (newid(),2222,'准备开始post cms') ");
BaseRepository().ExecuteBySql($"insert INTO LR_Base_Log(F_LogId,F_CategoryId,F_SourceContentJson,F_Module,F_OperateTime) VALUES (newid(),2222,'准备开始post cms','{newEntity.F_NewsId}','{DateTime.Now}') ");

string responses = HttpMethods.HttpPosts("http://" + ports + "/api/v1/contents/" + siteId + "/" + channelId, SendNew.ToJson(), ApiId);
BaseRepository()
.ExecuteBySql("insert INTO LR_Base_Log(F_LogId,F_CategoryId,F_SourceContentJson) VALUES (newid(),2222,'"+HttpUtility.UrlEncode(responses)+"') ");
BaseRepository().ExecuteBySql($"insert INTO LR_Base_Log(F_LogId,F_CategoryId,F_SourceContentJson,F_Module,F_OperateTime) VALUES (newid(),2222,'post cms响应结果:{HttpUtility.UrlEncode(responses)}','{newEntity.F_NewsId}','{DateTime.Now}') ");

//#region 修改审核状态
//string Nid = JsonConvert.DeserializeObject<Root>(responses).value.id;
@@ -287,8 +289,7 @@ namespace Learun.Application.OA
}
catch (Exception ex)
{
BaseRepository()
.ExecuteBySql("insert INTO LR_Base_Log(F_LogId,F_CategoryId,F_SourceContentJson) VALUES (newid(),2222,'"+ex.Message + "') ");
BaseRepository().ExecuteBySql($"insert INTO LR_Base_Log(F_LogId,F_CategoryId,F_SourceContentJson,F_Module,F_OperateTime) VALUES (newid(),2222,'下发官网异常:{ex.Message}','{newEntity.F_NewsId}','{DateTime.Now}') ");
}
}

@@ -298,10 +299,10 @@ namespace Learun.Application.OA
return this.BaseRepository().FindList<NewsEntity>().Count();
}

public Dictionary<int,int> GetNewMonthSum()
public Dictionary<int, int> GetNewMonthSum()
{
var dt = new DateTime(DateTime.Now.Year, 1, 1);
var ls = this.BaseRepository().FindList<NewsEntity>(x=>x.F_CreateDate>=dt).Select(x => new { Year = x.F_CreateDate.Value.Year, Month = x.F_CreateDate.Value.Month }).GroupBy(x => new { x.Year, x.Month }).ToDictionary(x => x.Key.Month, a => a.Count());
var ls = this.BaseRepository().FindList<NewsEntity>(x => x.F_CreateDate >= dt).Select(x => new { Year = x.F_CreateDate.Value.Year, Month = x.F_CreateDate.Value.Month }).GroupBy(x => new { x.Year, x.Month }).ToDictionary(x => x.Key.Month, a => a.Count());
return ls;
}
}


Loading…
Cancel
Save