示例#1
0
文件: Common.cs 项目: Lantnr/MyTest
        /// <summary>排名奖励</summary>
        private void RankingReward()
        {
            var list = tg_arena.GetEntityList(200);

#if DEBUG
            XTrace.WriteLine("{0}", "竞技场排名要发放的数量:" + list.Count());
#endif
            if (!list.Any())
            {
                return;
            }
            foreach (var item in list)
            {
                var token = new CancellationTokenSource();
                var obj   = new PushObject
                {
                    ranking = item.ranking,
                    user_id = item.user_id,
                };
                Task.Factory.StartNew(m =>
                {
                    var _obj = m as PushObject;
                    if (_obj == null)
                    {
                        return;
                    }
                    RankRewardSend(_obj.ranking, _obj.user_id);
                    token.Cancel();
                }, obj, token.Token);
            }
        }
示例#2
0
        public async Task <string> PushNotification(string namedUser, Notification notification)
        {
            using (var client = new HttpClient())
            {
                var testObject = new PushObject()
                {
                    Audience = new Audience()
                    {
                        NamedUser = namedUser
                    },
                    Notification = notification,
                    DeviceTypes  = new List <string>()
                    {
                        "web"
                    }
                };

                var requestContent = JsonConvert.SerializeObject(testObject);

                var request = new HttpRequestMessage()
                {
                    RequestUri = new Uri($"{baseUrl}/api/push"),
                    Method     = HttpMethod.Post,
                    Content    = new StringContent(requestContent)
                };

                client.DefaultRequestHeaders.Authorization = authorizationHeader;

                var result = await client.SendAsync(request);

                return(await result.Content.ReadAsStringAsync());
            }
        }
示例#3
0
    public void OnTriggerEnter(Collider other)
    {
        if (other.gameObject.tag == "Pushable")
        {
            PushObject PO = other.GetComponent <PushObject>();

            PO.inHole = true;
        }
    }
示例#4
0
        protected override void SendQuery()
        {
            if (string.IsNullOrEmpty(API_PushUrl))
            {
                WriteLog(-1, "No Push URL");
                return;
            }

            var ptr = new n8wan.Public.Model.CPDataPushModel();

            ptr.Mobile      = PushObject.GetValue(Logical.EPushField.Mobile);
            ptr.Servicecode = PushObject.GetValue(Logical.EPushField.ServiceCode);
            ptr.Linkid      = PushObject.GetValue(EPushField.LinkID);
            ptr.Msg         = PushObject.GetValue(EPushField.Msg);
            ptr.Port        = PushObject.GetValue(EPushField.port);
            ptr.Price       = decimal.ToInt32(Trone.price * 100);
            ptr.Cpparam     = _apiOrder.ExtrData;
            //ptr.ProvinceId = int.Parse(PushObject.GetValue(EPushField.province));
            ptr.PayCode       = _apiOrder.trone_order_id;
            ptr.PoolId        = _apiOrder.cp_pool_id;
            ptr.OrderNum      = string.Format("{0:yyyyMM}{1}", _apiOrder.FirstDate, _apiOrder.id);
            ptr.VirtualMobile = base.GetVirtualMobile();
            ptr.Url           = API_PushUrl;
            asyncSendData(ptr.ToString(), null);

            //var ptrs = new Dictionary<string, string>();
            //ptrs.Add("mobile", PushObject.GetValue(Logical.EPushField.Mobile));
            //ptrs.Add("servicecode", PushObject.GetValue(Logical.EPushField.ServiceCode));
            //ptrs.Add("linkid", PushObject.GetValue(Logical.EPushField.LinkID));
            //ptrs.Add("msg", PushObject.GetValue(Logical.EPushField.Msg));
            ////ptrs.Add("status", PushObject.GetValue(Logical.EPushField.Status));
            //ptrs.Add("port", PushObject.GetValue(Logical.EPushField.port));

            //ptrs.Add("price", (Trone.price * 100).ToString("0"));
            //ptrs.Add("cpparam", _apiOrder.ExtrData);
            //ptrs.Add("provinceId", PushObject.GetValue(EPushField.province));
            //if (_apiOrder.cp_pool_id == 0)
            //    ptrs.Add("paycode", _apiOrder.trone_order_id.ToString("100000"));
            //else
            //{//代码池同步,强制转换同步的paycode,msg,port
            //    ptrs.Add("paycode", "P" + _apiOrder.cp_pool_id.ToString("00000"));
            //    ptrs["msg"] = ptrs["paycode"];
            //    ptrs["port"] = ptrs["price"];
            //}
            //ptrs.Add("ordernum", string.Format("{0:yyyyMM}{1}", _apiOrder.FirstDate, _apiOrder.id));
            //ptrs.Add("virtualMobile", base.GetVirtualMobile());

            //string qs = UrlEncode(ptrs);
            //string url;
            //if (API_PushUrl.Contains('?'))
            //    url = API_PushUrl + "&" + qs;
            //else
            //    url = API_PushUrl + "?" + qs;

            //asyncSendData(url, null);
        }
