Просмотр исходного кода

[智价云] 公司管理&采集配置&清洗配置临时提交

tangyuanwang 1 месяц назад
Родитель
Сommit
a7ff7d8555

+ 232 - 0
app/Http/Controllers/Manager/External/Company.php

@@ -0,0 +1,232 @@
+<?php
+
+namespace App\Http\Controllers\Manager\External;
+
+use App\Http\Controllers\Controller;
+use App\Http\Requests\Manager\External\Company as Request;
+use App\Models\Manager\External\Company as CompanyModel;
+use Illuminate\Support\Facades\DB;
+use Illuminate\Support\Carbon;
+
+/**
+ * 外部-公司管理
+ * @author    唐远望
+ * @version   1.0
+ * @date      2026-02-03
+ */
+class Company extends Controller
+{
+    /**
+     * 列表
+     * @author    唐远望
+     * @version   1.0
+     * @date      2026-02-03
+     * 
+     */
+    public function list(Request $request, CompanyModel $CompanyModel)
+    {
+        $request->scene('list')->validate();
+        // 查询条件
+        $map  = [];
+        $limit = request('limit', config('page_num', 10));
+        $status    = request('status', '');
+        $start_time = request('start_time', '');
+        $end_time = request('end_time', '');
+        $company_name = request('company_name', '');
+        // 时间条件
+        if ($start_time) $map[] = ['insert_time', '>=', strtotime($start_time)];
+        if ($end_time) $map[]   = ['insert_time', '<=', strtotime($end_time)];
+        // 其他条件
+        if (is_numeric($status)) $map[] = ['status', '=', $status];
+        if ($company_name) $map[] = ['company_name', 'like', "%$company_name%"];
+        // 查询数据
+        $result = $CompanyModel->query()
+            ->where($map)
+            ->orderByDesc('id')
+            ->paginate($limit)->toarray();
+        // 分配数据
+        if (!$result)  return json_send(['code' => 'success', 'msg' => '获取成功', 'data' => []]);
+        // 加载模板
+        return        json_send(['code' => 'success', 'msg' => '获取成功', 'data' => $result]);
+    }
+
+    /**
+     * 详情
+     * @author    唐远望
+     * @version   1.0
+     * @date      2026-02-03
+     */
+    public function detail(Request $request, CompanyModel $CompanyModel)
+    {
+        $request->scene('detail')->validate();
+        // 接收参数
+        $id = request('id', 0);
+        $map = ['id' => $id];
+        // 权限判断
+        $data = $CompanyModel->where($map)->first();
+        if (!$data)     return json_send(['code' => 'error', 'msg' => '记录不存在']);
+
+        $data->platform = isset($data->platform) ? explode(',', $data->platform) : '';
+        // 加载模板
+        return json_send(['code' => 'success', 'msg' => '获取成功', 'data' => $data]);
+    }
+
+    /**
+     * 添加
+     * @author    唐远望
+     * @version   1.0
+     * @date      2026-02-03
+     * 
+     */
+    public function add(Request $request, CompanyModel $CompanyModel)
+    {
+        $request->scene('add')->validate();
+        $all_data = request()->all();
+        //采集信息配置
+        $minimum_order_quantity = request('minimum_order_quantity', 1);
+        $sampling_cycle = request('sampling_cycle', '0');
+        $sampling_start_time = request('sampling_start_time', '');
+        $sampling_end_time = request('sampling_end_time', '');
+        $all_data['sampling_cycle'] = $sampling_cycle;
+        $all_data['sampling_start_time'] = $sampling_start_time ? strtotime($sampling_start_time . '00:00:00') : '0';
+        $all_data['sampling_end_time'] = $sampling_end_time ? strtotime($sampling_end_time . '23:59:59') : '0';
+        $all_data['minimum_order_quantity'] = $minimum_order_quantity;
+        $allow_sampling_time = Carbon::tomorrow()->startOfDay()->getTimestamp(); // 明天的开始时间(允许开始采集时间校验)
+        if ($all_data['sampling_start_time']  && $all_data['sampling_start_time'] < $allow_sampling_time) return json_send(['code' => 'error', 'msg' => '采集最早开始时间为明天']);
+        //查询是否存在
+        $map = ['company_name' => $all_data['company_name'], 'product_specs' => $all_data['product_specs'], 'platform' => $all_data['platform']];
+        $data = $CompanyModel->where($map)->first();
+        if ($data)     return json_send(['code' => 'error', 'msg' => '记录已存在']);
+        // 写入数据表
+        $result     =  $CompanyModel->addCompany($all_data);
+        // 如果操作失败
+        if (!$result)     return json_send(['code' => 'error', 'msg' => '新增失败']);
+        // 记录行为
+        $admin_id   = request('access_token.uid', 0); //用户ID
+        $is_admin   = request('access_token.is_admin'); //是否管理员操作 0=是1=否
+        $table_name = $CompanyModel->getTable();
+        $notes_type = 1; //操作类型,1添加,2修改,3=删除
+        $this->addAdminHistory('外部-公司管理', 0, $admin_id, $is_admin, $table_name, $notes_type, [], $all_data, '新增了公司' . $all_data['company_name'] . '信息');
+        // 告知结果
+        return json_send(['code' => 'success', 'msg' => '新增成功']);
+    }
+
+    /**
+     * 修改
+     * @author    唐远望
+     * @version   1.0
+     * @date      2026-02-03
+     * 
+     */
+    public function edit(Request $request, CompanyModel $CompanyModel)
+    {
+        $request->scene('edit')->validate();
+        // 接收参数
+        $id         = request('id', 0);
+        // 接收数据
+        $all_data = request()->all();
+        //采集信息配置
+        $minimum_order_quantity = request('minimum_order_quantity', 1);
+        $sampling_cycle = request('sampling_cycle', '0');
+        $sampling_start_time = request('sampling_start_time', '');
+        $sampling_end_time = request('sampling_end_time', '');
+        $all_data['sampling_cycle'] = $sampling_cycle;
+        $all_data['sampling_start_time'] = $sampling_start_time ? strtotime($sampling_start_time . '00:00:00') : '0';
+        $all_data['sampling_end_time'] = $sampling_end_time ? strtotime($sampling_end_time . '23:59:59') : '0';
+        $all_data['minimum_order_quantity'] = $minimum_order_quantity;
+        //查询是否存在
+        $map = ['company_name' => $all_data['company_name'], 'product_specs' => $all_data['product_specs'], 'platform' => $all_data['platform']];
+        $data = $CompanyModel->where($map)->where('id', '!=', $id)->first();
+        if ($data)     return json_send(['code' => 'error', 'msg' => '记录已存在']);
+        // 更新数据表
+        $where = ['id' => $id];
+        $Company = $CompanyModel->where($where)->first();
+        if (!$Company) return json_send(['code' => 'error', 'msg' => '记录不存在']);
+        $oldData = $Company->toarray();
+        $allow_sampling_time = Carbon::tomorrow()->startOfDay()->getTimestamp(); // 明天的开始时间(允许开始采集时间校验)
+        if ($all_data['sampling_start_time']  && $all_data['sampling_start_time'] < $allow_sampling_time) return json_send(['code' => 'error', 'msg' => '采集最早开始时间为明天']);
+        $result =  $CompanyModel->editCompany_content($Company, $all_data);
+        // 如果操作失败
+        if (!$result)     return json_send(['code' => 'error', 'msg' => '修改失败']);
+        // 记录行为
+        $admin_id   = request('access_token.uid', 0); //用户ID
+        $is_admin   = request('access_token.is_admin'); //是否管理员操作 0=是1=否
+        $table_name = $CompanyModel->getTable();
+        $notes_type = 2; //操作类型,1添加,2修改,3=删除
+        $this->addAdminHistory('外部-公司管理', 0, $admin_id, $is_admin, $table_name, $notes_type, $oldData, $all_data, '修改了公司' . $oldData['company_name'] . '信息');
+        // 告知结果
+        return json_send(['code' => 'success', 'msg' => '修改成功']);
+    }
+
+    /**
+     * 修改状态
+     * @author    唐远望
+     * @version   1.0
+     * @date      2026-02-03
+     * 
+     */
+    public function set_status(Request $request, CompanyModel $CompanyModel)
+    {
+        // 验证参数
+        $request->scene('set_status')->validate();
+        $is_admin = request('access_token.is_admin', '0');
+        // 接收数据
+        $id                = request('id', 0);
+        $status            = request('status', 0);
+        $where = ['id' => $id];
+        $Company = $CompanyModel->where($where)->first();
+        if (!$Company) return json_send(['code' => 'error', 'msg' => '记录不存在']);
+        // 执行修改
+        $result            =  $CompanyModel->changeStatus($Company, $status);
+        // 提示新增失败
+        if (!$result)    return json_send(['code' => 'error', 'msg' => '设置失败']);
+        // 记录行为
+        $admin_id   = request('access_token.uid', 0); //用户ID
+        $table_name = $CompanyModel->getTable();
+        $notes_type = 2; //操作类型,1添加,2修改,3=删除
+        $this->addAdminHistory('外部-公司管理', 0, $admin_id, $is_admin, $table_name, $notes_type, [], ['status' => $status], '修改了公司' . $Company->company_name . '状态');
+        // 告知结果
+        return             json_send(['code' => 'success', 'msg' => '设置成功']);
+    }
+
+
+    /**
+     * 删除
+     * @author    唐远望
+     * @version   1.0
+     * @date      2026-02-03
+     * 
+     */
+    public function delete(Request $request, CompanyModel $CompanyModel)
+    {
+        // 验证参数
+        $request->scene('delete')->validate();
+        // 接收数据
+        $id = request('id', 0);
+        // 查询用户
+        $where = ['id' => $id];
+        // 执行删除
+        $Company = $CompanyModel->where($where)->first();
+        if (!$Company) {
+            return             json_send(['code' => 'error', 'msg' => '删除失败,记录不存在']);
+        }
+        DB::beginTransaction();
+        try {
+            $Company->delete();
+            // 记录行为
+            $admin_id   = request('access_token.uid', 0); //用户ID
+            $is_admin   = request('access_token.is_admin'); //是否管理员操作 0=是1=否
+            $table_name = $CompanyModel->getTable();
+            $notes_type = 3; //操作类型,1添加,2修改,3=删除
+            $this->addAdminHistory('外部-公司管理', 0, $admin_id, $is_admin, $table_name, $notes_type, $Company->toarray(), [], '删除了公司' . $Company->company_name . '信息');
+            // 告知结果
+            DB::commit();
+            return             json_send(['code' => 'success', 'msg' => '删除成功']);
+            // 成功处理...
+        } catch (\Exception $e) {
+            DB::rollBack();
+            // 错误处理...
+            return             json_send(['code' => 'error', 'msg' => '删除失败']);
+        }
+    }
+}

