mirror of
https://github.com/keven1024/015.git
synced 2026-05-28 16:09:37 +00:00
26 lines
411 B
Go
26 lines
411 B
Go
package tasks
|
|
|
|
import (
|
|
"context"
|
|
"encoding/json"
|
|
|
|
"github.com/hibiken/asynq"
|
|
)
|
|
|
|
type ImageTaskPayload struct {
|
|
FileId string `json:"file_id"`
|
|
}
|
|
|
|
type CompressImageTaskPayload struct {
|
|
ImageTaskPayload
|
|
}
|
|
|
|
func CompressImage(ctx context.Context, task *asynq.Task) error {
|
|
var payload CompressImageTaskPayload
|
|
if err := json.Unmarshal(task.Payload(), &payload); err != nil {
|
|
return err
|
|
}
|
|
|
|
return nil
|
|
}
|