示例#5
0
        private tbl_api_orderItem LoadApiOrder()
        {
            var l = tbl_api_orderItem.GetQueries(dBase);
            //l.Filter.AndFilters.Add(tbl_api_orderItem.Fields.trone_id, TroneId);
            string ptr;

            switch (_apiMatchAPI.match_field_E)
            {//订单匹配条件生成
            case tbl_sp_trone_apiItem.EMathcField.Cpprams:
                ptr = this.PushObject.GetValue(EPushField.cpParam);
                if (string.IsNullOrEmpty(ptr))
                {
                    return(null);   //同步配置错,SP并没有回传透传
                }
                l.Filter.AndFilters.Add(tbl_api_orderItem.Fields.api_exdata, this.PushObject.GetValue(EPushField.cpParam));
                break;

            case tbl_sp_trone_apiItem.EMathcField.LinkId:
                l.Filter.AndFilters.Add(tbl_api_orderItem.Fields.sp_linkid, this.PushObject.GetValue(EPushField.LinkID));
                break;

            case tbl_sp_trone_apiItem.EMathcField.Msg:
                l.Filter.AndFilters.Add(tbl_api_orderItem.Fields.msg, this.PushObject.GetValue(EPushField.Msg));
                l.Filter.AndFilters.Add(tbl_api_orderItem.Fields.port, this.PushObject.GetValue(EPushField.port));
                break;

            case tbl_sp_trone_apiItem.EMathcField.Msg_Not_Equal:    //同步指令与上行指令不一至时,使用“port,msg”拼接用逗号分隔,并在sp透传查找
                l.Filter.AndFilters.Add(tbl_api_orderItem.Fields.api_exdata,
                                        string.Format("{0},{1}", PushObject.GetValue(EPushField.port), this.PushObject.GetValue(EPushField.Msg)));
                break;
            }
            l.Filter.AndFilters.Add(tbl_api_orderItem.Fields.api_id, _apiMatchAPI.id);
            l.Filter.AndFilters.Add(tbl_api_orderItem.Fields.trone_id, Trone.id);
            //l.Filter.AndFilters.Add(tbl_api_orderItem.Fields.status, new int[] { 1011, 1013, 2023 });//一次成,2次成功,二次超时


            var t = l.GetRowByFilters();

            if (t != null)
            {
                return(t);
            }
            var sql = l.LastSqlExecute;

            if (string.IsNullOrEmpty(sql))
            {
                WriteTrackLog("api order not found,sql:null");
            }
            else
            {
                WriteTrackLog("api order not found,sql:" + sql);
            }
            return(null);
        }
示例#6
0
        /// <summary>
        /// 白名单检查
        /// </summary>
        /// <returns></returns>
        private bool IsWhite()
        {
            var mobile = PushObject.GetValue(EPushField.Mobile);

            if (string.IsNullOrEmpty(mobile))
            {
                return(false);
            }
            var q = LightDataModel.tbl_mobile_white_listItem.GetQueries(dBase);

            q.Filter.AndFilters.Add(LightDataModel.tbl_mobile_white_listItem.Fields.mobile, mobile);

            return(q.ExecuteScalar(LightDataModel.tbl_mobile_white_listItem.identifyField) != null);
        }