+ 15 - 2
app/Http/Controllers/Manager/WashConfig/CompanyCategory.php

@@ -41,6 +41,7 @@ class CompanyCategory extends Controller
         if (is_numeric($status)) $map[] = ['status', '=', $status];
         if ($name) $map[] = ['name', 'like', "%$name%"];
         // 查询数据
+        if ($is_admin != 1 && $company_id != 0) $map[] = ['company_id', '=', $company_id];
         $result = $CompanyCategoryModel->query()
             ->where($map)
             ->orderByDesc('id')
@@ -73,6 +74,7 @@ class CompanyCategory extends Controller
         // 其他条件
         if ($name) $map[] = ['name', 'like', "%$name%"];
         if (is_numeric($status)) $map[] = ['status', '=', $status];
+        if ($is_admin != 1 && $company_id != 0) $map[] = ['company_id', '=', $company_id];
         $result = $CompanyCategoryModel->query()
             ->where($map)
             ->select(['id', 'name'])
@@ -98,6 +100,7 @@ class CompanyCategory extends Controller
         // 接收参数
         $id = request('id', 0);
         $map = ['id' => $id];
+        if ($is_admin != 1 && $company_id != 0) $map['company_id'] = $company_id;
         $data = $CompanyCategoryModel->where($map)->first();
         if (!$data)     return json_send(['code' => 'error', 'msg' => '记录不存在']);
         // 加载模板
@@ -122,9 +125,11 @@ class CompanyCategory extends Controller
         $all_data['store_scope'] = $store_scope;
         //查询是否存在
         $map = ['name' => $all_data['name']];
+        if ($is_admin != 1 && $company_id != 0) $map['company_id'] = $company_id;
         $data = $CompanyCategoryModel->where($map)->first();
         if ($data)     return json_send(['code' => 'error', 'msg' => '记录已存在']);
         // 写入数据表
+        $all_data['company_id'] = $company_id;
         $result     =  $CompanyCategoryModel->addCompanyCategory($all_data);
         // 如果操作失败
         if (!$result)     return json_send(['code' => 'error', 'msg' => '新增失败']);
@@ -157,10 +162,12 @@ class CompanyCategory extends Controller
         $all_data['store_scope'] = $store_scope;
         //查询是否存在
         $map = ['name' => $all_data['name']];
+        if ($is_admin != 1 && $company_id != 0) $map['company_id'] = $company_id;
         $data = $CompanyCategoryModel->where($map)->where('id', '!=', $id)->first();
         if ($data)     return json_send(['code' => 'error', 'msg' => '记录已存在']);
         // 更新数据表
         $where = ['id' => $id];
+        if ($is_admin != 1 && $company_id != 0) $where['company_id'] = $company_id;
         $CompanyCategory = $CompanyCategoryModel->where($where)->first();
         if (!$CompanyCategory) return json_send(['code' => 'error', 'msg' => '记录不存在']);
         $oldData = $CompanyCategory->toArray();
@@ -194,13 +201,16 @@ class CompanyCategory extends Controller
         $status            = request('status', 0);
         //如果是禁用,校验是否被使用
         if ($status == 1) {
-            $violation_store_count = $ViolationStoreModel->where(['category_id' => $id])->count();
+            $violation_store_where = ['category_id' => $id];
+            if ($is_admin != 1 && $company_id != 0) $violation_store_where['company_id'] = $company_id;
+            $violation_store_count = $ViolationStoreModel->where($violation_store_where)->count();
             if ($violation_store_count > 0) {
                 return json_send(['code' => 'error', 'msg' => '该分类下存在公司配置,禁用失败']);
             }
         }
         // 查询用户
         $where = ['id' => $id];
+        if ($is_admin != 1 && $company_id != 0) $where['company_id'] = $company_id;
         $CompanyCategory = $CompanyCategoryModel->where($where)->first();
         if (!$CompanyCategory) return json_send(['code' => 'error', 'msg' => '记录不存在']);
         // 执行修改
@@ -232,13 +242,16 @@ class CompanyCategory extends Controller
         $is_admin = request('access_token.is_admin', '0');//是否管理员操作 0=是1=否
         // 接收数据
         $id = request('id', 0);
-        $violation_store_count = $ViolationStoreModel->where(['category_id' => $id])->count();
+        $violation_store_where = ['category_id' => $id];
+        if ($is_admin != 1 && $company_id != 0) $violation_store_where['company_id'] = $company_id;
+        $violation_store_count = $ViolationStoreModel->where($violation_store_where)->count();
         if ($violation_store_count > 0) {
             return json_send(['code' => 'error', 'msg' => '该分类下存在公司配置,删除失败']);
         }
         // 查询用户
         $where = ['id' => $id];
         // 执行删除
+        if ($is_admin != 1 && $company_id != 0) $where['company_id'] = $company_id;
         $CompanyCategory = $CompanyCategoryModel->where($where)->first();
         if (!$CompanyCategory) return json_send(['code' => 'error', 'msg' => '记录不存在']);
         $result = $CompanyCategory->delete();

+ 50 - 6
app/Http/Controllers/Manager/WashConfig/ControlGoods.php

@@ -8,6 +8,7 @@ use App\Models\Manager\WashConfig\ControlGoods as ControlGoodsModel;
 use App\Models\Manager\WashConfig\ViolationStore as ViolationStoreModel;
 use App\Models\Manager\WashConfig\ControlGoodsCompany as ControlGoodsCompanyModel;
 use App\Models\Manager\WashConfig\ProductCategory as ProductCategoryModel;
