投诉骑手

This commit is contained in:
苏尹岚
2019-12-25 18:37:00 +08:00
parent 8b86f84966
commit 3983e9d5a9
3 changed files with 14 additions and 9 deletions

View File

@@ -249,14 +249,14 @@ func GetComplaintReasons() (complaintReasonList []*dadaapi.ComplaintReason) {
return complaintReasonList
}
func ComplaintRider(ctx *jxcontext.Context, orderID string, vendorID, complaintID int) (err error) {
func ComplaintRider(ctx *jxcontext.Context, vendorOrderID string, vendorID, waybillVendorID, complaintID int) (err error) {
db := dao.GetDB()
p := partner.GetDeliveryPlatformFromVendorID(vendorID).Handler
wayBillList, err := dao.GetWayBillByOrderID(db, model.OrderStatusFinished, vendorID, orderID)
wayBillList, err := dao.GetWayBillByOrderID(db, model.OrderStatusFinished, vendorID, waybillVendorID, vendorOrderID)
if err == nil && len(wayBillList) > 0 {
err = p.ComplaintRider(wayBillList[0], complaintID, complaintReasonsMap[complaintID])
} else {
return fmt.Errorf("未查询到到相关订单,订单状态要求必须是完成!订单号:[%v] ,厂商:[%v]", orderID, vendorID)
return fmt.Errorf("未查询到到相关订单,订单状态要求必须是完成!订单号:[%v] ,厂商:[%v]", orderID, waybillVendorID)
}
return err
}

View File

@@ -1028,14 +1028,18 @@ func LoadPendingOrders(db *DaoDB, orderCreatedAfter time.Time, beforStatus int)
return orderList, err
}
func GetWayBillByOrderID(db *DaoDB, orderStatus, waybillVendorID int, vendorOrderID string) (wayBillList []*model.Waybill, err error) {
func GetWayBillByOrderID(db *DaoDB, orderStatus, vendorID, waybillVendorID int, vendorOrderID string) (wayBillList []*model.Waybill, err error) {
sql := `
SELECT b.*
FROM goods_order a
LEFT JOIN waybill b ON IF(a.waybill_vendor_id = -1,a.vendor_order_id,a.vendor_waybill_id) = b.vendor_waybill_id
LEFT JOIN waybill b ON IF(a.waybill_vendor_id = -1,a.vendor_order_id,a.vendor_waybill_id) = b.vendor_waybill_id AND b.vendor_id = a.vendor_id
WHERE a.vendor_order_id = ?
AND a.vendor_id = ?
`
sqlParams := []interface{}{vendorOrderID}
sqlParams := []interface{}{
vendorOrderID,
vendorID,
}
if orderStatus > 0 {
sql += ` AND a.status = ?`
sqlParams = append(sqlParams, orderStatus)