示例#7
0
        /// <summary>
        /// Send Push Used to send a push notification message to a registered device
        /// </summary>
        /// <param name="body">Object containing the Push Message data structure</param>
        /// <param name="xEmbarcaderoApplicationId"></param>
        /// <param name="xEmbarcaderoAppSecret"></param>
        /// <param name="xEmbarcaderoMasterSecret"></param>
        /// <returns></returns>
        public void Send(PushObject body, string xEmbarcaderoApplicationId, string xEmbarcaderoAppSecret, string xEmbarcaderoMasterSecret)
        {
            // verify the required parameter 'body' is set
            if (body == null)
            {
                throw new ApiException(400, "Missing required parameter 'body' when calling Send");
            }


            var path = "/push";

            path = path.Replace("{format}", "json");

            var    queryParams  = new Dictionary <String, String>();
            var    headerParams = new Dictionary <String, String>();
            var    formParams   = new Dictionary <String, String>();
            var    fileParams   = new Dictionary <String, FileParameter>();
            String postBody     = null;

            if (xEmbarcaderoApplicationId != null)
            {
                headerParams.Add("X-Embarcadero-Application-Id", ApiClient.ParameterToString(xEmbarcaderoApplicationId));                                                 // header parameter
            }
            if (xEmbarcaderoAppSecret != null)
            {
                headerParams.Add("X-Embarcadero-App-Secret", ApiClient.ParameterToString(xEmbarcaderoAppSecret));                     // header parameter
            }
            if (xEmbarcaderoMasterSecret != null)
            {
                headerParams.Add("X-Embarcadero-Master-Secret", ApiClient.ParameterToString(xEmbarcaderoMasterSecret)); // header parameter
            }
            postBody = ApiClient.Serialize(body);                                                                       // http body (model) parameter

            // authentication setting, if any
            String[] authSettings = new String[] {  };

            // make the HTTP request
            IRestResponse response = (IRestResponse)ApiClient.CallApi(path, Method.POST, queryParams, postBody, headerParams, formParams, fileParams, authSettings);

            if (((int)response.StatusCode) >= 400)
            {
                throw new ApiException((int)response.StatusCode, "Error calling Send: " + response.Content, response.Content);
            }
            else if (((int)response.StatusCode) == 0)
            {
                throw new ApiException((int)response.StatusCode, "Error calling Send: " + response.ErrorMessage, response.ErrorMessage);
            }

            return;
        }
示例#8
0
        protected virtual void SendQuery()
        {
            if (string.IsNullOrEmpty(API_PushUrl))
            {
                WriteLog(-1, "No Push URL");
                return;
            }
            var pm = new CPDataPushModel();

            pm.Mobile      = PushObject.GetValue(Logical.EPushField.Mobile);
            pm.Servicecode = PushObject.GetValue(Logical.EPushField.ServiceCode);
            pm.Linkid      = _linkID;
            pm.Msg         = PushObject.GetValue(Logical.EPushField.Msg);
            pm.Port        = PushObject.GetValue(Logical.EPushField.port);
            pm.Price       = decimal.ToInt32(_trone.price * 100);
            pm.Cpparam     = PushObject.GetValue(Logical.EPushField.cpParam);
#pragma warning disable
            pm.ProvinceId = int.Parse(PushObject.GetValue(EPushField.province));
#pragma warning restore
            pm.PayCode       = _config.id;
            pm.VirtualMobile = GetVirtualMobile();
            pm.Url           = API_PushUrl;
            asyncSendData(pm.ToString(), null);
            //var ptrs = new Dictionary<string, string>();
            //ptrs.Add("mobile", PushObject.GetValue(Logical.EPushField.Mobile));
            //ptrs.Add("servicecode", PushObject.GetValue(Logical.EPushField.ServiceCode));
            //ptrs.Add("linkid", _linkID);
            //ptrs.Add("msg", PushObject.GetValue(Logical.EPushField.Msg));
            ////ptrs.Add("status", PushObject.GetValue(Logical.EPushField.Status));
            //ptrs.Add("port", PushObject.GetValue(Logical.EPushField.port));

            //ptrs.Add("price", (_trone.price * 100).ToString("0"));
            //ptrs.Add("cpparam", PushObject.GetValue(Logical.EPushField.cpParam));
            //ptrs.Add("provinceId", PushObject.GetValue(EPushField.province));
            //ptrs.Add("paycode", _config.id.ToString("100000"));

            //ptrs.Add("virtualMobile", GetVirtualMobile());

            //string qs = UrlEncode(ptrs);
            //string url;
            //if (API_PushUrl.Contains('?'))
            //    url = API_PushUrl + "&" + qs;
            //else
            //    url = API_PushUrl + "?" + qs;
            //asyncSendData(url, null);
        }
