refactor: remove the retired user storefront

dev
admin 2 months ago
parent 4f889fb1cc
commit 0347169753

@ -12,13 +12,13 @@
- 取消代理流量/账户/等级重置、试用和自动清理任务;不再按账户/等级到期自动禁用或清除用户。验证码、会话、支付订单和优惠券的安全/支付有效期仍保留。
- 邮箱账户注册/登录、验证码、TOTP、可信设备、会话撤销、密码找回/修改、人工账户管理、公告、工单、问卷、邀请和充值/财务基础功能保留。手动邀请码轮换不是退役的代理重置任务。
- 账户表删去代理字段及账户/等级到期列,不提供旧测试数据迁移或代理占位字段。新密码使用 `password_hash`/`password_verify`,bcrypt cost 12、随机盐;新密码需 12–72 字节并包含大小写、数字、符号。旧 MD5/SHA 账户哈希不兼容。
- 商城和管理员商品管理保留,规格改为 CPU 核数、内存 MiB、带宽 Mbps、硬盘 GiB。旧代理套餐开通、流量/等级变更、重置/续费逻辑删除。Python 引擎未接入前,购买接口返回 HTTP 409,不扣款、不创建订单。
- 本轮当时保留的用户旧商城及公开优惠码试算接口已在后续清理中移除;管理员基础套餐、销售方案与优惠券管理继续保留。旧代理套餐开通、流量/等级变更、重置/续费逻辑已经删除;保留优惠券管理不代表优惠券已接入新的云账单或订单流程。
- Telegram 只提供管理员私聊绑定和管理员工单通知。没有普通用户绑定、群组功能、TG 登录、签到、AI、订阅或机器人回复用户工单的能力;用户工单在网页处理。
## 配置、SQL 与备份
- 原实际 `.config.php` 未复制,因此修改的是 `web/config/.config.php.example`。
- 邮件、数据库和超级管理员配置区块保留;邮件模板未修改。数据库区块内原有 Redis 在线库键也按“数据库配置不动”的要求保留,但没有在线设备实现再使用它们。
- 邮件、数据库和超级管理员配置区块保留;邮件模板已在后续云账单与实例通知工作中改造,不属于本次旧业务裁剪的原始结果。数据库区块内原有 Redis 在线库键也按“数据库配置不动”的要求保留,但没有在线设备实现再使用它们。
- 删除注册旧配置区块、旧业务重置/自动清理、多用户混淆、签到、文档、订阅/TG URL 等配置;保留登录 IP 绑定和剩余流量提醒配置。
- 剩余流量提醒阈值规则保留为 `TrafficNotificationThreshold`;尚未接入 VM 流量配额,因此不会读取已删除的代理用量字段或假装已经发出 VM 提醒。
- `ss.sql` 为全新 PHP 账户/销售基础结构,`user_log.sql` 仅保留邮件、设置和站点统计/安全五张表。它们不包含 Python 虚拟化引擎表;不要对生产数据库直接执行。

@ -37,11 +37,6 @@ final class CloudSetup
'ALTER TABLE cloud_instances MODIFY order_id BIGINT UNSIGNED NULL'
);
}
if (!$connection->getSchemaBuilder()->hasColumn('shop', 'host_id')) {
$connection->getSchemaBuilder()->table('shop', static function ($table) {
$table->unsignedBigInteger('host_id')->nullable();
});
}
$shopSchema = $connection->getSchemaBuilder();
if (!$shopSchema->hasColumn('shop', 'validity_days')) {
$shopSchema->table('shop', static function ($table) {

@ -257,11 +257,6 @@ final class CloudPageController
return $this->renderVmPage($response, $args, 'rescue', '紧急救援');
}
public function legacyShop($request, $response, $args)
{
return $response->withHeader('Location', '/user/cloud/deploy')->withStatus(302);
}
private function renderVmPage($response, $args, $page, $title)
{
$vmId = $this->vmId($args);

@ -4,8 +4,6 @@ namespace App\Controllers;
use App\Services\Auth;
use App\Models\InviteCode;
use App\Models\Shop;
use App\Models\Coupon;
use App\Models\CloudInvoice;
use App\Models\Ticket;
use App\Models\TicketAttachment;
@ -41,7 +39,7 @@ use App\Services\TicketReplyService;
use App\Services\UserDrawerService;
/**
* Account, storefront and ticket pages.
* Account and ticket pages.
*/
class UserController extends BaseController
{
@ -622,66 +620,6 @@ class UserController extends BaseController
return $this->echoJson($response, ['ret' => 1, 'msg' => '密码修改成功,请重新登录']);
}
public function shop($request, $response, $args)
{
$shops = Shop::where('status', 1)->where('stock', '!=', 0)->orderBy('sort', 'desc')->get();
return $this->view()->assign('shops', $shops)
->assign('balance_purchase_restricted', UserFeatureRestrictionService::isBalancePurchaseRestricted($this->user))
->assign('provisioning_available', false)
->assign('cdn', $this->cdn)->assign('backup_cdn', $this->backup_cdn)->display('user/shop.tpl');
}
public function CouponCheck($request, $response, $args)
{
$coupon = $request->getParam('coupon');
$shop = $request->getParam('shop');
$shop = Shop::where("id", $shop)->where("status", 1)->first();
if ($shop == null) {
$res['ret'] = 0;
$res['msg'] = "非法请求";
return $response->getBody()->write(json_encode($res));
}
if ($coupon == "") {
$res['ret'] = 1;
$res['name'] = $shop->name;
$res['credit'] = "0 %";
$res['total'] = '$' . $shop->price;
return $response->getBody()->write(json_encode($res));
}
$coupon = Coupon::where("code", $coupon)->first();
if ($coupon == null) {
$res['ret'] = 0;
$res['msg'] = "优惠码无效";
return $response->getBody()->write(json_encode($res));
}
if ((int) $coupon->expire < time()) {
$res['ret'] = 0;
$res['msg'] = "此优惠码已过期";
return $response->getBody()->write(json_encode($res));
}
if ($coupon->order($shop->id) == false) {
$res['ret'] = 0;
$res['msg'] = "此优惠码不可用于此商品";
return $response->getBody()->write(json_encode($res));
}
$credit = max(0, min(100, (float) $coupon->credit));
$res['ret'] = 1;
$res['name'] = $shop->name;
$res['credit'] = $credit . " %";
$res['total'] = '$' . round($shop->price * ((100 - $credit) / 100), 2);
return $response->getBody()->write(json_encode($res));
}
public function ticket($request, $response, $args)
{
if ($this->ticketAccessRestricted()) {

@ -101,8 +101,6 @@ $app->group('/user', function () {
$this->get('/cloud/invoices', 'App\Controllers\CloudPageController:invoices');
$this->get('/cloud/invoices/{id:[0-9]+}', 'App\Controllers\CloudPageController:invoiceDetail');
$this->get('/invite', 'App\Controllers\UserController:invite');
$this->get('/shop', 'App\Controllers\CloudPageController:legacyShop');
$this->post('/coupon_check', 'App\Controllers\UserController:CouponCheck');
$this->get('/ticket', 'App\Controllers\UserController:ticket');
$this->get('/ticket/create', 'App\Controllers\UserController:ticket_create');
$this->post('/ticket', 'App\Controllers\UserController:ticket_add');

@ -308,7 +308,7 @@ body.vu-body .vu-text-link {
}
body.vu-body .vu-text-link:hover { text-decoration: underline; text-underline-offset: 3px; }
body.vu-body :where(.vu-content-grid, .vu-shop-grid) {
body.vu-body :where(.vu-content-grid) {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
gap: 20px;
@ -553,7 +553,7 @@ body.vu-body .vu-empty-state span { max-width: 430px; line-height: 1.65; }
body.vu-body .vu-empty-state .vu-btn { margin-top: 8px; }
body.vu-body :where(.vu-status, .vu-pill, .vu-badge, .vu-table-pill,
.vu-plan-badge, .vu-support-status) {
.vu-support-status) {
width: fit-content;
display: inline-flex;
align-items: center;
@ -844,35 +844,6 @@ body.vu-body .vu-profile-note {
}
body.vu-body .vu-profile-note.is-warning { color: var(--vu-warning); background: var(--vu-warning-soft); }
body.vu-body .vu-shop-card { display: flex; flex-direction: column; gap: 20px; }
body.vu-body .vu-shop-card-head {
display: flex;
align-items: flex-start;
justify-content: space-between;
gap: 18px;
}
body.vu-body .vu-shop-card h3 { margin: 12px 0 0; font-size: 20px; }
body.vu-body .vu-shop-price strong {
color: var(--vu-brand-strong);
font-size: 22px;
white-space: nowrap;
}
body.vu-body .vu-shop-features {
display: grid;
grid-template-columns: repeat(2, minmax(0, 1fr));
gap: 10px;
}
body.vu-body .vu-shop-features > div {
display: grid;
gap: 5px;
padding: 12px;
background: var(--vu-panel-soft);
border-radius: 9px;
}
body.vu-body .vu-shop-features span { color: var(--vu-muted); font-size: 11px; }
body.vu-body .vu-shop-features strong { font-size: 13px; }
body.vu-body .vu-shop-card > .vu-btn { width: 100%; margin-top: auto; }
body.vu-body .vu-pay-balance,
body.vu-body .vu-invite-balance {
display: flex;
@ -1353,7 +1324,7 @@ body.venix-auth .auth-modal-actions {
.vu-profile-hero-main, .vu-support-hero-main,
.vu-edit-summary, .vu-support-summary, .vu-pay-balance,
.vu-profile-account, .vu-invite-balance) { padding: 21px; border-radius: 12px; }
body.vu-body :where(.vu-form-grid, .vu-shop-features) { grid-template-columns: 1fr; }
body.vu-body :where(.vu-form-grid) { grid-template-columns: 1fr; }
body.vu-body .vu-ga-setup { grid-template-columns: 1fr; }
body.vu-body .vu-support-ticket { align-items: flex-start; flex-direction: column; }
body.vu-body .vu-support-ticket-side { width: 100%; justify-content: space-between; }

@ -1 +0,0 @@
/* Cloud storefront is display-only until the virtualization service is connected. */

@ -1,9 +1,7 @@
{include file='user/layout_assets.tpl'}
{assign var=vu_has_shop_page value=$vu_shop_page|default:0}
{assign var=vu_has_ticket_page value=$vu_ticket_page|default:0}
<script>window.VU_HOME = { jumpDelay: {$config['jump_delay']|default:1000}, pageTitle: '{$config["appName"]|escape:"javascript"}' };</script>
{if $vu_active_key|default:'' == 'edit' || $vu_qrcode|default:false}<script src="{$cdn}/theme/venix/js/qrcode.min.js?v={$vu_asset_version}"></script>{/if}
<script src="/theme/venix/js/user-home.js?v={$vu_asset_version}"></script>
{if $vu_has_shop_page}<script src="{$cdn}/theme/venix/js/shop-page.js?v={$vu_asset_version}"></script>{/if}
{if $vu_has_ticket_page}<script src="{$cdn}/theme/venix/js/ticket-page.js?v={$vu_asset_version}"></script>{/if}

@ -1,30 +0,0 @@
{include file='user/layout_header.tpl' vu_title='云服务器套餐' vu_active='shop'}
<header class="vu-topbar">
<div><p class="vu-kicker">Cloud Plans</p><h1>云服务器套餐</h1></div>
</header>
<div class="vu-content-stack">
<section class="vu-card"><h2>套餐展示</h2><p>虚拟化服务尚未接入,当前仅展示管理员配置的套餐,不能购买或开通。</p></section>
<section class="vu-shop-grid">
{foreach $shops as $shop}
<article class="vu-card vu-shop-card">
<div class="vu-shop-card-head">
<div><span class="vu-plan-badge">云服务器</span><h3>{$shop->name|escape:"html"}</h3></div>
<div class="vu-shop-price"><strong>$ {$shop->price|escape:"html"}</strong></div>
</div>
<div class="vu-shop-features">
<div><span>CPU</span><strong>{$shop->cpu_cores|escape:"html"} 核</strong></div>
<div><span>内存</span><strong>{$shop->memory_mib|escape:"html"} MiB</strong></div>
<div><span>带宽</span><strong>{$shop->bandwidth_mbps|escape:"html"} Mbps</strong></div>
<div><span>硬盘</span><strong>{$shop->disk_gib|escape:"html"} GiB</strong></div>
</div>
<button class="vu-btn" type="button" disabled>暂不可购买</button>
</article>
{foreachelse}
<div class="vu-card"><h2>暂无上架套餐</h2><p>请稍后再来查看。</p></div>
{/foreach}
</section>
</div>
{include file='user/layout_footer.tpl'}
{include file='user/layout_toast.tpl'}
{include file='user/layout_scripts.tpl'}
</body></html>

@ -218,9 +218,7 @@ CREATE TABLE `paylist` (
CREATE TABLE `shop` (
`id` bigint(20) NOT NULL,
`host_id` bigint(20) DEFAULT NULL,
`name` varchar(128) NOT NULL,
`price` decimal(12,2) NOT NULL DEFAULT 0.00,
`cpu_cores` int(11) NOT NULL,
`memory_mib` int(11) NOT NULL,
`bandwidth_mbps` int(11) NOT NULL,
@ -228,7 +226,6 @@ CREATE TABLE `shop` (
`validity_days` int(10) unsigned NOT NULL DEFAULT 30,
`traffic_quota_bytes` bigint(20) unsigned NOT NULL DEFAULT 0,
`status` tinyint(1) NOT NULL DEFAULT 1,
`stock` int(11) NOT NULL DEFAULT -1,
`sort` int(11) NOT NULL DEFAULT 0,
`created_at` bigint(20) unsigned NOT NULL DEFAULT 0,
`updated_at` bigint(20) unsigned NOT NULL DEFAULT 0

@ -25,7 +25,7 @@ $assert(!is_file($root . '/public/theme/venix/css/user-home.css'),
$assert(!is_file($views . '/layout_modal.tpl') && is_file($views . '/layout_toast.tpl'),
'The retired modal partial must be replaced by the Toast-only partial.');
foreach (['edit.tpl', 'paytaro.tpl', 'ticket_view.tpl', 'ticket_create.tpl', 'invite.tpl', 'shop.tpl'] as $template) {
foreach (['edit.tpl', 'paytaro.tpl', 'ticket_view.tpl', 'ticket_create.tpl', 'invite.tpl'] as $template) {
$source = $read($views . '/' . $template);
$assert(str_contains($source, "file='user/layout_toast.tpl'")
&& !str_contains($source, 'layout_modal.tpl'),

@ -31,16 +31,53 @@ foreach (['db_password', 'smtp_passsword', 'super_admin', 'auto_backup_passwd',
$assert(str_contains($config, "['" . $key . "']"), 'Preserved configuration missing: ' . $key);
}
$userController = file_get_contents($root . '/app/Controllers/UserController.php');
$cloudPageController = file_get_contents($root . '/app/Controllers/CloudPageController.php');
$assert(!str_contains($routes, "post('/buy'")
&& !str_contains($userController, 'public function buy('),
'Retired legacy purchase endpoint remains');
$assert(!str_contains($routes,
"get('/shop', 'App\\Controllers\\CloudPageController:legacyShop')")
&& !str_contains($routes,
"post('/coupon_check', 'App\\Controllers\\UserController:CouponCheck')")
&& !str_contains($cloudPageController, 'function legacyShop(')
&& !str_contains($userController, 'function shop(')
&& !str_contains($userController, 'function CouponCheck(')
&& !is_file($root . '/resources/views/venix/user/shop.tpl')
&& !is_file($root . '/public/theme/venix/js/shop-page.js'),
'Retired user storefront or coupon-check endpoint remains');
$assert(str_contains($routes,
"get('/coupon', 'App\\Controllers\\AdminController:coupon')")
&& str_contains($routes,
"post('/coupon', 'App\\Controllers\\AdminController:addCoupon')")
&& is_file($root . '/app/Models/Coupon.php')
&& is_file($root . '/resources/views/venix/admin/coupon.tpl'),
'Administrator coupon management was removed with the user storefront');
$layoutScripts = file_get_contents($root . '/resources/views/venix/user/layout_scripts.tpl');
$accountStyles = file_get_contents($root . '/public/cloud/account.css');
$assert(!str_contains($layoutScripts, 'vu_shop_page')
&& !str_contains($layoutScripts, 'shop-page.js')
&& !str_contains($accountStyles, '.vu-shop-')
&& !str_contains($accountStyles, '.vu-plan-badge'),
'Retired user storefront assets are still referenced');
$assert(str_contains($routes, '/password/reset') === false && str_contains($routes, "group('/password'"), 'Password recovery routes missing');
$schema = file_get_contents($root . '/sql/ss.sql');
$shopStart = strpos($schema, 'CREATE TABLE `shop` (');
$shopEnd = strpos($schema, ') ENGINE=InnoDB', $shopStart);
$shopSchema = $shopStart === false || $shopEnd === false ? ''
: substr($schema, $shopStart, $shopEnd - $shopStart);
$assert($shopSchema !== ''
&& !str_contains($shopSchema, '`host_id`')
&& !str_contains($shopSchema, '`price`')
&& !str_contains($shopSchema, '`stock`'),
'Fresh base-plan schema retains legacy storefront fields');
$assert(!str_contains($schema, 'CREATE TABLE `bought`')
&& !str_contains($schema, 'ALTER TABLE `bought`'),
'Retired bought table remains in the base schema');
$cloudSchema = file_get_contents($root . '/sql/cloud.sql');
$cloudSetup = file_get_contents($root . '/app/Command/CloudSetup.php');
$assert(!str_contains($cloudSetup, "hasColumn('shop', 'host_id')")
&& !str_contains($cloudSetup, "unsignedBigInteger('host_id')"),
'cloudInit still recreates the retired base-plan host field');
$adminShopController = file_get_contents($root . '/app/Controllers/Admin/ShopController.php');
$assert(!str_contains($cloudSchema, 'DROP TABLE IF EXISTS bought')
&& str_contains($cloudSetup, 'self::retireLegacyBought($connection)')

@ -80,7 +80,7 @@ SiteVisitEvent::insert(array_merge($base, [
'event_type' => 'visit',
'visitor_id' => str_repeat('a', 32),
'user_id' => 42,
'landing_path' => '/user/shop',
'landing_path' => '/user/cloud/instances',
'referrer_host' => 'panel.example',
]));
SiteVisitEvent::insert(array_merge($base, [
@ -129,7 +129,7 @@ $homeRequest = Request::createFromEnvironment(Environment::mock([
]));
$userRequest = Request::createFromEnvironment(Environment::mock([
'REQUEST_METHOD' => 'GET',
'REQUEST_URI' => '/user/shop',
'REQUEST_URI' => '/user/cloud/instances',
'HTTP_HOST' => 'panel.example',
'HTTP_ACCEPT' => 'text/html,application/xhtml+xml',
'HTTP_SEC_FETCH_MODE' => 'navigate',

Loading…
Cancel
Save