feat: 新增大量服务类图标及相关接口配置
- 新增20+家电维修类图标(电视、空调、冰箱等) - 新增短信发送、微信手机号登录接口 - 新增服务规格查询接口 - 更新后台配置与菜单结构 - 移除支付插件相关配置
这个提交包含在:
106
scripts/reorganize_menus.php
普通文件
106
scripts/reorganize_menus.php
普通文件
@@ -0,0 +1,106 @@
|
||||
<?php
|
||||
$pdo = new PDO("mysql:host=127.0.0.1;port=3306;dbname=yjyf", "yjyf", "4bRz2NYz6pDhsCk4");
|
||||
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||
|
||||
// 1. 定义 4 个新父级分类目录
|
||||
$parentCategories = [
|
||||
[
|
||||
'name' => 'order_manage',
|
||||
'title' => '服务与调度',
|
||||
'icon' => 'fa fa-tasks',
|
||||
'weigh' => 190,
|
||||
],
|
||||
[
|
||||
'name' => 'capacity_manage',
|
||||
'title' => '运力与商户',
|
||||
'icon' => 'fa fa-id-badge',
|
||||
'weigh' => 170,
|
||||
],
|
||||
[
|
||||
'name' => 'finance_manage',
|
||||
'title' => '财务与资金',
|
||||
'icon' => 'fa fa-money',
|
||||
'weigh' => 150,
|
||||
],
|
||||
[
|
||||
'name' => 'operation_manage',
|
||||
'title' => '运营与营销',
|
||||
'icon' => 'fa fa-bullhorn',
|
||||
'weigh' => 130,
|
||||
],
|
||||
];
|
||||
|
||||
$catIds = [];
|
||||
$now = time();
|
||||
|
||||
foreach ($parentCategories as $cat) {
|
||||
// 检查是否已存在
|
||||
$stmt = $pdo->prepare("SELECT id FROM fa_auth_rule WHERE name = ?");
|
||||
$stmt->execute([$cat['name']]);
|
||||
$id = $stmt->fetchColumn();
|
||||
if (!$id) {
|
||||
$insertStmt = $pdo->prepare("INSERT INTO fa_auth_rule (type, pid, name, title, icon, `condition`, remark, ismenu, createtime, updatetime, weigh, status) VALUES ('file', 0, ?, ?, ?, '', '', 1, ?, ?, ?, 'normal')");
|
||||
$insertStmt->execute([$cat['name'], $cat['title'], $cat['icon'], $now, $now, $cat['weigh']]);
|
||||
$id = $pdo->lastInsertId();
|
||||
echo "Created parent menu [{$cat['title']}] with ID: $id\n";
|
||||
} else {
|
||||
$updateStmt = $pdo->prepare("UPDATE fa_auth_rule SET title = ?, icon = ?, weigh = ?, ismenu = 1, status = 'normal' WHERE id = ?");
|
||||
$updateStmt->execute([$cat['title'], $cat['icon'], $cat['weigh'], $id]);
|
||||
echo "Updated parent menu [{$cat['title']}] with ID: $id\n";
|
||||
}
|
||||
$catIds[$cat['name']] = $id;
|
||||
}
|
||||
|
||||
// 2. 将子菜单调整到对应父分类下,并分配专属高辨识度图标和权重
|
||||
$menuUpdates = [
|
||||
// 业务与调度 (order_manage)
|
||||
119 => ['pid' => $catIds['order_manage'], 'title' => '订单管理', 'icon' => 'fa fa-shopping-cart', 'weigh' => 195],
|
||||
155 => ['pid' => $catIds['order_manage'], 'title' => '服务项目', 'icon' => 'fa fa-th-list', 'weigh' => 194],
|
||||
185 => ['pid' => $catIds['order_manage'], 'title' => '服务类目', 'icon' => 'fa fa-cubes', 'weigh' => 193],
|
||||
143 => ['pid' => $catIds['order_manage'], 'title' => '评价管理', 'icon' => 'fa fa-star', 'weigh' => 192],
|
||||
161 => ['pid' => $catIds['order_manage'], 'title' => '申诉工单', 'icon' => 'fa fa-shield', 'weigh' => 191],
|
||||
|
||||
// 运力与商户 (capacity_manage)
|
||||
125 => ['pid' => $catIds['capacity_manage'], 'title' => '师傅档案', 'icon' => 'fa fa-wrench', 'weigh' => 175],
|
||||
131 => ['pid' => $catIds['capacity_manage'], 'title' => '商家档案', 'icon' => 'fa fa-building', 'weigh' => 174],
|
||||
|
||||
// 财务与资金 (finance_manage)
|
||||
179 => ['pid' => $catIds['finance_manage'], 'title' => '结算账单', 'icon' => 'fa fa-calculator', 'weigh' => 155],
|
||||
173 => ['pid' => $catIds['finance_manage'], 'title' => '提现申请', 'icon' => 'fa fa-credit-card', 'weigh' => 154],
|
||||
167 => ['pid' => $catIds['finance_manage'], 'title' => '开票申请', 'icon' => 'fa fa-file-text-o', 'weigh' => 153],
|
||||
|
||||
// 运营与营销 (operation_manage)
|
||||
137 => ['pid' => $catIds['operation_manage'], 'title' => '优惠券管理', 'icon' => 'fa fa-ticket', 'weigh' => 135],
|
||||
113 => ['pid' => $catIds['operation_manage'], 'title' => '轮播管理', 'icon' => 'fa fa-picture-o', 'weigh' => 134],
|
||||
149 => ['pid' => $catIds['operation_manage'], 'title' => '消息通知', 'icon' => 'fa fa-bell', 'weigh' => 133],
|
||||
|
||||
// 现有一级菜单权重与图标强化
|
||||
1 => ['pid' => 0, 'title' => '控制台', 'icon' => 'fa fa-dashboard', 'weigh' => 200],
|
||||
66 => ['pid' => 0, 'title' => '会员管理', 'icon' => 'fa fa-user-circle', 'weigh' => 110],
|
||||
85 => ['pid' => 0, 'title' => '微信管理', 'icon' => 'fa fa-wechat', 'weigh' => 90],
|
||||
2 => ['pid' => 0, 'title' => '常规管理', 'icon' => 'fa fa-cogs', 'weigh' => 70],
|
||||
5 => ['pid' => 0, 'title' => '权限管理', 'icon' => 'fa fa-group', 'weigh' => 50],
|
||||
];
|
||||
|
||||
foreach ($menuUpdates as $id => $u) {
|
||||
$stmt = $pdo->prepare("UPDATE fa_auth_rule SET pid = ?, title = ?, icon = ?, weigh = ? WHERE id = ?");
|
||||
$stmt->execute([$u['pid'], $u['title'], $u['icon'], $u['weigh'], $id]);
|
||||
echo "Updated menu [$id] -> {$u['title']}\n";
|
||||
}
|
||||
|
||||
// 3. 在 常规管理 (general, id: 2) 下添加原控制台的迁移目标:系统监控 (general/system)
|
||||
$stmt = $pdo->prepare("SELECT id FROM fa_auth_rule WHERE name = 'general/system'");
|
||||
$stmt->execute();
|
||||
$systemId = $stmt->fetchColumn();
|
||||
if (!$systemId) {
|
||||
$stmt = $pdo->prepare("INSERT INTO fa_auth_rule (type, pid, name, title, icon, `condition`, remark, ismenu, createtime, updatetime, weigh, status) VALUES ('file', 2, 'general/system', '系统监控', 'fa fa-server', '', '系统运维与服务器状态监控', 1, ?, ?, 65, 'normal')");
|
||||
$stmt->execute([$now, $now]);
|
||||
$systemId = $pdo->lastInsertId();
|
||||
echo "Created [系统监控] menu under general with ID: $systemId\n";
|
||||
} else {
|
||||
$stmt = $pdo->prepare("UPDATE fa_auth_rule SET pid = 2, title = '系统监控', icon = 'fa fa-server', weigh = 65, ismenu = 1, status = 'normal' WHERE id = ?");
|
||||
$stmt->execute([$systemId]);
|
||||
echo "Updated [系统监控] menu with ID: $systemId\n";
|
||||
}
|
||||
|
||||
echo "\nMenu reorganization completed successfully!\n";
|
||||
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
$pdo = new PDO("mysql:host=127.0.0.1;port=3306;dbname=yjyf;charset=utf8mb4", "yjyf", "4bRz2NYz6pDhsCk4");
|
||||
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||
|
||||
$sqlFile = 'D:/Projects/phpstudy_pro/WWW/yjyf/db/schema_phase11_menu_reorganize_qibing.sql';
|
||||
if (!file_exists($sqlFile)) {
|
||||
die("Error: SQL file not found: $sqlFile\n");
|
||||
}
|
||||
|
||||
$sqlContent = file_get_contents($sqlFile);
|
||||
$statements = array_filter(array_map('trim', explode(';', $sqlContent)));
|
||||
|
||||
echo "========================================================\n";
|
||||
echo " 优匠优服 · 执行 Phase 11 菜单与大盘数据库配置脚本\n";
|
||||
echo " 文件路径: $sqlFile\n";
|
||||
echo "========================================================\n\n";
|
||||
|
||||
$step = 1;
|
||||
foreach ($statements as $st) {
|
||||
if (empty($st) || strpos($st, '--') === 0) continue;
|
||||
try {
|
||||
$affected = $pdo->exec($st);
|
||||
$preview = str_replace(["\r", "\n", " "], [" ", " ", " "], substr($st, 0, 75));
|
||||
echo "[步骤 {$step}] 执行成功 (受影响行数: $affected) -> {$preview}...\n";
|
||||
$step++;
|
||||
} catch (Exception $e) {
|
||||
echo "[步骤 {$step}] 执行失败: " . $e->getMessage() . "\n";
|
||||
die("终止执行。\n");
|
||||
}
|
||||
}
|
||||
|
||||
echo "\n========================================================\n";
|
||||
echo " SQL 执行完毕!当前数据库菜单层级验证:\n";
|
||||
echo "========================================================\n";
|
||||
|
||||
$rules = $pdo->query("SELECT id, pid, name, title, icon, weigh, ismenu FROM fa_auth_rule WHERE ismenu = 1 ORDER BY weigh DESC, id ASC")->fetchAll(PDO::FETCH_ASSOC);
|
||||
|
||||
function displayTree($rules, $pid = 0, $depth = 0) {
|
||||
foreach ($rules as $r) {
|
||||
if ($r['pid'] == $pid) {
|
||||
echo str_repeat(" ", $depth) . "├── [ID:{$r['id']}] {$r['title']} (name: {$r['name']}, icon: {$r['icon']}, weigh: {$r['weigh']})\n";
|
||||
displayTree($rules, $r['id'], $depth + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
displayTree($rules);
|
||||
|
||||
echo "\n========================================================\n";
|
||||
echo " 系统配置项验证 (fa_config.fixedpage):\n";
|
||||
echo "========================================================\n";
|
||||
$fixedpage = $pdo->query("SELECT name, title, value FROM fa_config WHERE name = 'fixedpage'")->fetch(PDO::FETCH_ASSOC);
|
||||
print_r($fixedpage);
|
||||
|
||||
echo "\n全部 SQL 执行并校验成功!\n";
|
||||
在新工单中引用
屏蔽一个用户