feat(service): huỷ dịch vụ, SSL, đổi mật khẩu hosting, lịch sử thanh toán theo hình thức
- Lịch sử thanh toán hoá đơn trả thêm `method` (tự động gia hạn / số dư / admin / chuyển khoản / hoàn tiền), bỏ đuôi `(method)` khỏi ghi chú - `DnsServer::panelUrl()` = https://<domain>/ dùng cho email cấp hosting và nút Plesk của khách - Order item trả thêm `uuid`/`type` của dịch vụ để FE dẫn tới trang quản lý - Yêu cầu huỷ dịch vụ, chứng chỉ SSL, lịch sử gia hạn, đổi mật khẩu hosting cho khách Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 5.5
parent
a6b641015e
commit
b44a88bb52
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Api\Client\Service;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\ServiceSslCertificate;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Str;
|
||||
use ZipArchive;
|
||||
|
||||
class SslArchiveController extends Controller
|
||||
{
|
||||
public function __invoke(Request $request, string $uuid)
|
||||
{
|
||||
$certificate = ServiceSslCertificate::query()
|
||||
->whereHas('service', fn ($query) => $query
|
||||
->where('uuid', $uuid)
|
||||
->where('customer_id', $request->user()->id))
|
||||
->with('service:id,uuid,server_name')
|
||||
->firstOrFail();
|
||||
|
||||
$path = tempnam(sys_get_temp_dir(), 'ssl');
|
||||
$zip = new ZipArchive();
|
||||
$zip->open($path, ZipArchive::OVERWRITE);
|
||||
|
||||
foreach ($certificate->data['files'] as $file) {
|
||||
$zip->addFromString($file['name'], $file['content']);
|
||||
}
|
||||
|
||||
if ($certificate->data['fields'] !== []) {
|
||||
$zip->addFromString('thong-tin.txt', collect($certificate->data['fields'])
|
||||
->map(fn ($field) => "{$field['label']}: {$field['value']}")
|
||||
->implode("\n\n"));
|
||||
}
|
||||
|
||||
$zip->close();
|
||||
|
||||
$name = Str::slug($certificate->service->server_name ?: 'ssl') . '-ssl.zip';
|
||||
|
||||
return response()->download($path, $name)->deleteFileAfterSend();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user