This commit is contained in:
苏尹岚
2020-10-14 18:29:36 +08:00
parent 0ff054afed
commit 54438022ff
15 changed files with 223 additions and 113 deletions

View File

@@ -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"},
}

View 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
}

View File

@@ -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 {

View File

@@ -5,6 +5,7 @@ import "time"
const (
JobStatusDoing = 0
JobStatusFinished = 1
JobStatusFailed = -1
JobOrderStatusAccept = 5
JobOrderStatusWaitAudit = 10

View File

@@ -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"},
}
}