feat(service): custom product, lịch sử giám sát VM và mã hoá response theo phiên
- Dịch vụ custom: bảng custom_products + services.custom_product_id; createService nhận
custom{} thay product_id, giá = đơn giá tháng x số tháng chu kỳ (1/3/6/12/24/36),
gia hạn tính theo cùng đơn giá, ServiceClientDetailResource trả custom_product và specs.
- Giám sát VM: GET v1/system/vm-metrics/history gom lịch sử về tối đa 240 điểm;
lỗi lấy dung lượng đĩa không còn làm hỏng cả thẻ metrics.
- SealResponse: AES-256-GCM theo khoá phiên do proxy Next cấp qua header x-seal-key
(HMAC của session id). Client opt-in bằng x-seal; chi tiết dịch vụ, mật khẩu VM và
console ticket luôn được mã hoá. Body gửi lên dạng {enc} được giải mã trước validate;
khoá lệch trả 428 để client lấy khoá mới. Đây là che mắt DevTools, không phải bảo mật
chống chính chủ tài khoản.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 5.5
parent
8108e8fe53
commit
6315a392c0
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('custom_products', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('name');
|
||||
$table->string('category', 50)->index();
|
||||
$table->unsignedInteger('cpu')->nullable();
|
||||
$table->unsignedInteger('ram_mb')->nullable();
|
||||
$table->unsignedInteger('disk_gb')->nullable();
|
||||
$table->unsignedInteger('bandwidth_gb')->nullable();
|
||||
$table->json('specs')->nullable();
|
||||
$table->text('description')->nullable();
|
||||
$table->unsignedBigInteger('unit_price')->default(0);
|
||||
$table->timestamps();
|
||||
});
|
||||
|
||||
Schema::table('services', function (Blueprint $table) {
|
||||
$table->foreignId('custom_product_id')->nullable()->after('product_id')
|
||||
->constrained('custom_products')->nullOnDelete();
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('services', function (Blueprint $table) {
|
||||
$table->dropConstrainedForeignId('custom_product_id');
|
||||
});
|
||||
Schema::dropIfExists('custom_products');
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user