1
This commit is contained in:
35
dao/print_bill_pay.go
Normal file
35
dao/print_bill_pay.go
Normal file
@@ -0,0 +1,35 @@
|
||||
package dao
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"git.rosy.net.cn/jx-print/globals"
|
||||
order "git.rosy.net.cn/jx-print/model/app_model"
|
||||
"github.com/jmoiron/sqlx"
|
||||
)
|
||||
|
||||
// InsertPrinterPayRecord 新增充值记录
|
||||
func InsertPrinterPayRecord(order *order.OrderPay) error {
|
||||
return Insert(globals.GetDB(), order)
|
||||
}
|
||||
|
||||
// QueryPrinterPayRecord 查询充值记录
|
||||
func QueryPrinterPayRecord(orderId string) (*order.OrderPay, error) {
|
||||
sql := `SELECT * FROM order_pay WHERE pay_order_id = ?`
|
||||
|
||||
var result []*order.OrderPay
|
||||
if err := globals.GetDB().Select(&result, sql, []interface{}{orderId}...); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(result) != 1 {
|
||||
globals.SugarLogger.Errorf("回调查询错误,订单id不存在或者不唯一")
|
||||
return nil, fmt.Errorf("回调查询错误,订单id不存在或者不唯一")
|
||||
}
|
||||
|
||||
return result[0], nil
|
||||
}
|
||||
|
||||
// UpdatePrinterPayRecord 修改充值表记录状态
|
||||
func UpdatePrinterPayRecord(db *sqlx.Tx, order *order.OrderPay, field ...string) error {
|
||||
return UpdateTx(db, order, field...)
|
||||
}
|
||||
Reference in New Issue
Block a user