+use Illuminate\Support\Facades\DB;
 
 /**
  * 数据清洗-强管控商品配置
@@ -51,6 +52,7 @@ class ControlGoods extends Controller
         if ($company_scope) $map[] = ['company_scope', '=', $company_scope];
         if ($category_id) $map[] = ['category_id', '=', $category_id];
         // 查询数据
+        if ($is_admin != 1 && $company_id != 0) $map[] = ['company_id', '=', $company_id];
         $result = $ControlGoodsModel->query()
             ->where($map)
             ->orderByDesc('id')
@@ -97,6 +99,7 @@ class ControlGoods extends Controller
         // 接收参数
         $id = request('id', 0);
         $map = ['id' => $id];
+        if ($is_admin != 1 && $company_id != 0) $map['company_id'] = $company_id;
         $data = $ControlGoodsModel->where($map)->first();
         if (!$data)     return json_send(['code' => 'error', 'msg' => '记录不存在']);
         //查询店铺名称
@@ -146,9 +149,11 @@ class ControlGoods extends Controller
         $all_data['specify_responsible_person'] = $specify_responsible_person;
         //查询是否存在
         $map = ['product_name' => $all_data['product_name'], 'product_specs' => $all_data['product_specs'], 'platform' => $all_data['platform']];
+        if ($is_admin != 1 && $company_id != 0) $map['company_id'] = $company_id;
         $data = $ControlGoodsModel->where($map)->first();
         if ($data)     return json_send(['code' => 'error', 'msg' => '记录已存在']);
         // 写入数据表
+        $all_data['company_id'] = $company_id;
         $result     =  $ControlGoodsModel->addControlGoods($all_data);
         // 如果操作失败
         if (!$result)     return json_send(['code' => 'error', 'msg' => '新增失败']);
@@ -182,6 +187,7 @@ class ControlGoods extends Controller
         $all_data['specify_responsible_person'] = $specify_responsible_person;
         //查询是否存在
         $map = ['product_name' => $all_data['product_name'], 'product_specs' => $all_data['product_specs'], 'platform' => $all_data['platform']];
+        if ($is_admin != 1 && $company_id != 0) $map['company_id'] = $company_id;
         $data = $ControlGoodsModel->where($map)->where('id', '!=', $id)->first();
         if ($data)     return json_send(['code' => 'error', 'msg' => '记录已存在']);
         // 更新数据表
@@ -209,12 +215,32 @@ class ControlGoods extends Controller
         // 接收数据
         $id                = request('id', 0);
         $status            = request('status', 0);
+        if ($status == 0) {
+            //获取管控商品启动数量
+            $control_product_where = ['status' => 0];
+            if ($is_admin != 1 && $company_id != 0) $control_product_where['company_id'] = $company_id;
+            $control_product_count = $ControlGoodsModel->where($control_product_where)->count();
+            //计算总数量
+            $product_totle = $control_product_count;
+            //判断是否超过限制
+            if ($product_totle >= 50) {
+                return json_send(['code' => 'error', 'msg' => '启用数量超过限制,管控商品不能超过50条']);
+            }
+        }
         // 查询用户
         $where = ['id' => $id];
+        if ($is_admin != 1 && $company_id != 0) $where['company_id'] = $company_id;
+        $LowProduct = $ControlGoodsModel->where($where)->first();
+        if (!$LowProduct) return json_send(['code' => 'error', 'msg' => '记录不存在']);
         // 执行修改
-        $result            =  $ControlGoodsModel->changeStatus($where, $status);
+        $result            =  $ControlGoodsModel->changeStatus($LowProduct, $status);
         // 提示新增失败
         if (!$result)    return json_send(['code' => 'error', 'msg' => '设置失败']);
+        // 记录行为
+        $admin_id   = request('access_token.uid', 0); //用户ID
+        $table_name = $ControlGoodsModel->getTable();
+        $notes_type = 2; //操作类型,1添加,2修改,3=删除
+        $this->addAdminHistory('清洗配置-管控商品管理',$company_id, $admin_id, $is_admin, $table_name, $notes_type, [], ['status' => $status], '修改了管控商品' . $LowProduct->product_name . '状态');
         // 告知结果
         return             json_send(['code' => 'success', 'msg' => '设置成功']);
     }
@@ -238,10 +264,28 @@ class ControlGoods extends Controller
         // 查询用户
         $where = ['id' => $id];
         // 执行删除
-        $result =  $ControlGoodsModel->deleteControlGoods($where);
-        // 提示删除失败
-        if (!$result)    return json_send(['code' => 'error', 'msg' => '删除失败']);
-        // 告知结果
-        return             json_send(['code' => 'success', 'msg' => '删除成功']);
+        if ($is_admin != 1 && $company_id != 0) $where['company_id'] = $company_id;
+        $LowProduct = $ControlGoodsModel->where($where)->first();
+        if (!$LowProduct) {
+            return json_send(['code' => 'error', 'msg' => '记录不存在']);
+        }
+        DB::beginTransaction();
+        try {
+            $LowProduct->delete();
+            // 记录行为
+            $admin_id   = request('access_token.uid', 0); //用户ID
+            $is_admin   = request('access_token.is_admin'); //是否管理员操作 0=是1=否
+            $table_name = $ControlGoodsModel->getTable();
+            $notes_type = 3; //操作类型,1添加,2修改,3=删除
+            $this->addAdminHistory('清洗配置-管控商品管理',$company_id, $admin_id, $is_admin, $table_name, $notes_type, $LowProduct->toarray(), [], '删除了管控商品' . $LowProduct->product_name . '信息');
+            DB::commit();
+            // 告知结果
+            return             json_send(['code' => 'success', 'msg' => '删除成功']);
+            // 成功处理...
+        } catch (\Exception $e) {
+            DB::rollBack();
+            // 错误处理...
+            return json_send(['code' => 'error', 'msg' => '删除失败']);
+        }
     }
 }

+ 13 - 2
app/Http/Controllers/Manager/WashConfig/LowPriceGoods.php

@@ -54,6 +54,7 @@ class LowPriceGoods extends Controller
         if ($company_scope) $map[] = ['company_scope', '=', $company_scope];
         if ($category_id) $map[] = ['category_id', '=', $category_id];
         // 查询数据
+        if ($is_admin != 1 && $company_id != 0) $map[] = ['company_id', '=', $company_id];
         $result = $LowPriceGoodsModel->query()
             ->where($map)
             ->orderByDesc('id')
@@ -100,6 +101,7 @@ class LowPriceGoods extends Controller
         // 接收参数
         $id = request('id', 0);
         $map = ['id' => $id];
+        if ($is_admin != 1 && $company_id != 0) $map['company_id'] = $company_id;
         $data = $LowPriceGoodsModel->where($map)->first();
         if (!$data)     return json_send(['code' => 'error', 'msg' => '记录不存在']);
         //查询店铺名称
@@ -159,9 +161,11 @@ class LowPriceGoods extends Controller
         $all_data['specify_responsible_person'] = $specify_responsible_person;
         //查询是否存在
         $map = ['product_name' => $all_data['product_name'], 'product_specs' => $all_data['product_specs'], 'platform' => $all_data['platform']];
+        if ($is_admin != 1 && $company_id != 0) $map['company_id'] = $company_id;
         $data = $LowPriceGoodsModel->where($map)->first();
         if ($data)     return json_send(['code' => 'error', 'msg' => '记录已存在']);
         // 写入数据表
+        $all_data['company_id'] = $company_id;
         $result     =  $LowPriceGoodsModel->addLowProduct($all_data);
         // 如果操作失败
         if (!$result)     return json_send(['code' => 'error', 'msg' => '新增失败']);
@@ -201,13 +205,16 @@ class LowPriceGoods extends Controller
         $all_data['specify_responsible_person'] = $specify_responsible_person;
         //查询是否存在
         $map = ['product_name' => $all_data['product_name'], 'product_specs' => $all_data['product_specs'], 'platform' => $all_data['platform']];
+        if ($is_admin != 1 && $company_id != 0) $map['company_id'] = $company_id;
         $data = $LowPriceGoodsModel->where($map)->where('id', '!=', $id)->first();
         if ($data)     return json_send(['code' => 'error', 'msg' => '记录已存在']);
         // 更新数据表
         $where = ['id' => $id];
+        if ($is_admin != 1 && $company_id != 0) $where['company_id'] = $company_id;
         $LowProduct = $LowPriceGoodsModel->where($where)->first();
         if (!$LowProduct) return json_send(['code' => 'error', 'msg' => '记录不存在']);
         $oldData = $LowProduct->toarray();
+        $all_data['company_id'] = $company_id;
         $result =  $LowPriceGoodsModel->editLowProduct_content($LowProduct, $all_data);
         // 如果操作失败
         if (!$result)     return json_send(['code' => 'error', 'msg' => '修改失败']);
@@ -238,9 +245,11 @@ class LowPriceGoods extends Controller
         $status            = request('status', 0);
         if ($status == 0) {
             //获取禁止商品启动数量
-            $violation_product_count = $ViolationProductModel->where('status', 0)->count();
+            $status_where = ['status' => 0];
+            if ($is_admin != 1 && $company_id != 0) $status_where['company_id'] = $company_id;
+            $violation_product_count = $ViolationProductModel->where($status_where)->count();
             //获取低价挂网商品启用数量
-            $lowprice_product_count = $LowPriceGoodsModel->where('status', 0)->count();
+            $lowprice_product_count = $LowPriceGoodsModel->where($status_where)->count();
             //计算总数量
             $product_totle = $violation_product_count + $lowprice_product_count;
             //判断是否超过限制
@@ -250,6 +259,7 @@ class LowPriceGoods extends Controller
         }
         // 查询用户
         $where = ['id' => $id];
+        if ($is_admin != 1 && $company_id != 0) $where['company_id'] = $company_id;
         $LowProduct = $LowPriceGoodsModel->where($where)->first();
         if (!$LowProduct) return json_send(['code' => 'error', 'msg' => '记录不存在']);
         // 执行修改
@@ -284,6 +294,7 @@ class LowPriceGoods extends Controller
         // 查询用户
         $where = ['id' => $id];
         // 执行删除
+        if ($is_admin != 1 && $company_id != 0) $where['company_id'] = $company_id;
         $LowProduct = $LowPriceGoodsModel->where($where)->first();
         if (!$LowProduct) {
             return json_send(['code' => 'error', 'msg' => '记录不存在']);

+ 9 - 0
app/Http/Controllers/Manager/WashConfig/PlatForm.php

@@ -41,6 +41,7 @@ class PlatForm extends Controller
         if (is_numeric($status)) $map[] = ['status', '=', $status];
         if ($name) $map[] = ['name', 'like', "%$name%"];
         // 查询数据
+        if ($is_admin != 1 && $company_id != 0) $map[] = ['company_id', '=', $company_id];
         $result = $PlatFormModel->query()
             ->where($map)
             ->orderByDesc('id')
@@ -80,6 +81,7 @@ class PlatForm extends Controller
         // 其他条件
         if ($name) $map[] = ['name', 'like', "%$name%"];
         if (is_numeric($status)) $map[] = ['status', '=', $status];
+        if ($is_admin != 1 && $company_id != 0) $map[] = ['company_id', '=', $company_id];
         $result = $PlatFormModel->query()
             ->where($map)
             ->select(['id', 'name'])
@@ -105,6 +107,7 @@ class PlatForm extends Controller
         // 接收参数
         $id = request('id', 0);
         $map = ['id' => $id];
+        if ($is_admin != 1 && $company_id != 0) $map[] = ['company_id', '=', $company_id];
         $data = $PlatFormModel->where($map)->first();
         if (!$data)     return json_send(['code' => 'error', 'msg' => '记录不存在']);
         $employee_ids = $data->employee_ids != '' ? explode(',', $data->employee_ids) : '';
@@ -132,9 +135,11 @@ class PlatForm extends Controller
         $all_data['employee_ids'] = $employee_ids;
         //查询是否存在
         $map = ['name' => $all_data['name']];
+        if ($is_admin != 1 && $company_id != 0) $map['company_id'] = $company_id;
         $data = $PlatFormModel->where($map)->first();
         if ($data)     return json_send(['code' => 'error', 'msg' => '记录已存在']);
         // 写入数据表
+        $all_data['company_id'] = $company_id;
         $result     =  $PlatFormModel->addPlatForm($all_data);
         // 如果操作失败
         if (!$result)     return json_send(['code' => 'error', 'msg' => '新增失败']);
@@ -171,9 +176,11 @@ class PlatForm extends Controller
         // if ($data)     return json_send(['code' => 'error', 'msg' => '记录已存在']);
         // 更新数据表
         $where = ['id' => $id];
+        if ($is_admin != 1 && $company_id != 0) $where['company_id'] = $company_id;
         $PlatForm = $PlatFormModel->where($where)->first();
         if (!$PlatForm) return json_send(['code' => 'error', 'msg' => '记录不存在']);
         $oldData = $PlatForm->toArray();
+        $all_data['company_id'] = $company_id;
         $result =  $PlatFormModel->updatePlatForm($PlatForm, $all_data);
         // 如果操作失败
         if (!$result)     return json_send(['code' => 'error', 'msg' => '修改失败']);
@@ -204,6 +211,7 @@ class PlatForm extends Controller
         $status            = request('status', 0);
         // 查询用户
         $where = ['id' => $id];
+        if ($is_admin != 1 && $company_id != 0) $where['company_id'] = $company_id;
         $PlatForm = $PlatFormModel->where($where)->first();
         if (!$PlatForm) return json_send(['code' => 'error', 'msg' => '记录不存在']);
         // 执行修改
@@ -238,6 +246,7 @@ class PlatForm extends Controller
         // 查询用户
         $where = ['id' => $id];
         // 执行删除
+        if ($is_admin != 1 && $company_id != 0) $where['company_id'] = $company_id;
         $PlatForm = $PlatFormModel->where($where)->first();
         if (!$PlatForm) return json_send(['code' => 'error', 'msg' => '记录不存在']);
         $result = $PlatForm->delete();

+ 18 - 4
app/Http/Controllers/Manager/WashConfig/ProductCategory.php

@@ -42,6 +42,7 @@ class ProductCategory extends Controller
         if (is_numeric($status)) $map[] = ['status', '=', $status];
         if ($name) $map[] = ['name', 'like', "%$name%"];
         // 查询数据
+        if ($is_admin != 1 && $company_id != 0) $map[] = ['company_id', '=', $company_id];
         $result = $ProductCategoryModel->query()
             ->where($map)
             ->orderByDesc('id')
@@ -74,6 +75,7 @@ class ProductCategory extends Controller
         // 其他条件
         if ($name) $map[] = ['name', 'like', "%$name%"];
         if (is_numeric($status)) $map[] = ['status', '=', $status];
+        if ($is_admin != 1 && $company_id != 0) $map[] = ['company_id', '=', $company_id];
         $result = $ProductCategoryModel->query()
             ->where($map)
             ->orderByDesc('id')
@@ -98,6 +100,7 @@ class ProductCategory extends Controller
         // 接收参数
         $id = request('id', 0);
         $map = ['id' => $id];
+        if ($is_admin != 1 && $company_id != 0) $map['company_id'] = $company_id;
         $data = $ProductCategoryModel->where($map)->first();
         if (!$data)     return json_send(['code' => 'error', 'msg' => '记录不存在']);
         // 加载模板
@@ -122,9 +125,11 @@ class ProductCategory extends Controller
         $all_data['store_scope'] = $store_scope;
         //查询是否存在
         $map = ['name' => $all_data['name']];
+        if ($is_admin != 1 && $company_id != 0) $map['company_id'] = $company_id;
         $data = $ProductCategoryModel->where($map)->first();
         if ($data)     return json_send(['code' => 'error', 'msg' => '记录已存在']);
         // 写入数据表
+        $all_data['company_id'] = $company_id;
         $result     =  $ProductCategoryModel->addProductCategory($all_data);
         // 如果操作失败
         if (!$result)     return json_send(['code' => 'error', 'msg' => '新增失败']);
@@ -157,13 +162,16 @@ class ProductCategory extends Controller
         $all_data['store_scope'] = $store_scope;
         //查询是否存在
         $map = ['name' => $all_data['name']];
+        if ($is_admin != 1 && $company_id != 0) $map['company_id'] = $company_id;
         $data = $ProductCategoryModel->where($map)->where('id', '!=', $id)->first();
         if ($data)     return json_send(['code' => 'error', 'msg' => '记录已存在']);
         // 更新数据表
         $where = ['id' => $id];
+        if ($is_admin != 1 && $company_id != 0) $where['company_id'] = $company_id;
         $ProductCategory = $ProductCategoryModel->where($where)->first();
         if (!$ProductCategory) return json_send(['code' => 'error', 'msg' => '记录不存在']);
         $oldData = $ProductCategory->toarray();
+        $all_data['company_id'] = $company_id;
         $result =  $ProductCategoryModel->editProductCategory_content($ProductCategory, $all_data);
         // 如果操作失败
         if (!$result)     return json_send(['code' => 'error', 'msg' => '修改失败']);
@@ -194,17 +202,20 @@ class ProductCategory extends Controller
         $status            = request('status', 0);
         //如果是禁用,校验是否被使用
         if ($status == 1) {
-            $low_price_goods_count = $LowPriceGoodsModel->where(['category_id' => $id])->count();
+            $product_where = ['category_id' => $id];
+            if ($is_admin != 1 && $company_id != 0) $product_where['company_id'] = $company_id;
+            $low_price_goods_count = $LowPriceGoodsModel->where($product_where)->count();
             if ($low_price_goods_count > 0) {
                 return json_send(['code' => 'error', 'msg' => '该分类下存在低价商品配置,禁用失败']);
             }
-            $violation_product_count = $ViolationProductModel->where(['category_id' => $id])->count();
+            $violation_product_count = $ViolationProductModel->where($product_where)->count();
             if ($violation_product_count > 0) {
                 return json_send(['code' => 'error', 'msg' => '该分类下存在禁止商品配置,禁用失败']);
             }
         }
         // 查询用户
         $where = ['id' => $id];
+        if ($is_admin != 1 && $company_id != 0) $where['company_id'] = $company_id;
         $ProductCategory = $ProductCategoryModel->where($where)->first();
         if (!$ProductCategory) return json_send(['code' => 'error', 'msg' => '记录不存在']);
         // 执行修改
@@ -236,17 +247,20 @@ class ProductCategory extends Controller
         $is_admin = request('access_token.is_admin', '0');//是否管理员操作 0=是1=否
         // 接收数据
         $id = request('id', 0);
-        $low_price_goods_count = $LowPriceGoodsModel->where(['category_id' => $id])->count();
+        $product_where = ['category_id' => $id];
+        if ($is_admin != 1 && $company_id != 0) $product_where['company_id'] = $company_id;
+        $low_price_goods_count = $LowPriceGoodsModel->where($product_where)->count();
         if ($low_price_goods_count > 0) {
             return json_send(['code' => 'error', 'msg' => '该分类下存在低价商品配置,删除失败']);
         }
-        $violation_product_count = $ViolationProductModel->where(['category_id' => $id])->count();
+        $violation_product_count = $ViolationProductModel->where($product_where)->count();
         if ($violation_product_count > 0) {
             return json_send(['code' => 'error', 'msg' => '该分类下存在禁止商品配置,删除失败']);
         }
         // 查询用户
         $where = ['id' => $id];
         // 执行删除
+        if ($is_admin != 1 && $company_id != 0) $where['company_id'] = $company_id;
         $ProductCategory = $ProductCategoryModel->where($where)->first();
         if (!$ProductCategory) {
             return json_send(['code' => 'error', 'msg' => '记录不存在']);

+ 8 - 2
app/Http/Controllers/Manager/WashConfig/ViolationProduct.php

@@ -54,6 +54,7 @@ class ViolationProduct extends Controller
         if ($company_scope) $map[] = ['company_scope', '=', $company_scope];
         if ($category_id) $map[] = ['category_id', '=', $category_id];
         // 查询数据
+        if ($is_admin != 1 && $company_id != 0) $map[] = ['company_id', '=', $company_id];
         $result = $ViolationProductModel->query()
             ->where($map)
             ->orderByDesc('id')
@@ -100,6 +101,7 @@ class ViolationProduct extends Controller
         // 接收参数
         $id = request('id', 0);
         $map = ['id' => $id];
+        if ($is_admin != 1 && $company_id != 0) $map['company_id'] = $company_id;
         $data = $ViolationProductModel->where($map)->first();
         if (!$data)     return json_send(['code' => 'error', 'msg' => '记录不存在']);
         //查询店铺名称
@@ -137,10 +139,12 @@ class ViolationProduct extends Controller
         $request->scene('add')->validate();
         $company_id = request('access_token.company_id', '0');
         $is_admin = request('access_token.is_admin', '0');//是否管理员操作 0=是1=否
+        $status_where = ['status' => 0];
+        if ($is_admin != 1 && $company_id != 0) $status_where['company_id'] = $company_id;
         //获取禁止商品启动数量
-        $violation_product_count = $ViolationProductModel->where('status', 0)->count();
+        $violation_product_count = $ViolationProductModel->where($status_where)->count();
         //获取低价挂网商品启用数量
-        $lowprice_product_count = $LowPriceGoodsModel->where('status', 0)->count();
+        $lowprice_product_count = $LowPriceGoodsModel->where($status_where)->count();
         //计算总数量
         $product_totle = $violation_product_count + $lowprice_product_count;
         //判断是否超过限制
@@ -159,9 +163,11 @@ class ViolationProduct extends Controller
         $all_data['specify_responsible_person'] = $specify_responsible_person;
         //查询是否存在
         $map = ['product_name' => $all_data['product_name'], 'product_specs' => $all_data['product_specs'], 'platform' => $all_data['platform']];
+        if ($is_admin != 1 && $company_id != 0) $map['company_id'] = $company_id;
         $data = $ViolationProductModel->where($map)->first();
         if ($data)     return json_send(['code' => 'error', 'msg' => '记录已存在']);
         // 写入数据表
+        $all_data['company_id'] = $company_id;
         $result     =  $ViolationProductModel->addViolationProduct($all_data);
         // 如果操作失败
         if (!$result)     return json_send(['code' => 'error', 'msg' => '新增失败']);

+ 13 - 2
app/Http/Controllers/Manager/WashConfig/ViolationStore.php

@@ -53,6 +53,7 @@ class ViolationStore extends Controller
         if ($store_type) $map[] = ['store_type', '=', $store_type];
         if ($category_id) $map[] = ['category_id', '=', $category_id];
         // 查询数据
+        if ($is_admin != 1 && $company_id != 0) $map[] = ['company_id', '=', $company_id];
         $result = $ViolationStoreModel->query()
             ->where($map)
             ->orderByDesc('id')
@@ -107,6 +108,7 @@ class ViolationStore extends Controller
         if ($store_name) $map[] = ['store_name', 'like', "%$store_name%"];
         if ($category_id) $map[] = ['category_id', '=', $category_id];
         // 查询数据
+        if ($is_admin != 1 && $company_id != 0) $map[] = ['company_id', '=', $company_id];
         $result = $ViolationStoreModel->query()
             ->where($map)
             ->orderByDesc('id')
@@ -131,6 +133,7 @@ class ViolationStore extends Controller
         // 接收参数
         $id = request('id', 0);
         $map = ['id' => $id];
+        if ($is_admin != 1 && $company_id != 0) $map['company_id'] = $company_id;
         $data = $ViolationStoreModel->where($map)->first();
         if (!$data)     return json_send(['code' => 'error', 'msg' => '记录不存在']);
         $employee_ids = $data->employee_ids != '' ? explode(',', $data->employee_ids) : '';
@@ -174,9 +177,11 @@ class ViolationStore extends Controller
         $all_data['platform'] = $platform;
         //查询是否存在
         $map = ['social_credit_code' => $all_data['social_credit_code']];
+        if ($is_admin != 1 && $company_id != 0) $map['company_id'] = $company_id;
         $data = $ViolationStoreModel->where($map)->first();
         if ($data)     return json_send(['code' => 'error', 'msg' => '营业执照记录已存在']);
         // 写入数据表
+        $all_data['company_id'] = $company_id;
         $result     =  $ViolationStoreModel->addViolationStore($all_data);
         // 如果操作失败
         if (!$result)     return json_send(['code' => 'error', 'msg' => '新增失败']);
@@ -219,13 +224,16 @@ class ViolationStore extends Controller
         $all_data['platform'] = $platform;
         //查询是否存在
         $map = ['social_credit_code' => $all_data['social_credit_code']];
+        if ($is_admin != 1 && $company_id != 0) $map['company_id'] = $company_id;
         $data = $ViolationStoreModel->where($map)->where('id', '!=', $id)->first();
         if ($data)     return json_send(['code' => 'error', 'msg' => '记录已存在']);
         // 更新数据表
         $where = ['id' => $id];
+        if ($is_admin != 1 && $company_id != 0) $where['company_id'] = $company_id;
         $ViolationStore = $ViolationStoreModel->where($where)->first();
         if (!$ViolationStore) return json_send(['code' => 'error', 'msg' => '记录不存在']);
         $oldData = $ViolationStore->toarray();
+        $all_data['company_id'] = $company_id;
         $result =  $ViolationStoreModel->updateViolationStore($ViolationStore, $all_data);
         // 如果操作失败
         if (!$result)     return json_send(['code' => 'error', 'msg' => '修改失败']);
@@ -256,6 +264,7 @@ class ViolationStore extends Controller
         $status            = request('status', 0);
         // 查询用户
         $where = ['id' => $id];
+        if ($is_admin != 1 && $company_id != 0) $where['company_id'] = $company_id;
         $ViolationStore = $ViolationStoreModel->where($where)->first();
         if (!$ViolationStore) return json_send(['code' => 'error', 'msg' => '记录不存在']);
         // 执行修改
@@ -287,12 +296,14 @@ class ViolationStore extends Controller
         $is_admin = request('access_token.is_admin', '0');
         // 接收数据
         $id = request('id', 0);
+        $company_where = ['company_id' => $id];
+        if ($is_admin != 1 && $company_id != 0) $where['company_id'] = $company_id;
         //查询是否已经被使用
-        $use_low_price_goods_company_log = $LowPriceGoodsCompanyModel->where('company_id', $id)->first();
+        $use_low_price_goods_company_log = $LowPriceGoodsCompanyModel->where($company_where)->first();
         if ($use_low_price_goods_company_log) {
             return json_send(['code' => 'error', 'msg' => '该记录已被使用在低价商品配置中,不能删除']);
         }
-        $use_violation_product_company_log = $ViolationProductCompanyModel->where('company_id', $id)->first();
+        $use_violation_product_company_log = $ViolationProductCompanyModel->where($company_where)->first();
         if ($use_violation_product_company_log) {
             return json_send(['code' => 'error', 'msg' => '该记录已被使用在违规商品配置中,不能删除']);
         }

+ 70 - 0
app/Http/Requests/Manager/External/Company.php

@@ -0,0 +1,70 @@
+<?php
+
+namespace App\Http\Requests\Manager\External;
+
+use App\Http\Requests\BaseRequest;
+
+/**
+ * 采集配置-商品信息验证
+ * @author 唐远望
+ * @version 1.0
+ * @date 2026-02-02
+ * 
+ */
+class Company extends BaseRequest
+{
+    /**
+     * 获取应用于请求的规则
+     *
+     * @return array
+     */
+    public function rules()
+    {
+        // 返回结果
+        return      [
+            'name'                 => 'required',
+            'id'                => 'required|integer|gt:0',
+            'status'            => 'required|integer|in:0,1',
+            'page'              => 'integer|min:1',
+            'limit'             => 'integer|min:1',
+            'sort'              => 'required|integer|min:0',
+            'company_name'      => 'required',
+            'social_credit_code'    => 'required',
+        ];
+    }
+
+
+    // 场景列表
+    protected   $scenes         = [
+        'detail'             => ['id'],
+        'list'               => ['page', 'limit'],
+        'add'                      => ['company_name','social_credit_code'],
+        'edit'                  => ['id','company_name','social_credit_code'],
+        'set_status'              => ['id', 'status'],
+        'delete'                  => ['id'],
+    ];
+
+    /**
+     * 获取已定义验证规则的错误消息
+     *
+     * @return array
+     */
+    public function messages()
+    {
+        return [
+            'name.required'     => '名称必填',
+            'id.required'       => 'ID未知',
+            'id.integer'        => 'ID格式错误',
+            'id.gt'               => 'ID格式错误',
+            'status.required'   => '状态未知',
+            'status.integer'    => '状态格式错误',
+            'status.in'         => '状态格式错误',
+            'page.integer'      => '页码格式错误',
+            'page.min'          => '页码格式错误',
+            'limit.integer'     => '每页数量格式错误',
+            'limit.min'         => '每页数量格式错误',
+            'company_name.required' => '公司名称必填',
+            'social_credit_code.required' => '社会信用代码必填',
+        ];
+    }
+}