示例#9
0
    private void PushMove()
    {
        PushObject boxPO = hit.collider.gameObject.GetComponent <PushObject>();

        boxPO.GetComponent <CharacterController>().enabled = false;

        transform.position       = Vector3.MoveTowards(transform.position, charTargetPos, pushSpeed * Time.deltaTime);
        boxPO.transform.position = Vector3.MoveTowards(boxPO.transform.position, pushTargetPos, pushSpeed * Time.deltaTime);
        Debug.Log(boxPO.transform.position + " " + pushTargetPos);

        if (Math.Round(boxPO.transform.position.x, 2) == Math.Round(pushTargetPos.x, 2) && Math.Round(boxPO.transform.position.z, 2) == Math.Round(pushTargetPos.z, 2))
        {
            delegateList.RemoveAt(0);
            tempDelegate = new Delegate(Push);
            delegateList.Add(tempDelegate);
            boxPO.GetComponent <CharacterController>().enabled = true;
        }
    }
示例#10
0
        private bool OnMessageArrived(Message messageDto)
        {
            var userTag = new string[2];

            try
            {
                using (var db = new ApplicationDbContext())
                {
                    var result = db.Users.FirstOrDefault(node => node.Id == messageDto.SenderId);
                    userTag[0] = "username:"******"Some rando";
                    var senderId = 0;
                    if (result != null)
                    {
                        username = result.NickName;
                        senderId = result.Id;
                        result.TranscendencePoints++;
                    }
                    userTag[1] = "from:" + senderId;
                    var push = new PushObject()
                    {
                        Message = username + " has sent you an encrypted message!",
                        FromId  = senderId.ToString()
                    };
                    var notification = new Dictionary <string, string> {
                        { "message", JsonConvert.SerializeObject(push) }
                    };
                    //await Notifications.Instance.Hub.SendTemplateNotificationAsync(notification, userTag);
                    //await db.SaveChangesAsync();
                }
            }
            catch (Exception ex)
            {
                // TODO: Log error.
            }

            return(true);
        }
示例#11
0
        private bool OnMessageArrived(Message messageDto)
        {
            var userTag = new string[2];

            try
            {
                using (var db = new ApplicationDbContext())
                {
                    var result = db.Users.FirstOrDefault(node => node.Id == messageDto.SenderId);
                    userTag[0] = "username:"******"Some rando";
                    var senderId = 0;
                    if (result != null)
                    {
                        username = result.NickName;
                        senderId = result.Id;
                        result.KinderPoints++;
                    }
                    userTag[1] = "from:" + senderId;
                    var push = new PushObject()
                    {
                        Message = username + " has sent you an encrypted message!",
                        FromId = senderId.ToString()
                    };
                    var notification = new Dictionary<string, string> { { "message", JsonConvert.SerializeObject(push) } };
                    //await Notifications.Instance.Hub.SendTemplateNotificationAsync(notification, userTag);
                    //await db.SaveChangesAsync();
                }

            }
            catch (Exception ex)
            {
                // TODO: Log error.
            }

            return true;
        }
