コード例 #1
0
        public ResultPager <RBookList> BookNameAndAuthor(SearchReq req)
        {
            ResultPager <RBookList> result = null;

            try
            {
                req.userId = this.getUserId();
                result     = _searchServices.searchBook(req);
            }
            catch (Exception ex)
            {
                if (result == null)
                {
                    result = new ResultPager <RBookList>();
                }
                result.ErrorMsg = ex.Message;
            }
            return(result);
        }
コード例 #2
0
        public ResultPager <RBookList> getBookListPager(QBookList query)
        {
            ResultPager <RBookList> result = new ResultPager <RBookList>();
            var st = DateTime.Now;

            Console.WriteLine($"开始Query{st}");
            try
            {
                if (query.QueryType == QBookList_Type.Search)
                {
                    result = _searchServices.searchBook(new SearchReq
                    {
                        keyword   = query.Code,
                        pageIndex = query.pageIndex,
                        pageSize  = query.pageSize,
                        userId    = this.getUserId()
                    });
                }
                else
                {
                    ModelPager <RBookList> pd = _bookServices.GetBookListPager(query);
                    result.PageData           = pd;
                    result.PageData.pageIndex = query.pageIndex;
                    result.PageData.pageSize  = query.pageSize;
                }
            }
            catch (Exception ex)
            {
                result.ErrorMsg = ex.Message;
            }

            var et = DateTime.Now;

            Console.WriteLine($"结束Query{et}");
            Console.WriteLine($"时间差{et - st}");
            return(result);
        }