This commit is contained in:
shoopea 2019-05-16 20:41:21 +08:00
parent c7db99ce7d
commit 0d42524e6d

View File

@ -2,7 +2,9 @@ package main
import ( import (
"encoding/json" "encoding/json"
"fmt"
"log" "log"
"math/rand"
"strconv" "strconv"
"time" "time"
@ -117,7 +119,7 @@ func SQLIdentifyMsgWorker(id int, objIds <-chan int64) {
logOnError(err, "SQLIdentifyMsgWorker["+strconv.Itoa(id)+"] : insertMsgMiniWar") logOnError(err, "SQLIdentifyMsgWorker["+strconv.Itoa(id)+"] : insertMsgMiniWar")
err = setObjSubTypeId(objId, objSubTypeMessagePillageInc) err = setObjSubTypeId(objId, objSubTypeMessagePillageInc)
logOnError(err, "SQLIdentifyMsgWorker["+strconv.Itoa(id)+"] : setObjSubTypeId(PillageInc)") logOnError(err, "SQLIdentifyMsgWorker["+strconv.Itoa(id)+"] : setObjSubTypeId(PillageInc)")
err = createJob(objSubTypeJobPillage, objJobPriority, m.UserID64, time.Now().Add((25+rand.Intn(35))*time.Second)) err = createJob(objSubTypeJobPillage, objJobPriority, m.UserID64, time.Now().Add((25+rand.Intn(35))*time.Second), `{}`)
logOnError(err, "SQLIdentifyMsgWorker["+strconv.Itoa(id)+"] : createJob(JobPillage)") logOnError(err, "SQLIdentifyMsgWorker["+strconv.Itoa(id)+"] : createJob(JobPillage)")
s := TGCommand{ s := TGCommand{
Type: commandSendMsg, Type: commandSendMsg,
@ -209,7 +211,7 @@ func TGCmdWorker(id int, b *tb.Bot, cmds <-chan TGCommand) {
log.Printf("TGCmdWorker[" + strconv.Itoa(id) + "] : Closing.") log.Printf("TGCmdWorker[" + strconv.Itoa(id) + "] : Closing.")
} }
func MQTGCmdWorker(id int, msgs <-chan TGCommand) { func MQTGCmdWorker(id int, cmds <-chan TGCommand) {
log.Printf("MQTGCmdWorker[" + strconv.Itoa(id) + "] : Starting.") log.Printf("MQTGCmdWorker[" + strconv.Itoa(id) + "] : Starting.")
for c := range cmds { for c := range cmds {
j, err := json.Marshal(c) j, err := json.Marshal(c)