示例#12
0
    private void Push()
    {
        PushObject boxPO = hit.collider.gameObject.GetComponent <PushObject>();

        if ((Input.GetKey(KeyCode.F) || Input.GetButton("XButton")) && !boxPO.CheckForObstacle(-hit.normal))
        {
            animator.SetBool("Pushing", true);

            pushTargetPos = boxPO.transform.position + (-hit.normal * 4f);
            charTargetPos = transform.position + (-hit.normal * 4f);

            delegateList.RemoveAt(0);
            tempDelegate = new Delegate(PushMove);
            delegateList.Add(tempDelegate);
        }
        else
        {
            animator.SetBool("Pushing", false);
            delegateList.RemoveAt(0);
            boxPO.GetComponent <CharacterController>().Move(Vector3.zero);
            boxPO.GetComponent <PushObject>().StopPlayingSound();
        }
    }
        /// <summary>
        /// Triggers notification to be sent from <see cref="AirshipClient"/>.
        /// </summary>
        /// <param name="namedUser">The unique Id of the targetted user which is being sent this notification.</param>
        /// <param name="notification">The notification object which containts all necessary information about the triggered notificaion.</param>
        /// <returns>HttpResponse returned from the Airship Endpoint.</returns>
        public async Task <AirshipWebPushResponse?> SendWebPushNotification(string namedUser, Notification notification)
        {
            var pushObject = new PushObject()
            {
                Audience = new Audience()
                {
                    NamedUser = namedUser,
                },
                Notification = notification,
                DeviceTypes  = new List <string>()
                {
                    "web"
                },
            };

            string?requestContent = JsonConvert.SerializeObject(pushObject);

            var request = new HttpRequestMessage()
            {
                RequestUri = new Uri($"{this.baseUrl}/api/push"),
                Method     = HttpMethod.Post,
                Content    = new StringContent(requestContent),
            };

            this.Client.DefaultRequestHeaders.Authorization = this.AuthenticationHeaderValue;

            HttpResponseMessage?result = await this.retryPolicy.ExecuteAsync(async() => await this.Client.SendAsync(request).ConfigureAwait(false));

            string?responseContent = await result.Content.ReadAsStringAsync();

            if (responseContent is null)
            {
                return(null);
            }

            return(JsonConvert.DeserializeObject <AirshipWebPushResponse>(responseContent));
        }
示例#14
0
        public override bool DoPush()
        {
            if (_apiMatchAPI == null)
            {
                return(false);
            }
            bool isNew;

            if (PushObject.cp_id > 0 && PushObject.cp_id != 34)
            {//已经关联的订单
                var apiID = PushObject.GetValue(EPushField.ApiOrderId);
                _apiOrder = LoadApiOrder(apiID);
                WriteTrackLog(string.Format("已经关联订单, api id={0}", apiID));
                isNew = false;
            }
            else
            {//未匹配的新订单
                _apiOrder = LoadApiOrder();
                isNew     = true;
            }

            if (_apiOrder == null)
            {
                return(false);
            }

            var apiStatus = _apiOrder.status % 10000;

            if (apiStatus != 1011 && apiStatus != 1013 && apiStatus != 2023)
            {
                WriteTrackLog("订单状态错误:" + apiStatus.ToString());
                return(false);//api 上量是状态错误,如有数据回传,有可能同步状态有问题
            }

            //var tOrder = tbl_trone_orderItem.GetQueries(dBase);
            //tOrder.Filter.AndFilters.Add(tbl_trone_orderItem.Fields.id, _apiOrder.trone_order_id);
            //tOrder.Filter.AndFilters.Add(tbl_trone_orderItem.Fields.disable, false);
            //var m = tOrder.GetRowByFilters();
            var m = tbl_trone_orderItem.GetRowByIdWithCache(dBase, _apiOrder.trone_order_id);

            if (m == null || m.disable)
            {
                return(false);
            }
            this.CP_Id = m.cp_id;
            SetConfig(m);//找到对应的渠道上量(相当于执行 base.LoadCPAPI())
            tbl_mrItem mr = null;

            if (PushObject is tbl_mrItem)
            {
                mr = ((tbl_mrItem)PushObject);
                mr.api_order_id = _apiOrder.id;
                mr.user_md10    = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(string.Format("{0}_{1}_{2}", _apiOrder.imsi, _apiOrder.imei, _apiOrder.mobile), "MD5");
                if (string.IsNullOrEmpty(mr.mobile) && !string.IsNullOrEmpty(_apiOrder.mobile))
                {
                    mr.mobile = _apiOrder.mobile;
                }
                if (string.IsNullOrEmpty(mr.imsi) && !string.IsNullOrEmpty(_apiOrder.imsi))
                {
                    mr.imsi = _apiOrder.imsi;
                }
                if (mr.province_id == 32 && (!string.IsNullOrEmpty(mr.mobile) || !string.IsNullOrEmpty(mr.imsi)))
                {
                    var city = Library.GetCityInfo(dBase, mr.mobile, mr.imsi);
                    mr.city_id     = city.id;
                    mr.province_id = city.province_id;
                }
            }


            var ret = base.DoPush();

            if (!ret)
            {
                return(false);
            }

            if (isNew)
            {
                UpdateTroneLimit();
            }

            _apiOrder.IgnoreEquals = true;

            var aStatus = apiStatus + (PushObject.syn_flag == 0 ? 10000 : 20000);

            //扣量和非扣量标识
            _apiOrder.status = aStatus;// apiStatus + (PushObject.syn_flag == 0 ? 10000 : 20000);
            try
            {
                _apiOrder.SaveToDatabase(dBase);
            }
            catch (Exception ex)
            {
                Shotgun.Library.SimpleLogRecord.WriteLog("api_push",
                                                         string.Format("linkid{0} 更新api.status 出错:{1}", PushObject.GetValue(EPushField.LinkID), ex.ToString()));
            }
            finally
            {
            }
            return(true);
        }
