29 lines
		
	
	
		
			537 B
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			29 lines
		
	
	
		
			537 B
		
	
	
	
		
			Go
		
	
	
	
	
	
| package queue
 | |
| 
 | |
| import (
 | |
| 	"context"
 | |
| 	"github.com/hibiken/asynq"
 | |
| 	"qnc-server/app/user/cmd/api/internal/svc"
 | |
| 	"qnc-server/app/user/cmd/api/internal/types"
 | |
| )
 | |
| 
 | |
| type CronJob struct {
 | |
| 	ctx    context.Context
 | |
| 	svcCtx *svc.ServiceContext
 | |
| }
 | |
| 
 | |
| func NewCronJob(ctx context.Context, svcCtx *svc.ServiceContext) *CronJob {
 | |
| 	return &CronJob{
 | |
| 		ctx:    ctx,
 | |
| 		svcCtx: svcCtx,
 | |
| 	}
 | |
| }
 | |
| 
 | |
| func (l *CronJob) Register() *asynq.ServeMux {
 | |
| 
 | |
| 	mux := asynq.NewServeMux()
 | |
| 
 | |
| 	mux.Handle(types.MsgPaySuccessQuery, NewPaySuccessNotifyUserHandler(l.svcCtx))
 | |
| 	return mux
 | |
| }
 |