update craft item
This commit is contained in:
parent
ca052bc10c
commit
f65c61236d
19
bot.go
19
bot.go
@ -721,11 +721,22 @@ func botCraftItem(m *ChatWarsMessage) {
|
|||||||
clt.Mux.Unlock()
|
clt.Mux.Unlock()
|
||||||
|
|
||||||
p := JobPayloadCraftItem{
|
p := JobPayloadCraftItem{
|
||||||
MsgID64: m.ID64,
|
MsgID64: m.ID64,
|
||||||
ChatID64: m.ChatID64,
|
ChatID64: m.ChatID64,
|
||||||
ObjItemID64: getCraftItemID(m.Text),
|
Status: 0,
|
||||||
Status: 0,
|
|
||||||
}
|
}
|
||||||
|
p.ObjItemID64, err = getCraftItemID(m.Text)
|
||||||
|
if err != nil {
|
||||||
|
c := TGCommand{
|
||||||
|
Type: commandReplyMsg,
|
||||||
|
Text: fmt.Sprintf("%s", err),
|
||||||
|
FromMsgID64: m.ID64,
|
||||||
|
FromChatID64: m.ChatID64,
|
||||||
|
}
|
||||||
|
TGCmdQueue <- c
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
b, _ := json.Marshal(p)
|
b, _ := json.Marshal(p)
|
||||||
t := time.Now().UTC().Add(1 * time.Second)
|
t := time.Now().UTC().Add(1 * time.Second)
|
||||||
_, err = createJob(cacheObjSubType[`job_craft_item`], objJobPriority, userID64, 0, t, b)
|
_, err = createJob(cacheObjSubType[`job_craft_item`], objJobPriority, userID64, 0, t, b)
|
||||||
|
2
item.go
2
item.go
@ -242,7 +242,7 @@ func addObjItemCraftItem(objID64 int64, itemID64 int64, quantity int64) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func getCraftItemID(cmd string) (int64, error) {
|
func getCraftItemID(cmd string) int64, error) {
|
||||||
muxObjItem.RLock()
|
muxObjItem.RLock()
|
||||||
defer muxObjItem.RUnlock()
|
defer muxObjItem.RUnlock()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user