我需要你的指导。我用mssql和php在slim框架中创建了一个API。它工作正常,但现在我检查邮递员时显示错误。我在下面附上了错误截图。请帮帮我。
$app->post('/tracking', function ($request) use ($app){
$params_tracking = $request->getBody();
$params_tracking = json_decode($params_tracking);
global $connTrack;
$consignment = $params_tracking->data;
$strsql = <<<SQL
SELECT
c.consignmentNumber,
c.pieces,
c.consigner,
c.consignee consignee,
CONVERT(VARCHAR(10), c.bookingDate, 105) bookingDate,
c.weight,
c.serviceTypeName,
r.receivedBy ReceivedBy,
case when cth.reason is null then ( CASE WHEN r.CurrentStatus IS
NULL THEN s.TrackingStatus ELSE r.CurrentStatus END )
else cth.reason end CurrentStatus,
DeliveryTime,bb.name Destination,c.consignerAccountNo
AccoutNo,b.name orign,r.delievryRider delievryRider
FROM Consignment c
INNER JOIN Branches bb ON c.destination = bb.branchCode
INNER JOIN Branches b ON c.orgin = b.branchCode
LEFT JOIN (
SELECT rc.consignmentNumber,
max(rc.receivedBy) ReceivedBy,
max(rc.Status) CurrentStatus,
max(rc.deliveryDate) DeliveryTime,
max(r.firstName + ' (' + rrs.riderCode + ' )')
delievryRider
FROM RunsheetConsignment rc,
Riders r,
RiderRunsheet rrs,
ExpressCenters ec
WHERE rc.runsheetNumber = rrs.runsheetNumber
AND rrs.riderCode = r.riderCode
AND rrs.expIdTemp = r.expressCenterId
AND rrs.expIdTemp = ec.expressCenterCode
AND ec.bid = rc.branchcode
GROUP BY rc.consignmentNumber
) r
ON c.consignmentnumber = r.consignmentNumber
INNER JOIN (
SELECT MAX(t.id) ID,t.consignmentNumber
FROM ConsignmentsTrackingHistory t
GROUP BY t.consignmentNumber
)
ct ON ct.consignmentNumber = c.consignmentNumber
INNER JOIN ConsignmentsTrackingHistory AS cth
ON cth.id = ct.ID
INNER JOIN MNP_ConsginmentTrackingStatus AS s
ON s.StatusID = cth.stateID
WHERE c.consignmentNumber = '$consignment' and
c.consignerAccountNo not in
('4B45','7240','4H86','4H87',
'4H88','4B87','7240','4B45','4H91',
'4H89','4H90','4F47');
SQL;
$result_track = mssql_query( $strsql,$connTrack );
$num_rows = mssql_num_rows($result_track);
if ($num_rows > 0){
while($row = mssql_fetch_assoc($result_track)){
$track = array(); //create the array
$tracking_array['cn_no'] = $consignment;
$tracking_array['book_date'] = $row['bookingDate'];
$tracking_array['service_type'] = $row['serviceTypeName'];
$tracking_array['origin'] = $row['orign'];
$tracking_array['destination'] = $row['Destination'];
$tracking_array['status'] = $row['CurrentStatus'];
$tracking_array['delivery_date'] = $row['DeliveryTime'];
$tracking_array['received_by'] = $row['ReceivedBy'];
array_push($track,$tracking_array);
}
echo json_encode($track);
}
});