| | |
| | | using Newtonsoft.Json; |
| | | using com.igetui.api.openservice.igetui.template; |
| | | using com.igetui.api.openservice.igetui; |
| | | using WebApiWithFleck; |
| | | |
| | | namespace WebAPI.Service |
| | | { |
| | |
| | | string content = ds.Tables[0].Rows[0]["内容"].ToString(); |
| | | template = GetNotificationTemplate(title, content, "/pages/ZLGL/OA_WorkLink/OA_WorkLinkBillQuery", "0"); // 跳转到工作联系单查询页面 |
| | | |
| | | bool pushSuccess = false; |
| | | // 广播 |
| | | if(ds.Tables[0].Rows[0]["发送类型"].ToString() == "公共") |
| | | { |
| | | // 遍历 全推送 |
| | | foreach(DataRow row in ds.Tables[1].Rows) |
| | | { |
| | | PushMessageToSingle(template, row["HClientID"].ToString()); |
| | | pushSuccess = PushMessageToSingle(template, row["HClientID"].ToString()); |
| | | } |
| | | }else // 单独推送 |
| | | { |
| | |
| | | { |
| | | if(ds.Tables[0].Rows[0]["接收人"].ToString() == row["HUserName"].ToString() |
| | | || ds.Tables[0].Rows[0]["抄送接收人"].ToString() == row["HUserName"].ToString()) |
| | | PushMessageToSingle(template, row["HClientID"].ToString()); |
| | | { |
| | | pushSuccess = PushMessageToSingle(template, row["HClientID"].ToString()); |
| | | } |
| | | } |
| | | } |
| | | |
| | | if(!pushSuccess) |
| | | { |
| | | // 个推 推送不成功(内网环境) 使用webSocket进行推送 |
| | | // TODO: 使用 rabbitMQ 实现消息队列 |
| | | // WebSocketServer.PushOne(HInterID); |
| | | } |
| | | } |
| | | } |
| | |
| | | } |
| | | |
| | | // 单推 使用通知消息模型 |
| | | private static void PushMessageToSingle(NotificationTemplate template, string ClientID) |
| | | private static bool PushMessageToSingle(NotificationTemplate template, string ClientID) |
| | | { |
| | | |
| | | IGtPush push = new IGtPush(HOST, APPKEY, MASTERSECRET); |
| | |
| | | LogService.Write("-----------------------------------------------"); |
| | | LogService.Write("-----------------------------------------------"); |
| | | LogService.Write("----------------服务端返回结果:" + pushResult); |
| | | return true; |
| | | } |
| | | catch (RequestException e) |
| | | { |
| | |
| | | LogService.Write("-----------------------------------------------"); |
| | | LogService.Write("-----------------------------------------------"); |
| | | LogService.Write("----------------服务端返回结果:" + pushResult); |
| | | return false; |
| | | } |
| | | } |
| | | |