You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

MeetingManagementService.cs 27 KiB

4 years ago
3 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
3 years ago
4 years ago
3 years ago
4 years ago
3 years ago
4 years ago
3 years ago
4 years ago
3 years ago
4 years ago
3 years ago
4 years ago
3 years ago
4 years ago
3 years ago
4 years ago
3 years ago
4 years ago
4 years ago
3 years ago
4 years ago
3 years ago
4 years ago
3 years ago
4 years ago
3 years ago
4 years ago
3 years ago
4 years ago
4 years ago
3 years ago
4 years ago
3 years ago
3 years ago
4 years ago
3 years ago
4 years ago
3 years ago
4 years ago
3 years ago
3 years ago
4 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644
  1. using Dapper;
  2. using Learun.Application.Organization;
  3. using Learun.Application.TwoDevelopment.EducationalAdministration;
  4. using Learun.Application.TwoDevelopment.LR_Desktop;
  5. using Learun.DataBase.Repository;
  6. using Learun.Util;
  7. using Microsoft.AspNet.SignalR.Client;
  8. using Newtonsoft.Json;
  9. using System;
  10. using System.Collections.Generic;
  11. using System.Configuration;
  12. using System.Data;
  13. using System.Linq;
  14. using System.Text;
  15. using System.Threading.Tasks;
  16. using System.Web;
  17. namespace Learun.Application.TwoDevelopment.PersonnelManagement
  18. {
  19. /// <summary>
  20. /// 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架
  21. /// Copyright (c) 2013-2020 力软信息技术(苏州)有限公司
  22. /// 创 建:超级管理员
  23. /// 日 期:2021-02-21 10:07
  24. /// 描 述:会议管理
  25. /// </summary>
  26. public class MeetingManagementService : RepositoryFactory
  27. {
  28. #region 获取数据
  29. /// <summary>
  30. /// 获取页面显示列表分页数据
  31. /// <summary>
  32. /// <param name="pagination">分页参数</param>
  33. /// <param name="queryJson">查询参数</param>
  34. /// <returns></returns>
  35. public IEnumerable<MeetingManagementEntity> GetPageList(Pagination pagination, string queryJson)
  36. {
  37. try
  38. {
  39. var strSql = new StringBuilder();
  40. strSql.Append("SELECT t.*,r.Name as ConferenceRoomName ");
  41. strSql.Append(" FROM MeetingManagement t left join ConferenceRoom r on t.MeetingPlace=r.ID ");
  42. strSql.Append(" WHERE 1=1 ");
  43. var queryParam = queryJson.ToJObject();
  44. // 虚拟参数
  45. var dp = new DynamicParameters(new { });
  46. if (!queryParam["MeetingTitle"].IsEmpty())
  47. {
  48. dp.Add("MeetingTitle", "%" + queryParam["MeetingTitle"].ToString() + "%", DbType.String);
  49. strSql.Append(" AND t.MeetingTitle Like @MeetingTitle ");
  50. }
  51. if (!queryParam["MeetingPlace"].IsEmpty())
  52. {
  53. dp.Add("MeetingPlace", queryParam["MeetingPlace"].ToString(), DbType.String);
  54. strSql.Append(" AND t.MeetingPlace = @MeetingPlace ");
  55. }
  56. if (!queryParam["CreateUser"].IsEmpty())
  57. {
  58. dp.Add("CreateUser", queryParam["CreateUser"].ToString(), DbType.String);
  59. strSql.Append(" AND t.CreateUser = @CreateUser ");
  60. }
  61. if (!queryParam["InternalParticipants"].IsEmpty())
  62. {
  63. dp.Add("InternalParticipants", "%" + queryParam["InternalParticipants"].ToString() + "%", DbType.String);
  64. strSql.Append(" AND t.InternalParticipants Like @InternalParticipants ");
  65. }
  66. return this.BaseRepository("CollegeMIS").FindList<MeetingManagementEntity>(strSql.ToString(), dp, pagination);
  67. }
  68. catch (Exception ex)
  69. {
  70. if (ex is ExceptionEx)
  71. {
  72. throw;
  73. }
  74. else
  75. {
  76. throw ExceptionEx.ThrowServiceException(ex);
  77. }
  78. }
  79. }
  80. /// <summary>
  81. /// 获取页面显示列表数据
  82. /// <summary>
  83. /// <param name="queryJson">查询参数</param>
  84. /// <returns></returns>
  85. public IEnumerable<MeetingManagementEntity> GetList(string queryJson)
  86. {
  87. try
  88. {
  89. var strSql = new StringBuilder();
  90. strSql.Append("SELECT t.*");
  91. strSql.Append(" FROM MeetingManagement t ");
  92. strSql.Append(" WHERE 1=1 ");
  93. var queryParam = queryJson.ToJObject();
  94. // 虚拟参数
  95. var dp = new DynamicParameters(new { });
  96. if (!queryParam["MeetingTitle"].IsEmpty())
  97. {
  98. dp.Add("MeetingTitle", "%" + queryParam["MeetingTitle"].ToString() + "%", DbType.String);
  99. strSql.Append(" AND t.MeetingTitle Like @MeetingTitle ");
  100. }
  101. if (!queryParam["MeetingPlace"].IsEmpty())
  102. {
  103. dp.Add("MeetingPlace", queryParam["MeetingPlace"].ToString(), DbType.String);
  104. strSql.Append(" AND t.MeetingPlace = @MeetingPlace ");
  105. }
  106. if (!queryParam["CreateUser"].IsEmpty())
  107. {
  108. dp.Add("CreateUser", queryParam["CreateUser"].ToString(), DbType.String);
  109. strSql.Append(" AND t.CreateUser = @CreateUser ");
  110. }
  111. return this.BaseRepository("CollegeMIS").FindList<MeetingManagementEntity>(strSql.ToString(), dp);
  112. }
  113. catch (Exception ex)
  114. {
  115. if (ex is ExceptionEx)
  116. {
  117. throw;
  118. }
  119. else
  120. {
  121. throw ExceptionEx.ThrowServiceException(ex);
  122. }
  123. }
  124. }
  125. /// <summary>
  126. /// 获取MeetingManagement表实体数据
  127. /// <param name="keyValue">主键</param>
  128. /// <summary>
  129. /// <returns></returns>
  130. public MeetingManagementEntity GetMeetingManagementEntity(string keyValue)
  131. {
  132. try
  133. {
  134. var data = this.BaseRepository("CollegeMIS").FindEntity<MeetingManagementEntity>(keyValue);
  135. if (data != null)
  136. {
  137. data.ConferenceRoomName = this.BaseRepository("CollegeMIS").FindEntity<ConferenceRoomEntity>(data.MeetingPlace).Name;
  138. }
  139. return data;
  140. }
  141. catch (Exception ex)
  142. {
  143. if (ex is ExceptionEx)
  144. {
  145. throw;
  146. }
  147. else
  148. {
  149. throw ExceptionEx.ThrowServiceException(ex);
  150. }
  151. }
  152. }
  153. /// <summary>
  154. /// 获取MeetingManagement表实体数据
  155. /// <param name="keyValue">主键</param>
  156. /// <summary>
  157. /// <returns></returns>
  158. public MeetingManagementEntity GetMeetingManagementEntityByProcessId(string processId)
  159. {
  160. try
  161. {
  162. return this.BaseRepository("CollegeMIS").FindEntity<MeetingManagementEntity>(x => x.ProcessId == processId);
  163. }
  164. catch (Exception ex)
  165. {
  166. if (ex is ExceptionEx)
  167. {
  168. throw;
  169. }
  170. else
  171. {
  172. throw ExceptionEx.ThrowServiceException(ex);
  173. }
  174. }
  175. }
  176. #endregion
  177. #region 提交数据
  178. /// <summary>
  179. /// 删除实体数据
  180. /// <param name="keyValue">主键</param>
  181. /// <summary>
  182. /// <returns></returns>
  183. public void DeleteEntity(string keyValue)
  184. {
  185. var db = this.BaseRepository("CollegeMIS").BeginTrans();
  186. try
  187. {
  188. //会议签到记录表中删除参会人员记录
  189. db.Delete<MeetingSignInRecordEntity>(x => x.MeetID == keyValue);
  190. //会议工作管理表删除会议
  191. db.Delete<MeetingManagementEntity>(t => t.Id == keyValue);
  192. db.Commit();
  193. }
  194. catch (Exception ex)
  195. {
  196. db.Rollback();
  197. if (ex is ExceptionEx)
  198. {
  199. throw;
  200. }
  201. else
  202. {
  203. throw ExceptionEx.ThrowServiceException(ex);
  204. }
  205. }
  206. }
  207. /// <summary>
  208. /// 保存实体数据(新增、修改)
  209. /// <param name="keyValue">主键</param>
  210. /// <summary>
  211. /// <returns></returns>
  212. public string SaveEntity(UserInfo userInfo, string keyValue, MeetingManagementEntity entity)
  213. {
  214. var db = this.BaseRepository("CollegeMIS").BeginTrans();
  215. try
  216. {
  217. if (!string.IsNullOrEmpty(keyValue))
  218. {
  219. entity.Modify(keyValue, userInfo);
  220. db.Update(entity);
  221. }
  222. else
  223. {
  224. entity.Create(userInfo);
  225. db.Insert(entity);
  226. }
  227. db.Commit();
  228. }
  229. catch (Exception ex)
  230. {
  231. db.Rollback();
  232. if (ex is ExceptionEx)
  233. {
  234. throw;
  235. }
  236. else
  237. {
  238. throw ExceptionEx.ThrowServiceException(ex);
  239. }
  240. }
  241. return entity.Id;
  242. }
  243. /// <summary>
  244. /// 审核实体数据
  245. /// <param name="keyValue">主键</param>
  246. /// <summary>
  247. /// <returns></returns>
  248. public void DoCheck(UserInfo userInfo, string keyValue, string status)
  249. {
  250. var db = this.BaseRepository("CollegeMIS").BeginTrans();
  251. try
  252. {
  253. //修改会议工作管理表的审核字段;
  254. db.ExecuteBySql("update MeetingManagement set CheckStatus='" + status + "',CheckUser='" + userInfo.userId + "',CheckTime='" + DateTime.Now + "' where Id='" + keyValue + "' ");
  255. if (status == "1")//审核通过:会议签到记录表中增加参会人员;
  256. {
  257. var entity = db.FindEntity<MeetingManagementEntity>(x => x.Id == keyValue);
  258. if (entity != null)
  259. {
  260. //增加校内参入人员:
  261. if (!string.IsNullOrEmpty(entity.InternalParticipants))
  262. {
  263. if (entity.InternalParticipants.IndexOf(',') == -1)
  264. {
  265. var model = new MeetingSignInRecordEntity()
  266. {
  267. MeetID = entity.Id,
  268. ParticipantID = entity.InternalParticipants,
  269. ParticipantName = this.BaseRepository().FindEntity<UserEntity>(x => x.F_UserId == entity.InternalParticipants)?.F_RealName,
  270. IsSignIn = false
  271. };
  272. model.Create(userInfo);
  273. db.Insert(model);
  274. }
  275. else
  276. {
  277. foreach (var item in entity.InternalParticipants.Split(','))
  278. {
  279. var model = new MeetingSignInRecordEntity()
  280. {
  281. MeetID = entity.Id,
  282. ParticipantID = item,
  283. ParticipantName = this.BaseRepository().FindEntity<UserEntity>(x => x.F_UserId == item)?.F_RealName,
  284. IsSignIn = false
  285. };
  286. model.Create(userInfo);
  287. db.Insert(model);
  288. }
  289. }
  290. }
  291. //增加校外参入人员:
  292. if (!string.IsNullOrEmpty(entity.ExternalParticipants))
  293. {
  294. if (entity.ExternalParticipants.IndexOf(',') == -1)
  295. {
  296. var model = new MeetingSignInRecordEntity()
  297. {
  298. MeetID = entity.Id,
  299. ParticipantName = entity.ExternalParticipants,
  300. IsSignIn = false
  301. };
  302. model.Create(userInfo);
  303. db.Insert(model);
  304. }
  305. else
  306. {
  307. foreach (var item in entity.ExternalParticipants.Split(','))
  308. {
  309. var model = new MeetingSignInRecordEntity()
  310. {
  311. MeetID = entity.Id,
  312. ParticipantName = item,
  313. IsSignIn = false
  314. };
  315. model.Create(userInfo);
  316. db.Insert(model);
  317. }
  318. }
  319. }
  320. }
  321. }
  322. else if (status == "2") //审核不通过:会议签到记录表中删除参会人员记录;
  323. {
  324. db.Delete<MeetingSignInRecordEntity>(x => x.MeetID == keyValue);
  325. }
  326. db.Commit();
  327. }
  328. catch (Exception ex)
  329. {
  330. db.Rollback();
  331. if (ex is ExceptionEx)
  332. {
  333. throw;
  334. }
  335. else
  336. {
  337. throw ExceptionEx.ThrowServiceException(ex);
  338. }
  339. }
  340. }
  341. /// <summary>
  342. /// 提交实体数据
  343. /// <param name="keyValue">主键</param>
  344. /// <summary>
  345. /// <returns></returns>
  346. public void DoSubmit(string keyValue, string status, string processId)
  347. {
  348. try
  349. {
  350. this.BaseRepository("CollegeMIS").ExecuteBySql("update MeetingManagement set CheckStatus='" + status + "',ProcessId='" + processId + "' where Id='" + keyValue + "' ");
  351. }
  352. catch (Exception ex)
  353. {
  354. if (ex is ExceptionEx)
  355. {
  356. throw;
  357. }
  358. else
  359. {
  360. throw ExceptionEx.ThrowServiceException(ex);
  361. }
  362. }
  363. }
  364. /// <summary>
  365. /// 判断会议场地是否被占用
  366. /// <param name="keyValue">主键</param>
  367. /// <summary>
  368. /// <returns></returns>
  369. public bool JudgeIsOccupy(MeetingManagementEntity entity)
  370. {
  371. try
  372. {
  373. var result = false;//默认false,代表未占用
  374. //查找已提交/已审核通过的会议场地
  375. var list = this.BaseRepository("CollegeMIS").FindList<MeetingManagementEntity>(x => x.MeetingPlace == entity.MeetingPlace && (x.CheckStatus == "1" || x.CheckStatus == "3")).OrderBy(x => x.BeginTime);
  376. if (list.Any())
  377. {
  378. //有则判断时间是否冲突
  379. foreach (var item in list)
  380. {
  381. //开始时间:小于区间左,则判断结束时间;区间中间,则占用;大于区间右,则不占用;
  382. if (entity.BeginTime < item.BeginTime)
  383. {
  384. //结束时间:小于区间左,则不占用;
  385. if (entity.EndTime > item.BeginTime)
  386. {
  387. result = true;
  388. return result;
  389. }
  390. }
  391. else if(entity.BeginTime < item.EndTime)
  392. {
  393. result = true;
  394. return result;
  395. }
  396. }
  397. }
  398. return result;
  399. }
  400. catch (Exception ex)
  401. {
  402. if (ex is ExceptionEx)
  403. {
  404. throw;
  405. }
  406. else
  407. {
  408. throw ExceptionEx.ThrowServiceException(ex);
  409. }
  410. }
  411. }
  412. /// <summary>
  413. /// 审核实体数据
  414. /// <param name="keyValue">主键</param>
  415. /// <summary>
  416. /// <returns></returns>
  417. public void ChangeStatusByProcessId(string processId, string status, string userId)
  418. {
  419. UserInfo userInfo = LoginUserInfo.Get();
  420. var db = this.BaseRepository("CollegeMIS").BeginTrans();
  421. try
  422. {
  423. //修改会议工作管理表的审核字段;
  424. db.ExecuteBySql("update MeetingManagement set CheckStatus='" + status + "',CheckUser='" + userId + "',CheckTime='" + DateTime.Now + "' where ProcessId='" + processId + "' ");
  425. var entity = db.FindEntity<MeetingManagementEntity>(x => x.ProcessId == processId);
  426. if (entity != null)
  427. {
  428. if (status == "1")//审核通过:会议签到记录表中增加参会人员;
  429. {
  430. //增加校内参入人员:
  431. if (!string.IsNullOrEmpty(entity.InternalParticipants))
  432. {
  433. if (entity.InternalParticipants.IndexOf(',') == -1)
  434. {
  435. var model = new MeetingSignInRecordEntity()
  436. {
  437. MeetID = entity.Id,
  438. ParticipantID = entity.InternalParticipants,
  439. ParticipantName = this.BaseRepository().FindEntity<UserEntity>(x => x.F_UserId == entity.InternalParticipants)?.F_RealName,
  440. IsSignIn = false
  441. };
  442. model.Create(userInfo);
  443. db.Insert(model);
  444. }
  445. else
  446. {
  447. foreach (var item in entity.InternalParticipants.Split(','))
  448. {
  449. var model = new MeetingSignInRecordEntity()
  450. {
  451. MeetID = entity.Id,
  452. ParticipantID = item,
  453. ParticipantName = this.BaseRepository().FindEntity<UserEntity>(x => x.F_UserId == item)?.F_RealName,
  454. IsSignIn = false
  455. };
  456. model.Create(userInfo);
  457. db.Insert(model);
  458. }
  459. }
  460. }
  461. //增加校外参入人员:
  462. if (!string.IsNullOrEmpty(entity.ExternalParticipants))
  463. {
  464. if (entity.ExternalParticipants.IndexOf(',') == -1)
  465. {
  466. var model = new MeetingSignInRecordEntity()
  467. {
  468. MeetID = entity.Id,
  469. ParticipantName = entity.ExternalParticipants,
  470. IsSignIn = false
  471. };
  472. model.Create(userInfo);
  473. db.Insert(model);
  474. }
  475. else
  476. {
  477. foreach (var item in entity.ExternalParticipants.Split(','))
  478. {
  479. var model = new MeetingSignInRecordEntity()
  480. {
  481. MeetID = entity.Id,
  482. ParticipantName = item,
  483. IsSignIn = false
  484. };
  485. model.Create(userInfo);
  486. db.Insert(model);
  487. }
  488. }
  489. }
  490. }
  491. else if (status == "2") //审核不通过:会议签到记录表中删除参会人员记录;
  492. {
  493. db.Delete<MeetingSignInRecordEntity>(x => x.MeetID == entity.Id);
  494. }
  495. }
  496. db.Commit();
  497. }
  498. catch (Exception ex)
  499. {
  500. db.Rollback();
  501. if (ex is ExceptionEx)
  502. {
  503. throw;
  504. }
  505. else
  506. {
  507. throw ExceptionEx.ThrowServiceException(ex);
  508. }
  509. }
  510. }
  511. public void ReceivedList(string processId)
  512. {
  513. var Received = GetMeetingManagementEntityByProcessId(processId);
  514. List<UserEntity> userInfos = new List<UserEntity>();
  515. foreach (var rid in Received.InternalParticipants.Split(','))
  516. {
  517. var user = this.BaseRepository().FindEntity<UserEntity>(m => m.F_UserId == rid);
  518. if (!userInfos.Contains(user))
  519. {
  520. userInfos.Add(user);
  521. }
  522. }
  523. if (!string.IsNullOrEmpty(Received.RecordPerson))
  524. {
  525. foreach (var rid in Received.RecordPerson.Split(','))
  526. {
  527. var user = this.BaseRepository().FindEntity<UserEntity>(m => m.F_UserId == rid);
  528. if (!userInfos.Contains(user))
  529. {
  530. userInfos.Add(user);
  531. }
  532. }
  533. }
  534. //foreach (var uitem in userInfos)
  535. //{
  536. // SYS_ReceiveMessageEntity receiveMessageEntity = new SYS_ReceiveMessageEntity();
  537. // receiveMessageEntity.Create();
  538. // receiveMessageEntity.SENDERID = Received.SENDERID;
  539. // receiveMessageEntity.SENDER = messageentity.SENDER;
  540. // receiveMessageEntity.RECEIVERID = uitem.F_UserId;
  541. // receiveMessageEntity.RECEIVER = uitem.F_RealName;
  542. // receiveMessageEntity.TITLE = messageentity.TITLE;
  543. // receiveMessageEntity.CONTENTS = messageentity.CONTENTS;
  544. // receiveMessageEntity.URL = messageentity.URL;
  545. // receiveMessageEntity.READFLAG = 0;
  546. // receiveMessageEntity.SENDTIME = DateTime.Now;
  547. // receiveMessageEntity.DelFlag = false;
  548. // this.BaseRepository().Insert(receiveMessageEntity);
  549. //}
  550. //读取信息推送管理-会议申请推送(03)的配置
  551. var informationPushEntity = this.BaseRepository().FindEntity<Sys_InformationPushEntity>(x => x.PushItem == "03");
  552. if (informationPushEntity != null && informationPushEntity.Status == true)
  553. {
  554. //微信推送
  555. try
  556. {
  557. PushWeixin(userInfos, Received.MeetingTitle);
  558. }
  559. catch (Exception e)
  560. {
  561. }
  562. //飞星推送
  563. Task.Run(async () =>
  564. {
  565. using (var hubConnection = new HubConnection(ConfigurationManager.AppSettings["CommunicationServeraddress"]))
  566. {
  567. var hubProxy = hubConnection.CreateHubProxy("SignalRHub");
  568. await hubConnection.Start();
  569. await hubProxy.Invoke("PushAnnouncement", Received.InternalParticipants, Received.MeetingTitle, Util.Str.ReplaceHtml(HttpUtility.HtmlDecode(Received.Content)).Length < 20 ? Util.Str.ReplaceHtml(HttpUtility.HtmlDecode(Received.Content)) : Util.Str.ReplaceHtml(HttpUtility.HtmlDecode(Received.Content)).Substring(0, 20), "mail", string.Join(",", userInfos.Select(m => m.F_UserId)), "");
  570. }
  571. });
  572. }
  573. }
  574. public void PushWeixin(List<UserEntity> needpostuserlist, string title)
  575. {
  576. var WeChatConfigentity = BaseRepository().FindEntity<WeChatConfigEntity>(m => m.IsEnable == true);
  577. string appid = WeChatConfigentity.APPId;
  578. string secret = WeChatConfigentity.secret;
  579. var wechatemplete = BaseRepository()
  580. .FindEntity<WeChatTemplateEntity>(m => m.WeID == WeChatConfigentity.ID && m.TCode == "task");
  581. string weixintaskurl = wechatemplete.TUrl;
  582. string weixintasktempid = wechatemplete.TempId;
  583. var responsejson = Util.HttpMethods.HttpGet("https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=" + appid + "&secret=" + secret);
  584. foreach (UserEntity userinfo in needpostuserlist)
  585. {
  586. if (userinfo != null && !string.IsNullOrEmpty(userinfo.OpenIdForWeixin))
  587. {
  588. //执行推送任务
  589. if (!string.IsNullOrEmpty(appid) && !string.IsNullOrEmpty(secret) && !string.IsNullOrEmpty(weixintaskurl) && !string.IsNullOrEmpty(weixintasktempid))
  590. {
  591. if (!string.IsNullOrEmpty(responsejson))
  592. {
  593. var weixintokenobj = JsonConvert.DeserializeObject<dynamic>(responsejson);
  594. if (string.IsNullOrEmpty(weixintokenobj.errcode))
  595. {
  596. string access_token = weixintokenobj.access_token;
  597. string jsondata = "{\"touser\":\"" + userinfo.OpenIdForWeixin + "\"," +
  598. "\"template_id\":\"" + weixintasktempid + "\"," +
  599. "\"url\":\"" + weixintaskurl + "\"," +
  600. "\"data\":{" +
  601. "\"first\": {\"value\":\"您有新的会议消息\",\"color\":\"#173177\"}," +
  602. "\"keyword1\":{\"value\":\"未读邮件\",\"color\":\"#173177\"}," +
  603. "\"keyword2\": {\"value\":\"" + title + "\",\"color\":\"#173177\"}," +
  604. "\"keyword3\": {\"value\":\"待查看\",\"color\":\"#173177\"}," +
  605. "\"keyword4\": {\"value\":\"您有新的未读会议【" + title + "】\",\"color\":\"#173177\"}" +
  606. "}" +
  607. "}";
  608. string pushresult = Util.HttpMethods.HttpPost("https://api.weixin.qq.com/cgi-bin/message/template/send?access_token=" + access_token, jsondata);
  609. }
  610. }
  611. }
  612. }
  613. }
  614. }
  615. #endregion
  616. }
  617. }