public List <panBookInfo> queryPanBookByPath(panQueryFile query)
        {
            var path          = query.rootPath;
            var convertStatus = query.convertStatus;

            var q = Db.Queryable <panBookInfo>();

            q = q.WhereIF(!string.IsNullOrEmpty(path) && path != "/", a => a.parentPath == path);
            q = q.WhereIF(convertStatus != panConvertStatus.All, a => a.ConvertStatus == convertStatus);

            var panList = q.ToPageList(query.pageIndex, query.pageSize);

            return(panList);
        }
        public ResultEntity <panFilemetaList> run(panQueryFile query)
        {
            var fList = this.fileList(query);
            var list  = fList.Entity.list;

            query.fsIds = new List <string>();
            foreach (var item in list)
            {
                if (item.isdir == 0)
                {
                    query.fsIds.Add(item.fs_id);
                }
            }

            return(this.filemetaList(query));
        }
        public ResultEntity <panFilemetaList> filemetaList(panQueryFile query)
        {
            ResultEntity <panFilemetaList> result = new ResultEntity <panFilemetaList>();

            try
            {
                string fsids = string.Join(",", query.fsIds);
                string url   = @$ "https://pan.baidu.com/rest/2.0/xpan/multimedia?method=filemetas&path={query.rootPath}&fsids=[{fsids}]&dlink=1&access_token={query.accessToken}";
                var    list  = HttpUtil.Get <panFilemetaList>(url);
                result.Entity = list;
            }
            catch (Exception ex)
            {
                result.ErrorMsg = ex.Message;
            }
            return(result);
        }
        public ResultEntity <panFileList> fileList(panQueryFile query)
        {
            ResultEntity <panFileList> result = new ResultEntity <panFileList>();

            try
            {
                string url  = $"https://pan.baidu.com/rest/2.0/xpan/multimedia?method=listall&path={query.rootPath}&access_token={query.accessToken}";
                var    list = HttpUtil.Get <panFileList>(url);

                result.Entity = list;
            }
            catch (Exception ex)
            {
                result.ErrorMsg = ex.Message;
            }
            return(result);
        }
        //书本对应的豆瓣搜索结果
        public List <RSearchOneBookResult> queryDouBanSearch(panQueryFile query)
        {
            var convertStatus = query.convertStatus;
            var path          = query.rootPath;
            var sql           = Db.Queryable <panBookInfo, ESearchOneBookResult>((b, s) => new object[]
            {
                JoinType.Inner, b.fsId == s.fsId
            })
                                .WhereIF(!string.IsNullOrEmpty(path) && path != "/", b => b.parentPath == path)
                                .WhereIF(convertStatus != panConvertStatus.All, b => b.ConvertStatus == convertStatus)
                                .Select((b, s) => new RSearchOneBookResult
            {
                Code     = s.Code,
                CoverUrl = s.CoverUrl,
                fsId     = s.fsId,
                Id       = s.Id,
                keyWord  = s.keyWord,
                Name     = s.Name
            });

            return(sql.ToList());
        }
示例#6
0
        public List <RpanBookInfo> queryPanBookByPath(panQueryFile query)
        {
            List <RpanBookInfo> result = new List <RpanBookInfo>();

            var panList = _baiduPanRepository.queryPanBookByPath(query);
            List <RSearchOneBookResult> searchList = null;

            if (query.querySearchResultNum > 0)
            {
                searchList = _baiduPanRepository.queryDouBanSearch(query);
            }
            foreach (var pan in panList)
            {
                RpanBookInfo rObj = new RpanBookInfo();
                if (searchList != null && searchList.Count > 0)
                {
                    rObj.searchList = searchList.FindAll(s => s.fsId == pan.fsId).Take(query.querySearchResultNum).ToList();
                }
                rObj.panBookInfo = pan;
                result.Add(rObj);
            }
            return(result);
        }
        public ResultList <RpanBookInfo> queryPanBookList(panQueryFile query)
        {
            ResultList <RpanBookInfo> result = new ResultList <RpanBookInfo>();

            try
            {
                if (query.queryOnlyFromDB)
                {
                    result.List = _baiduPanService.queryPanBookByPath(query);
                }
                else
                {
                    var panList    = _baiduPanService.requireFileList(query.rootPath, query.accessToken);
                    var dbBookList = _baiduPanService.queryPanBookByPath(query);

                    result.List = new List <RpanBookInfo>();
                    foreach (var panFile in panList.list)
                    {
                        RpanBookInfo rBook = this.getbookInDb(panFile, dbBookList);
                        if (rBook == null)
                        {
                            var dbBook = panFile.toPanBook(query.rootPath);
                            rBook = new RpanBookInfo
                            {
                                panBookInfo = dbBook
                            };
                        }
                        result.List.Add(rBook);
                    }
                }
            }
            catch (Exception ex)
            {
                result.ErrorMsg = ex.Message;
            }
            return(result);
        }
示例#8
0
 public void QueryList(panQueryFile query)
 {
     // query.
 }