litian
2024-06-26 ccda9ec2fe70d8f51ef184eafc04b78d22dfbabd
assets/js/middleGround/api/resource.js
@@ -1,7 +1,14 @@
import request from "../../../request/index";
import { publicStore, publicRepository } from "../../config";
import { tokenKey } from "../../config";
import { handleQueryResourceListData } from "../tool";
import {
  publicStore,
  publicRepository
} from "../../config";
import {
  tokenKey
} from "../../config";
import {
  handleQueryResourceListData
} from "../tool";
import toolClass from "../../toolClass";
const resourceApi = {
  /*
@@ -21,6 +28,8 @@
    repositoryInfo = publicRepository,
    queryType,
    linkType,
    RefCode,
    CmsItemType,
    paging,
    sort,
    fields,
@@ -30,14 +39,10 @@
    coverSize,
    itemIdArr,
    SysType,
    tourism_isHighQualityResources,
  }) => {
    if (!path) return Promise.reject("接口请求必要参数不能为空!");
    const query = {
      AccessControl: {
        Path: path,
@@ -57,14 +62,14 @@
      Description: [],
      Name: [],
      Icon: [],
      RefCode: [],
      // RefCode: [],
      Type: [],
      TypeId: [],
      State: [],
      Tag: [],
      LinkInfo: [],
      LinkFile: [],
      CmsItemType: [],
      // CmsItemType: [],
      ChildrenFolderCount: [],
      ChildrenCount: [],
      ...fields,
@@ -78,7 +83,15 @@
    if (itemId) query["Id="] = [`${itemId}`];
    if (itemIds) query["Id="] = itemIds;
    if (itemType) query["Type="] = [`${itemType}`];
    const body = { query: JSON.stringify({ Query: [{ Q1: query }] }) };
    if (RefCode) query["RefCode="] = [`${RefCode}`];
    if (CmsItemType) query["CmsItemType="] = [`${CmsItemType}`];
    const body = {
      query: JSON.stringify({
        Query: [{
          Q1: query
        }]
      })
    };
    let token = wx.getStorageSync('tokenKey');
    return request({
      url: token ? "/resource/api/ApiAppUserQuery" : "/resource/api/ApiQuery",
@@ -95,14 +108,24 @@
          repositoryInfo,
          coverSize,
        });
        return { datas, total: data.totalCount };
        return {
          datas,
          total: data.totalCount
        };
      }
      return { datas: [], total: 0 };
      return {
        datas: [],
        total: 0
      };
    });
  },
  // 模糊搜索
  EsQuery(query) {
    let { params, path, paging } = query;
    let {
      params,
      path,
      paging
    } = query;
    let queryBody = {
      Type: "*",
      Store: [],
@@ -153,16 +176,20 @@
    // 全部搜索  - 单独的某个库
    if (path != "All") {
      let data = {
        Path: [
          {
            Repository: "tourism_tourismLawsAndRegulationsDatabase",
            Path: path,
          },
        ],
        Path: [{
          Repository: "tourism_tourismLawsAndRegulationsDatabase",
          Path: path,
        }, ],
      };
      Object.assign(queryBody, data);
    }
    const body = { query: JSON.stringify({ Query: [{ Q1: queryBody }] }) };
    const body = {
      query: JSON.stringify({
        Query: [{
          Q1: queryBody
        }]
      })
    };
    return request({
      url: "/resource/api/ApiEsQuery",
@@ -176,9 +203,15 @@
          datas: data.datas,
          path,
        });
        return { datas, total: data.totalCount };
        return {
          datas,
          total: data.totalCount
        };
      }
      return { data: [], total: 0 };
      return {
        data: [],
        total: 0
      };
    });
  },
@@ -211,7 +244,13 @@
  // 获取cms收藏列表
  getCmsCollectList(data) {
    const body = { query: JSON.stringify({ Query: [{ Q1: data }] }) };
    const body = {
      query: JSON.stringify({
        Query: [{
          Q1: data
        }]
      })
    };
    return request({
      url: "/resource/api/ApiAppUserQuery",
      method: "post",
@@ -220,4 +259,4 @@
  },
};
export default resourceApi;
export default resourceApi;