Commit ebdd694e authored by duanjinfei's avatar duanjinfei

add function

parent 05a6a997
......@@ -53,7 +53,8 @@ Deno.serve(async (req) => {
// 上传所有 app 数据到 storage
const allAppsJson = JSON.stringify(allApps);
const allAppsFileName = `app_all_${timestamp}.json`;
const directory = `app-category/${timestamp}`;
const allAppsFileName = `${directory}/app_all.json`;
const bucketName = 'cache'; // 替换为存储桶名称
const { error: allAppsUploadError } = await supabase.storage
......@@ -83,7 +84,7 @@ Deno.serve(async (req) => {
// 上传每个 category_id 的数据
for (const [categoryId, apps] of Object.entries(groupedData)) {
const categoryJson = JSON.stringify(apps);
const categoryFileName = `app_category_${categoryId}_${timestamp}.json`;
const categoryFileName = `${directory}/${categoryId}.json`;
const { error: categoryUploadError } = await supabase.storage
.from(bucketName)
......
......@@ -30,7 +30,8 @@ Deno.serve(async (req) => {
// 3. 生成文件名
const timestamp = Math.floor(Date.now() / 3600000) * 3600; // 计算整点的时间戳
const fileName = `user_top_100_${timestamp}.json`;
const directory = `user-rank/${timestamp}`;
const fileName = `${directory}/user_top_100.json`;
const bucketName = 'cache'; // 替换为你的存储桶名称
const { error: uploadError } = await supabase.storage
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment