bill job
This commit is contained in:
@@ -34,18 +34,23 @@ func (v *BillExpend) TableIndex() [][]string {
|
||||
|
||||
//用户账单表
|
||||
type UserBill struct {
|
||||
ModelIDCUL
|
||||
ModelIDCULD
|
||||
|
||||
BillID int64 `orm:"column(bill_id)" json:"billID"` //账单ID
|
||||
UserID string `orm:"column(user_id)" json:"userID"` //用户ID
|
||||
AccountBalance int `json:"accountBalance"` //账户余额
|
||||
DepositBalance int `json:"DepositBalance"` //保证金余额
|
||||
DepositBalance int `json:"depositBalance"` //保证金余额
|
||||
}
|
||||
|
||||
func (v *UserBill) TableUnique() [][]string {
|
||||
return [][]string{
|
||||
[]string{"UserID"},
|
||||
}
|
||||
}
|
||||
|
||||
func (v *UserBill) TableIndex() [][]string {
|
||||
return [][]string{
|
||||
[]string{"BillID"},
|
||||
[]string{"UserID"},
|
||||
[]string{"CreatedAt"},
|
||||
[]string{"AccountBalance"},
|
||||
}
|
||||
|
||||
23
business/model/dao/dao_bill.go
Normal file
23
business/model/dao/dao_bill.go
Normal file
@@ -0,0 +1,23 @@
|
||||
package dao
|
||||
|
||||
import (
|
||||
"git.rosy.net.cn/baseapi/utils"
|
||||
"git.rosy.net.cn/jx-callback/business/model"
|
||||
)
|
||||
|
||||
func GetUserBill(db *DaoDB, userID, billID string) (userBill *model.UserBill, err error) {
|
||||
sql := `
|
||||
SELECT * FROM user_bill WHERE deleted_at = ?
|
||||
`
|
||||
sqlParams := []interface{}{utils.DefaultTimeValue}
|
||||
if userID != "" {
|
||||
sql += ` AND user_id = ?`
|
||||
sqlParams = append(sqlParams, userID)
|
||||
}
|
||||
if billID != "" {
|
||||
sql += ` AND bill_id = ?`
|
||||
sqlParams = append(sqlParams, billID)
|
||||
}
|
||||
err = GetRow(db, &userBill, sql, sqlParams)
|
||||
return userBill, err
|
||||
}
|
||||
@@ -51,9 +51,9 @@ func GetJobs(db *DaoDB, userIDs []string, categoryIDs []int, includeStep bool, f
|
||||
sql += ` AND a.created_at <= ?`
|
||||
sqlParams = append(sqlParams, toTime)
|
||||
}
|
||||
sql += " LIMIT ? OFFSET ?"
|
||||
sql += " AND a.status <> ? LIMIT ? OFFSET ?"
|
||||
pageSize = jxutils.FormalizePageSize(pageSize)
|
||||
sqlParams = append(sqlParams, pageSize, offset)
|
||||
sqlParams = append(sqlParams, model.JobStatusFailed, pageSize, offset)
|
||||
Begin(db)
|
||||
defer Commit(db)
|
||||
if err = GetRows(db, &jobs, sql, sqlParams...); err == nil {
|
||||
|
||||
@@ -5,6 +5,7 @@ import "time"
|
||||
const (
|
||||
JobStatusDoing = 0
|
||||
JobStatusFinished = 1
|
||||
JobStatusFailed = -1
|
||||
|
||||
JobOrderStatusAccept = 5
|
||||
JobOrderStatusWaitAudit = 10
|
||||
|
||||
@@ -32,6 +32,8 @@ const (
|
||||
OrderTypeMatter = 1 //物料订单
|
||||
OrderTypeSupplyGoods = 2 //进货订单
|
||||
OrderTypeDefendPrice = 3 //守价订单
|
||||
|
||||
OrderTypeDeposit = 1 //保证金
|
||||
)
|
||||
|
||||
var (
|
||||
@@ -457,10 +459,15 @@ type Order struct {
|
||||
Comment string `orm:"size(255)" json:"comment"` //备注
|
||||
}
|
||||
|
||||
func (v *Order) TableUnique() [][]string {
|
||||
return [][]string{
|
||||
[]string{"OrderID"},
|
||||
}
|
||||
}
|
||||
|
||||
func (v *Order) TableIndex() [][]string {
|
||||
return [][]string{
|
||||
[]string{"CreatedAt"},
|
||||
[]string{"OrderID"},
|
||||
[]string{"UserID"},
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user