사이트 코드와 홈페이지 위젯 추가 v1.5.34
This commit is contained in:
@@ -542,6 +542,8 @@ export const getAnalyticsSummary = async (options = {}) => {
|
||||
if (!sql) {
|
||||
return {
|
||||
todayVisitors: 0,
|
||||
todayPageViews: 0,
|
||||
todayAvgEngagedSeconds: 0,
|
||||
visitorsLast7Days: 0,
|
||||
pageViewsLast30Days: 0,
|
||||
onlineNow: 0,
|
||||
@@ -630,9 +632,15 @@ export const getAnalyticsSummary = async (options = {}) => {
|
||||
|
||||
const engagedViews = Number(engagementRows[0]?.engaged_views || 0)
|
||||
const totalEngagedSeconds = Number(engagementRows[0]?.total_engaged_seconds || 0)
|
||||
const todayEngagedViews = Number(todayRows[0]?.engaged_views || 0)
|
||||
const todayTotalEngagedSeconds = Number(todayRows[0]?.total_engaged_seconds || 0)
|
||||
|
||||
return {
|
||||
todayVisitors: Number(todayRows[0]?.visitors || 0),
|
||||
todayPageViews: Number(todayRows[0]?.page_views || 0),
|
||||
todayAvgEngagedSeconds: todayEngagedViews > 0
|
||||
? Math.round(todayTotalEngagedSeconds / todayEngagedViews)
|
||||
: 0,
|
||||
visitorsLast7Days: Number(last7Rows[0]?.visitors || 0),
|
||||
pageViewsLast30Days: Number(pageViewRows[0]?.page_views || 0),
|
||||
onlineNow: Number(onlineRows[0]?.online_now || 0),
|
||||
|
||||
@@ -110,6 +110,9 @@ const mapSiteSettingsRow = (row) => ({
|
||||
announcementUrl: row.announcement_url || '',
|
||||
announcementBackgroundColor: row.announcement_background_color || '#15171a',
|
||||
signupBlockedUsernames: parseSignupBlockedUsernamesFromDb(row.signup_blocked_usernames),
|
||||
adsTxt: row.ads_txt || '',
|
||||
customHeadCode: row.custom_head_code || '',
|
||||
customFooterCode: row.custom_footer_code || '',
|
||||
updatedAt: row.updated_at.toISOString()
|
||||
})
|
||||
|
||||
@@ -874,6 +877,9 @@ export const updateSiteSettings = async (input) => {
|
||||
announcement_url,
|
||||
announcement_background_color,
|
||||
signup_blocked_usernames,
|
||||
ads_txt,
|
||||
custom_head_code,
|
||||
custom_footer_code,
|
||||
updated_at
|
||||
)
|
||||
VALUES (
|
||||
@@ -895,6 +901,9 @@ export const updateSiteSettings = async (input) => {
|
||||
${input.announcementUrl || ''},
|
||||
${input.announcementBackgroundColor || '#15171a'},
|
||||
${JSON.stringify(normalizeSignupBlockedUsernames(input.signupBlockedUsernames))},
|
||||
${input.adsTxt || ''},
|
||||
${input.customHeadCode || ''},
|
||||
${input.customFooterCode || ''},
|
||||
now()
|
||||
)
|
||||
ON CONFLICT (id) DO UPDATE
|
||||
@@ -916,6 +925,9 @@ export const updateSiteSettings = async (input) => {
|
||||
announcement_url = EXCLUDED.announcement_url,
|
||||
announcement_background_color = EXCLUDED.announcement_background_color,
|
||||
signup_blocked_usernames = EXCLUDED.signup_blocked_usernames,
|
||||
ads_txt = EXCLUDED.ads_txt,
|
||||
custom_head_code = EXCLUDED.custom_head_code,
|
||||
custom_footer_code = EXCLUDED.custom_footer_code,
|
||||
updated_at = now()
|
||||
RETURNING *
|
||||
`
|
||||
|
||||
Reference in New Issue
Block a user