Ejemplo n.º 1
0
        private void RegPushByTags(int pushType, List <string> tags, object id, string title, string subTitle, string noticeId)
        {
            PushPayload pushEntity = new PushPayload
            {
                Audience     = new { tag = tags.ToArray() },
                Platform     = "all",
                Notification = new Notification
                {
                    Alert = title,
                    IOS   = new IOS
                    {
                        Alert  = new { title = title, body = subTitle },
                        Extras = PushHelper.GetNewExtras(pushType, id, title, subTitle, noticeId)
                    },
                    Android = new Android
                    {
                        Alert  = subTitle,
                        Title  = title,
                        Extras = PushHelper.GetNewExtras(pushType, id, title, subTitle, noticeId)
                    }
                },
                Message = new Message
                {
                    Title   = title,
                    Content = subTitle,
                    Extras  = PushHelper.GetNewExtras(pushType, id, title, subTitle, noticeId)
                },
                Options = new Options {
                    IsApnsProduction = IsPushProduction
                }
            };
            var agent = new JPushAgent();

            agent.Push(pushEntity);
        }
Ejemplo n.º 2
0
        public void PushOrderPayed(Guid orderId)
        {
            var order       = new OrderDAC().GetOrderByOrderId(orderId);
            var coin        = new CryptocurrencyDAC().GetById(order.CryptoId);
            var agent       = new JPushAgent();
            var regId       = RedisHelper.StringGet($"{FiiiPOS_APP_Notice_MerchantId}:{order.MerchantAccountId}");
            var lang        = RedisHelper.StringGet(REDIS_LANGUAGE_DBINDEX, $"{FiiiPOS_APP_Language_MerchantId}:{order.MerchantAccountId}") ?? "en";
            var titleKey    = "ReceiptTitle";
            var subTitleKey = "ReceiptSubTitle";

            var content  = ResourceHelper.FiiiPos.GetFormatResource(titleKey, lang, coin.Code);
            var subTitle = ResourceHelper.FiiiPos.GetResource(subTitleKey, lang);

            string noticeId = "";

            //写MongoDB [收款成功]
            MessagesComponent.AddMessage(order.MerchantAccountId, UserType.Merchant, order.Id.ToString(), FiiiPayPushType.TYPE_RECEIPT, titleKey, subTitleKey, coin.Code, content, subTitle, out noticeId);

            var result = agent.Push(new PushPayload
            {
                Audience = new { registration_id = new List <string> {
                                     regId
                                 } },
                Platform     = "all",
                Notification = new Notification
                {
                    Alert   = content,
                    Android = new Android
                    {
                        Alert  = subTitle,
                        Title  = content,
                        Extras = PushHelper.GetNewExtras(FiiiPayPushType.TYPE_RECEIPT, orderId, content, subTitle, noticeId)
                    }
                },
                Message = new Message
                {
                    Content = content,
                    Extras  = PushHelper.GetNewExtras(FiiiPayPushType.TYPE_RECEIPT, orderId, content, subTitle, noticeId)
                },
                Options = new Options {
                    IsApnsProduction = IsPushProduction
                }
            });

            LogHelper.Info($"--------{lang}------{content}----------{subTitle}");
        }