fixes
This commit is contained in:
parent
cdfdc21c13
commit
60469f8564
1
bot.go
1
bot.go
@ -678,6 +678,7 @@ func botGStock(m ChatWarsMessage) {
|
|||||||
p := JobPayloadGStock{
|
p := JobPayloadGStock{
|
||||||
MsgID64: m.ID64,
|
MsgID64: m.ID64,
|
||||||
ChatID64: m.ChatID64,
|
ChatID64: m.ChatID64,
|
||||||
|
Status: 0,
|
||||||
}
|
}
|
||||||
b, _ := json.Marshal(p)
|
b, _ := json.Marshal(p)
|
||||||
t := time.Now().UTC().Add(1 * time.Second)
|
t := time.Now().UTC().Add(1 * time.Second)
|
||||||
|
1
def.go
1
def.go
@ -401,6 +401,7 @@ type JobPayloadStatus struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type JobPayloadGStock struct {
|
type JobPayloadGStock struct {
|
||||||
|
Status int64 `json:"status"`
|
||||||
MsgID64 int64 `json:"msg_id"`
|
MsgID64 int64 `json:"msg_id"`
|
||||||
ChatID64 int64 `json:"chat_id"`
|
ChatID64 int64 `json:"chat_id"`
|
||||||
VaultJobID64 int64 `json:"vault_job_id"`
|
VaultJobID64 int64 `json:"vault_job_id"`
|
||||||
|
8
item.go
8
item.go
@ -246,9 +246,13 @@ func getCraftItemID(cmd string) (int64, error) {
|
|||||||
muxObjItem.RLock()
|
muxObjItem.RLock()
|
||||||
defer muxObjItem.RUnlock()
|
defer muxObjItem.RUnlock()
|
||||||
|
|
||||||
for _, o := range objItems {
|
if id, ok := cacheObjItemCraft[cmd]; ok {
|
||||||
|
return objItems[id].ObjID64, nil
|
||||||
|
} else {
|
||||||
|
return 0, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return 0, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func loadObjItem() error {
|
func loadObjItem() error {
|
||||||
|
16
job.go
16
job.go
@ -201,13 +201,16 @@ func setJobPayload(jobID64 int64, payload []byte) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func getJobPayload(j.ID64) []byte {
|
func getJobPayload(jobID64 int64) []byte {
|
||||||
var b []byte
|
var b []byte
|
||||||
muxObjJob.Lock()
|
muxObjJob.Lock()
|
||||||
j := cacheObjJob[jobID64]
|
|
||||||
b = j.Payload
|
|
||||||
defer muxObjJob.Unlock()
|
defer muxObjJob.Unlock()
|
||||||
return b
|
if j, ok := cacheObjJob[jobID64]; ok {
|
||||||
|
b = j.Payload
|
||||||
|
return b
|
||||||
|
} else {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func setJobDone(jobID64 int64) error {
|
func setJobDone(jobID64 int64) error {
|
||||||
@ -909,9 +912,6 @@ func jobGStock(j Job) {
|
|||||||
err = json.Unmarshal(j.Payload, &p)
|
err = json.Unmarshal(j.Payload, &p)
|
||||||
logOnError(err, "jobGStock : Unmarshal payload")
|
logOnError(err, "jobGStock : Unmarshal payload")
|
||||||
|
|
||||||
fmt.Printf("jobGStock : Progress => %d\n", p.Progress)
|
|
||||||
fmt.Printf("jobGStock : UserID64 => %d\n", j.UserID64)
|
|
||||||
|
|
||||||
if p.Status == 0 {
|
if p.Status == 0 {
|
||||||
p2.JobCallbackID64 = j.ID64
|
p2.JobCallbackID64 = j.ID64
|
||||||
p2.ItemTypeList = make([]int64, 0)
|
p2.ItemTypeList = make([]int64, 0)
|
||||||
@ -938,7 +938,7 @@ func jobGStock(j Job) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
b = getJobPayload(p.VaultJobID64)
|
b := getJobPayload(p.VaultJobID64)
|
||||||
err = json.Unmarshal(b, &p2)
|
err = json.Unmarshal(b, &p2)
|
||||||
logOnError(err, "jobGStock : Unmarshal(p2)")
|
logOnError(err, "jobGStock : Unmarshal(p2)")
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user