|
|
@@ -16,7 +16,7 @@ use App\Models\Api\WashConfig\ViolationProduct as ViolationProductModel;
|
|
|
class ViolationProduct extends Api
|
|
|
{
|
|
|
/**
|
|
|
- * 列表
|
|
|
+ * 商品列表
|
|
|
* @author 唐远望
|
|
|
* @version 1.0
|
|
|
* @date 2025-12-03
|
|
|
@@ -51,6 +51,51 @@ class ViolationProduct extends Api
|
|
|
->where($map)
|
|
|
->orderByDesc('id')
|
|
|
->select(['id','product_name'])
|
|
|
+ ->distinct('product_name')
|
|
|
+ ->paginate($limit);
|
|
|
+ // 分配数据
|
|
|
+ if (!$result) return json_send(['code' => 'error', 'msg' => '暂无数据']);
|
|
|
+ // 加载模板
|
|
|
+ return json_send(['code' => 'success', 'msg' => '获取成功', 'data' => $result]);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 规格列表
|
|
|
+ * @author 唐远望
|
|
|
+ * @version 1.0
|
|
|
+ * @date 2025-12-15
|
|
|
+ *
|
|
|
+ */
|
|
|
+ public function spec_list(Request $request, ViolationProductModel $ViolationProductModel)
|
|
|
+ {
|
|
|
+ $user_info = $this->checkLogin();
|
|
|
+ if (!$user_info) return json_send(['code' => 'error', 'msg' => '请先登录']);
|
|
|
+ $request->scene('spec_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_specs = request('product_specs', '');
|
|
|
+ $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_specs) $map[] = ['product_specs', 'like', "%$product_specs%"];
|
|
|
+ if ($platform) $map[] = ['platform', 'like', "%$platform%"];
|
|
|
+ if ($store_scope) $map[] = ['store_scope', '=', $store_scope];
|
|
|
+ if ($company_scope) $map[] = ['company_scope', '=', $company_scope];
|
|
|
+ // 查询数据
|
|
|
+ $result = $ViolationProductModel->query()
|
|
|
+ ->where($map)
|
|
|
+ ->orderByDesc('id')
|
|
|
+ ->select(['id','product_specs'])
|
|
|
+ ->distinct('product_specs')
|
|
|
->paginate($limit);
|
|
|
// 分配数据
|
|
|
if (!$result) return json_send(['code' => 'error', 'msg' => '暂无数据']);
|