Example #1
0
        public void Push(NotifyAppQueue entity)
        {
            var config = ConfigGet(entity.NotifyApplicationId);

            PushJson result = new PushJson();

            switch (entity.PushType)
            {
            case PushType.SoftToken:
            {
                result = PushHelper.SendBySoftTokens(config.Authtoken, config.Email, entity.AppId, entity.Title, entity.Body,
                                                     entity.Platforms,
                                                     entity.List);
                break;
            }

            case PushType.AppId:
            {
                result = PushHelper.SendByAppId(config.Authtoken, config.Email, entity.AppId, entity.Title, entity.Body);
                entity.QueueStatusCode = result.status;
                entity.QueueStatusMsg  = result.info;
                break;
            }

            case PushType.UserId:
            {
                result = PushHelper.SendByUserIds(config.Authtoken, config.Email, entity.AppId, entity.Title, entity.Body, entity.Platforms,
                                                  entity.List);
                break;
            }

            default:
            {
                break;
            }
            }
            entity.QueueStatusMsg  = result.info;
            entity.QueueStatusCode = result.status;
            if (result.status == "ok")
            {
                entity.QueueStatus = QueueStatus.Success;
            }
            else
            {
                entity.QueueStatus = QueueStatus.Fail;
            }
            QueueSave(entity);
        }