+ 168 - 0
app/Models/Manager/External/Company.php

@@ -0,0 +1,168 @@
+<?php
+
+namespace App\Models\manager\External;
+
+use Illuminate\Database\Eloquent\Factories\HasFactory;
+use Illuminate\Database\Eloquent\Model;
+use Illuminate\Support\Facades\DB;
+
+/**
+ * 外部-公司管理
+ * @author: 唐远望
+ * @version: 1.0
+ * @date: 2026-02-02
+ */
+class Company extends Model
+{
+    use HasFactory;
+    // 与模型关联的表名
+    protected $table = 'external_company';
+    // 是否主动维护时间戳
+    public $timestamps = false;
+    // 定义时间戳字段名
+    // const CREATED_AT = 'insert_time';
+    // const UPDATED_AT = 'update_time';
+
+
+    /**
+     * 添加
+     * @author 唐远望
+     * @version 1.0
+     * @date 2026-02-02
+     */
+    public function addCompany_content($data)
+    {
+        $insert_data = [
+            'company_name' => $data['company_name'],
+            'social_credit_code' => $data['social_credit_code'],
+            'insert_time' => time(),
+        ];
+        $Company_id = $this->insertGetId($insert_data);
+        return $Company_id;
+    }
+
+
+    /**
+     * 写入数据
+     * @author 唐远望
+     * @version 1.0
+     * @date 2026-02-02
+     * @param $data
+     * @return bool
+     */
+    public function addCompany($data)
+    {
+        DB::beginTransaction();
+        try {
+            $insert_data = [
+                'company_name' => $data['company_name'],
+                'social_credit_code' => $data['social_credit_code'],
+                'insert_time' => time(),
+            ];
+            $Company_id = $this->insertGetId($insert_data);
+            DB::commit();
+            return $Company_id;
+            // 成功处理...
+        } catch (\Exception $e) {
+            DB::rollBack();
+            // 错误处理...
+            return false;
+        }
+    }
+
+
+    /**
+     * 编辑内容
+     * @author 唐远望
+     * @version 1.0
+     * @date 2026-02-02
+     * @param $data
+     * @return bool
+     */
+    public function editCompany_content($Company, $data)
+    {
+        DB::beginTransaction();
+        try {
+            $Company->company_name = $data['company_name'];
+            $Company->social_credit_code = $data['social_credit_code'];
+            $Company->update_time = time();
+            $Company->save();
+            DB::commit();
+            return true;
+            // 成功处理...
+        } catch (\Exception $e) {
+            DB::rollBack();
+            // 错误处理...
+            return false;
+        }
+    }
+
+
+
+    /**
+     * 更新数据
+     * @author 唐远望
+     * @version 1.0
+     * @date 2026-02-02
+     * @param $data
+     * @return bool
+     */
+    public function updateCompany($where, $data)
+    {
+        DB::beginTransaction();
+        try {
+            $this->editCompany_content($where, $data);
+            DB::commit();
+            return true;
+            // 成功处理...
+        } catch (\Exception $e) {
+            DB::rollBack();
+            // 错误处理...
+            return false;
+        }
+    }
+
+    /**
+     * 修改状态
+     * @author 唐远望
+     * @version 1.0
+     * @date 2026-02-02
+     * @param $id
+     * @param $status
+     * @return bool
+     */
+    public function changeStatus($Company, $status)
+    {
+        $Company->status = $status;
+        $Company->update_time = time();
+        $Company->save();
+        return true;
+    }
+
+    /**
+     * 删除数据
+     * @author 唐远望
+     * @version 1.0
+     * @date 2026-02-02
+     * @param $id
+     * @return bool
+     */
+    public function deleteCompany($where)
+    {
+        $Company = $this->where($where)->first();
+        if (!$Company) {
+            return false;
+        }
+        DB::beginTransaction();
+        try {
+            $Company->delete();
+            DB::commit();
+            return true;
+            // 成功处理...
+        } catch (\Exception $e) {
+            DB::rollBack();
+            // 错误处理...
+            return false;
+        }
+    }
+}

