Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
appbase-edge-function
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
duanjinfei
appbase-edge-function
Commits
47abd4c1
Commit
47abd4c1
authored
Feb 27, 2025
by
duanjinfei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix:修复获取RewardCount
parent
5d13859d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
26 deletions
+26
-26
cli-latest
supabase/.temp/cli-latest
+1
-1
index.ts
supabase/functions/update-app-recommend/index.ts
+25
-25
No files found.
supabase/.temp/cli-latest
View file @
47abd4c1
v2.9.6
\ No newline at end of file
v2.15.8
\ No newline at end of file
supabase/functions/update-app-recommend/index.ts
View file @
47abd4c1
...
...
@@ -52,31 +52,20 @@ const getTimestampForMidnight3AM = () => {
async
function
cacheTaskCount
(
supabase
,
directory
,
bucketName
)
{
const
pageFileName
=
`
${
directory
}
/task_count.json`
;
// // 获取所有任务组 ID
// const { data: taskGroupArr, error: groupError } = await supabase
// .from('task')
// .select('task_group_id');
// if (groupError) {
// console.error("Error fetching task groups:", groupError);
// return;
// }
// // 提取所有任务组 ID
// const groupIds = taskGroupArr.map(group => group.task_group_id);
// // 使用 IN 操作符来一次性查询所有匹配的任务组任务数量
// const { data, error } = await supabase
// .from('taskcenter.task')
// .select('group_id, id', { count: 'exact' })
// .in('group_id', groupIds);
// if (error) {
// console.error("Error fetching task counts:", error);
// return;
// }
// 查询group_id = 1 and enabled = true 的task数量
const
{
data
,
error
}
=
await
supabase
.
from
(
'
task
'
)
.
select
(
'
id
'
,
{
count
:
'
exact
'
})
.
eq
(
'
group_id
'
,
'
1856166987890167808
'
)
.
eq
(
'
enable
'
,
true
);
if
(
error
)
{
console
.
error
(
"
Error fetching task counts:
"
,
error
);
return
;
}
const
pageJson
=
JSON
.
stringify
({
total_count
:
4
,
total_count
:
data
.
length
,
});
const
{
error
:
pageUploadError
}
=
await
supabase
.
storage
...
...
@@ -187,7 +176,18 @@ Deno.serve(async (req) => {
const
directory
=
`app-category/
${
timestamp
}
`
;
const
bucketName
=
'
cache
'
;
// 替换为存储桶名称
EdgeRuntime
.
waitUntil
(
cacheTaskCount
(
supabase
,
directory
,
bucketName
));
const
supabaseTask
=
createClient
(
Deno
.
env
.
get
(
'
SUPABASE_URL
'
)
??
''
,
Deno
.
env
.
get
(
'
SUPABASE_ANON_KEY
'
)
??
''
,
{
global
:
{
headers
:
{
Authorization
:
req
.
headers
.
get
(
'
Authorization
'
)
!
}
},
db
:
{
schema
:
'
taskcenter
'
}
}
)
EdgeRuntime
.
waitUntil
(
cacheTaskCount
(
supabaseTask
,
directory
,
bucketName
));
EdgeRuntime
.
waitUntil
(
cacheAnnouncementData
(
supabase
,
directory
,
bucketName
));
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment