Implement VM deletion functionality and update related services; add confirmation check and logging

This commit is contained in:
baodev0
2026-07-17 09:14:26 +07:00
parent 5cf7411d3e
commit abc12b71ef
12 changed files with 320 additions and 161 deletions
+50 -79
View File
@@ -2,97 +2,68 @@
namespace Database\Seeders;
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use App\Models\Setting as SettingModel;
use Illuminate\Database\Seeder;
use App\Models\Setting as SettingWeb;
class Setting extends Seeder
{
/**
* Run the database seeds.
* Seed the application settings without creating duplicate keys.
*
* @return void
* @throws \JsonException
*/
public function run()
public function run(): void
{
SettingWeb::insert([
[
'key' => 'setting',
'value' => json_encode([
'tax' => '',
'tel' => '',
'favi_icon' => 'https://tgs.com.vn/wp-content/uploads/2020/11/logo-social-01.png',
'logo' => 'https://tgs.com.vn/wp-content/uploads/2023/02/cropped-LOGO-THE-GIOI-SO-2023-05M-1-1024x487.png',
'email' => 'tgs@gmail.com',
'title' => 'Trang Quản Lý Portal',
'company' => 'Thế giới số Portal',
'bot_id' => env('TELEGRAM_BOT_ID'),
'bot_token' => env('TELEGRAM_BOT_TOKEN'),
'telegram_group_id' => env('TELEGRAM_GROUP_ID', ''),
'status' => 1,
'address' => 'HCM',
'hotline' => '',
'admin_email' => env('ADMIN_NOTIFY_EMAIL', ''),
'support' => null,
'brand_color' => '#EF6824'
], JSON_THROW_ON_ERROR)
$settings = [
'setting' => [
'tax' => null,
'tel' => null,
'favi_icon' => 'https://tgs.com.vn/wp-content/uploads/2020/11/logo-social-01.png',
'logo' => env('APP_LOGO_URL', 'https://tgs.com.vn/wp-content/uploads/2023/02/cropped-LOGO-THE-GIOI-SO-2023-05M-1-1024x487.png'),
'email' => env('ADMIN_NOTIFY_EMAIL', 'web@tgs.com.vn'),
'title' => 'Trang Quản Lý Portal',
'company' => 'Thế giới số Portal',
'bot_id' => env('TELEGRAM_BOT_ID'),
'bot_token' => env('TELEGRAM_BOT_TOKEN'),
'status' => 1,
'address' => 'HCM',
'support' => null,
'brand_color' => '#EF6824',
'hotline' => null,
'admin_email' => env('ADMIN_NOTIFY_EMAIL', 'web@tgs.com.vn'),
'telegram_group_id' => env('TELEGRAM_GROUP_ID'),
'inet_api_key' => env('INET_API_KEY'),
],
[
'key' => 'smtp',
'value' => json_encode([
'transport' => env('MAIL_MAILER', 'smtp'),
'host' => env('MAIL_HOST'),
'user' => env('MAIL_USERNAME'),
'password' => env('MAIL_PASSWORD'),
'encryption' => env('MAIL_ENCRYPTION', 'ssl'),
'port' => env('MAIL_PORT', 465),
'status' => 1
], JSON_THROW_ON_ERROR)
'smtp' => [
'transport' => env('MAIL_MAILER', 'smtp'),
'host' => env('MAIL_HOST', 'smtp.gmail.com'),
'user' => env('MAIL_USERNAME'),
'password' => env('MAIL_PASSWORD'),
'encryption' => env('MAIL_ENCRYPTION', 'tls'),
'port' => env('MAIL_PORT', 465),
'status' => 1,
],
[
'key' => 'banking',
'value' => json_encode([
'type' => 'MB',
'callback' => 'api.callback.MB',
'captcha' => '',
'user' => '',
'password' => '',
'status' => 0
], JSON_THROW_ON_ERROR)
'banking' => [
'type' => 'MB',
'callback' => 'api.callback.MB',
'captcha' => '',
'user' => '',
'password' => '',
'status' => 0,
],
[
'key' => 'domain_pricing',
'value' => json_encode([
'domains' => [
['tld' => '.com', 'setupFee' => 'Miễn phí', 'firstYear' => 320000, 'renewal' => 340000],
['tld' => '.net', 'setupFee' => 'Miễn phí', 'firstYear' => 369000, 'renewal' => 409000],
['tld' => '.org', 'setupFee' => 'Miễn phí', 'firstYear' => 339000, 'renewal' => 369000],
['tld' => '.biz', 'setupFee' => 'Miễn phí', 'firstYear' => 399000, 'renewal' => 409000],
['tld' => '.info', 'setupFee' => 'Miễn phí', 'firstYear' => 490000, 'renewal' => 509000],
['tld' => '.Pro', 'setupFee' => 'Miễn phí', 'firstYear' => 469000, 'renewal' => 489000],
['tld' => '.name', 'setupFee' => 'Miễn phí', 'firstYear' => 259000, 'renewal' => 259000],
['tld' => '.ws', 'setupFee' => 'Miễn phí', 'firstYear' => 909000, 'renewal' => 909000],
['tld' => '.tv', 'setupFee' => 'Miễn phí', 'firstYear' => 765000, 'renewal' => 819000],
['tld' => '.mobi', 'setupFee' => 'Miễn phí', 'firstYear' => 589000, 'renewal' => 589000],
['tld' => '.uk', 'setupFee' => 'Miễn phí', 'firstYear' => 537000, 'renewal' => 537000],
['tld' => '.asia', 'setupFee' => 'Miễn phí', 'firstYear' => 380000, 'renewal' => 452000],
['tld' => '.me', 'setupFee' => 'Miễn phí', 'firstYear' => 1029000, 'renewal' => 1029000],
['tld' => '.us', 'setupFee' => 'Miễn phí', 'firstYear' => 323000, 'renewal' => 323000],
],
'services' => [
['name' => 'Chứng thực Rapid SSL', 'setupFee' => 230000, 'maintenance' => 750000, 'note' => '01 Domain'],
['name' => 'Chứng thực Quick SSL', 'setupFee' => 230000, 'maintenance' => 2300000, 'note' => '01 Domain'],
['name' => 'Chứng thực Wildcard SSL', 'setupFee' => 230000, 'maintenance' => 3300000, 'note' => 'Unlimited Subdomain'],
['name' => 'Chứng thực True BusinessID', 'setupFee' => 540000, 'maintenance' => 3900000, 'note' => '01 Domain'],
['name' => 'Chứng thực True BusinessID WildCard', 'setupFee' => 900000, 'maintenance' => 15000000, 'note' => 'Unlimited Subdomain'],
['name' => 'Đăng ký DNS riêng', 'setupFee' => 200000, 'maintenance' => 'Miễn phí', 'note' => "dns1.tenmiencuaban.com\ndns2.tenmiencuaban.com"],
['name' => 'Bảo mật thông tin tên miền', 'setupFee' => 'Miễn phí', 'maintenance' => 90000, 'note' => 'Toàn bộ thông tin Whois tên miền của bạn sẽ được giấu kín hoàn toàn với mọi công cụ Whois'],
['name' => 'Khóa tên miền', 'setupFee' => 'Miễn phí', 'maintenance' => 'Miễn phí', 'note' => 'Tăng cường bảo mật cho tên miền'],
],
], JSON_THROW_ON_ERROR)
]
]);
'email_settings' => [
'vm_template_id' => 2,
'renewal_template_id' => 6,
'news_template_id' => null,
'invoice_template_id' => null,
],
];
foreach ($settings as $key => $value) {
SettingModel::updateOrCreate(
['key' => $key],
['value' => json_encode($value, JSON_THROW_ON_ERROR | JSON_UNESCAPED_UNICODE)]
);
}
}
}