前端极简黑白重设计,并纳入客户端注册、站点设置与后台相关改动

- storefront 全站改为极简黑白配色:直角、细线分隔、卡片 hover 浅底、深色模式(跟随系统+手动切换)
- 抽出 storefront/partials/card 复用卡片
- 一并提交此前暂存的客户端注册 API、站点设置、后台页面与测试

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
浪子
2026-09-22 08:35:49 +08:00
parent 62cffc6f5f
commit 04a2034975
41 changed files with 3447 additions and 658 deletions
+85
View File
@@ -0,0 +1,85 @@
<?php
namespace App\Services;
use App\Models\StoreSetting;
use Illuminate\Support\Facades\Schema;
use RuntimeException;
use Throwable;
class StoreSettings
{
private ?array $resolved = null;
public function all(): array
{
if ($this->resolved !== null) {
return $this->resolved;
}
$defaults = $this->defaults();
if (!$this->tableExists()) {
return $this->resolved = $defaults;
}
$stored = StoreSetting::query()
->pluck('value', 'key')
->map(fn ($value) => (string) $value)
->all();
return $this->resolved = array_replace($defaults, $stored);
}
public function get(string $key, mixed $default = null): mixed
{
$settings = $this->all();
return $settings[$key] ?? $default;
}
public function defaults(): array
{
return (array) config('store.settings_defaults', []);
}
public function keys(): array
{
return array_keys($this->defaults());
}
public function setMany(array $values): void
{
if (!$this->tableExists()) {
throw new RuntimeException('store_settings table is missing. Please run php artisan migrate.');
}
$now = now();
$rows = collect($values)
->only($this->keys())
->map(fn ($value, $key) => [
'key' => $key,
'value' => (string) $value,
'created_at' => $now,
'updated_at' => $now,
])
->values()
->all();
if ($rows === []) {
return;
}
StoreSetting::query()->upsert($rows, ['key'], ['value', 'updated_at']);
$this->resolved = null;
}
private function tableExists(): bool
{
try {
return Schema::hasTable('store_settings');
} catch (Throwable) {
return false;
}
}
}