aozhiwei d05123ebb3 1
2024-08-05 13:19:23 +08:00

74 lines
1.4 KiB
Go

package task
import (
"q5"
"f5"
"main/constant"
"main/service"
"fmt"
//"main/mt"
//"strings"
"jccommon"
)
type recharge struct {
}
func (this *recharge) init() {
go this.process()
}
func (this *recharge) unInit() {
}
func (this *recharge) process() {
f5.GetGoStyleDb().LoopLoadNew(
constant.BCNFT_DB,
"recharge_order",
"t_recharge_order",
0,
func (lastIdx int64, maxIdx int64) (string, []string) {
sql := fmt.Sprintf(`
SELECT * FROM t_recharge_order
WHERE idx > %d AND idx <= %d AND pay_status = %d AND delivery_status = %d
ORDER BY idx LIMIT 1000
`,
lastIdx,
maxIdx,
jccommon.RECHARGE_ORDER_PAY_STATUS_OK,
jccommon.RECHARGE_ORDER_DELIVERY_STATUS_PENDING)
params := []string{
}
return sql, params
},
this.deliverGoods)
}
func (this *recharge) deliverGoods(ds *f5.DataSet) bool {
var result = false
//orderId := ds.GetByName("order_id")
passportAddress := ds.GetByName("passport_address")
accountId := service.GetAccountIdByAddress(passportAddress)
if accountId == "" {
return false
}
return result
}
func (this *recharge) markStatus(idx int64, status int32) error {
var resultErr error
f5.GetGoStyleDb().Update(
constant.BCNFT_DB,
"t_recharge_order",
[][]string{
{"idx", q5.ToString(idx)},
},
[][]string{
{"status", q5.ToString(status)},
},
func (err error, lastInsertId int64, rowsAffected int64) {
resultErr = err
})
return resultErr
}