查询订单是否是第一次下单
This commit is contained in:
@@ -1368,7 +1368,8 @@ func RefreshJdShopOrdersEarningPrice(ctx *jxcontext.Context, orderStartTime, ord
|
||||
return err
|
||||
}
|
||||
|
||||
func GetOrderUserBuyFirst(ctx *jxcontext.Context, vendorOrderID string) (orderPay *model.OrderPay, err error) {
|
||||
func GetOrderUserBuyFirst(ctx *jxcontext.Context, vendorOrderID string) (isFirst bool, err error) {
|
||||
var orderPays []*model.OrderPay
|
||||
sql := `
|
||||
SELECT b.*
|
||||
FROM goods_order a, order_pay b
|
||||
@@ -1382,6 +1383,11 @@ func GetOrderUserBuyFirst(ctx *jxcontext.Context, vendorOrderID string) (orderPa
|
||||
AND a.vendor_order_id <> ?
|
||||
`
|
||||
sqlParams := []interface{}{model.VendorIDJX, vendorOrderID, vendorOrderID}
|
||||
err = dao.GetRow(dao.GetDB(), &orderPay, sql, sqlParams)
|
||||
return orderPay, err
|
||||
err = dao.GetRows(dao.GetDB(), &orderPays, sql, sqlParams)
|
||||
if len(orderPays) > 0 {
|
||||
return false, err
|
||||
} else {
|
||||
return true, err
|
||||
}
|
||||
return isFirst, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user