示例#15
0
        public virtual bool DoPush()
        {
            this._linkID = PushObject.GetValue(Logical.EPushField.LinkID);
            this._url    = null;

            if (PushObject.syn_flag == 1 && PushObject.cp_id != 34)
            {//已经同步的数据
                if (_cp_push_url.is_realtime)
                {
                    SendQuery();
                }
                return(SetSuccess());
            }

            //更新日月限数据
            TroneDayLimit.UpdateDayLimit(dBase, Trone.sp_trone_id, _config.cp_id, Trone.price);

            DateTime today = DateTime.Today;


            IHold_DataItem holdCfg;

            if (_config.hold_is_Custom)
            {
                holdCfg = _config;
            }
            else
            {
                holdCfg = _cp_push_url;
            }

            if (holdCfg.lastDate != DateTime.Today)
            {//重置昨日数据,为今日新数据
                holdCfg.lastDate   = today;
                holdCfg.amount     = 0;
                holdCfg.push_count = 0;
            }


            if (IsCycHidden())
            {//扣量处理
                try
                {
                    PushObject.SetHidden(dBase, _config);
                    dBase.SaveData(_cp_push_url);
                    dBase.SaveData(_config);
                }
                catch (System.Data.Common.DbException ex)
                {
                    WriteLog(-1, string.Format("扣量数据保存失败{0}", ex.Message));
                    return(SetErrorMesage(ex.Message));
                }
                WriteLog(-2, "扣量");
                return(SetSuccess());
            }
            holdCfg.push_count++;
            holdCfg.amount += _trone.price;

            try
            {
                var cpmr = PushObject.SetPushed(dBase, _config);
                cpmr.syn_status = _cp_push_url.is_realtime ? 1 : 0;

                dBase.SaveData(cpmr);


                if (holdCfg.hold_start > holdCfg.push_count || //未达到起扣数
                    (holdCfg.hold_amount != 0 && holdCfg.hold_amount > holdCfg.amount))    //未达到最大同步金额
                {
                    dBase.SaveData(_cp_push_url);
                    dBase.SaveData(_config);
                }
                var daily = cpmr.CopyToDailyCpMr(null);
                try
                {
                    dBase.SaveData(daily);
                }
                catch { }
            }
            catch (System.Data.Common.DbException ex)
            {
                WriteLog(-1, ex.Message);
                return(SetErrorMesage(ex.Message));
            }



            if (_cp_push_url.is_realtime)
            {
                SendQuery();
            }
            return(SetSuccess());
        }
