You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
467 B
Go
25 lines
467 B
Go
package libs
|
|
|
|
import (
|
|
"encoding/json"
|
|
"fmt"
|
|
"mygo/conf"
|
|
"mygo/dbhelper"
|
|
"time"
|
|
|
|
"github.com/google/uuid"
|
|
)
|
|
|
|
func PutQueue(data interface{}) {
|
|
conn := dbhelper.GetQueueDb()
|
|
uu := uuid.New()
|
|
myuuid := uu.String()
|
|
cmd := make(map[string]interface{})
|
|
cmd["uuid"] = myuuid
|
|
cmd["roomid"] = time.Now().UnixNano()
|
|
cmd["data"] = data
|
|
str, _ := json.Marshal(cmd)
|
|
queuekey := fmt.Sprintf("%s:mailreward:queue", conf.APPNAME)
|
|
conn.LPush(queuekey, string(str))
|
|
}
|