feat: email gửi tay/nhắc gia hạn, gói hosting, sửa dữ liệu sản phẩm
- Gửi email theo template cho 1 khách, tab lịch sử email, nhắc gia hạn dịch vụ hàng loạt - Mail lưu from/bcc/sent_by; mẫu MARKETING và mẫu cũ trong TemplateSeeder - Gói hosting: giới hạn, trạng thái, lấy plan Plesk qua CLI gateway - Backfill payment_method và ngày đơn hàng còn thiếu - Bổ sung field CPU/RAM/Disk/Băng thông cho loại sản phẩm vps và cloud Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
8651dde6b1
commit
30898ea46f
@@ -74,6 +74,36 @@ final class MailCampaignController extends Controller
|
||||
]);
|
||||
}
|
||||
|
||||
public function variableSuggestions(Request $request): JsonResponse
|
||||
{
|
||||
$data = $request->validate([
|
||||
'template_id' => 'required|integer|exists:template,id',
|
||||
]);
|
||||
|
||||
$suggestions = MailCampaign::query()
|
||||
->where('template_id', $data['template_id'])
|
||||
->whereNotNull('variables')
|
||||
->where('sent_count', '>', 0)
|
||||
->orderByDesc('created_at')
|
||||
->limit(20)
|
||||
->get(['uuid', 'name', 'variables', 'created_at'])
|
||||
->filter(fn (MailCampaign $campaign) => !empty($campaign->variables))
|
||||
->unique(fn (MailCampaign $campaign) => json_encode($campaign->variables))
|
||||
->take(8)
|
||||
->map(fn (MailCampaign $campaign) => [
|
||||
'uuid' => $campaign->uuid,
|
||||
'name' => $campaign->name,
|
||||
'variables' => $campaign->variables,
|
||||
'created_at' => $campaign->created_at,
|
||||
])
|
||||
->values();
|
||||
|
||||
return response()->json([
|
||||
'error' => false,
|
||||
'data' => $suggestions,
|
||||
]);
|
||||
}
|
||||
|
||||
public function preview(Request $request, MailCampaignRenderer $renderer): JsonResponse
|
||||
{
|
||||
$campaign = $this->draftCampaign($request->validate($this->contentRules()));
|
||||
|
||||
Reference in New Issue
Block a user