예제 #1
0
 public void ProcessRequest(HttpContext context)
 {
     this.context = context;
     context.Response.ContentType = "text/plain";
     if (this.context.Request.HttpMethod == "POST")
     {
         try
         {
             string json = getPostData();
             SeatManage.JsonModel.BaseSeatNotify basemsg = SeatManage.SeatManageComm.JSONSerializer.Deserialize <SeatManage.JsonModel.BaseSeatNotify>(json);
             if (basemsg.NotifyType == SeatManage.JsonModel.SeatNotifyType.Msg)
             {
                 SeatManage.JsonModel.JM_SeatNotice noticeNodel = SeatManage.SeatManageComm.JSONSerializer.Deserialize <SeatManage.JsonModel.JM_SeatNotice>(json);
                 pushMsg(noticeNodel);
             }
             else
             {
                 SeatManage.JsonModel.JM_NotifyEvent notifyEvent = SeatManage.SeatManageComm.JSONSerializer.Deserialize <SeatManage.JsonModel.JM_NotifyEvent>(json);
                 pushEvent(notifyEvent);
             }
         }
         catch (Exception ex)
         { SeatManage.SeatManageComm.WriteLog.Write("消息出错:" + ex.Message); }
         finally
         {
             context.Response.End();
         }
     }
 }
예제 #2
0
        /// <summary>
        /// 推送事件(穿透消息)
        /// </summary>
        /// <param name="notifyEvent"></param>
        private void pushEvent(SeatManage.JsonModel.JM_NotifyEvent notifyEvent)
        {
            try
            {
                AppUserInfo app_user = AMS.ServiceProxy.App_UserInfoProxy.GetAppUserInfoByCardNoAndSchoolNum(notifyEvent.CardNo, notifyEvent.SchoolNum);
                if (app_user == null)
                {
                    return;
                }
                if (notifyEvent == null)
                {
                    return;
                }
                PushOptions pOpts = new PushOptions(app_user.ChannelId, 0, SeatManage.SeatManageComm.JSONSerializer.Serialize(notifyEvent), null, api_key, getTimestamp(), null, Device_Type.Android);

                BaiduPush.BaiduPush push = new BaiduPush.BaiduPush("POST", secret_key);
                string pushResult        = push.PushSingleDevice(pOpts);
                //  SeatManage.SeatManageComm.WriteLog.Write("消息推送结果:" + pushResult);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }