test
This commit is contained in:
parent
27ebd8260c
commit
7730b0c897
21
item.go
21
item.go
@ -448,3 +448,24 @@ func loadObjItem() error {
|
|||||||
return nil
|
return nil
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func getObjItemVal(objID64 int, quality string) float64 {
|
||||||
|
var val float64
|
||||||
|
item, err := getObjItem(objID64)
|
||||||
|
if err != nil {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
if !item.Auction {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
row := db.QueryRow(`SELECT avg(omaa.price)
|
||||||
|
FROM obj_msg_auction_announce omaa
|
||||||
|
WHERE omaa.item_id = ?
|
||||||
|
AND omaa.quality = ?`, objID64, quality)
|
||||||
|
err = row.Scan(&val)
|
||||||
|
if err != nil {
|
||||||
|
logOnError(err, "getObjItemVal : row.Scan")
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
return val
|
||||||
|
}
|
||||||
|
16
job.go
16
job.go
@ -2609,6 +2609,7 @@ func jobVaultVal(j Job) {
|
|||||||
p JobPayloadVaultVal
|
p JobPayloadVaultVal
|
||||||
p2 JobPayloadGetVault
|
p2 JobPayloadGetVault
|
||||||
b []byte
|
b []byte
|
||||||
|
other, part, rec float64
|
||||||
)
|
)
|
||||||
|
|
||||||
err := setJobStart(j.ID64)
|
err := setJobStart(j.ID64)
|
||||||
@ -2646,9 +2647,22 @@ func jobVaultVal(j Job) {
|
|||||||
err = json.Unmarshal(b, &p2)
|
err = json.Unmarshal(b, &p2)
|
||||||
logOnError(err, "jobVaultVal : Unmarshal(p2)")
|
logOnError(err, "jobVaultVal : Unmarshal(p2)")
|
||||||
|
|
||||||
|
for _, v := range p2.Vault {
|
||||||
|
item, _ := getObjItem(v.ItemID64)
|
||||||
|
switch item.ItemTypeID {
|
||||||
|
case cacheObjSubType[`item_part`]:
|
||||||
|
part += getObjItemVal(v.ItemID64, v.Quality)
|
||||||
|
case cacheObjSubType[`item_rec`]:
|
||||||
|
rec += getObjItemVal(v.ItemID64, v.Quality)
|
||||||
|
case cacheObjSubType[`item_other`]:
|
||||||
|
other += getObjItemVal(v.ItemID64, v.Quality)
|
||||||
|
default:
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
c := TGCommand{
|
c := TGCommand{
|
||||||
Type: commandReplyMsg,
|
Type: commandReplyMsg,
|
||||||
Text: "out",
|
Text: fmt.Sprintf("Value :\n- Parts: %f\n- Recipes: %f\n- Other: %f", part, rec, other),
|
||||||
FromMsgID64: p.MsgID64,
|
FromMsgID64: p.MsgID64,
|
||||||
FromChatID64: p.ChatID64,
|
FromChatID64: p.ChatID64,
|
||||||
ParseMode: cmdParseModeHTML,
|
ParseMode: cmdParseModeHTML,
|
||||||
|
Loading…
Reference in New Issue
Block a user