+ 2 - 0
app/Models/Manager/WashConfig/CompanyCategory.php

@@ -34,6 +34,7 @@ class CompanyCategory extends Model
     {
         $insert_data = [
             'name' => $data['name'],
+            'company_id' => $data['company_id'],
             'insert_time' => time(),
         ];
         $CompanyCategory_id = $this->insertGetId($insert_data);
@@ -76,6 +77,7 @@ class CompanyCategory extends Model
     public function editCompanyCategory_content($CompanyCategory, $data)
     {
         $CompanyCategory->name = $data['name'];
+        $CompanyCategory->company_id = $data['company_id'];
         $CompanyCategory->update_time = time();
         $CompanyCategory->save();
         return true;

+ 3 - 0
app/Models/Manager/WashConfig/ControlGoods.php

@@ -35,6 +35,7 @@ class ControlGoods extends Model
     public function addControlGoods_content($data)
     {
         $insert_data = [
+            'company_id' => $data['company_id'],
             'platform' => $data['platform'],
             'product_name' => $data['product_name'],
             'product_specs' => $data['product_specs'],
@@ -63,6 +64,7 @@ class ControlGoods extends Model
         try {
             $ControlGoodsCompanyModel = new ControlGoodsCompanyModel();
             $insert_data = [
+                'company_id' => $data['company_id'],
                 'platform' => $data['platform'],
                 'product_name' => $data['product_name'],
                 'product_specs' => $data['product_specs'],
@@ -114,6 +116,7 @@ class ControlGoods extends Model
             $ControlGoodsCompanyModel = new ControlGoodsCompanyModel();
             $store_scope = $data['store_scope'] != '' ? 2 : 1; //店铺范围1=全部店铺 2=指定店铺
             $company_scope = $data['company_scope'] != '' ? 2 : 1; //公司范围1=全部公司 2=指定公司
+            $ControlGoods->company_id = $data['company_id'];
             $ControlGoods->platform = $data['platform'];
             $ControlGoods->product_name = $data['product_name'];
             $ControlGoods->product_specs = $data['product_specs'];

+ 2 - 0
app/Models/Manager/WashConfig/LowPriceGoods.php

@@ -64,6 +64,7 @@ class LowPriceGoods extends Model
         try {
             $LowPriceGoodsCompanyModel = new LowPriceGoodsCompanyModel();
             $insert_data = [
+                'company_id'=> $data['company_id'],
                 'platform' => $data['platform'],
                 'product_name' => $data['product_name'],
                 'product_specs' => $data['product_specs'],
@@ -113,6 +114,7 @@ class LowPriceGoods extends Model
             $LowPriceGoodsCompanyModel = new LowPriceGoodsCompanyModel();
             $store_scope = $data['store_scope'] != '' ? 2 : 1; //店铺范围1=全部店铺 2=指定店铺
             $company_scope = $data['company_scope'] != '' ? 2 : 1; //公司范围1=全部公司 2=指定公司
+            $LowProduct->company_id = $data['company_id'];
             $LowProduct->platform = $data['platform'];
             $LowProduct->product_name = $data['product_name'];
             $LowProduct->product_specs = $data['product_specs'];

+ 2 - 0
app/Models/Manager/WashConfig/PlatForm.php

@@ -58,6 +58,7 @@ class PlatForm extends Model
         try {
             $PlatFormMemberModel = new PlatFormMemberModel();
             $insert_data = [
+                'company_id' => $data['company_id'],
                 'platform' => $data['platform'],
                 'employee_ids'  => $data['employee_ids'],
                 'insert_time' => time(),
@@ -122,6 +123,7 @@ class PlatForm extends Model
         DB::beginTransaction();
         try {
             // $PlatForm->name = $data['name'];
+            $PlatForm->company_id = $data['company_id'];
             $PlatForm->employee_ids = $data['employee_ids'];
             $PlatForm->update_time = time();
             $PlatForm->save();

+ 2 - 0
app/Models/Manager/WashConfig/ViolationProduct.php

@@ -63,6 +63,7 @@ class ViolationProduct extends Model
         try {
             $ViolationProductCompanyModel = new ViolationProductCompanyModel();
             $insert_data = [
+                'company_id' => $data['company_id'],
                 'platform' => $data['platform'],
                 'product_name' => $data['product_name'],
                 'product_specs' => $data['product_specs'],
@@ -110,6 +111,7 @@ class ViolationProduct extends Model
             $ViolationProductCompanyModel = new ViolationProductCompanyModel();
             $store_scope = $data['store_scope'] != '' ? 2 : 1; //店铺范围1=全部店铺 2=指定店铺
             $company_scope = $data['company_scope'] != '' ? 2 : 1; //公司范围1=全部公司 2=指定公司
+            $ViolationProduct->company_id = $data['company_id'];
             $ViolationProduct->platform = $data['platform'];
             $ViolationProduct->product_name = $data['product_name'];
             $ViolationProduct->product_specs = $data['product_specs'];

+ 5 - 0
app/Models/Manager/WashConfig/ViolationStore.php

@@ -36,6 +36,7 @@ class ViolationStore extends Model
     public function addViolationStore_content($data)
     {
         $insert_data = [
+            'company_id' => $data['company_id'],
             'platform' => $data['platform'],
             'category_id' => $data['category_id'],
             'company_name' => $data['company_name'],
@@ -67,6 +68,7 @@ class ViolationStore extends Model
         try {
             $ViolationCompanyMemberModel = new ViolationCompanyMemberModel();
             $insert_data = [
+                'company_id' => $data['company_id'],
                 'platform' => $data['platform'],
                 'category_id' => $data['category_id'],
                 'company_name' => $data['company_name'],
@@ -117,6 +119,8 @@ class ViolationStore extends Model
         if (!$ViolationStore) {
             return false;
         }
+        
+        $ViolationStore->company_id = $data['company_id'];
         $ViolationStore->platform = $data['platform'];
         $ViolationStore->category_id = $data['category_id'];
         $ViolationStore->company_name = $data['company_name'];
@@ -146,6 +150,7 @@ class ViolationStore extends Model
     {
         DB::beginTransaction();
         try {
+            $ViolationStore->company_id = $data['company_id'];
             $ViolationStore->category_id = $data['category_id'];
             $ViolationStore->company_name = $data['company_name'];
             $ViolationStore->social_credit_code = $data['social_credit_code'];

+ 726 - 0
public/index.html

@@ -0,0 +1,726 @@
+<!DOCTYPE html>
+<html lang="zh-CN">
+<head>
+    <meta charset="UTF-8">
+    <meta name="viewport" content="width=device-width, initial-scale=1.0">
+    <title>微信扫码登录 - 官方实现</title>
+    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
+    <style>
+        * {
+            margin: 0;
+            padding: 0;
+            box-sizing: border-box;
+            font-family: 'Segoe UI', 'Microsoft YaHei', sans-serif;
+        }
+        
+        body {
+            background-color: #f5f7fa;
+            color: #333;
+            line-height: 1.6;
+            min-height: 100vh;
+            display: flex;
+            flex-direction: column;
+            align-items: center;
+            justify-content: center;
+            padding: 20px;
+        }
+        
+        .container {
+            width: 100%;
+            max-width: 900px;
+            display: flex;
+            flex-direction: column;
+            align-items: center;
+        }
+        
+        header {
+            text-align: center;
+            margin-bottom: 40px;
+            width: 100%;
+        }
+        
+        h1 {
+            color: #2c3e50;
+            margin-bottom: 10px;
+            font-size: 2.5rem;
+            display: flex;
+            align-items: center;
+            justify-content: center;
+            gap: 15px;
+        }
+        
+        .subtitle {
+            color: #7f8c8d;
+            font-size: 1.1rem;
+            max-width: 600px;
+            margin: 0 auto;
+        }
+        
+        .content-wrapper {
+            display: flex;
+            flex-direction: row;
+            width: 100%;
+            gap: 30px;
+            margin-bottom: 40px;
+        }
+        
+        .login-section {
+            flex: 1;
+            background-color: white;
+            border-radius: 16px;
+            box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
+            padding: 40px;
+            display: flex;
+            flex-direction: column;
+        }
+        
+        .info-section {
+            flex: 1;
+            background-color: white;
+            border-radius: 16px;
+            box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
+            padding: 40px;
+            display: flex;
+            flex-direction: column;
+        }
+        
+        .section-title {
+            font-size: 1.5rem;
+            color: #2c3e50;
+            margin-bottom: 25px;
+            padding-bottom: 15px;
+            border-bottom: 2px solid #f0f2f5;
+            display: flex;
+            align-items: center;
+            gap: 10px;
+        }
+        
+        #login_container {
+            width: 100%;
+            min-height: 320px;
+            display: flex;
+            justify-content: center;
+            align-items: center;
+            border-radius: 12px;
+            background-color: #f8fafc;
+            margin-bottom: 25px;
+            border: 1px solid #eaeaea;
+        }
+        
+        .qrcode-loading {
+            text-align: center;
+            color: #999;
+            font-size: 1.1rem;
+        }
+        
+        .qrcode-loading i {
+            font-size: 3rem;
+            margin-bottom: 15px;
+            color: #07c160;
+            display: block;
+        }
+        
+        .status-indicator {
+            margin-top: 20px;
+            padding: 15px;
+            border-radius: 10px;
+            background-color: #f8fafc;
+            border-left: 4px solid #07c160;
+        }
+        
+        .status-title {
+            font-weight: 600;
+            color: #2c3e50;
+            margin-bottom: 8px;
+            display: flex;
+            align-items: center;
+            gap: 8px;
+        }
+        
+        .status-desc {
+            color: #666;
+            font-size: 0.95rem;
+        }
+        
+        .steps-container {
+            margin-top: 10px;
+        }
+        
+        .step {
+            display: flex;
+            margin-bottom: 20px;
+            padding-bottom: 20px;
+            border-bottom: 1px solid #f0f2f5;
+        }
+        
+        .step:last-child {
+            margin-bottom: 0;
+            padding-bottom: 0;
+            border-bottom: none;
+        }
+        
+        .step-number {
+            width: 32px;
+            height: 32px;
+            border-radius: 50%;
+            background-color: #07c160;
+            color: white;
+            display: flex;
+            align-items: center;
+            justify-content: center;
+            font-weight: bold;
+            margin-right: 15px;
+            flex-shrink: 0;
+        }
+        
+        .step-content h4 {
+            color: #2c3e50;
+            margin-bottom: 5px;
+        }
+        
+        .step-content p {
+            color: #666;
+            font-size: 0.95rem;
+        }
+        
+        .config-section {
+            margin-top: 30px;
+            background-color: #f8fafc;
+            padding: 20px;
+            border-radius: 10px;
+        }
+        
+        .config-title {
+            font-size: 1.1rem;
+            color: #2c3e50;
+            margin-bottom: 15px;
+            display: flex;
+            align-items: center;
+            gap: 10px;
+        }
+        
+        .config-item {
+            margin-bottom: 15px;
+            display: flex;
+            flex-direction: column;
+        }
+        
+        .config-item label {
+            font-weight: 600;
+            color: #555;
+            margin-bottom: 5px;
+            font-size: 0.95rem;
+        }
+        
+        .config-item input {
+            padding: 10px 12px;
+            border-radius: 6px;
+            border: 1px solid #ddd;
+            font-size: 0.95rem;
+            transition: border-color 0.3s;
+        }
+        
+        .config-item input:focus {
+            outline: none;
+            border-color: #07c160;
+            box-shadow: 0 0 0 2px rgba(7, 193, 96, 0.1);
+        }
+        
+        .config-hint {
+            color: #888;
+            font-size: 0.85rem;
+            margin-top: 5px;
+        }
+        
+        .buttons-container {
+            display: flex;
+            gap: 15px;
+            margin-top: 25px;
+            flex-wrap: wrap;
+        }
+        
+        .btn {
+            padding: 12px 24px;
+            border-radius: 8px;
+            border: none;
+            font-size: 1rem;
+            font-weight: 600;
+            cursor: pointer;
+            transition: all 0.3s ease;
+            display: flex;
+            align-items: center;
+            justify-content: center;
+            gap: 8px;
+        }
+        
+        .btn-primary {
+            background-color: #07c160;
+            color: white;
+        }
+        
+        .btn-primary:hover {
+            background-color: #06ad56;
+            transform: translateY(-2px);
+            box-shadow: 0 5px 15px rgba(7, 193, 96, 0.2);
+        }
+        
+        .btn-secondary {
+            background-color: #f0f2f5;
+            color: #606266;
+        }
+        
+        .btn-secondary:hover {
+            background-color: #e4e6e9;
+            transform: translateY(-2px);
+        }
+        
+        .btn-refresh {
+            background-color: #1677ff;
+            color: white;
+        }
+        
+        .btn-refresh:hover {
+            background-color: #0d66d9;
+            transform: translateY(-2px);
+            box-shadow: 0 5px 15px rgba(22, 119, 255, 0.2);
+        }
+        
+        .btn:disabled {
+            opacity: 0.6;
+            cursor: not-allowed;
+            transform: none !important;
+            box-shadow: none !important;
+        }
+        
+        .note-box {
+            margin-top: 25px;
+            padding: 15px;
+            border-radius: 10px;
+            background-color: #fff9e6;
+            border-left: 4px solid #ffc107;
+        }
+        
+        .note-title {
+            font-weight: 600;
+            color: #e6a700;
+            margin-bottom: 8px;
+            display: flex;
+            align-items: center;
+            gap: 8px;
+        }
+        
+        .note-content {
+            color: #8a6d3b;
+            font-size: 0.9rem;
+            line-height: 1.5;
+        }
+        
+        .footer {
+            margin-top: 40px;
+            text-align: center;
+            color: #95a5a6;
+            font-size: 0.9rem;
+            width: 100%;
+            max-width: 900px;
+            padding-top: 20px;
+            border-top: 1px solid #eee;
+        }
+        
+        .wechat-qrcode {
+            text-align: center;
+            margin-top: 20px;
+        }
+        
+        .wechat-qrcode img {
+            max-width: 200px;
+            border-radius: 8px;
+            box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
+        }
+        
+        @media (max-width: 768px) {
+            .content-wrapper {
+                flex-direction: column;
+            }
+            
+            h1 {
+                font-size: 2rem;
+                flex-direction: column;
+                gap: 10px;
+            }
+            
+            .login-section, .info-section {
+                padding: 30px 20px;
+            }
+            
+            .buttons-container {
+                flex-direction: column;
+            }
+            
+            .btn {
+                width: 100%;
+            }
+        }
+        
+        @media (max-width: 480px) {
+            .section-title {
+                font-size: 1.3rem;
+            }
+            
+            #login_container {
+                min-height: 280px;
+            }
+        }
+    </style>
+</head>
+<body>
+    <div class="container">
+        <header>
+            <h1>
+                <i class="fab fa-weixin"></i>
+                微信官方扫码登录
+            </h1>
+            <p class="subtitle">
+                本页面使用微信官方提供的JS SDK实现扫码登录功能。请按照下方步骤配置参数并体验微信扫码登录流程。
+            </p>
+        </header>
+        
+        <div class="content-wrapper">
+            <div class="login-section">
+                <h2 class="section-title">
+                    <i class="fas fa-qrcode"></i>
+                    微信扫码登录
+                </h2>
+                
+                <!-- 微信登录二维码容器 -->
+                <div id="login_container">
+                    <div class="qrcode-loading">
+                        <i class="fas fa-spinner fa-spin"></i>
+                        <p>正在加载微信登录二维码...</p>
+                    </div>
+                </div>
+                
+                <div class="status-indicator">
+                    <div class="status-title">
+                        <i class="fas fa-info-circle"></i>
+                        状态监控
+                    </div>
+                    <p class="status-desc" id="statusText">等待二维码加载完成</p>
+                </div>
+                
+                <div class="buttons-container">
+                    <button class="btn btn-refresh" id="refreshBtn">
+                        <i class="fas fa-sync-alt"></i>
+                        刷新二维码
+                    </button>
+                    <button class="btn btn-secondary" id="testBtn">
+                        <i class="fas fa-mobile-alt"></i>
+                        模拟扫码测试
+                    </button>
+                </div>
+                
+                <div class="note-box">
+                    <div class="note-title">
+                        <i class="fas fa-exclamation-triangle"></i>
+                        重要提示
+                    </div>
+                    <div class="note-content">
+                        此演示使用了测试参数,在实际生产环境中需要:
+                        1. 在微信开放平台注册应用获取真实appid
+                        2. 配置有效的redirect_uri(授权回调地址)
+                        3. 部署在备案的域名下(微信要求HTTPS)
+                    </div>
+                </div>
+            </div>
+            
+            <div class="info-section">
+                <h2 class="section-title">
+                    <i class="fas fa-cogs"></i>
+                    配置说明
+                </h2>
+                
+                <div class="steps-container">
+                    <div class="step">
+                        <div class="step-number">1</div>
+                        <div class="step-content">
+                            <h4>获取AppID</h4>
+                            <p>访问微信开放平台,注册并创建网站应用,获取AppID和AppSecret</p>
+                        </div>
+                    </div>
+                    
+                    <div class="step">
+                        <div class="step-number">2</div>
+                        <div class="step-content">
+                            <h4>配置回调地址</h4>
+                            <p>在微信开放平台配置授权回调域名,必须与redirect_uri域名一致</p>
+                        </div>
+                    </div>
+                    
+                    <div class="step">
+                        <div class="step-number">3</div>
+                        <div class="step-content">
+                            <h4>部署代码</h4>
+                            <p>将配置好参数的代码部署到已备案的域名(必须支持HTTPS)</p>
+                        </div>
+                    </div>
+                </div>
+                
+                <div class="config-section">
+                    <h3 class="config-title">
+                        <i class="fas fa-sliders-h"></i>
+                        参数配置
+                    </h3>
+                    
+                    <div class="config-item">
+                        <label for="appid">AppID</label>
+                        <input type="text" id="appid" placeholder="请输入微信开放平台AppID" value="wxbdc5610cc59c1631">
+                        <div class="config-hint">此处为测试AppID,实际使用时请替换为自己的AppID</div>
+                    </div>
+                    
+                    <div class="config-item">
+                        <label for="redirect_uri">Redirect URI</label>
+                        <input type="text" id="redirect_uri" placeholder="请输入授权回调地址" value="https://open.weixin.qq.com/connect/qrconnect">
+                        <div class="config-hint">用户授权后微信会跳转到此地址,需与开放平台配置一致</div>
+                    </div>
+                    
+                    <div class="config-item">
+                        <label for="scope">Scope</label>
+                        <input type="text" id="scope" placeholder="请输入授权作用域" value="snsapi_login">
+                        <div class="config-hint">应用授权作用域,snsapi_login为微信登录专用</div>
+                    </div>
+                    
+                    <div class="buttons-container">
+                        <button class="btn btn-primary" id="applyConfigBtn">
+                            <i class="fas fa-check-circle"></i>
+                            应用配置
+                        </button>
+                        <button class="btn btn-secondary" id="resetConfigBtn">
+                            <i class="fas fa-undo"></i>
+                            重置配置
+                        </button>
+                    </div>
+                </div>
+                
+                <div class="wechat-qrcode">
+                    <p>使用微信扫描体验</p>
+                    <img src="https://res.wx.qq.com/a/wx_fed/assets/res/OTE0YTAw.png" alt="微信扫码">
+                </div>
+            </div>
+        </div>
+        
+        <footer class="footer">
+            <p>本页面使用微信官方JS SDK实现扫码登录功能 | 请遵循微信开放平台相关规范</p>
+            <p>© 2023 微信扫码登录演示 | 仅用于学习和演示目的</p>
+        </footer>
+    </div>
+
+    <!-- 微信官方JS SDK -->
+    <script src="https://res.wx.qq.com/connect/zh_CN/htmledition/js/wxLogin.js"></script>
+    
+    <script>
+        // 微信登录对象
+        let wxLoginObj = null;
+        
+        // 默认配置参数
+        const defaultConfig = {
+            self_redirect: true,
+            id: "login_container",
+            appid: "wxbdc5610cc59c1631", // 微信提供的测试AppID:wxbdc5610cc59c1631
+            scope: "snsapi_login",
+            redirect_uri: encodeURIComponent("https://passport.yhd.com/wechat/callback.do"),
+            state: "STATE", // 可以自定义的参数,用于防止CSRF攻击
+            style: "black", // 二维码样式:black黑色,white白色
+            href: "" // 自定义样式链接,可以为空
+        };
+        
+        // DOM元素
+        const loginContainer = document.getElementById('login_container');
+        const statusText = document.getElementById('statusText');
+        const refreshBtn = document.getElementById('refreshBtn');
+        const testBtn = document.getElementById('testBtn');
+        const applyConfigBtn = document.getElementById('applyConfigBtn');
+        const resetConfigBtn = document.getElementById('resetConfigBtn');
+        const appidInput = document.getElementById('appid');
+        const redirectUriInput = document.getElementById('redirect_uri');
+        const scopeInput = document.getElementById('scope');
+        
+        // 初始化函数
+        function initWeChatLogin(config) {
+            // 清除现有二维码
+            loginContainer.innerHTML = '<div class="qrcode-loading"><i class="fas fa-spinner fa-spin"></i><p>正在加载微信登录二维码...</p></div>';
+            statusText.textContent = "正在初始化微信登录...";
+            
+            // 销毁之前的实例
+            if (wxLoginObj) {
+                // 微信官方SDK没有提供销毁方法,我们只能替换容器内容
+                loginContainer.innerHTML = '';
+            }
+            
+            // 创建微信登录实例
+            try {
+                wxLoginObj = new WxLogin({
+                    self_redirect: config.self_redirect,
+                    id: config.id,
+                    appid: config.appid,
+                    scope: config.scope,
+                    redirect_uri: config.redirect_uri,
+                    state: config.state,
+                    style: config.style,
+                    href: config.href,
+                    onReady: function(isReady) {
+                        console.log("微信登录二维码加载状态:", isReady);
+                        if (isReady) {
+                            statusText.textContent = "二维码已就绪,请使用微信扫描";
+                            refreshBtn.disabled = false;
+                        } else {
+                            statusText.textContent = "二维码加载失败,请检查配置";
+                        }
+                    }
+                });
+                
+                // 监听二维码状态变化(模拟)
+                setTimeout(() => {
+                    statusText.textContent = "二维码已加载完成,请使用微信扫描";
+                }, 1000);
+                
+            } catch (error) {
+                console.error("微信登录初始化失败:", error);
+                statusText.textContent = "微信登录初始化失败: " + error.message;
+                loginContainer.innerHTML = `<div class="qrcode-loading" style="color:#f44336;">
+                    <i class="fas fa-exclamation-triangle"></i>
+                    <p>微信登录初始化失败</p>
+                    <p style="font-size:0.8rem; margin-top:10px;">${error.message}</p>
+                </div>`;
+            }
+        }
+        
+        // 刷新二维码
+        function refreshQRCode() {
+            // 获取当前配置
+            const currentConfig = {
+                ...defaultConfig,
+                appid: appidInput.value.trim() || defaultConfig.appid,
+                scope: scopeInput.value.trim() || defaultConfig.scope,
+                redirect_uri: encodeURIComponent(redirectUriInput.value.trim() || defaultConfig.redirect_uri)
+            };
+            
+            // 重新初始化
+            initWeChatLogin(currentConfig);
+            
+            // 禁用按钮避免重复点击
+            refreshBtn.disabled = true;
+            refreshBtn.innerHTML = '<i class="fas fa-spinner fa-spin"></i> 刷新中...';
+            
+            // 3秒后启用按钮
+            setTimeout(() => {
+                refreshBtn.disabled = false;
+                refreshBtn.innerHTML = '<i class="fas fa-sync-alt"></i> 刷新二维码';
+            }, 30000);
+        }
+        
+        // 模拟扫码测试
+        function simulateScanTest() {
+            statusText.textContent = "已模拟扫描,请在手机上确认登录";
+            testBtn.disabled = true;
+            testBtn.innerHTML = '<i class="fas fa-check-circle"></i> 已模拟扫码';
+            
+            // 5秒后重置
+            setTimeout(() => {
+                statusText.textContent = "二维码已就绪,请使用微信扫描";
+                testBtn.disabled = false;
+                testBtn.innerHTML = '<i class="fas fa-mobile-alt"></i> 模拟扫码测试';
+            }, 5000);
+        }
+        
+        // 应用配置
+        function applyConfig() {
+            // 验证配置
+            const appid = appidInput.value.trim();
+            const redirectUri = redirectUriInput.value.trim();
+            
+            if (!appid) {
+                alert("请填写AppID");
+                appidInput.focus();
+                return;
+            }
+            
+            if (!redirectUri) {
+                alert("请填写Redirect URI");
+                redirectUriInput.focus();
+                return;
+            }
+            
+            // 应用配置并刷新二维码
+            applyConfigBtn.disabled = true;
+            applyConfigBtn.innerHTML = '<i class="fas fa-spinner fa-spin"></i> 应用中...';
+            
+            setTimeout(() => {
+                refreshQRCode();
+                applyConfigBtn.disabled = false;
+                applyConfigBtn.innerHTML = '<i class="fas fa-check-circle"></i> 应用配置';
+            }, 1000);
+        }
+        
+        // 重置配置
+        function resetConfig() {
+            appidInput.value = defaultConfig.appid;
+            redirectUriInput.value = decodeURIComponent(defaultConfig.redirect_uri);
+            scopeInput.value = defaultConfig.scope;
+            
+            // 应用重置的配置
+            applyConfig();
+        }
+        
+        // 页面加载完成后初始化
+        document.addEventListener('DOMContentLoaded', function() {
+            // 初始化微信登录
+            initWeChatLogin(defaultConfig);
+            
+            // 设置输入框默认值
+            appidInput.value = defaultConfig.appid;
+            redirectUriInput.value = decodeURIComponent(defaultConfig.redirect_uri);
+            scopeInput.value = defaultConfig.scope;
+            
+            // 绑定按钮事件
+            refreshBtn.addEventListener('click', refreshQRCode);
+            testBtn.addEventListener('click', simulateScanTest);
+            applyConfigBtn.addEventListener('click', applyConfig);
+            resetConfigBtn.addEventListener('click', resetConfig);
+            
+            // 监听输入框变化
+            appidInput.addEventListener('input', function() {
+                applyConfigBtn.disabled = false;
+            });
+            
+            redirectUriInput.addEventListener('input', function() {
+                applyConfigBtn.disabled = false;
+            });
+            
+            scopeInput.addEventListener('input', function() {
+                applyConfigBtn.disabled = false;
+            });
+            
+            // 添加键盘快捷键
+            document.addEventListener('keydown', function(e) {
+                // Ctrl+R 刷新二维码
+                if (e.ctrlKey && e.key === 'r') {
+                    e.preventDefault();
+                    if (!refreshBtn.disabled) refreshQRCode();
+                }
+                
+                // Enter 在输入框时应用配置
+                if (e.key === 'Enter' && document.activeElement.tagName === 'INPUT') {
+                    applyConfig();
+                }
+            });
+        });
+        
+        // 页面可见性变化时刷新二维码
+        document.addEventListener('visibilitychange', function() {
+            if (!document.hidden && wxLoginObj) {
+                // 页面从后台切换回来时刷新二维码
+                setTimeout(refreshQRCode, 500);
+            }
+        });
+    </script>
+</body>
+</html>

+ 13 - 0
routes/manager.php

@@ -305,3 +305,16 @@ Route::any('collect/product/edit', [App\Http\Controllers\Manager\Collect\Product
 Route::any('collect/product/delete', [App\Http\Controllers\Manager\Collect\Product::class, 'delete']);
 //采集配置-商品管理-状态修改
 Route::any('collect/product/set_status', [App\Http\Controllers\Manager\Collect\Product::class,'set_status']);
+
+//外部-公司管理-列表
+Route::any('external/company/list', [App\Http\Controllers\Manager\External\Company::class, 'list']);
+//外部-公司管理-详情
+Route::any('external/company/detail', [App\Http\Controllers\Manager\External\Company::class, 'detail']);
+//外部-公司管理-添加
+Route::any('external/company/add', [App\Http\Controllers\Manager\External\Company::class, 'add']);
+//外部-公司管理-修改
+Route::any('external/company/edit', [App\Http\Controllers\Manager\External\Company::class, 'edit']);
+//外部-公司管理-删除
+Route::any('external/company/delete', [App\Http\Controllers\Manager\External\Company::class, 'delete']);
+//外部-公司管理-状态修改
+Route::any('external/company/set_status', [App\Http\Controllers\Manager\External\Company::class,'set_status']);