mirror of
https://github.com/myronblair/tomsjavajive
synced 2026-06-30 17:50:32 -05:00
sync: updated admin, assets, new images, composer config, customer email API
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
/**
|
||||
* Tom's Java Jive - Admin API: Customer Email History
|
||||
*/
|
||||
require_once dirname(__DIR__, 2) . '/includes/auth.php';
|
||||
AdminAuth::require();
|
||||
|
||||
header('Content-Type: application/json');
|
||||
|
||||
$customerId = trim($_GET['customer_id'] ?? '');
|
||||
if (!$customerId) {
|
||||
echo json_encode(['emails' => []]);
|
||||
exit;
|
||||
}
|
||||
|
||||
$emails = db()->fetchAll(
|
||||
"SELECT id, subject, status, opened, open_count, opened_at, tags,
|
||||
DATE_FORMAT(sent_at, '%b %e, %Y %l:%i %p') as sent_at,
|
||||
message_id, error_message
|
||||
FROM email_log
|
||||
WHERE customer_id = :cid
|
||||
ORDER BY sent_at DESC
|
||||
LIMIT 50",
|
||||
['cid' => $customerId]
|
||||
);
|
||||
|
||||
echo json_encode(['emails' => $emails ?: []]);
|
||||
Reference in New Issue
Block a user