接单员与财务管理
This commit is contained in:
@@ -8,14 +8,15 @@ return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
// 任务分类
|
||||
// 任务分类(跑腿/代取/租借等,后台可管理)
|
||||
if (! Schema::hasTable('task_categories')) {
|
||||
Schema::create('task_categories', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('name', 50)->comment('分类名称');
|
||||
$table->string('slug', 50)->comment('标识');
|
||||
$table->string('slug', 50)->comment('标识:errand=跑腿,pickup=代取,rental=租借');
|
||||
$table->string('description', 255)->default('')->comment('描述');
|
||||
$table->string('icon', 255)->default('')->comment('图标');
|
||||
$table->json('form_schema')->nullable()->comment('分类特有字段模板,前端据此动态渲染表单');
|
||||
$table->integer('sort')->default(0)->comment('排序');
|
||||
$table->tinyInteger('status')->default(1)->comment('状态:0=禁用,1=正常');
|
||||
$table->timestamps();
|
||||
@@ -24,26 +25,37 @@ return new class extends Migration
|
||||
});
|
||||
}
|
||||
|
||||
// 任务订单(跑腿/代取/租借)
|
||||
// 任务订单(跑腿/代取/租借统一,分类特有字段存 extra)
|
||||
if (! Schema::hasTable('task_orders')) {
|
||||
Schema::create('task_orders', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('order_no', 32)->comment('订单编号');
|
||||
$table->unsignedInteger('user_id')->comment('发布用户ID');
|
||||
$table->unsignedInteger('runner_id')->nullable()->comment('接单用户ID');
|
||||
$table->unsignedBigInteger('category_id')->comment('分类ID');
|
||||
$table->unsignedBigInteger('category_id')->comment('任务分类ID');
|
||||
$table->string('title', 100)->comment('任务标题');
|
||||
$table->text('description')->comment('任务描述');
|
||||
$table->text('description')->nullable()->comment('任务描述');
|
||||
$table->json('images')->nullable()->comment('图片列表');
|
||||
$table->decimal('price', 10, 2)->default(0)->comment('任务价格/报酬');
|
||||
$table->json('extra')->nullable()->comment('分类特有字段:跑腿{取件地址,送达地址},代取{取件地点,取件码},租借{押金,租借天数}');
|
||||
$table->decimal('price', 10, 2)->default(0)->comment('任务报酬');
|
||||
$table->string('address', 255)->default('')->comment('任务地址');
|
||||
$table->string('contact_name', 30)->default('')->comment('联系人');
|
||||
$table->string('contact_mobile', 20)->default('')->comment('联系电话');
|
||||
$table->timestamp('deadline')->nullable()->comment('截止时间');
|
||||
|
||||
// 支付信息(创建订单时支付)
|
||||
$table->tinyInteger('pay_type')->default(0)->comment('支付方式:0=余额,1=微信支付');
|
||||
$table->tinyInteger('pay_status')->default(0)->comment('支付状态:0=待支付,1=已支付,2=退款中,3=已退款');
|
||||
$table->timestamp('paid_at')->nullable()->comment('支付时间');
|
||||
|
||||
// 订单状态流转
|
||||
$table->tinyInteger('status')->default(0)->comment('状态:0=待接单,1=已接单,2=进行中,3=已完成,4=已取消');
|
||||
$table->string('cancel_reason', 255)->default('')->comment('取消原因');
|
||||
$table->string('remark', 500)->default('')->comment('订单备注');
|
||||
$table->timestamp('accepted_at')->nullable()->comment('接单时间');
|
||||
$table->timestamp('completed_at')->nullable()->comment('完成时间');
|
||||
$table->timestamp('cancelled_at')->nullable()->comment('取消时间');
|
||||
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
$table->unique('order_no');
|
||||
@@ -51,29 +63,56 @@ return new class extends Migration
|
||||
$table->index('runner_id');
|
||||
$table->index('category_id');
|
||||
$table->index('status');
|
||||
$table->index('pay_status');
|
||||
$table->comment('校园任务订单');
|
||||
});
|
||||
}
|
||||
|
||||
// 任务竞价/接单报价
|
||||
// 接单记录/竞价(用户对任务报价或申请接单)
|
||||
if (! Schema::hasTable('task_bids')) {
|
||||
Schema::create('task_bids', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->unsignedBigInteger('task_id')->comment('任务ID');
|
||||
$table->unsignedBigInteger('task_id')->comment('任务订单ID');
|
||||
$table->unsignedInteger('user_id')->comment('接单人ID');
|
||||
$table->decimal('price', 10, 2)->default(0)->comment('报价');
|
||||
$table->string('message', 500)->default('')->comment('留言');
|
||||
$table->decimal('price', 10, 2)->default(0)->comment('报价(等于任务价即为直接接单)');
|
||||
$table->string('message', 500)->default('')->comment('申请留言/自我介绍');
|
||||
$table->tinyInteger('status')->default(0)->comment('状态:0=待确认,1=已接受,2=已拒绝');
|
||||
$table->timestamp('accepted_at')->nullable()->comment('接受时间');
|
||||
$table->timestamps();
|
||||
$table->index('task_id');
|
||||
$table->index('user_id');
|
||||
$table->comment('任务竞价');
|
||||
$table->unique(['task_id', 'user_id'], 'uk_task_user');
|
||||
$table->comment('任务接单/竞价记录');
|
||||
});
|
||||
}
|
||||
|
||||
// 任务支付日志(支付成功后写入,关联三方支付流水)
|
||||
if (! Schema::hasTable('task_payments')) {
|
||||
Schema::create('task_payments', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('payment_no', 32)->comment('支付日志编号');
|
||||
$table->unsignedBigInteger('order_id')->comment('任务订单ID');
|
||||
$table->unsignedInteger('user_id')->comment('支付用户ID');
|
||||
$table->unsignedBigInteger('payment_transaction_id')->nullable()->comment('三方支付流水ID');
|
||||
$table->decimal('amount', 10, 2)->comment('支付金额');
|
||||
$table->tinyInteger('pay_type')->comment('支付方式:0=余额,1=微信支付');
|
||||
$table->tinyInteger('status')->default(0)->comment('状态:0=待支付,1=已支付,2=已退款');
|
||||
$table->timestamp('paid_at')->nullable()->comment('支付时间');
|
||||
$table->timestamp('refund_at')->nullable()->comment('退款时间');
|
||||
$table->timestamps();
|
||||
$table->unique('payment_no');
|
||||
$table->index('order_id');
|
||||
$table->index('user_id');
|
||||
$table->index('payment_transaction_id');
|
||||
$table->index('status');
|
||||
$table->comment('任务支付日志');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('task_payments');
|
||||
Schema::dropIfExists('task_bids');
|
||||
Schema::dropIfExists('task_orders');
|
||||
Schema::dropIfExists('task_categories');
|
||||
|
||||
@@ -8,14 +8,14 @@ return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
// 兼职申请/报名
|
||||
if (! Schema::hasTable('part_time_applications')) {
|
||||
Schema::create('part_time_applications', function (Blueprint $table) {
|
||||
// 接单员申请
|
||||
if (! Schema::hasTable('runner_applications')) {
|
||||
Schema::create('runner_applications', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->unsignedInteger('user_id')->comment('申请用户ID');
|
||||
$table->string('real_name', 30)->comment('真实姓名');
|
||||
$table->string('mobile', 20)->comment('联系电话');
|
||||
$table->string('resume', 500)->default('')->comment('个人简介/简历');
|
||||
$table->string('resume', 500)->default('')->comment('个人简介/申请理由');
|
||||
$table->string('id_card', 18)->comment('身份证号');
|
||||
$table->string('id_card_front', 255)->default('')->comment('身份证正面照');
|
||||
$table->string('id_card_back', 255)->default('')->comment('身份证背面照');
|
||||
@@ -24,38 +24,41 @@ return new class extends Migration
|
||||
$table->timestamp('reviewed_at')->nullable()->comment('审核时间');
|
||||
$table->timestamps();
|
||||
$table->index('user_id');
|
||||
$table->comment('兼职申请');
|
||||
$table->index('mobile');
|
||||
$table->comment('接单员申请');
|
||||
});
|
||||
}
|
||||
|
||||
// 兼职人员(已认证)
|
||||
if (! Schema::hasTable('part_time_workers')) {
|
||||
Schema::create('part_time_workers', function (Blueprint $table) {
|
||||
// 接单员列表(审核通过后写入)
|
||||
if (! Schema::hasTable('runner_workers')) {
|
||||
Schema::create('runner_workers', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->unsignedInteger('user_id')->comment('用户ID');
|
||||
$table->unsignedInteger('user_id')->unique()->comment('用户ID');
|
||||
$table->string('real_name', 30)->comment('真实姓名');
|
||||
$table->string('mobile', 20)->comment('联系电话');
|
||||
$table->string('id_card', 18)->comment('身份证号');
|
||||
$table->decimal('total_income', 10, 2)->default(0)->comment('累计收入');
|
||||
$table->integer('total_order')->default(0)->comment('累计订单');
|
||||
$table->decimal('credit_score', 10, 2)->default(100)->comment('信誉分');
|
||||
$table->timestamp('verified_at')->nullable()->comment('认证时间');
|
||||
$table->tinyInteger('status')->default(1)->comment('状态:0=禁止接单,1=正常');
|
||||
$table->integer('total_order')->default(0)->comment('累计完成订单');
|
||||
$table->integer('cancel_order')->default(0)->comment('累计取消订单');
|
||||
$table->decimal('credit_score', 10, 2)->default(100)->comment('信誉分(满分100)');
|
||||
$table->timestamp('verified_at')->nullable()->comment('认证通过时间');
|
||||
$table->tinyInteger('status')->default(1)->comment('状态:0=禁止接单,1=正常,2=休息中');
|
||||
$table->timestamps();
|
||||
$table->index('user_id');
|
||||
$table->index('mobile');
|
||||
$table->comment('兼职人员');
|
||||
$table->index('credit_score');
|
||||
$table->comment('接单员');
|
||||
});
|
||||
}
|
||||
|
||||
// 兼职提现
|
||||
if (! Schema::hasTable('part_time_withdrawals')) {
|
||||
Schema::create('part_time_withdrawals', function (Blueprint $table) {
|
||||
// 接单员提现
|
||||
if (! Schema::hasTable('runner_withdrawals')) {
|
||||
Schema::create('runner_withdrawals', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('withdraw_no', 32)->comment('提现编号');
|
||||
$table->unsignedInteger('user_id')->comment('用户ID');
|
||||
$table->unsignedBigInteger('worker_id')->comment('兼职人员ID');
|
||||
$table->unsignedBigInteger('worker_id')->comment('接单员ID');
|
||||
$table->decimal('amount', 10, 2)->comment('提现金额');
|
||||
$table->decimal('fee', 10, 2)->default(0)->comment('手续费');
|
||||
$table->string('channel', 20)->comment('提现渠道:wechat=微信,alipay=支付宝,bank=银行卡');
|
||||
$table->json('account_info')->nullable()->comment('收款账户信息');
|
||||
$table->tinyInteger('status')->default(0)->comment('状态:0=待审核,1=已通过,2=已完成,3=已拒绝');
|
||||
@@ -66,16 +69,127 @@ return new class extends Migration
|
||||
$table->index('user_id');
|
||||
$table->index('worker_id');
|
||||
$table->index('status');
|
||||
$table->comment('兼职提现');
|
||||
$table->comment('接单员提现');
|
||||
});
|
||||
}
|
||||
|
||||
// 信誉分变动记录
|
||||
if (! Schema::hasTable('runner_credit_logs')) {
|
||||
Schema::create('runner_credit_logs', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->unsignedBigInteger('worker_id')->comment('接单员ID');
|
||||
$table->decimal('score', 5, 2)->comment('变动分值(正=加分,负=扣分)');
|
||||
$table->decimal('score_after', 5, 2)->comment('变动后分值');
|
||||
$table->string('type', 30)->comment('变动类型:order_complete=完成订单,order_cancel=取消订单,order_timeout=超时,complaint=被投诉,appeal_success=申诉成功,manual=管理员调整');
|
||||
$table->string('description', 255)->comment('变动说明');
|
||||
$table->string('related_type', 30)->nullable()->comment('关联类型');
|
||||
$table->unsignedBigInteger('related_id')->nullable()->comment('关联ID');
|
||||
$table->timestamps();
|
||||
$table->index('worker_id');
|
||||
$table->index('type');
|
||||
$table->index(['related_type', 'related_id']);
|
||||
$table->comment('接单员信誉分记录');
|
||||
});
|
||||
}
|
||||
|
||||
// 投诉记录
|
||||
if (! Schema::hasTable('runner_complaints')) {
|
||||
Schema::create('runner_complaints', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('complaint_no', 32)->comment('投诉编号');
|
||||
$table->unsignedInteger('user_id')->comment('投诉用户ID');
|
||||
$table->unsignedBigInteger('worker_id')->comment('被投诉接单员ID');
|
||||
$table->unsignedBigInteger('order_id')->nullable()->comment('关联任务订单ID');
|
||||
$table->string('type', 30)->comment('投诉类型:late=迟到/超时,attitude=服务态度,damage=物品损坏,lost=物品丢失,other=其他');
|
||||
$table->text('content')->comment('投诉内容');
|
||||
$table->json('images')->nullable()->comment('凭证图片');
|
||||
$table->tinyInteger('status')->default(0)->comment('状态:0=待处理,1=已处理,2=已驳回');
|
||||
$table->string('result', 255)->default('')->comment('处理结果');
|
||||
$table->string('result_remark', 500)->default('')->comment('处理备注');
|
||||
$table->timestamp('handled_at')->nullable()->comment('处理时间');
|
||||
$table->timestamps();
|
||||
$table->unique('complaint_no');
|
||||
$table->index('user_id');
|
||||
$table->index('worker_id');
|
||||
$table->index('order_id');
|
||||
$table->index('status');
|
||||
$table->comment('接单员投诉记录');
|
||||
});
|
||||
}
|
||||
|
||||
// 投诉申诉记录
|
||||
if (! Schema::hasTable('runner_complaint_appeals')) {
|
||||
Schema::create('runner_complaint_appeals', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->unsignedBigInteger('complaint_id')->comment('投诉ID');
|
||||
$table->unsignedBigInteger('worker_id')->comment('申诉接单员ID');
|
||||
$table->text('content')->comment('申诉内容');
|
||||
$table->json('images')->nullable()->comment('凭证图片');
|
||||
$table->tinyInteger('status')->default(0)->comment('状态:0=待审核,1=已通过,2=已驳回');
|
||||
$table->string('reply', 500)->default('')->comment('审核回复');
|
||||
$table->timestamp('reviewed_at')->nullable()->comment('审核时间');
|
||||
$table->timestamps();
|
||||
$table->index('complaint_id');
|
||||
$table->index('worker_id');
|
||||
$table->comment('接单员投诉申诉');
|
||||
});
|
||||
}
|
||||
|
||||
// 接单员保证金
|
||||
if (! Schema::hasTable('runner_deposits')) {
|
||||
Schema::create('runner_deposits', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('deposit_no', 32)->comment('保证金编号');
|
||||
$table->unsignedBigInteger('worker_id')->comment('接单员ID');
|
||||
$table->unsignedInteger('user_id')->comment('用户ID');
|
||||
$table->decimal('amount', 10, 2)->comment('保证金金额');
|
||||
$table->tinyInteger('status')->default(0)->comment('状态:0=未缴纳,1=已缴纳,2=已退还,3=已扣除');
|
||||
$table->string('deduct_reason', 255)->default('')->comment('扣除原因');
|
||||
$table->timestamp('paid_at')->nullable()->comment('缴纳时间');
|
||||
$table->timestamp('refund_at')->nullable()->comment('退还时间');
|
||||
$table->timestamp('deducted_at')->nullable()->comment('扣除时间');
|
||||
$table->timestamps();
|
||||
$table->unique('deposit_no');
|
||||
$table->index('worker_id');
|
||||
$table->index('user_id');
|
||||
$table->index('status');
|
||||
$table->comment('接单员保证金');
|
||||
});
|
||||
}
|
||||
|
||||
// 保证金支付日志(支付成功后写入,关联三方支付流水)
|
||||
if (! Schema::hasTable('deposit_payments')) {
|
||||
Schema::create('deposit_payments', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('payment_no', 32)->comment('支付日志编号');
|
||||
$table->unsignedBigInteger('deposit_id')->comment('保证金ID');
|
||||
$table->unsignedInteger('user_id')->comment('支付用户ID');
|
||||
$table->unsignedBigInteger('payment_transaction_id')->nullable()->comment('三方支付流水ID');
|
||||
$table->decimal('amount', 10, 2)->comment('支付金额');
|
||||
$table->tinyInteger('pay_type')->comment('支付方式:0=余额,1=微信支付');
|
||||
$table->tinyInteger('status')->default(0)->comment('状态:0=待支付,1=已支付,2=已退款');
|
||||
$table->timestamp('paid_at')->nullable()->comment('支付时间');
|
||||
$table->timestamp('refund_at')->nullable()->comment('退款时间');
|
||||
$table->timestamps();
|
||||
$table->unique('payment_no');
|
||||
$table->index('deposit_id');
|
||||
$table->index('user_id');
|
||||
$table->index('payment_transaction_id');
|
||||
$table->index('status');
|
||||
$table->comment('保证金支付日志');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('part_time_withdrawals');
|
||||
Schema::dropIfExists('part_time_workers');
|
||||
Schema::dropIfExists('part_time_applications');
|
||||
Schema::dropIfExists('part_time_jobs');
|
||||
Schema::dropIfExists('deposit_payments');
|
||||
Schema::dropIfExists('runner_deposits');
|
||||
Schema::dropIfExists('runner_complaint_appeals');
|
||||
Schema::dropIfExists('runner_complaints');
|
||||
Schema::dropIfExists('runner_credit_logs');
|
||||
Schema::dropIfExists('runner_withdrawals');
|
||||
Schema::dropIfExists('runner_workers');
|
||||
Schema::dropIfExists('runner_applications');
|
||||
}
|
||||
};
|
||||
|
||||
@@ -8,37 +8,28 @@ return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
// 钱包
|
||||
if (! Schema::hasTable('wallets')) {
|
||||
Schema::create('wallets', function (Blueprint $table) {
|
||||
// 统一三方支付流水
|
||||
if (! Schema::hasTable('payment_transactions')) {
|
||||
Schema::create('payment_transactions', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('owner_type', 30)->comment('所属类型:user=用户,merchant=商户');
|
||||
$table->unsignedBigInteger('owner_id')->comment('所属ID');
|
||||
$table->decimal('balance', 10, 2)->default(0)->comment('可用余额');
|
||||
$table->decimal('frozen_balance', 10, 2)->default(0)->comment('冻结余额');
|
||||
$table->timestamps();
|
||||
$table->unique(['owner_type', 'owner_id']);
|
||||
$table->comment('钱包');
|
||||
});
|
||||
}
|
||||
|
||||
// 资金流水
|
||||
if (! Schema::hasTable('transactions')) {
|
||||
Schema::create('transactions', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('transaction_no', 32)->comment('流水编号');
|
||||
$table->unsignedBigInteger('wallet_id')->comment('钱包ID');
|
||||
$table->tinyInteger('type')->comment('类型:1=收入,2=支出');
|
||||
$table->decimal('amount', 10, 2)->comment('金额');
|
||||
$table->decimal('balance_after', 10, 2)->comment('交易后余额');
|
||||
$table->string('description', 255)->comment('描述');
|
||||
$table->string('related_type', 30)->nullable()->comment('关联类型:order=订单,task=任务,withdrawal=提现,refund=退款');
|
||||
$table->unsignedBigInteger('related_id')->nullable()->comment('关联ID');
|
||||
$table->string('transaction_no', 64)->comment('第三方交易号(微信支付transaction_id)');
|
||||
$table->string('out_trade_no', 32)->comment('商户订单号');
|
||||
$table->string('pay_type', 20)->comment('支付方式:wechat=微信支付,alipay=支付宝');
|
||||
$table->decimal('amount', 10, 2)->comment('支付金额');
|
||||
$table->tinyInteger('status')->default(0)->comment('状态:0=待支付,1=成功,2=失败,3=已退款');
|
||||
$table->string('business_type', 30)->comment('业务类型:task=任务订单,deposit=保证金,order=商城订单');
|
||||
$table->unsignedBigInteger('business_id')->nullable()->comment('业务ID');
|
||||
$table->unsignedInteger('user_id')->comment('支付用户ID');
|
||||
$table->string('openid', 64)->default('')->comment('微信OpenID');
|
||||
$table->json('raw_data')->nullable()->comment('支付/退款回调原始数据');
|
||||
$table->timestamp('paid_at')->nullable()->comment('支付时间');
|
||||
$table->timestamps();
|
||||
$table->unique('transaction_no');
|
||||
$table->index('wallet_id');
|
||||
$table->index(['related_type', 'related_id']);
|
||||
$table->comment('资金流水');
|
||||
$table->unique('out_trade_no');
|
||||
$table->index('user_id');
|
||||
$table->index(['business_type', 'business_id']);
|
||||
$table->index('status');
|
||||
$table->comment('三方支付流水');
|
||||
});
|
||||
}
|
||||
|
||||
@@ -65,7 +56,6 @@ return new class extends Migration
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('messages');
|
||||
Schema::dropIfExists('transactions');
|
||||
Schema::dropIfExists('wallets');
|
||||
Schema::dropIfExists('payment_transactions');
|
||||
}
|
||||
};
|
||||
|
||||
@@ -13,6 +13,7 @@ class DatabaseSeeder extends Seeder
|
||||
{
|
||||
$this->call([
|
||||
SysUserSeeder::class,
|
||||
SysRuleSeeder::class,
|
||||
SysDataSeeder::class,
|
||||
SysAgentSeeder::class,
|
||||
]);
|
||||
|
||||
@@ -0,0 +1,682 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class SysRuleSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*/
|
||||
public function run(): void
|
||||
{
|
||||
// 每次执行前清空权限菜单和角色权限关联
|
||||
DB::table('sys_role_rule')->delete();
|
||||
DB::table('sys_rule')->delete();
|
||||
|
||||
$rules = [
|
||||
[
|
||||
'type' => 'menu',
|
||||
'name' => '仪表盘',
|
||||
'key' => 'dashboard',
|
||||
'icon' => 'PieChartOutlined',
|
||||
'local' => 'menu.dashboard',
|
||||
'children' => [
|
||||
[
|
||||
'type' => 'route',
|
||||
'name' => '分析页',
|
||||
'local' => "menu.analysis",
|
||||
'key' => 'dashboard.analysis',
|
||||
'path' => '/dashboard/analysis',
|
||||
]
|
||||
]
|
||||
],
|
||||
[
|
||||
'type' => 'menu',
|
||||
'name' => 'AI',
|
||||
'local' => "menu.ai",
|
||||
'icon' => "OpenAIOutlined",
|
||||
'key' => "ai",
|
||||
'children' => [
|
||||
[
|
||||
'type' => "route",
|
||||
'key' => "ai.chat",
|
||||
'name' => "AI对话",
|
||||
"path" => "/ai/chat",
|
||||
'local' => "menu.ai.chat",
|
||||
'children' => [
|
||||
['type' => 'rule', 'name' => '发送消息', 'key' => 'ai.chat.send'],
|
||||
['type' => 'rule', 'name' => '会话列表', 'key' => 'ai.chat.conversations'],
|
||||
['type' => 'rule', 'name' => '消息列表', 'key' => 'ai.chat.messages'],
|
||||
['type' => 'rule', 'name' => '删除会话', 'key' => 'ai.chat.delete'],
|
||||
]
|
||||
],
|
||||
[
|
||||
'type' => "route",
|
||||
'key' => "ai.conversation",
|
||||
'name' => "会话管理",
|
||||
"path" => "/ai/conversation",
|
||||
'local' => "menu.ai.conversation",
|
||||
'children' => [
|
||||
['type' => 'rule', 'name' => '查询会话列表', 'key' => 'ai.conversation.query'],
|
||||
['type' => 'rule', 'name' => '删除会话', 'key' => 'ai.conversation.delete'],
|
||||
]
|
||||
],
|
||||
[
|
||||
'type' => "route",
|
||||
'key' => "ai.agent",
|
||||
'name' => "Agent 管理",
|
||||
"path" => "/ai/agent",
|
||||
'local' => "menu.ai.agent",
|
||||
'children' => [
|
||||
['type' => 'rule', 'name' => '查询列表', 'key' => 'ai.agent.query'],
|
||||
['type' => 'rule', 'name' => '更新 Agent', 'key' => 'ai.agent.update'],
|
||||
]
|
||||
],
|
||||
]
|
||||
],
|
||||
[
|
||||
'type' => "menu",
|
||||
'name' => "系统管理",
|
||||
'local' => "menu.system",
|
||||
'icon' => "SettingOutlined",
|
||||
'key' => "system",
|
||||
'children' => [
|
||||
[
|
||||
'type' => "route",
|
||||
'key' => "system.user",
|
||||
'name' => "用户管理",
|
||||
'path' => "/system/user",
|
||||
'local' => "menu.system.user",
|
||||
'children' => [
|
||||
['type' => 'rule', 'name' => '查询列表', 'key' => 'system.user.query'],
|
||||
['type' => 'rule', 'name' => '新增用户', 'key' => 'system.user.create'],
|
||||
['type' => 'rule', 'name' => '修改用户', 'key' => 'system.user.update'],
|
||||
['type' => 'rule', 'name' => '删除用户', 'key' => 'system.user.delete'],
|
||||
['type' => 'rule', 'name' => '重置用户密码', 'key' => 'system.user.resetPassword'],
|
||||
['type' => 'rule', 'name' => '获取角色选项', 'key' => 'system.user.role'],
|
||||
['type' => 'rule', 'name' => '获取部门选项', 'key' => 'system.user.dept'],
|
||||
]
|
||||
],
|
||||
[
|
||||
'type' => "route",
|
||||
'key' => "system.dept",
|
||||
'name' => "部门管理",
|
||||
'path' => "/system/dept",
|
||||
'local' => "menu.system.dept",
|
||||
'children' => [
|
||||
['type' => 'rule', 'name' => '获取部门列表', 'key' => 'system.dept.query'],
|
||||
['type' => 'rule', 'name' => '新建部门', 'key' => 'system.dept.create'],
|
||||
['type' => 'rule', 'name' => '更新部门信息', 'key' => 'system.dept.update'],
|
||||
['type' => 'rule', 'name' => '删除部门', 'key' => 'system.dept.delete'],
|
||||
['type' => 'rule', 'name' => '获取部门用户', 'key' => 'system.dept.users'],
|
||||
]
|
||||
],
|
||||
[
|
||||
'type' => "route",
|
||||
'key' => "system.role",
|
||||
'name' => "角色管理",
|
||||
'path' => "/system/role",
|
||||
'local' => "menu.system.role",
|
||||
'children' => [
|
||||
['type' => 'rule', 'name' => '新增角色', 'key' => 'system.role.create'],
|
||||
['type' => 'rule', 'name' => '查询角色列表', 'key' => 'system.role.query'],
|
||||
['type' => 'rule', 'name' => '更新角色信息', 'key' => 'system.role.update'],
|
||||
['type' => 'rule', 'name' => '删除角色', 'key' => 'system.role.delete'],
|
||||
['type' => 'rule', 'name' => '设置启用状态', 'key' => 'system.role.status'],
|
||||
['type' => 'rule', 'name' => '获取角色用户', 'key' => 'system.role.users'],
|
||||
['type' => 'rule', 'name' => '设置角色权限', 'key' => 'system.role.setRule'],
|
||||
['type' => 'rule', 'name' => '获取权限选项', 'key' => 'system.role.ruleList'],
|
||||
]
|
||||
],
|
||||
[
|
||||
'type' => "route",
|
||||
'key' => "system.rule",
|
||||
'name' => "菜单管理",
|
||||
'path' => "/system/rule",
|
||||
'local' => "menu.system.rule",
|
||||
'children' => [
|
||||
['type' => 'rule', 'name' => '获取权限列表', 'key' => 'system.rule.query'],
|
||||
['type' => 'rule', 'name' => '创建权限规则', 'key' => 'system.rule.create'],
|
||||
['type' => 'rule', 'name' => '更新权限规则', 'key' => 'system.rule.update'],
|
||||
['type' => 'rule', 'name' => '删除权限规则', 'key' => 'system.rule.delete'],
|
||||
['type' => 'rule', 'name' => '获取父级权限', 'key' => 'system.rule.parentQuery'],
|
||||
['type' => 'rule', 'name' => '设置显示状态', 'key' => 'system.rule.show'],
|
||||
['type' => 'rule', 'name' => '设置启用状态', 'key' => 'system.rule.status'],
|
||||
]
|
||||
],
|
||||
[
|
||||
'type' => "route",
|
||||
'name' => "文件管理",
|
||||
'local' => "menu.system.file",
|
||||
'key' => "system.file",
|
||||
'path' => "/system/file",
|
||||
'children' => [
|
||||
['type' => 'rule', 'name' => '获取文件夹', 'key' => 'system.file.group.query'],
|
||||
['type' => 'rule', 'name' => '新增文件夹', 'key' => 'system.file.group.create'],
|
||||
['type' => 'rule', 'name' => '编辑文件夹', 'key' => 'system.file.group.update'],
|
||||
['type' => 'rule', 'name' => '删除文件夹', 'key' => 'system.file.group.delete'],
|
||||
['type' => 'rule', 'name' => '查询文件列表', 'key' => 'system.file.list.query'],
|
||||
['type' => 'rule', 'name' => '上传文件', 'key' => 'system.file.list.upload'],
|
||||
['type' => 'rule', 'name' => '下载文件', 'key' => 'system.file.list.download'],
|
||||
['type' => 'rule', 'name' => '删除文件', 'key' => 'system.file.list.delete'],
|
||||
['type' => 'rule', 'name' => '永久删除文件', 'key' => 'system.file.list.force-delete'],
|
||||
['type' => 'rule', 'name' => '恢复文件', 'key' => 'system.file.list.restore'],
|
||||
['type' => 'rule', 'name' => '查看回收站', 'key' => 'system.file.list.trashed'],
|
||||
['type' => 'rule', 'name' => '清空回收站', 'key' => 'system.file.list.clean-trashed'],
|
||||
['type' => 'rule', 'name' => '复制文件', 'key' => 'system.file.list.copy'],
|
||||
['type' => 'rule', 'name' => '移动文件', 'key' => 'system.file.list.move'],
|
||||
['type' => 'rule', 'name' => '重命名文件', 'key' => 'system.file.list.rename']
|
||||
],
|
||||
],
|
||||
[
|
||||
'type' => "route",
|
||||
'name' => "系统字典",
|
||||
'local' => "menu.system.dict",
|
||||
'key' => "system.dict",
|
||||
'path' => "/system/dict",
|
||||
'children' => [
|
||||
['type' => 'rule', 'name' => '字典列表', 'key' => 'system.dict.list.query'],
|
||||
['type' => 'rule', 'name' => '新增字典', 'key' => 'system.dict.list.create'],
|
||||
['type' => 'rule', 'name' => '删除字典', 'key' => 'system.dict.list.delete'],
|
||||
['type' => 'rule', 'name' => '更新字典', 'key' => 'system.dict.list.update'],
|
||||
['type' => 'rule', 'name' => '字典项列表', 'key' => 'system.dict.item.query'],
|
||||
['type' => 'rule', 'name' => '字典项新增', 'key' => 'system.dict.item.create'],
|
||||
['type' => 'rule', 'name' => '字典项编辑', 'key' => 'system.dict.item.update'],
|
||||
['type' => 'rule', 'name' => '字典项删除', 'key' => 'system.dict.item.delete'],
|
||||
]
|
||||
],
|
||||
[
|
||||
'type' => "route",
|
||||
'name' => "系统配置",
|
||||
'local' => "menu.system.config",
|
||||
'key' => "system.config",
|
||||
'path' => "/system/config",
|
||||
'children' => [
|
||||
['type' => 'rule', 'name' => '配置列表', 'key' => 'system.config.items.query'],
|
||||
['type' => 'rule', 'name' => '新增配置', 'key' => 'system.config.items.create'],
|
||||
['type' => 'rule', 'name' => '编辑配置', 'key' => 'system.config.items.update'],
|
||||
['type' => 'rule', 'name' => '删除配置', 'key' => 'system.config.items.delete'],
|
||||
['type' => 'rule', 'name' => '保存配置', 'key' => 'system.config.items.save'],
|
||||
['type' => 'rule', 'name' => '刷新配置', 'key' => 'system.config.items.refresh'],
|
||||
['type' => 'rule', 'name' => '配置组编辑', 'key' => 'system.config.group.update'],
|
||||
['type' => 'rule', 'name' => '配置组删除', 'key' => 'system.config.items.item.delete'],
|
||||
['type' => 'rule', 'name' => '配置组列表', 'key' => 'system.config.group.query'],
|
||||
['type' => 'rule', 'name' => '配置组新增', 'key' => 'system.config.group.create'],
|
||||
]
|
||||
],
|
||||
[
|
||||
'type' => 'route',
|
||||
'key' => 'system.mail',
|
||||
'name' => '邮件配置',
|
||||
'path' => '/system/mail',
|
||||
'local' => 'menu.system.mail',
|
||||
'children' => [
|
||||
['type' => 'rule', 'name' => '获取配置', 'key' => 'system.mail.config'],
|
||||
['type' => 'rule', 'name' => '保存配置', 'key' => 'system.mail.save'],
|
||||
['type' => 'rule', 'name' => '发送测试', 'key' => 'system.mail.test'],
|
||||
]
|
||||
],
|
||||
[
|
||||
'type' => 'route',
|
||||
'key' => 'system.storage',
|
||||
'name' => '存储配置',
|
||||
'path' => '/system/storage',
|
||||
'local' => 'menu.system.storage',
|
||||
'children' => [
|
||||
['type' => 'rule', 'name' => '获取配置', 'key' => 'system.storage.config'],
|
||||
['type' => 'rule', 'name' => '保存配置', 'key' => 'system.storage.save'],
|
||||
['type' => 'rule', 'name' => '测试连接', 'key' => 'system.storage.test'],
|
||||
]
|
||||
],
|
||||
[
|
||||
'type' => 'route',
|
||||
'key' => 'system.ai',
|
||||
'name' => 'AI 配置',
|
||||
'path' => '/system/ai',
|
||||
'local' => 'menu.system.ai',
|
||||
'children' => [
|
||||
['type' => 'rule', 'name' => '获取可用AI列表', 'key' => 'system.ai.list'],
|
||||
['type' => 'rule', 'name' => '获取AI配置', 'key' => 'system.ai.config'],
|
||||
['type' => 'rule', 'name' => '保存AI配置', 'key' => 'system.ai.save'],
|
||||
['type' => 'rule', 'name' => '测试连接', 'key' => 'system.ai.test'],
|
||||
]
|
||||
],
|
||||
[
|
||||
'type' => "route",
|
||||
'name' => "系统信息",
|
||||
'local' => "menu.system.info",
|
||||
'key' => "system.info",
|
||||
'path' => "/system/info",
|
||||
]
|
||||
]
|
||||
],
|
||||
[
|
||||
'type' => 'menu',
|
||||
'name' => '小程序用户',
|
||||
'local' => 'menu.member',
|
||||
'icon' => 'UserOutlined',
|
||||
'key' => 'member',
|
||||
'children' => [
|
||||
[
|
||||
'type' => 'route',
|
||||
'name' => '用户列表',
|
||||
'key' => 'member.user',
|
||||
'path' => '/member/user',
|
||||
'local' => 'menu.member.user',
|
||||
'children' => [
|
||||
['type' => 'rule', 'name' => '查询列表', 'key' => 'member.user.query'],
|
||||
['type' => 'rule', 'name' => '新增用户', 'key' => 'member.user.create'],
|
||||
['type' => 'rule', 'name' => '修改用户', 'key' => 'member.user.update'],
|
||||
['type' => 'rule', 'name' => '删除用户', 'key' => 'member.user.delete'],
|
||||
],
|
||||
],
|
||||
[
|
||||
'type' => 'route',
|
||||
'name' => '地址管理',
|
||||
'key' => 'member.address',
|
||||
'path' => '/member/address',
|
||||
'local' => 'menu.member.address',
|
||||
'children' => [
|
||||
['type' => 'rule', 'name' => '查询列表', 'key' => 'member.address.query'],
|
||||
['type' => 'rule', 'name' => '新增地址', 'key' => 'member.address.create'],
|
||||
['type' => 'rule', 'name' => '修改地址', 'key' => 'member.address.update'],
|
||||
['type' => 'rule', 'name' => '删除地址', 'key' => 'member.address.delete'],
|
||||
],
|
||||
],
|
||||
],
|
||||
],
|
||||
[
|
||||
'type' => 'menu',
|
||||
'name' => '校园论坛',
|
||||
'local' => 'menu.forum',
|
||||
'icon' => 'MessageOutlined',
|
||||
'key' => 'forum',
|
||||
'children' => [
|
||||
[
|
||||
'type' => 'route',
|
||||
'name' => '话题管理',
|
||||
'key' => 'forum.category',
|
||||
'path' => '/forum/category',
|
||||
'local' => 'menu.forum.category',
|
||||
'children' => [
|
||||
['type' => 'rule', 'name' => '查询列表', 'key' => 'forum.category.query'],
|
||||
['type' => 'rule', 'name' => '新增分类', 'key' => 'forum.category.create'],
|
||||
['type' => 'rule', 'name' => '修改分类', 'key' => 'forum.category.update'],
|
||||
['type' => 'rule', 'name' => '删除分类', 'key' => 'forum.category.delete'],
|
||||
],
|
||||
],
|
||||
[
|
||||
'type' => 'route',
|
||||
'name' => '帖子管理',
|
||||
'key' => 'forum.post',
|
||||
'path' => '/forum/post',
|
||||
'local' => 'menu.forum.post',
|
||||
'children' => [
|
||||
['type' => 'rule', 'name' => '查询列表', 'key' => 'forum.post.query'],
|
||||
['type' => 'rule', 'name' => '新增帖子', 'key' => 'forum.post.create'],
|
||||
['type' => 'rule', 'name' => '修改帖子', 'key' => 'forum.post.update'],
|
||||
['type' => 'rule', 'name' => '删除帖子', 'key' => 'forum.post.delete'],
|
||||
],
|
||||
],
|
||||
[
|
||||
'type' => 'route',
|
||||
'name' => '评论管理',
|
||||
'key' => 'forum.comment',
|
||||
'path' => '/forum/comment',
|
||||
'local' => 'menu.forum.comment',
|
||||
'children' => [
|
||||
['type' => 'rule', 'name' => '查询列表', 'key' => 'forum.comment.query'],
|
||||
['type' => 'rule', 'name' => '新增评论', 'key' => 'forum.comment.create'],
|
||||
['type' => 'rule', 'name' => '修改评论', 'key' => 'forum.comment.update'],
|
||||
['type' => 'rule', 'name' => '删除评论', 'key' => 'forum.comment.delete'],
|
||||
],
|
||||
],
|
||||
[
|
||||
'type' => 'route',
|
||||
'name' => '敏感词管理',
|
||||
'key' => 'forum.sensitive-word',
|
||||
'path' => '/forum/sensitive-word',
|
||||
'local' => 'menu.forum.sensitive-word',
|
||||
'children' => [
|
||||
['type' => 'rule', 'name' => '查询列表', 'key' => 'forum.sensitive-word.query'],
|
||||
['type' => 'rule', 'name' => '新增敏感词', 'key' => 'forum.sensitive-word.create'],
|
||||
['type' => 'rule', 'name' => '修改敏感词', 'key' => 'forum.sensitive-word.update'],
|
||||
['type' => 'rule', 'name' => '删除敏感词', 'key' => 'forum.sensitive-word.delete'],
|
||||
],
|
||||
],
|
||||
[
|
||||
'type' => 'route',
|
||||
'name' => '点赞记录',
|
||||
'key' => 'forum.post-like',
|
||||
'path' => '/forum/post-like',
|
||||
'local' => 'menu.forum.post-like',
|
||||
'children' => [
|
||||
['type' => 'rule', 'name' => '查询列表', 'key' => 'forum.post-like.query'],
|
||||
['type' => 'rule', 'name' => '删除记录', 'key' => 'forum.post-like.delete'],
|
||||
],
|
||||
],
|
||||
[
|
||||
'type' => 'route',
|
||||
'name' => '收藏记录',
|
||||
'key' => 'forum.post-favorite',
|
||||
'path' => '/forum/post-favorite',
|
||||
'local' => 'menu.forum.post-favorite',
|
||||
'children' => [
|
||||
['type' => 'rule', 'name' => '查询列表', 'key' => 'forum.post-favorite.query'],
|
||||
['type' => 'rule', 'name' => '删除记录', 'key' => 'forum.post-favorite.delete'],
|
||||
],
|
||||
],
|
||||
],
|
||||
],
|
||||
[
|
||||
'type' => 'menu',
|
||||
'name' => '校园商户',
|
||||
'local' => 'menu.merchant',
|
||||
'icon' => 'ShopOutlined',
|
||||
'key' => 'merchant',
|
||||
'children' => [
|
||||
[
|
||||
'type' => 'route',
|
||||
'name' => '商户分类',
|
||||
'key' => 'merchant.category',
|
||||
'path' => '/merchant/category',
|
||||
'local' => 'menu.merchant.category',
|
||||
'children' => [
|
||||
['type' => 'rule', 'name' => '查询列表', 'key' => 'merchant.category.query'],
|
||||
['type' => 'rule', 'name' => '新增分类', 'key' => 'merchant.category.create'],
|
||||
['type' => 'rule', 'name' => '修改分类', 'key' => 'merchant.category.update'],
|
||||
['type' => 'rule', 'name' => '删除分类', 'key' => 'merchant.category.delete'],
|
||||
],
|
||||
],
|
||||
[
|
||||
'type' => 'route',
|
||||
'name' => '商户管理',
|
||||
'key' => 'merchant.store',
|
||||
'path' => '/merchant/store',
|
||||
'local' => 'menu.merchant.store',
|
||||
'children' => [
|
||||
['type' => 'rule', 'name' => '查询列表', 'key' => 'merchant.store.query'],
|
||||
['type' => 'rule', 'name' => '新增商户', 'key' => 'merchant.store.create'],
|
||||
['type' => 'rule', 'name' => '修改商户', 'key' => 'merchant.store.update'],
|
||||
['type' => 'rule', 'name' => '删除商户', 'key' => 'merchant.store.delete'],
|
||||
],
|
||||
],
|
||||
[
|
||||
'type' => 'route',
|
||||
'name' => '商品分类',
|
||||
'key' => 'merchant.product-category',
|
||||
'path' => '/merchant/product-category',
|
||||
'local' => 'menu.merchant.product-category',
|
||||
'children' => [
|
||||
['type' => 'rule', 'name' => '查询列表', 'key' => 'merchant.product-category.query'],
|
||||
['type' => 'rule', 'name' => '新增分类', 'key' => 'merchant.product-category.create'],
|
||||
['type' => 'rule', 'name' => '修改分类', 'key' => 'merchant.product-category.update'],
|
||||
['type' => 'rule', 'name' => '删除分类', 'key' => 'merchant.product-category.delete'],
|
||||
],
|
||||
],
|
||||
[
|
||||
'type' => 'route',
|
||||
'name' => '商品管理',
|
||||
'key' => 'merchant.product',
|
||||
'path' => '/merchant/product',
|
||||
'local' => 'menu.merchant.product',
|
||||
'children' => [
|
||||
['type' => 'rule', 'name' => '查询列表', 'key' => 'merchant.product.query'],
|
||||
['type' => 'rule', 'name' => '新增商品', 'key' => 'merchant.product.create'],
|
||||
['type' => 'rule', 'name' => '修改商品', 'key' => 'merchant.product.update'],
|
||||
['type' => 'rule', 'name' => '删除商品', 'key' => 'merchant.product.delete'],
|
||||
],
|
||||
],
|
||||
[
|
||||
'type' => 'route',
|
||||
'name' => '打印机管理',
|
||||
'key' => 'merchant.printer',
|
||||
'path' => '/merchant/printer',
|
||||
'local' => 'menu.merchant.printer',
|
||||
'children' => [
|
||||
['type' => 'rule', 'name' => '查询列表', 'key' => 'merchant.printer.query'],
|
||||
['type' => 'rule', 'name' => '新增打印机', 'key' => 'merchant.printer.create'],
|
||||
['type' => 'rule', 'name' => '修改打印机', 'key' => 'merchant.printer.update'],
|
||||
['type' => 'rule', 'name' => '删除打印机', 'key' => 'merchant.printer.delete'],
|
||||
],
|
||||
],
|
||||
[
|
||||
'type' => 'route',
|
||||
'name' => '打印任务',
|
||||
'key' => 'merchant.print-task',
|
||||
'path' => '/merchant/print-task',
|
||||
'local' => 'menu.merchant.print-task',
|
||||
'children' => [
|
||||
['type' => 'rule', 'name' => '查询列表', 'key' => 'merchant.print-task.query'],
|
||||
['type' => 'rule', 'name' => '删除任务', 'key' => 'merchant.print-task.delete'],
|
||||
],
|
||||
],
|
||||
],
|
||||
],
|
||||
// 校园任务
|
||||
[
|
||||
'type' => 'menu',
|
||||
'key' => 'task',
|
||||
'name' => '校园任务',
|
||||
'icon' => 'ThunderboltOutlined',
|
||||
'local' => 'menu.task',
|
||||
'children' => [
|
||||
// 任务分类
|
||||
[
|
||||
'type' => 'route', 'key' => 'task.category', 'name' => '任务分类',
|
||||
'path' => '/task/category', 'local' => 'menu.task.category',
|
||||
'children' => [
|
||||
['type' => 'rule', 'key' => 'task.category.query', 'name' => '查询'],
|
||||
['type' => 'rule', 'key' => 'task.category.create', 'name' => '创建'],
|
||||
['type' => 'rule', 'key' => 'task.category.update', 'name' => '编辑'],
|
||||
['type' => 'rule', 'key' => 'task.category.delete', 'name' => '删除'],
|
||||
],
|
||||
],
|
||||
// 跑腿订单
|
||||
[
|
||||
'type' => 'route', 'key' => 'task.order_errand', 'name' => '跑腿订单',
|
||||
'path' => '/task/order-errand', 'local' => 'menu.task.order_errand',
|
||||
'children' => [
|
||||
['type' => 'rule', 'key' => 'task.order.query', 'name' => '查询'],
|
||||
['type' => 'rule', 'key' => 'task.order.create', 'name' => '创建'],
|
||||
['type' => 'rule', 'key' => 'task.order.update', 'name' => '编辑'],
|
||||
['type' => 'rule', 'key' => 'task.order.delete', 'name' => '删除'],
|
||||
],
|
||||
],
|
||||
// 代取订单
|
||||
[
|
||||
'type' => 'route', 'key' => 'task.order_pickup', 'name' => '代取订单',
|
||||
'path' => '/task/order-pickup', 'local' => 'menu.task.order_pickup',
|
||||
],
|
||||
// 租借订单
|
||||
[
|
||||
'type' => 'route', 'key' => 'task.order_rental', 'name' => '租借订单',
|
||||
'path' => '/task/order-rental', 'local' => 'menu.task.order_rental',
|
||||
],
|
||||
// 接单记录
|
||||
[
|
||||
'type' => 'route', 'key' => 'task.bid', 'name' => '接单记录',
|
||||
'path' => '/task/bid', 'local' => 'menu.task.bid',
|
||||
'children' => [
|
||||
['type' => 'rule', 'key' => 'task.bid.query', 'name' => '查询'],
|
||||
['type' => 'rule', 'key' => 'task.bid.create', 'name' => '创建'],
|
||||
['type' => 'rule', 'key' => 'task.bid.update', 'name' => '编辑'],
|
||||
['type' => 'rule', 'key' => 'task.bid.delete', 'name' => '删除'],
|
||||
],
|
||||
],
|
||||
],
|
||||
],
|
||||
// 接单员管理
|
||||
[
|
||||
'type' => 'menu',
|
||||
'key' => 'runner',
|
||||
'name' => '接单员管理',
|
||||
'icon' => 'TeamOutlined',
|
||||
'local' => 'menu.runner',
|
||||
'children' => [
|
||||
// 接单员申请
|
||||
[
|
||||
'type' => 'route', 'key' => 'runner.application', 'name' => '接单员申请',
|
||||
'path' => '/runner/application', 'local' => 'menu.runner.application',
|
||||
'children' => [
|
||||
['type' => 'rule', 'key' => 'runner.application.query', 'name' => '查询'],
|
||||
['type' => 'rule', 'key' => 'runner.application.create', 'name' => '创建'],
|
||||
['type' => 'rule', 'key' => 'runner.application.update', 'name' => '编辑'],
|
||||
['type' => 'rule', 'key' => 'runner.application.delete', 'name' => '删除'],
|
||||
],
|
||||
],
|
||||
// 接单员列表 (query/update/delete)
|
||||
[
|
||||
'type' => 'route', 'key' => 'runner.worker', 'name' => '接单员列表',
|
||||
'path' => '/runner/worker', 'local' => 'menu.runner.worker',
|
||||
'children' => [
|
||||
['type' => 'rule', 'key' => 'runner.worker.query', 'name' => '查询'],
|
||||
['type' => 'rule', 'key' => 'runner.worker.update', 'name' => '编辑'],
|
||||
['type' => 'rule', 'key' => 'runner.worker.delete', 'name' => '删除'],
|
||||
],
|
||||
],
|
||||
// 信誉分记录 (query only)
|
||||
[
|
||||
'type' => 'route', 'key' => 'runner.credit_log', 'name' => '信誉分记录',
|
||||
'path' => '/runner/credit-log', 'local' => 'menu.runner.credit_log',
|
||||
'children' => [
|
||||
['type' => 'rule', 'key' => 'runner.credit_log.query', 'name' => '查询'],
|
||||
],
|
||||
],
|
||||
// 投诉记录
|
||||
[
|
||||
'type' => 'route', 'key' => 'runner.complaint', 'name' => '投诉记录',
|
||||
'path' => '/runner/complaint', 'local' => 'menu.runner.complaint',
|
||||
'children' => [
|
||||
['type' => 'rule', 'key' => 'runner.complaint.query', 'name' => '查询'],
|
||||
['type' => 'rule', 'key' => 'runner.complaint.create', 'name' => '创建'],
|
||||
['type' => 'rule', 'key' => 'runner.complaint.update', 'name' => '编辑'],
|
||||
['type' => 'rule', 'key' => 'runner.complaint.delete', 'name' => '删除'],
|
||||
],
|
||||
],
|
||||
// 投诉申诉
|
||||
[
|
||||
'type' => 'route', 'key' => 'runner.complaint_appeal', 'name' => '投诉申诉',
|
||||
'path' => '/runner/complaint-appeal', 'local' => 'menu.runner.complaint_appeal',
|
||||
'children' => [
|
||||
['type' => 'rule', 'key' => 'runner.complaint_appeal.query', 'name' => '查询'],
|
||||
['type' => 'rule', 'key' => 'runner.complaint_appeal.create', 'name' => '创建'],
|
||||
['type' => 'rule', 'key' => 'runner.complaint_appeal.update', 'name' => '编辑'],
|
||||
['type' => 'rule', 'key' => 'runner.complaint_appeal.delete', 'name' => '删除'],
|
||||
],
|
||||
],
|
||||
],
|
||||
],
|
||||
// 财务管理
|
||||
[
|
||||
'type' => 'menu',
|
||||
'key' => 'finance',
|
||||
'name' => '财务管理',
|
||||
'icon' => 'AccountBookOutlined',
|
||||
'local' => 'menu.finance',
|
||||
'children' => [
|
||||
// 任务支付日志 (query/delete)
|
||||
[
|
||||
'type' => 'route', 'key' => 'task.payment', 'name' => '任务支付日志',
|
||||
'path' => '/finance/task-payment', 'local' => 'menu.finance.task_payment',
|
||||
'children' => [
|
||||
['type' => 'rule', 'key' => 'task.payment.query', 'name' => '查询'],
|
||||
['type' => 'rule', 'key' => 'task.payment.delete', 'name' => '删除'],
|
||||
],
|
||||
],
|
||||
// 保证金管理 (query/update/delete)
|
||||
[
|
||||
'type' => 'route', 'key' => 'runner.deposit', 'name' => '保证金管理',
|
||||
'path' => '/finance/deposit', 'local' => 'menu.finance.deposit',
|
||||
'children' => [
|
||||
['type' => 'rule', 'key' => 'runner.deposit.query', 'name' => '查询'],
|
||||
['type' => 'rule', 'key' => 'runner.deposit.update', 'name' => '编辑'],
|
||||
['type' => 'rule', 'key' => 'runner.deposit.delete', 'name' => '删除'],
|
||||
],
|
||||
],
|
||||
// 保证金支付日志 (query/delete)
|
||||
[
|
||||
'type' => 'route', 'key' => 'runner.deposit_payment', 'name' => '保证金支付日志',
|
||||
'path' => '/finance/deposit-payment', 'local' => 'menu.finance.deposit_payment',
|
||||
'children' => [
|
||||
['type' => 'rule', 'key' => 'runner.deposit_payment.query', 'name' => '查询'],
|
||||
['type' => 'rule', 'key' => 'runner.deposit_payment.delete', 'name' => '删除'],
|
||||
],
|
||||
],
|
||||
// 接单员提现 (query/update/delete)
|
||||
[
|
||||
'type' => 'route', 'key' => 'runner.withdrawal', 'name' => '接单员提现',
|
||||
'path' => '/finance/withdrawal', 'local' => 'menu.finance.withdrawal',
|
||||
'children' => [
|
||||
['type' => 'rule', 'key' => 'runner.withdrawal.query', 'name' => '查询'],
|
||||
['type' => 'rule', 'key' => 'runner.withdrawal.update', 'name' => '编辑'],
|
||||
['type' => 'rule', 'key' => 'runner.withdrawal.delete', 'name' => '删除'],
|
||||
],
|
||||
],
|
||||
// 资金流水 (query only)
|
||||
[
|
||||
'type' => 'route', 'key' => 'finance.transaction', 'name' => '资金流水',
|
||||
'path' => '/finance/transaction', 'local' => 'menu.finance.transaction',
|
||||
'children' => [
|
||||
['type' => 'rule', 'key' => 'finance.transaction.query', 'name' => '查询'],
|
||||
['type' => 'rule', 'key' => 'finance.transaction.delete', 'name' => '删除'],
|
||||
],
|
||||
],
|
||||
],
|
||||
],
|
||||
[
|
||||
'type' => 'route',
|
||||
'name' => 'XinAdmin',
|
||||
'local' => "menu.xin-admin",
|
||||
'key' => "xin-admin",
|
||||
'icon' => "LinkOutlined",
|
||||
'link' => 1,
|
||||
'path' => 'https://xinadmin.cn',
|
||||
]
|
||||
];
|
||||
|
||||
$this->insertRules($rules);
|
||||
|
||||
// 为超级管理员(role_id=1)授予全部启用权限
|
||||
DB::table('sys_role_rule')->insertUsing(
|
||||
['role_id', 'rule_id'],
|
||||
DB::table('sys_rule')
|
||||
->where('status', 1)
|
||||
->select(DB::raw('1 as role_id'), 'id')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 递归插入权限规则数据
|
||||
*/
|
||||
private function insertRules(array $rules, int $pid = 0): void
|
||||
{
|
||||
$order = 0;
|
||||
foreach ($rules as $rule) {
|
||||
$insertData = [
|
||||
'parent_id' => $pid,
|
||||
'type' => $rule['type'],
|
||||
'key' => $rule['key'],
|
||||
'name' => $rule['name'],
|
||||
'path' => $rule['path'] ?? '',
|
||||
'icon' => $rule['icon'] ?? '',
|
||||
'order' => $order++,
|
||||
'local' => $rule['local'] ?? '',
|
||||
'status' => 1,
|
||||
'hidden' => 1,
|
||||
'link' => $rule['link'] ?? 0,
|
||||
'created_at' => now(),
|
||||
'updated_at' => now(),
|
||||
];
|
||||
|
||||
$currentId = DB::table('sys_rule')->insertGetId($insertData);
|
||||
|
||||
if (! empty($rule['children']) && is_array($rule['children'])) {
|
||||
$this->insertRules($rule['children'], $currentId);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -122,466 +122,6 @@ class SysUserSeeder extends Seeder
|
||||
],
|
||||
]);
|
||||
|
||||
$rules = [
|
||||
[
|
||||
'type' => 'menu',
|
||||
'name' => '仪表盘',
|
||||
'key' => 'dashboard',
|
||||
'icon' => 'PieChartOutlined',
|
||||
'local' => 'menu.dashboard',
|
||||
'children' => [
|
||||
[
|
||||
'type' => 'route',
|
||||
'name' => '分析页',
|
||||
'local' => "menu.analysis",
|
||||
'key' => 'dashboard.analysis',
|
||||
'path' => '/dashboard/analysis',
|
||||
]
|
||||
]
|
||||
],
|
||||
[
|
||||
'type' => 'menu',
|
||||
'name' => 'AI',
|
||||
'local' => "menu.ai",
|
||||
'icon' => "OpenAIOutlined",
|
||||
'key' => "ai",
|
||||
'children' => [
|
||||
[
|
||||
'type' => "route",
|
||||
'key' => "ai.chat",
|
||||
'name' => "AI对话",
|
||||
"path" => "/ai/chat",
|
||||
'local' => "menu.ai.chat",
|
||||
'children' => [
|
||||
['type' => 'rule', 'name' => '发送消息', 'key' => 'ai.chat.send'],
|
||||
['type' => 'rule', 'name' => '会话列表', 'key' => 'ai.chat.conversations'],
|
||||
['type' => 'rule', 'name' => '消息列表', 'key' => 'ai.chat.messages'],
|
||||
['type' => 'rule', 'name' => '删除会话', 'key' => 'ai.chat.delete'],
|
||||
]
|
||||
],
|
||||
[
|
||||
'type' => "route",
|
||||
'key' => "ai.conversation",
|
||||
'name' => "会话管理",
|
||||
"path" => "/ai/conversation",
|
||||
'local' => "menu.ai.conversation",
|
||||
'children' => [
|
||||
['type' => 'rule', 'name' => '查询会话列表', 'key' => 'ai.conversation.query'],
|
||||
['type' => 'rule', 'name' => '删除会话', 'key' => 'ai.conversation.delete'],
|
||||
]
|
||||
],
|
||||
[
|
||||
'type' => "route",
|
||||
'key' => "ai.agent",
|
||||
'name' => "Agent 管理",
|
||||
"path" => "/ai/agent",
|
||||
'local' => "menu.ai.agent",
|
||||
'children' => [
|
||||
['type' => 'rule', 'name' => '查询列表', 'key' => 'ai.agent.query'],
|
||||
['type' => 'rule', 'name' => '更新 Agent', 'key' => 'ai.agent.update'],
|
||||
]
|
||||
],
|
||||
]
|
||||
],
|
||||
[
|
||||
'type' => "menu",
|
||||
'name' => "系统管理",
|
||||
'local' => "menu.system",
|
||||
'icon' => "SettingOutlined",
|
||||
'key' => "system",
|
||||
'children' => [
|
||||
[
|
||||
'type' => "route",
|
||||
'key' => "system.user",
|
||||
'name' => "用户管理",
|
||||
'path' => "/system/user",
|
||||
'local' => "menu.system.user",
|
||||
'children' => [
|
||||
['type' => 'rule', 'name' => '查询列表', 'key' => 'system.user.query'],
|
||||
['type' => 'rule', 'name' => '新增用户', 'key' => 'system.user.create'],
|
||||
['type' => 'rule', 'name' => '修改用户', 'key' => 'system.user.update'],
|
||||
['type' => 'rule', 'name' => '删除用户', 'key' => 'system.user.delete'],
|
||||
['type' => 'rule', 'name' => '重置用户密码', 'key' => 'system.user.resetPassword'],
|
||||
['type' => 'rule', 'name' => '获取角色选项', 'key' => 'system.user.role'],
|
||||
['type' => 'rule', 'name' => '获取部门选项', 'key' => 'system.user.dept'],
|
||||
]
|
||||
],
|
||||
[
|
||||
'type' => "route",
|
||||
'key' => "system.dept",
|
||||
'name' => "部门管理",
|
||||
'path' => "/system/dept",
|
||||
'local' => "menu.system.dept",
|
||||
'children' => [
|
||||
['type' => 'rule', 'name' => '获取部门列表', 'key' => 'system.dept.query'],
|
||||
['type' => 'rule', 'name' => '新建部门', 'key' => 'system.dept.create'],
|
||||
['type' => 'rule', 'name' => '更新部门信息', 'key' => 'system.dept.update'],
|
||||
['type' => 'rule', 'name' => '删除部门', 'key' => 'system.dept.delete'],
|
||||
['type' => 'rule', 'name' => '获取部门用户', 'key' => 'system.dept.users'],
|
||||
]
|
||||
],
|
||||
[
|
||||
'type' => "route",
|
||||
'key' => "system.role",
|
||||
'name' => "角色管理",
|
||||
'path' => "/system/role",
|
||||
'local' => "menu.system.role",
|
||||
'children' => [
|
||||
['type' => 'rule', 'name' => '新增角色', 'key' => 'system.role.create'],
|
||||
['type' => 'rule', 'name' => '查询角色列表', 'key' => 'system.role.query'],
|
||||
['type' => 'rule', 'name' => '更新角色信息', 'key' => 'system.role.update'],
|
||||
['type' => 'rule', 'name' => '删除角色', 'key' => 'system.role.delete'],
|
||||
['type' => 'rule', 'name' => '设置启用状态', 'key' => 'system.role.status'],
|
||||
['type' => 'rule', 'name' => '获取角色用户', 'key' => 'system.role.users'],
|
||||
['type' => 'rule', 'name' => '设置角色权限', 'key' => 'system.role.setRule'],
|
||||
['type' => 'rule', 'name' => '获取权限选项', 'key' => 'system.role.ruleList'],
|
||||
]
|
||||
],
|
||||
[
|
||||
'type' => "route",
|
||||
'key' => "system.rule",
|
||||
'name' => "菜单管理",
|
||||
'path' => "/system/rule",
|
||||
'local' => "menu.system.rule",
|
||||
'children' => [
|
||||
['type' => 'rule', 'name' => '获取权限列表', 'key' => 'system.rule.query'],
|
||||
['type' => 'rule', 'name' => '创建权限规则', 'key' => 'system.rule.create'],
|
||||
['type' => 'rule', 'name' => '更新权限规则', 'key' => 'system.rule.update'],
|
||||
['type' => 'rule', 'name' => '删除权限规则', 'key' => 'system.rule.delete'],
|
||||
['type' => 'rule', 'name' => '获取父级权限', 'key' => 'system.rule.parentQuery'],
|
||||
['type' => 'rule', 'name' => '设置显示状态', 'key' => 'system.rule.show'],
|
||||
['type' => 'rule', 'name' => '设置启用状态', 'key' => 'system.rule.status'],
|
||||
]
|
||||
],
|
||||
[
|
||||
'type' => "route",
|
||||
'name' => "文件管理",
|
||||
'local' => "menu.system.file",
|
||||
'key' => "system.file",
|
||||
'path' => "/system/file",
|
||||
'children' => [
|
||||
['type' => 'rule', 'name' => '获取文件夹', 'key' => 'system.file.group.query'],
|
||||
['type' => 'rule', 'name' => '新增文件夹', 'key' => 'system.file.group.create'],
|
||||
['type' => 'rule', 'name' => '编辑文件夹', 'key' => 'system.file.group.update'],
|
||||
['type' => 'rule', 'name' => '删除文件夹', 'key' => 'system.file.group.delete'],
|
||||
['type' => 'rule', 'name' => '查询文件列表', 'key' => 'system.file.list.query'],
|
||||
['type' => 'rule', 'name' => '上传文件', 'key' => 'system.file.list.upload'],
|
||||
['type' => 'rule', 'name' => '下载文件', 'key' => 'system.file.list.download'],
|
||||
['type' => 'rule', 'name' => '删除文件', 'key' => 'system.file.list.delete'],
|
||||
['type' => 'rule', 'name' => '永久删除文件', 'key' => 'system.file.list.force-delete'],
|
||||
['type' => 'rule', 'name' => '恢复文件', 'key' => 'system.file.list.restore'],
|
||||
['type' => 'rule', 'name' => '查看回收站', 'key' => 'system.file.list.trashed'],
|
||||
['type' => 'rule', 'name' => '清空回收站', 'key' => 'system.file.list.clean-trashed'],
|
||||
['type' => 'rule', 'name' => '复制文件', 'key' => 'system.file.list.copy'],
|
||||
['type' => 'rule', 'name' => '移动文件', 'key' => 'system.file.list.move'],
|
||||
['type' => 'rule', 'name' => '重命名文件', 'key' => 'system.file.list.rename']
|
||||
],
|
||||
],
|
||||
[
|
||||
'type' => "route",
|
||||
'name' => "系统字典",
|
||||
'local' => "menu.system.dict",
|
||||
'key' => "system.dict",
|
||||
'path' => "/system/dict",
|
||||
'children' => [
|
||||
['type' => 'rule', 'name' => '字典列表', 'key' => 'system.dict.list.query'],
|
||||
['type' => 'rule', 'name' => '新增字典', 'key' => 'system.dict.list.create'],
|
||||
['type' => 'rule', 'name' => '删除字典', 'key' => 'system.dict.list.delete'],
|
||||
['type' => 'rule', 'name' => '更新字典', 'key' => 'system.dict.list.update'],
|
||||
['type' => 'rule', 'name' => '字典项列表', 'key' => 'system.dict.item.query'],
|
||||
['type' => 'rule', 'name' => '字典项新增', 'key' => 'system.dict.item.create'],
|
||||
['type' => 'rule', 'name' => '字典项编辑', 'key' => 'system.dict.item.update'],
|
||||
['type' => 'rule', 'name' => '字典项删除', 'key' => 'system.dict.item.delete'],
|
||||
]
|
||||
],
|
||||
[
|
||||
'type' => "route",
|
||||
'name' => "系统配置",
|
||||
'local' => "menu.system.config",
|
||||
'key' => "system.config",
|
||||
'path' => "/system/config",
|
||||
'children' => [
|
||||
['type' => 'rule', 'name' => '配置列表', 'key' => 'system.config.items.query'],
|
||||
['type' => 'rule', 'name' => '新增配置', 'key' => 'system.config.items.create'],
|
||||
['type' => 'rule', 'name' => '编辑配置', 'key' => 'system.config.items.update'],
|
||||
['type' => 'rule', 'name' => '删除配置', 'key' => 'system.config.items.delete'],
|
||||
['type' => 'rule', 'name' => '保存配置', 'key' => 'system.config.items.save'],
|
||||
['type' => 'rule', 'name' => '刷新配置', 'key' => 'system.config.items.refresh'],
|
||||
['type' => 'rule', 'name' => '配置组编辑', 'key' => 'system.config.group.update'],
|
||||
['type' => 'rule', 'name' => '配置组删除', 'key' => 'system.config.items.item.delete'],
|
||||
['type' => 'rule', 'name' => '配置组列表', 'key' => 'system.config.group.query'],
|
||||
['type' => 'rule', 'name' => '配置组新增', 'key' => 'system.config.group.create'],
|
||||
]
|
||||
],
|
||||
[
|
||||
'type' => 'route',
|
||||
'key' => 'system.mail',
|
||||
'name' => '邮件配置',
|
||||
'path' => '/system/mail',
|
||||
'local' => 'menu.system.mail',
|
||||
'children' => [
|
||||
['type' => 'rule', 'name' => '获取配置', 'key' => 'system.mail.config'],
|
||||
['type' => 'rule', 'name' => '保存配置', 'key' => 'system.mail.save'],
|
||||
['type' => 'rule', 'name' => '发送测试', 'key' => 'system.mail.test'],
|
||||
]
|
||||
],
|
||||
[
|
||||
'type' => 'route',
|
||||
'key' => 'system.storage',
|
||||
'name' => '存储配置',
|
||||
'path' => '/system/storage',
|
||||
'local' => 'menu.system.storage',
|
||||
'children' => [
|
||||
['type' => 'rule', 'name' => '获取配置', 'key' => 'system.storage.config'],
|
||||
['type' => 'rule', 'name' => '保存配置', 'key' => 'system.storage.save'],
|
||||
['type' => 'rule', 'name' => '测试连接', 'key' => 'system.storage.test'],
|
||||
]
|
||||
],
|
||||
[
|
||||
'type' => 'route',
|
||||
'key' => 'system.ai',
|
||||
'name' => 'AI 配置',
|
||||
'path' => '/system/ai',
|
||||
'local' => 'menu.system.ai',
|
||||
'children' => [
|
||||
['type' => 'rule', 'name' => '获取可用AI列表', 'key' => 'system.ai.list'],
|
||||
['type' => 'rule', 'name' => '获取AI配置', 'key' => 'system.ai.config'],
|
||||
['type' => 'rule', 'name' => '保存AI配置', 'key' => 'system.ai.save'],
|
||||
['type' => 'rule', 'name' => '测试连接', 'key' => 'system.ai.test'],
|
||||
]
|
||||
],
|
||||
[
|
||||
'type' => "route",
|
||||
'name' => "系统信息",
|
||||
'local' => "menu.system.info",
|
||||
'key' => "system.info",
|
||||
'path' => "/system/info",
|
||||
]
|
||||
]
|
||||
],
|
||||
[
|
||||
'type' => 'menu',
|
||||
'name' => '小程序用户',
|
||||
'local' => 'menu.member',
|
||||
'icon' => 'UserOutlined',
|
||||
'key' => 'member',
|
||||
'children' => [
|
||||
[
|
||||
'type' => 'route',
|
||||
'name' => '用户列表',
|
||||
'key' => 'member.user',
|
||||
'path' => '/member/user',
|
||||
'local' => 'menu.member.user',
|
||||
'children' => [
|
||||
['type' => 'rule', 'name' => '查询列表', 'key' => 'member.user.query'],
|
||||
['type' => 'rule', 'name' => '新增用户', 'key' => 'member.user.create'],
|
||||
['type' => 'rule', 'name' => '修改用户', 'key' => 'member.user.update'],
|
||||
['type' => 'rule', 'name' => '删除用户', 'key' => 'member.user.delete'],
|
||||
],
|
||||
],
|
||||
[
|
||||
'type' => 'route',
|
||||
'name' => '地址管理',
|
||||
'key' => 'member.address',
|
||||
'path' => '/member/address',
|
||||
'local' => 'menu.member.address',
|
||||
'children' => [
|
||||
['type' => 'rule', 'name' => '查询列表', 'key' => 'member.address.query'],
|
||||
['type' => 'rule', 'name' => '新增地址', 'key' => 'member.address.create'],
|
||||
['type' => 'rule', 'name' => '修改地址', 'key' => 'member.address.update'],
|
||||
['type' => 'rule', 'name' => '删除地址', 'key' => 'member.address.delete'],
|
||||
],
|
||||
],
|
||||
],
|
||||
],
|
||||
[
|
||||
'type' => 'menu',
|
||||
'name' => '校园论坛',
|
||||
'local' => 'menu.forum',
|
||||
'icon' => 'MessageOutlined',
|
||||
'key' => 'forum',
|
||||
'children' => [
|
||||
[
|
||||
'type' => 'route',
|
||||
'name' => '话题管理',
|
||||
'key' => 'forum.category',
|
||||
'path' => '/forum/category',
|
||||
'local' => 'menu.forum.category',
|
||||
'children' => [
|
||||
['type' => 'rule', 'name' => '查询列表', 'key' => 'forum.category.query'],
|
||||
['type' => 'rule', 'name' => '新增分类', 'key' => 'forum.category.create'],
|
||||
['type' => 'rule', 'name' => '修改分类', 'key' => 'forum.category.update'],
|
||||
['type' => 'rule', 'name' => '删除分类', 'key' => 'forum.category.delete'],
|
||||
],
|
||||
],
|
||||
[
|
||||
'type' => 'route',
|
||||
'name' => '帖子管理',
|
||||
'key' => 'forum.post',
|
||||
'path' => '/forum/post',
|
||||
'local' => 'menu.forum.post',
|
||||
'children' => [
|
||||
['type' => 'rule', 'name' => '查询列表', 'key' => 'forum.post.query'],
|
||||
['type' => 'rule', 'name' => '新增帖子', 'key' => 'forum.post.create'],
|
||||
['type' => 'rule', 'name' => '修改帖子', 'key' => 'forum.post.update'],
|
||||
['type' => 'rule', 'name' => '删除帖子', 'key' => 'forum.post.delete'],
|
||||
],
|
||||
],
|
||||
[
|
||||
'type' => 'route',
|
||||
'name' => '评论管理',
|
||||
'key' => 'forum.comment',
|
||||
'path' => '/forum/comment',
|
||||
'local' => 'menu.forum.comment',
|
||||
'children' => [
|
||||
['type' => 'rule', 'name' => '查询列表', 'key' => 'forum.comment.query'],
|
||||
['type' => 'rule', 'name' => '新增评论', 'key' => 'forum.comment.create'],
|
||||
['type' => 'rule', 'name' => '修改评论', 'key' => 'forum.comment.update'],
|
||||
['type' => 'rule', 'name' => '删除评论', 'key' => 'forum.comment.delete'],
|
||||
],
|
||||
],
|
||||
[
|
||||
'type' => 'route',
|
||||
'name' => '敏感词管理',
|
||||
'key' => 'forum.sensitive-word',
|
||||
'path' => '/forum/sensitive-word',
|
||||
'local' => 'menu.forum.sensitive-word',
|
||||
'children' => [
|
||||
['type' => 'rule', 'name' => '查询列表', 'key' => 'forum.sensitive-word.query'],
|
||||
['type' => 'rule', 'name' => '新增敏感词', 'key' => 'forum.sensitive-word.create'],
|
||||
['type' => 'rule', 'name' => '修改敏感词', 'key' => 'forum.sensitive-word.update'],
|
||||
['type' => 'rule', 'name' => '删除敏感词', 'key' => 'forum.sensitive-word.delete'],
|
||||
],
|
||||
],
|
||||
[
|
||||
'type' => 'route',
|
||||
'name' => '点赞记录',
|
||||
'key' => 'forum.post-like',
|
||||
'path' => '/forum/post-like',
|
||||
'local' => 'menu.forum.post-like',
|
||||
'children' => [
|
||||
['type' => 'rule', 'name' => '查询列表', 'key' => 'forum.post-like.query'],
|
||||
['type' => 'rule', 'name' => '删除记录', 'key' => 'forum.post-like.delete'],
|
||||
],
|
||||
],
|
||||
[
|
||||
'type' => 'route',
|
||||
'name' => '收藏记录',
|
||||
'key' => 'forum.post-favorite',
|
||||
'path' => '/forum/post-favorite',
|
||||
'local' => 'menu.forum.post-favorite',
|
||||
'children' => [
|
||||
['type' => 'rule', 'name' => '查询列表', 'key' => 'forum.post-favorite.query'],
|
||||
['type' => 'rule', 'name' => '删除记录', 'key' => 'forum.post-favorite.delete'],
|
||||
],
|
||||
],
|
||||
],
|
||||
],
|
||||
[
|
||||
'type' => 'menu',
|
||||
'name' => '校园商户',
|
||||
'local' => 'menu.merchant',
|
||||
'icon' => 'ShopOutlined',
|
||||
'key' => 'merchant',
|
||||
'children' => [
|
||||
[
|
||||
'type' => 'route',
|
||||
'name' => '商户分类',
|
||||
'key' => 'merchant.category',
|
||||
'path' => '/merchant/category',
|
||||
'local' => 'menu.merchant.category',
|
||||
'children' => [
|
||||
['type' => 'rule', 'name' => '查询列表', 'key' => 'merchant.category.query'],
|
||||
['type' => 'rule', 'name' => '新增分类', 'key' => 'merchant.category.create'],
|
||||
['type' => 'rule', 'name' => '修改分类', 'key' => 'merchant.category.update'],
|
||||
['type' => 'rule', 'name' => '删除分类', 'key' => 'merchant.category.delete'],
|
||||
],
|
||||
],
|
||||
[
|
||||
'type' => 'route',
|
||||
'name' => '商户管理',
|
||||
'key' => 'merchant.store',
|
||||
'path' => '/merchant/store',
|
||||
'local' => 'menu.merchant.store',
|
||||
'children' => [
|
||||
['type' => 'rule', 'name' => '查询列表', 'key' => 'merchant.store.query'],
|
||||
['type' => 'rule', 'name' => '新增商户', 'key' => 'merchant.store.create'],
|
||||
['type' => 'rule', 'name' => '修改商户', 'key' => 'merchant.store.update'],
|
||||
['type' => 'rule', 'name' => '删除商户', 'key' => 'merchant.store.delete'],
|
||||
],
|
||||
],
|
||||
[
|
||||
'type' => 'route',
|
||||
'name' => '商品分类',
|
||||
'key' => 'merchant.product-category',
|
||||
'path' => '/merchant/product-category',
|
||||
'local' => 'menu.merchant.product-category',
|
||||
'children' => [
|
||||
['type' => 'rule', 'name' => '查询列表', 'key' => 'merchant.product-category.query'],
|
||||
['type' => 'rule', 'name' => '新增分类', 'key' => 'merchant.product-category.create'],
|
||||
['type' => 'rule', 'name' => '修改分类', 'key' => 'merchant.product-category.update'],
|
||||
['type' => 'rule', 'name' => '删除分类', 'key' => 'merchant.product-category.delete'],
|
||||
],
|
||||
],
|
||||
[
|
||||
'type' => 'route',
|
||||
'name' => '商品管理',
|
||||
'key' => 'merchant.product',
|
||||
'path' => '/merchant/product',
|
||||
'local' => 'menu.merchant.product',
|
||||
'children' => [
|
||||
['type' => 'rule', 'name' => '查询列表', 'key' => 'merchant.product.query'],
|
||||
['type' => 'rule', 'name' => '新增商品', 'key' => 'merchant.product.create'],
|
||||
['type' => 'rule', 'name' => '修改商品', 'key' => 'merchant.product.update'],
|
||||
['type' => 'rule', 'name' => '删除商品', 'key' => 'merchant.product.delete'],
|
||||
],
|
||||
],
|
||||
[
|
||||
'type' => 'route',
|
||||
'name' => '打印机管理',
|
||||
'key' => 'merchant.printer',
|
||||
'path' => '/merchant/printer',
|
||||
'local' => 'menu.merchant.printer',
|
||||
'children' => [
|
||||
['type' => 'rule', 'name' => '查询列表', 'key' => 'merchant.printer.query'],
|
||||
['type' => 'rule', 'name' => '新增打印机', 'key' => 'merchant.printer.create'],
|
||||
['type' => 'rule', 'name' => '修改打印机', 'key' => 'merchant.printer.update'],
|
||||
['type' => 'rule', 'name' => '删除打印机', 'key' => 'merchant.printer.delete'],
|
||||
],
|
||||
],
|
||||
[
|
||||
'type' => 'route',
|
||||
'name' => '打印任务',
|
||||
'key' => 'merchant.print-task',
|
||||
'path' => '/merchant/print-task',
|
||||
'local' => 'menu.merchant.print-task',
|
||||
'children' => [
|
||||
['type' => 'rule', 'name' => '查询列表', 'key' => 'merchant.print-task.query'],
|
||||
['type' => 'rule', 'name' => '删除任务', 'key' => 'merchant.print-task.delete'],
|
||||
],
|
||||
],
|
||||
],
|
||||
],
|
||||
[
|
||||
'type' => 'route',
|
||||
'name' => 'XinAdmin',
|
||||
'local' => "menu.xin-admin",
|
||||
'key' => "xin-admin",
|
||||
'icon' => "LinkOutlined",
|
||||
'link' => 1,
|
||||
'path' => 'https://xinadmin.cn',
|
||||
]
|
||||
];
|
||||
|
||||
$this->insertRules($rules);
|
||||
|
||||
DB::table('sys_role_rule')->insertUsing(
|
||||
['role_id', 'rule_id'],
|
||||
DB::table('sys_rule')
|
||||
->where('status', 1)
|
||||
->select(DB::raw('1 as role_id'), 'id')
|
||||
);
|
||||
|
||||
DB::table('sys_user_role')->insert([
|
||||
[
|
||||
'user_id' => 1,
|
||||
@@ -593,43 +133,4 @@ class SysUserSeeder extends Seeder
|
||||
]
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 递归插入权限规则数据
|
||||
*
|
||||
* @param array $rules 规则数据
|
||||
* @param int $pid 父级ID,默认为0(顶级)
|
||||
* @return void
|
||||
*/
|
||||
function insertRules(array $rules, int $pid = 0): void
|
||||
{
|
||||
$order = 0;
|
||||
foreach ($rules as $rule) {
|
||||
// 准备插入数据
|
||||
$insertData = [
|
||||
'parent_id' => $pid,
|
||||
'type' => $rule['type'],
|
||||
'key' => $rule['key'],
|
||||
'name' => $rule['name'],
|
||||
'path' => $rule['path'] ?? '',
|
||||
'icon' => $rule['icon'] ?? '',
|
||||
'order' => $order++,
|
||||
'local' => $rule['local'] ?? '',
|
||||
'status' => 1,
|
||||
'hidden' => 1,
|
||||
'link' => $rule['link'] ?? 0,
|
||||
'created_at' => now(),
|
||||
'updated_at' => now(),
|
||||
];
|
||||
|
||||
// 插入数据并获取插入的ID
|
||||
$currentId = DB::table('sys_rule')->insertGetId($insertData);
|
||||
|
||||
// 如果有子菜单,递归插入
|
||||
if (!empty($rule['children']) && is_array($rule['children'])) {
|
||||
$this->insertRules($rule['children'], $currentId);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user