From dc1a81057497cdd692d8a384279e2bcded021ff2 Mon Sep 17 00:00:00 2001 From: 闫增涛 <1829501689@qq.com> Date: 星期四, 27 六月 2024 09:25:21 +0800 Subject: [PATCH] 优化 --- src/assets/methods/resources.js | 52 +++++++++++++++++++++++++++++++++++++++++++++++++--- 1 files changed, 49 insertions(+), 3 deletions(-) diff --git a/src/assets/methods/resources.js b/src/assets/methods/resources.js index 7711436..74e4315 100644 --- a/src/assets/methods/resources.js +++ b/src/assets/methods/resources.js @@ -1,5 +1,51 @@ -const getResourcePath = (md5) => { - return 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"; +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) => { + let list = [] + await identityApi + .getUserKey({ + domain: "collectResource", + keys: [key], + }) + .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, + getCollectResource, + setCollectResource +}; -export default getResourcePath \ No newline at end of file +export default MT; -- Gitblit v1.9.1