@@ -4,9 +4,13 @@ | |||
} | |||
<div class="lr-form-wrap" id="form"> | |||
<div class="col-xs-12 lr-form-item" data-table="OANews"> | |||
<div class="col-xs-6 lr-form-item" data-table="OANews"> | |||
<div class="lr-form-item-title">公告标题<font face="宋体">*</font></div> | |||
<input id="F_FullHead" readonly="readonly" type="text" class="form-control" isvalid="yes" checkexpession="NotNull" placeholder="请输入标题" /> | |||
<input id="F_FullHead" type="text" class="form-control" isvalid="yes" checkexpession="NotNull" placeholder="请输入标题" /> | |||
</div> | |||
<div class="col-xs-6 lr-form-item" data-table="OANews"> | |||
<div class="lr-form-item-title">下发CMS<font face="宋体">*</font></div> | |||
<div id="IsSend" isvalid="yes" checkexpession="NotNull"></div> | |||
</div> | |||
<div class="col-xs-6 lr-form-item" data-table="OANews"> | |||
<div class="lr-form-item-title">公告类别<font face="宋体">*</font></div> | |||
@@ -28,6 +28,11 @@ var bootstrap = function ($, learun) { | |||
page.initData(); | |||
}, | |||
bind: function () { | |||
$('#IsSend').lrselect({ | |||
data: [{ text: "是", value: "1" }, { text: "否", value: "0" }], | |||
text: "text", | |||
value: "value" | |||
}); | |||
//公告类别 | |||
$('#F_CategoryId').lrDataItemSelect({ | |||
code: 'NoticeCategory', maxHeight: 230, select: function (item) { | |||
@@ -176,22 +176,28 @@ | |||
success: function (res) { | |||
if (res.code == 200) { | |||
if (source == "noLogin") { | |||
window.location.href = DigitalschoolMisLoginurl + "?F_Account=" + username + "&returnurl=" + Returnurl + "/SSOSystem/Index"; | |||
//window.location.href = DigitalschoolMisLoginurl + "?F_Account=" + username + "&returnurl=" + Returnurl + "/SSOSystem/Index"; | |||
window.location.href = "/SSOSystem/Index"; | |||
} else if (source == "NoLogin") { | |||
window.location.href = DigitalschoolMisLoginurl + "?F_Account=" + username + "&returnurl=" + Returnurl + "/SSOSystem/DragModelOne"; | |||
window.location.href = "SSOSystem/DragModelOne"; | |||
//window.location.href = DigitalschoolMisLoginurl + "?F_Account=" + username + "&returnurl=" + Returnurl + "/SSOSystem/DragModelOne"; | |||
} else { | |||
if (res.data.pwd == true) { | |||
if (res.data.pwdtip == true) { | |||
window.location.href = DigitalschoolMisLoginurl + "?F_Account=" + username + "&returnurl=" + Returnurl + "/Home/Index?pwdpwdtip=true"; | |||
window.location.href = "/Home/Index?pwdpwdtip=true"; | |||
//window.location.href = DigitalschoolMisLoginurl + "?F_Account=" + username + "&returnurl=" + Returnurl + "/Home/Index?pwdpwdtip=true"; | |||
} else { | |||
window.location.href = DigitalschoolMisLoginurl + "?F_Account=" + username + "&returnurl=" + Returnurl + "/Home/Index?pwd=true"; | |||
//window.location.href = DigitalschoolMisLoginurl + "?F_Account=" + username + "&returnurl=" + Returnurl + "/Home/Index?pwd=true"; | |||
window.location.href = "/Home/Index?pwd=true"; | |||
} | |||
} | |||
else { | |||
if (res.data.pwdtip == true) { | |||
window.location.href = DigitalschoolMisLoginurl + "?F_Account=" + username + "&returnurl=" + Returnurl + "/Home/Index?pwdtip=true"; | |||
window.location.href = "/Home/Index?pwdtip=true"; | |||
//window.location.href = DigitalschoolMisLoginurl + "?F_Account=" + username + "&returnurl=" + Returnurl + "/Home/Index?pwdtip=true"; | |||
} else { | |||
window.location.href = DigitalschoolMisLoginurl + "?F_Account=" + username + "&returnurl=" + Returnurl + "/Home/Index"; | |||
window.location.href = "/Home/Index"; | |||
//window.location.href = DigitalschoolMisLoginurl + "?F_Account=" + username + "&returnurl=" + Returnurl + "/Home/Index"; | |||
} | |||
//window.location.href = "/Home/Index"; | |||
} | |||
@@ -169,11 +169,10 @@ | |||
<add key="ForbidLoginMinutes" value="10"/> | |||
<!--下发新闻配置--> | |||
<add key="SiteId" value="1"/> | |||
<add key="ChannelId" value="6"/> | |||
<add key="SiteId" value="39"/> | |||
<add key="ChannelId" value="49"/> | |||
<!--秘钥--> | |||
<add key="ApiKey" value="fafc361a-40c1-4060-8eee-ea796640c39c"/> | |||
<!--CMS部署端口--> | |||
<add key="Ports" value="8007"/> | |||
<!--CMS地址--> | |||
<add key="Ports" value="192.168.50.127:8007"/> | |||
</appSettings> |
@@ -9,6 +9,8 @@ using Spire.Pdf.General.Render.Decode.Jpeg2000.Icc; | |||
using static Learun.Application.OA.NewsEntity; | |||
using Nancy.Helpers; | |||
using System.Configuration; | |||
using System.Threading.Tasks; | |||
using Newtonsoft.Json; | |||
namespace Learun.Application.OA | |||
{ | |||
@@ -183,69 +185,24 @@ namespace Learun.Application.OA | |||
{ | |||
try | |||
{ | |||
var newEntity = this.BaseRepository().FindEntity<NewsEntity>(a => a.F_ProgressId == parameterProcessId); | |||
if (null != newEntity) | |||
{ | |||
if (status == 2) | |||
{ | |||
newEntity.F_Status = "2"; | |||
if (newEntity.IsSend == "1") //判断是否下发 | |||
{ | |||
#region 获取配置文件 | |||
string siteId = HttpUtility.UrlEncode(ConfigurationManager.AppSettings["SiteId"]); | |||
string channelId = HttpUtility.UrlEncode(ConfigurationManager.AppSettings["ChannelId"]); | |||
string ApiKey = HttpUtility.UrlEncode(ConfigurationManager.AppSettings["ApiKey"]); | |||
string ports = HttpUtility.UrlEncode(ConfigurationManager.AppSettings["Ports"]); | |||
#endregion | |||
SemdNewList SendNew = new SemdNewList | |||
{ | |||
Title = newEntity.F_FullHead, | |||
SubTitle = newEntity.F_BriefHead, | |||
Content = newEntity.F_NewsContent, | |||
Author = newEntity.F_AuthorName, | |||
Source = newEntity.F_SourceName, | |||
AddDate = DateTime.Now, | |||
Tags = newEntity.F_TagWord, | |||
AddUserName = newEntity.F_CreateUserName, | |||
}; | |||
WebHeaderCollection ApiId = new WebHeaderCollection | |||
{ | |||
{ "X-SS-API-KEY", ApiKey } | |||
}; | |||
string responses = Util.HttpMethods.HttpPosts("http://localhost:" + ports + "/api/v1/contents/" + siteId + "/" + channelId, SendNew.ToJson(), ApiId); | |||
#region 修改审核状态 | |||
JavaScriptSerializer Jss = new JavaScriptSerializer(); | |||
Dictionary<string, object> DicText = (Dictionary<string, object>)Jss.DeserializeObject(responses); | |||
string Nid = DicText["id"].ToString(); | |||
AuditList AList = new AuditList(); | |||
if (Nid != null) | |||
{ | |||
AList.siteId = siteId; | |||
List<contents> listCon = new List<contents>(); | |||
//这里应该循环,如果多个 | |||
contents con = new contents(); | |||
con.channelId = Convert.ToInt32(channelId); | |||
con.id = Convert.ToInt32(Nid); | |||
listCon.Add(con); | |||
AList.contents = listCon; | |||
AList.reasons = "终审通过"; | |||
Util.HttpMethods.HttpPosts("http://localhost:" + ports + "/api/v1/contents/actions/check", AList.ToJson(), ApiId); | |||
} | |||
#endregion | |||
} | |||
} | |||
else | |||
{ | |||
newEntity.F_Status = "0"; | |||
} | |||
} | |||
this.BaseRepository().Update(newEntity); | |||
if (newEntity.IsSend == "1" && status == 2) | |||
{ | |||
Task.Run(async () => { sendNew(newEntity); }); | |||
} | |||
} | |||
catch (Exception ex) | |||
{ | |||
@@ -259,5 +216,75 @@ namespace Learun.Application.OA | |||
} | |||
} | |||
} | |||
public void sendNew(NewsEntity newEntity) | |||
{ | |||
try | |||
{ | |||
if (newEntity.IsSend == "1") //判断是否下发 | |||
{ | |||
#region 获取配置文件 | |||
string siteId = ConfigurationManager.AppSettings["SiteId"]; | |||
string channelId = ConfigurationManager.AppSettings["ChannelId"]; | |||
string ApiKey = ConfigurationManager.AppSettings["ApiKey"]; | |||
string ports = ConfigurationManager.AppSettings["Ports"]; | |||
#endregion | |||
SemdNewList SendNew = new SemdNewList | |||
{ | |||
Title = newEntity.F_FullHead, | |||
SubTitle = newEntity.F_BriefHead, | |||
Content = newEntity.F_NewsContent, | |||
Author = newEntity.F_AuthorName, | |||
Source = newEntity.F_SourceName, | |||
AddDate = DateTime.Now, | |||
Tags = newEntity.F_TagWord, | |||
AddUserName = newEntity.F_CreateUserName, | |||
}; | |||
WebHeaderCollection ApiId = new WebHeaderCollection | |||
{ | |||
{ "X-SS-API-KEY", ApiKey } | |||
}; | |||
string responses = HttpMethods.HttpPosts("http://" + ports + "/api/v1/contents/" + siteId + "/" + channelId, SendNew.ToJson(), ApiId); | |||
#region 修改审核状态 | |||
string Nid = JsonConvert.DeserializeObject<Root>(responses).value.id; | |||
AuditList AList = new AuditList(); | |||
if (Nid != null) | |||
{ | |||
AList.siteId = siteId; | |||
List<contents> listCon = new List<contents>(); | |||
//这里应该循环,如果多个 | |||
contents con = new contents(); | |||
con.channelId = Convert.ToInt32(channelId); | |||
con.id = Convert.ToInt32(Nid); | |||
listCon.Add(con); | |||
AList.contents = listCon; | |||
//AList.reasons = "终审通过"; | |||
HttpMethods.HttpPosts("http://" + ports + "/api/v1/contents/check", AList.ToJson(), ApiId); | |||
} | |||
#endregion | |||
} | |||
} | |||
catch (Exception ex) | |||
{ | |||
} | |||
} | |||
} | |||
public class Root | |||
{ | |||
public RootValue value { get; set; } | |||
} | |||
public class RootValue | |||
{ | |||
public string id { get; set; } | |||
} | |||
} |