| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- <?php
- namespace App\Http\Controllers\Api\WashConfig;
- use App\Http\Controllers\Api\Api;
- use App\Http\Requests\Manager\WashConfig\LowPriceGoods as Request;
- use App\Models\Manager\WashConfig\LowPriceGoods as LowPriceGoodsModel;
- /**
- * 数据清洗-低价产品配置
- * @author 唐远望
- * @version 1.0
- * @date 2025-12-02
- */
- class LowPriceGoods extends Api
- {
- /**
- * 列表
- * @author 唐远望
- * @version 1.0
- * @date 2025-12-02
- *
- */
- public function list(Request $request, LowPriceGoodsModel $LowPriceGoodsModel)
- {
- $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', '');
- $product_name = request('product_name', '');
- $platform = request('platform', '');
- $store_scope = request('store_scope', '');
- $company_scope = request('company_scope', '');
- // 时间条件
- 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 ($product_name) $map[] = ['product_name', 'like', "%$product_name%"];
- if ($platform) $map[] = ['platform', 'like', "%$platform%"];
- if ($store_scope) $map[] = ['store_scope', '=', $store_scope];
- if ($company_scope) $map[] = ['company_scope', '=', $company_scope];
- // 查询数据
- $result = $LowPriceGoodsModel->query()
- ->where($map)
- ->orderByDesc('id')
- ->select(['id','product_name'])
- ->paginate($limit);
- // 分配数据
- if (!$result) return json_send(['code' => 'error', 'msg' => '暂无数据']);
- // 加载模板
- return json_send(['code' => 'success', 'msg' => '获取成功', 'data' => $result]);
- }
- }
|