1
wtt
2026-02-12 fc9f979e90c300778c6dd43804145dac6db185e5
WebAPI/Service/GeTuiService.cs
@@ -9,6 +9,7 @@
using Newtonsoft.Json;
using com.igetui.api.openservice.igetui.template;
using com.igetui.api.openservice.igetui;
using WebApiWithFleck;
namespace WebAPI.Service
{
@@ -48,13 +49,14 @@
                    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 // 单独推送
                    {
@@ -63,8 +65,17 @@
                        {
                            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);
                    }
                }
            }
@@ -76,7 +87,7 @@
        }
        // 单推 使用通知消息模型
        private static void PushMessageToSingle(NotificationTemplate template, string ClientID)
        private static bool PushMessageToSingle(NotificationTemplate template, string ClientID)
        {
            IGtPush push = new IGtPush(HOST, APPKEY, MASTERSECRET);
@@ -100,6 +111,7 @@
                LogService.Write("-----------------------------------------------");
                LogService.Write("-----------------------------------------------");
                LogService.Write("----------------服务端返回结果:" + pushResult);
                return true;
            }
            catch (RequestException e)
            {
@@ -109,6 +121,7 @@
                LogService.Write("-----------------------------------------------");
                LogService.Write("-----------------------------------------------");
                LogService.Write("----------------服务端返回结果:" + pushResult);
                return false;
            }
        }