This commit is contained in:
ditiqi 2025-02-25 09:11:15 +08:00
parent a7c82b66f8
commit f8f3e7985e
5 changed files with 12 additions and 4 deletions

View File

@ -40,7 +40,11 @@ export class VisitService extends BaseService<Prisma.VisitDelegate> {
id: postId,
visitType: args.data.type, // 直接复用传入的类型
});
EventBus.emit('updateTotalCourseViewCount', {
visitType: args.data.type, // 直接复用传入的类型
});
}
return result;
}
async createMany(args: Prisma.VisitCreateManyArgs, staff?: UserProfile) {
@ -138,6 +142,9 @@ export class VisitService extends BaseService<Prisma.VisitDelegate> {
id: args?.where?.postId as string,
visitType: args.where.type as any, // 直接复用传入的类型
});
EventBus.emit('updateTotalCourseViewCount', {
visitType: args.where.type as any, // 直接复用传入的类型
});
}
}
return superDetele;

View File

@ -38,7 +38,7 @@ export async function updateTotalCourseViewCount(type: VisitType) {
data: {
meta: {
...baseSeting,
reads: totalViews,
reads: totalViews._sum.views,
},
},
});

View File

@ -1,5 +1,6 @@
import React from "react";
export interface MenuItemType {
icon: JSX.Element;
icon: React.;
label: string;
action: () => void;
}

View File

@ -47,7 +47,7 @@ export const CourseDetailDescription: React.FC = () => {
<div>{course?.subTitle}</div>
<div className="flex gap-1">
<EyeOutlined></EyeOutlined>
<div>{course?.meta?.views}</div>
<div>{course?.meta?.views || 0}</div>
</div>
<div className="flex gap-1">
<CalendarOutlined></CalendarOutlined>

View File

@ -21,7 +21,7 @@ export function CourseDetailHeader() {
return (
<Header className="select-none flex items-center justify-center bg-white shadow-md border-b border-gray-100 fixed w-full z-30">
<div className="w-full max-w-screen-2xl px-4 md:px-6 mx-auto flex items-center justify-between h-full">
<div className="w-full flex items-center justify-between h-full">
<div className="flex items-center space-x-2">
<HomeOutlined
onClick={() => {