增加生产数据结构的定义
This commit is contained in:
@@ -13,6 +13,7 @@ import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"git.zhangdeman.cn/zhangdeman/util"
|
||||
"github.com/go-redis/redis/v8"
|
||||
)
|
||||
|
||||
@@ -65,7 +66,11 @@ func (rp *redisProduce) Produce(ctx context.Context, data ...*Queue) error {
|
||||
//
|
||||
// Date : 18:22 2022/7/6
|
||||
func (rp *redisProduce) buildAddMember(queueData *Queue) *redis.Z {
|
||||
byteData, _ := json.Marshal(queueData)
|
||||
byteData, _ := json.Marshal(&ProduceData{
|
||||
MsgID: util.String.Md5(util.String.GenRandom("", 16)),
|
||||
Timestamp: time.Now().UnixNano() / 1e6,
|
||||
Data: queueData.Data,
|
||||
})
|
||||
return &redis.Z{
|
||||
Score: float64(time.Now().Unix() + queueData.DelayTime),
|
||||
Member: string(byteData),
|
||||
|
||||
Reference in New Issue
Block a user