fix(order): 修复分销收号商品在主站租用后报订单不存在的问题
This commit is contained in:
@@ -159,14 +159,16 @@ func Append(tx *gorm.DB, entries ...Entry) error {
|
||||
if siteID == nil {
|
||||
if (entry.BizType == "order" || entry.BizType == "order_handoff") && entry.BizID != nil && *entry.BizID > 0 {
|
||||
var orderSiteID *uint64
|
||||
row := tx.Table("rental_orders").Where("id = ?", *entry.BizID).Select("distribution_site_id").Row()
|
||||
if err := row.Scan(&orderSiteID); err == nil && orderSiteID != nil {
|
||||
var mode string
|
||||
row := tx.Table("rental_orders").Where("id = ?", *entry.BizID).Select("distribution_site_id, distribution_mode").Row()
|
||||
if err := row.Scan(&orderSiteID, &mode); err == nil && orderSiteID != nil && mode != "two_party_distributor_receive" {
|
||||
siteID = orderSiteID
|
||||
}
|
||||
} else if entry.BizType == "dispute" && entry.BizID != nil && *entry.BizID > 0 {
|
||||
var orderSiteID *uint64
|
||||
row := tx.Table("order_disputes d").Joins("JOIN rental_orders o ON o.id = d.order_id").Where("d.id = ?", *entry.BizID).Select("o.distribution_site_id").Row()
|
||||
if err := row.Scan(&orderSiteID); err == nil && orderSiteID != nil {
|
||||
var mode string
|
||||
row := tx.Table("order_disputes d").Joins("JOIN rental_orders o ON o.id = d.order_id").Where("d.id = ?", *entry.BizID).Select("o.distribution_site_id, o.distribution_mode").Row()
|
||||
if err := row.Scan(&orderSiteID, &mode); err == nil && orderSiteID != nil && mode != "two_party_distributor_receive" {
|
||||
siteID = orderSiteID
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user