feat: 实现平台抽成、提现审批、异步任务集成及安全审计功能
This commit is contained in:
27
backend/app/jobs/notification_job.go
Normal file
27
backend/app/jobs/notification_job.go
Normal file
@@ -0,0 +1,27 @@
|
||||
package jobs
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"quyun/v2/app/jobs/args"
|
||||
"quyun/v2/database/models"
|
||||
|
||||
"github.com/riverqueue/river"
|
||||
)
|
||||
|
||||
// @provider(job)
|
||||
type NotificationWorker struct {
|
||||
river.WorkerDefaults[args.NotificationArgs]
|
||||
}
|
||||
|
||||
func (j *NotificationWorker) Work(ctx context.Context, job *river.Job[args.NotificationArgs]) error {
|
||||
arg := job.Args
|
||||
n := &models.Notification{
|
||||
UserID: arg.UserID,
|
||||
Type: arg.Type,
|
||||
Title: arg.Title,
|
||||
Content: arg.Content,
|
||||
IsRead: false,
|
||||
}
|
||||
return models.NotificationQuery.WithContext(ctx).Create(n)
|
||||
}
|
||||
Reference in New Issue
Block a user