| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- <?php
- namespace App\Http\Controllers\Api\WashConfig;
- use App\Http\Controllers\Api\Api;
- use App\Http\Requests\Api\WashConfig\ViolationStore as Request;
- use App\Models\Api\WashConfig\ViolationStore as ViolationStoreModel;
- /**
- * 数据清洗-违规店铺(公司)配置
- * @author 唐远望
- * @version 1.0
- * @date 2025-12-03
- */
- class ViolationStore extends Api
- {
- /**
- * 列表
- * @author 唐远望
- * @version 1.0
- * @date 2025-12-03
- *
- */
- public function list(Request $request, ViolationStoreModel $ViolationStoreModel)
- {
- $user_info = $this->checkLogin();
- if (!$user_info) return json_send(['code' => 'error', 'msg' => '请先登录']);
- $request->scene('list')->validate();
- // 查询条件
- $map = [];
- $limit = request('limit', config('page_num', 10));
- $status = request('status', '0');
- $start_time = request('start_time', '');
- $end_time = request('end_time', '');
- $store_name = request('store_name', '');
- $company_name = request('company_name', '');
- $social_credit_code = request('social_credit_code', '');
- $store_type = request('store_type', '');
- // 时间条件
- 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 ($social_credit_code) $map[] = ['social_credit_code', 'like', "%$social_credit_code%"];
- if ($company_name) $map[] = ['company_name', 'like', "%$company_name%"];
- if ($store_name) $map[] = ['store_name', 'like', "%$store_name%"];
- if ($store_type) $map[] = ['store_type', '=', $store_type];
- // 查询数据
- $result = $ViolationStoreModel->query()
- ->where($map)
- ->orderByDesc('id')
- ->select(['id','company_name'])
- ->paginate($limit);
- // 分配数据
- if (!$result) return json_send(['code' => 'error', 'msg' => '暂无数据']);
- // 加载模板
- return json_send(['code' => 'success', 'msg' => '获取成功', 'data' => $result]);
- }
- }
|