public function get_Certificate($ProducerId) { try { $certs = R::find('producercertificate', 'ProducerId=?', array($ProducerId)); if (!isset($certs) || empty($certs)) { throw new RecordNotFoundException("Record not found, id:" . $ProducerId); } $response = new ResponseJSON(["id", "certficatetime", "bigcertificateurl", "smallcertificateurl"]); foreach ($certs as $cert) { $response->appendData($cert); } //print json_encode($response2->exportResponse())."\n"; echo $response->exportResponse() . "\n"; //只返回认证证书列表信息,多条认证信息一同返回 /* List $bottles = R::find( 'whisky' ); if ( !count( $bottles ) ) die( "The cellar is empty!\n" ); foreach( $bottles as $b ) { echo "* #{$b->id}: {$b->name}\n"; } */ } catch (Exception $ex) { return ExceptionHandler::Response($ex, $this->_app); } }
public function get_Images($ProductId) { try { /*$product = R::find('product', 'ProductId=?', array($ProductId)); echo json_encode(R::exportAll($product));*/ $records = R::getAll('SELECT id, description, bigportraiturl, smallportraiturl FROM productimage WHERE productid=?', array($ProductId)); if (!isset($records) || empty($records)) { throw new RecordNotFoundException("Record not found, id:" . $ProductId); } /*$Count = count($records); $OrderList = array(); foreach ($records as $record) { $List[] = array('Id' => $record['id'], 'description' => $record['description'], 'bigportraiturl' => $record['bigportraiturl'], 'smallportraiturl' => $record['smallportraiturl']); } sendSuccess(array( 'Count' => $Count, 'List' => $List, ));*/ $response = new ResponseJSON(["id", "description", "bigportraiturl", "smallportraiturl"]); foreach ($records as $record) { $response->appendData($record); } //print json_encode($response2->exportResponse())."\n"; echo $response->exportResponse() . "\n"; } catch (Exception $ex) { return ExceptionHandler::Response($ex, $this->_app); } }