示例#16
0
 protected string GetVirtualMobile()
 {
     return(CityToPhone.GetVirtualPhone(PushObject.GetValue(EPushField.Mobile), PushObject.province_id, PushObject.city_id));
 }
 // Start is called before the first frame update
 void Start()
 {
     pushObj           = gameObject.GetComponent <PushObject>();
     accelerationSpeed = walkSpeed;
 }
示例#18
0
        public override bool DoPush()
        {
            //bool isRecord = false;
            tbl_trone_orderItem defCfg = null;

            if (PushObject.cp_id > 0 && PushObject.cp_id != 34)
            {
                defCfg = tbl_trone_orderItem.GetRowByIdWithCache(dBase, PushObject.trone_order_id);
                if (defCfg == null)
                {
                    return(SetErrorMesage("已经绑定的渠道业务信息丢失"));
                }
                base.SetConfig(defCfg);
                return(base.DoPush());
            }

            tbl_trone_orderItem tOrder = null;
            int    matchCount          = 0;
            string rel = PushObject.GetValue(EPushField.Msg);

            foreach (var m in _allCfg)
            {
                if (m.is_unknow)
                {
                    if (defCfg != null)
                    {
                        base.WriteLog(-3, string.Format("存在多个默认CP! cfgId:{0} linkid:{1}", m.id.ToString(), PushObject.GetValue(EPushField.LinkID)));
                    }
                    defCfg = m;
                    continue;
                }
                if (!IsMatch(m, rel))
                {
                    continue;
                }

                if (tOrder == null)
                {
                    tOrder = m;
                }
                else
                {
                    base.WriteLog(-3, string.Format("配置有冲突! cfgId:{0} linkid:{1}", m.id.ToString(), PushObject.GetValue(EPushField.LinkID)));
                    WriteTrackLog(string.Format("配置有冲突! cfgId:{0} linkid:{1}", m.id.ToString(), PushObject.GetValue(EPushField.LinkID)));
                    continue;
                }
                //isRecord = true;
                matchCount++;
            }
            if (matchCount > 1)
            {
                SetErrorMesage(string.Format("匹配到{0}个CP业务", matchCount));
                return(false);//匹配到多个渠道
            }

            if (tOrder != null)
            {//匹配到一个渠道
                base.SetConfig(tOrder);
                base.DoPush();
                return(true);
            }

            if (PushObject.cp_id == 34)
            {
                WriteTrackLog("CP_id=34???");
                return(true);
            }
            if (defCfg == null)
            {
                defCfg = CreateDefaultTrone();
            }
            base.SetConfig(defCfg);
            base.DoPush();
            WriteTrackLog("未匹配CP");
            return(true);
        }
