Exemplo n.º 1
0
        public async Task <MessageModel <ResponseEnum> > Get()
        {
            var data = new MessageModel <ResponseEnum>();

            await _redisBasketRepository.ListLeftPushAsync(RedisMqKey.Loging, "xxxxxxxxxxxxxxxxxxx");

            /*
             *  测试 sql 查询
             */
            var queryBySql = await _blogArticleServices.QuerySql("SELECT bsubmitter,btitle,bcontent,bCreateTime FROM BlogArticle WHERE bID>5");


            /*
             *  测试 sql 更新
             *
             * 【SQL参数】:@bID:5
             *  @bsubmitter:laozhang619
             *  @IsDeleted:False
             * 【SQL语句】:UPDATE `BlogArticle`  SET
             *  `bsubmitter`=@bsubmitter,`IsDeleted`=@IsDeleted  WHERE `bID`=@bID
             */
            var updateSql = await _blogArticleServices.Update(new { bsubmitter = $"laozhang{DateTime.Now.Millisecond}", IsDeleted = false, bID = 5 });


            // 测试模拟异常,全局异常过滤器拦截
            var i = 0;
            var d = 3 / i;


            // 测试 AOP 缓存
            var blogArticles = await _blogArticleServices.GetBlogs();


            // 测试多表联查
            var roleModulePermissions = await _roleModulePermissionServices.QueryMuchTable();


            // 测试多个异步执行时间
            var roleModuleTask = _roleModulePermissionServices.Query();
            var listTask       = _advertisementServices.Query();
            var ad             = await roleModuleTask;
            var list           = await listTask;


            // 测试service层返回异常
            _advertisementServices.ReturnExp();

            Love love = null;

            love.SayLoveU();

            return(data);
        }
Exemplo n.º 2
0
        public async Task <object> Get()
        {
            var msg = "这里是一条日志";
            await _redisBasketRepository.ListLeftPushAsync(RedisMqKey.Loging, msg);

            return(Ok());
        }
Exemplo n.º 3
0
        public async Task RedisMq([FromServices] IRedisBasketRepository _redisBasketRepository)
        {
            var msg = $"这里是一条日志{DateTime.Now}";
            await _redisBasketRepository.ListLeftPushAsync(RedisMqKey.Loging, msg);

            //var priceChangedEvent = new ProductPriceChangedIntegrationEvent(catalogItem.Id, productToUpdate.Price, oldPrice);
            //_eventBus.Publish(evt);
        }
Exemplo n.º 4
0
 public async Task RedisMq([FromServices] IRedisBasketRepository _redisBasketRepository)
 {
     var msg = $"这里是一条日志{DateTime.Now}";
     await _redisBasketRepository.ListLeftPushAsync(RedisMqKey.Loging, msg);
 }
Exemplo n.º 5
0
 public async Task RedisMq()
 {
     var msg = "这里是一条日志";
     await _redisBasketRepository.ListLeftPushAsync(RedisMqKey.Loging, msg);
 }