vault status job

This commit is contained in:
shoopea 2019-10-11 13:18:53 +08:00
parent 59331a7c07
commit dfab9bb46c
4 changed files with 27 additions and 0 deletions

9
def.go
View File

@ -346,6 +346,14 @@ type JobPayloadBackupImport struct {
ChatID64 int64 `json:"chat_id"`
}
type JobPayloadVaultStatus struct {
UserListID64 []int64 `json:"user_list"`
ItemTypeListID64 []int64 `json:"item_type_list"`
DepositChatID64 int64 `json:"deposit_chat_id"`
MsgID64 int64 `json:"msg_id"`
ChatID64 int64 `json:"chat_id"`
}
const (
userID64ChtWrsBot = 408101137
@ -494,6 +502,7 @@ const (
objSubTypeJobGDeposit = 612
objSubTypeJobGDepositForward = 613
objSubTypeJobSaveRes = 614
objSubTypeJobVaultStatus = 615
objSubTypeItemResource = 701
objSubTypeItemAlch = 702
objSubTypeItemMisc = 703

14
job.go
View File

@ -892,6 +892,20 @@ func jobGDeposit(j Job) {
return
}
func jobVaultStatus(j Job) {
var p JobPayloadVaultStatus
err := setJobStart(j.ID64)
logOnError(err, "jobVaultStatus : setJobStart")
err = json.Unmarshal(j.Payload, &p)
logOnError(err, "jobVaultStatus : Unmarshal payload")
err = setJobDone(j.ID64)
logOnError(err, "jobVaultStatus : setJobDone")
return
}
func jobGWithdraw(j Job) {
var p JobPayloadGWithdraw
err := setJobStart(j.ID64)

2
sql.go
View File

@ -563,6 +563,7 @@ func initDB() {
,(` + strconv.Itoa(objSubTypeJobGDeposit) + `, "job_gdeposit", "GDeposit job", ` + strconv.Itoa(objTypeJob) + `)
,(` + strconv.Itoa(objSubTypeJobGDepositForward) + `, "job_gdeposit_fwd", "GDeposit Forward job", ` + strconv.Itoa(objTypeJob) + `)
,(` + strconv.Itoa(objSubTypeJobSaveRes) + `, "job_save_res", "Save resources job", ` + strconv.Itoa(objTypeJob) + `)
,(` + strconv.Itoa(objSubTypeJobVaultStatus) + `, "job_vault_status", "Vault Status job", ` + strconv.Itoa(objTypeJob) + `)
,(` + strconv.Itoa(objSubTypeItemResource) + `, "item_res", "Time", ` + strconv.Itoa(objTypeItem) + `)
,(` + strconv.Itoa(objSubTypeItemAlch) + `, "item_alch", "Time", ` + strconv.Itoa(objTypeItem) + `)
,(` + strconv.Itoa(objSubTypeItemMisc) + `, "item_misc", "Time", ` + strconv.Itoa(objTypeItem) + `)
@ -584,6 +585,7 @@ func initDB() {
_, err = db.Exec(`CREATE VIEW obj_msg_vault_v AS
SELECT om.sender_user_id user_id
,om.chat_id
,o.obj_sub_type_id msg_type_id
,omi.item_id
,omi.quantity
FROM obj o

View File

@ -553,6 +553,8 @@ func JobWorker(id int, jobs <-chan Job) {
jobGDepositForward(j)
case objSubTypeJobGWithdraw:
jobGWithdraw(j)
case objSubTypeJobVaultStatus:
jobVaultStatus(j)
default:
log.Printf("jobWorker["+strconv.Itoa(id)+"] : No handler for job type #%d.\n", j.JobTypeID)
}