zhongshujie
2025-01-22 697783bc171a448068b6341f4b71c902f1e1fac4
src/assets/methods/resources.js
@@ -1,19 +1,53 @@
import fileApi from '@/assets/js/middleGround/api/file'
export const getResourcePath = async(md5,appRefCode = "jingshieke") => {
  let path = ''
  await fileApi.getAliVod({
    md5,appRefCode
  }).then(res => {
    if(res.data.length) {
      path =  res.data
    } else {
      path =   process.env.VUE_APP_API_URL + '/file/api/ApiDownload?md5=' + md5
    }
import fileApi from "@/assets/js/middleGround/api/file";
import identityApi from "../js/middleGround/api/identity";
import { tokenKey } from "../js/config";
export const getResourcePath = async (md5, appRefCode = "jingshieke") => {
  let path = "";
  await fileApi
    .getAliVod({
      md5,
      appRefCode,
    })
    .then((res) => {
      if (res.data != "" && res.data != undefined) {
        path = res.data;
      } else {
        path = process.env.VUE_APP_API_URL + "/file/api/ApiDownload?md5=" + md5;
      }
    });
  return path;
};
// 获取收藏的资源
export const getCollectResource = async (key) => {
  if(!localStorage.getItem(tokenKey)) return []
  let list = []
  await identityApi
  .getUserKey({
    domain: "collectResource",
    keys: [key],
  })
  return path
  .then((res) => {
    if(res.length) {
      list = JSON.parse(res[0].value)
    }
  });
  return list
}
export const setCollectResource = (key,list) => {
  identityApi.setUserKey({
    setKeyRequests: [
      {
        domain: "collectResource",
        key,
        value: JSON.stringify(list),
      },
    ],
  })
}
const MT = {
  getResourcePath
}
  getResourcePath,
  getCollectResource,
  setCollectResource
};
export default MT
export default MT;