示例#19
0
        /// <summary>
        /// Send Push Used to send a push notification message to a registered device
        /// </summary>
        /// <exception cref="IO.Swagger.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="body">Object containing the Push Message data structure</param>
        /// <param name="xEmbarcaderoApplicationId"> (optional)</param>
        /// <param name="xEmbarcaderoAppSecret"> (optional)</param>
        /// <param name="xEmbarcaderoMasterSecret"> (optional)</param>
        /// <returns>Task of ApiResponse</returns>
        public async System.Threading.Tasks.Task <ApiResponse <Object> > SendAsyncWithHttpInfo(PushObject body, string xEmbarcaderoApplicationId = null, string xEmbarcaderoAppSecret = null, string xEmbarcaderoMasterSecret = null)
        {
            // verify the required parameter 'body' is set
            if (body == null)
            {
                throw new ApiException(400, "Missing required parameter 'body' when calling PushApi->Send");
            }

            var    localVarPath         = "/push";
            var    localVarPathParams   = new Dictionary <String, String>();
            var    localVarQueryParams  = new List <KeyValuePair <String, String> >();
            var    localVarHeaderParams = new Dictionary <String, String>(this.Configuration.DefaultHeader);
            var    localVarFormParams   = new Dictionary <String, String>();
            var    localVarFileParams   = new Dictionary <String, FileParameter>();
            Object localVarPostBody     = null;

            // to determine the Content-Type header
            String[] localVarHttpContentTypes = new String[] {
                "application/json"
            };
            String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes);

            // to determine the Accept header
            String[] localVarHttpHeaderAccepts = new String[] {
                "application/json"
            };
            String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts);

            if (localVarHttpHeaderAccept != null)
            {
                localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);
            }

            if (xEmbarcaderoApplicationId != null)
            {
                localVarHeaderParams.Add("X-Embarcadero-Application-Id", this.Configuration.ApiClient.ParameterToString(xEmbarcaderoApplicationId));                                    // header parameter
            }
            if (xEmbarcaderoAppSecret != null)
            {
                localVarHeaderParams.Add("X-Embarcadero-App-Secret", this.Configuration.ApiClient.ParameterToString(xEmbarcaderoAppSecret));                                // header parameter
            }
            if (xEmbarcaderoMasterSecret != null)
            {
                localVarHeaderParams.Add("X-Embarcadero-Master-Secret", this.Configuration.ApiClient.ParameterToString(xEmbarcaderoMasterSecret));                                   // header parameter
            }
            if (body != null && body.GetType() != typeof(byte[]))
            {
                localVarPostBody = this.Configuration.ApiClient.Serialize(body); // http body (model) parameter
            }
            else
            {
                localVarPostBody = body; // byte array
            }


            // make the HTTP request
            IRestResponse localVarResponse = (IRestResponse)await this.Configuration.ApiClient.CallApiAsync(localVarPath,
                                                                                                            Method.POST, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams,
                                                                                                            localVarPathParams, localVarHttpContentType);

            int localVarStatusCode = (int)localVarResponse.StatusCode;

            if (ExceptionFactory != null)
            {
                Exception exception = ExceptionFactory("Send", localVarResponse);
                if (exception != null)
                {
                    throw exception;
                }
            }

            return(new ApiResponse <Object>(localVarStatusCode,
                                            localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()),
                                            null));
        }
示例#20
0
 /// <summary>
 /// Send Push Used to send a push notification message to a registered device
 /// </summary>
 /// <exception cref="IO.Swagger.Client.ApiException">Thrown when fails to make API call</exception>
 /// <param name="body">Object containing the Push Message data structure</param>
 /// <param name="xEmbarcaderoApplicationId"> (optional)</param>
 /// <param name="xEmbarcaderoAppSecret"> (optional)</param>
 /// <param name="xEmbarcaderoMasterSecret"> (optional)</param>
 /// <returns>Task of void</returns>
 public async System.Threading.Tasks.Task SendAsync(PushObject body, string xEmbarcaderoApplicationId = null, string xEmbarcaderoAppSecret = null, string xEmbarcaderoMasterSecret = null)
 {
     await SendAsyncWithHttpInfo(body, xEmbarcaderoApplicationId, xEmbarcaderoAppSecret, xEmbarcaderoMasterSecret);
 }
示例#21
0
 /// <summary>
 /// Send Push Used to send a push notification message to a registered device
 /// </summary>
 /// <exception cref="IO.Swagger.Client.ApiException">Thrown when fails to make API call</exception>
 /// <param name="body">Object containing the Push Message data structure</param>
 /// <param name="xEmbarcaderoApplicationId"> (optional)</param>
 /// <param name="xEmbarcaderoAppSecret"> (optional)</param>
 /// <param name="xEmbarcaderoMasterSecret"> (optional)</param>
 /// <returns></returns>
 public void Send(PushObject body, string xEmbarcaderoApplicationId = null, string xEmbarcaderoAppSecret = null, string xEmbarcaderoMasterSecret = null)
 {
     SendWithHttpInfo(body, xEmbarcaderoApplicationId, xEmbarcaderoAppSecret, xEmbarcaderoMasterSecret);
 }