vault status job
This commit is contained in:
parent
59331a7c07
commit
dfab9bb46c
9
def.go
9
def.go
@ -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
14
job.go
@ -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
2
sql.go
@ -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
|
||||
|
@ -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)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user