'exact', 'platform_id' => 'exact', 'store_id' => 'exact', 'status_id' => 'exact', 'platform_item_id' => 'exact', 'name' => 'like', ]; } protected function getDefaultSort(): string { return 'updated_date'; } /** * 产品列表 */ #[OA\Get( path: '/products', summary: '产品列表', description: '获取产品列表,支持分页、多维度筛选。返回业务字段,不含 raw/hash。', security: [['bearerAuth' => []]], tags: ['Products'], parameters: [ new OA\Parameter(name: 'page', in: 'query', required: false, schema: new OA\Schema(type: 'integer', default: 1)), new OA\Parameter(name: 'per_page', in: 'query', required: false, schema: new OA\Schema(type: 'integer', default: 15, maximum: 100)), new OA\Parameter(name: 'company_id', in: 'query', required: false, description: '公司 ID 精确筛选', schema: new OA\Schema(type: 'integer')), new OA\Parameter(name: 'platform_id', in: 'query', required: false, description: '平台 ID 精确筛选', schema: new OA\Schema(type: 'integer')), new OA\Parameter(name: 'store_id', in: 'query', required: false, description: '店铺 ID 精确筛选', schema: new OA\Schema(type: 'integer')), new OA\Parameter(name: 'status_id', in: 'query', required: false, description: '产品状态 ID 精确筛选', schema: new OA\Schema(type: 'integer')), new OA\Parameter(name: 'platform_item_id', in: 'query', required: false, description: '平台商品 ID 精确搜索', schema: new OA\Schema(type: 'string')), new OA\Parameter(name: 'name', in: 'query', required: false, description: '商品名称模糊搜索', schema: new OA\Schema(type: 'string')), ], responses: [ new OA\Response( response: 200, description: '获取成功', content: new OA\JsonContent(properties: [ new OA\Property(property: 'code', type: 'integer', example: 0), new OA\Property(property: 'message', type: 'string', example: '获取成功'), new OA\Property(property: 'data', properties: [ new OA\Property(property: 'items', type: 'array', items: new OA\Items(ref: '#/components/schemas/Product')), new OA\Property(property: 'total', type: 'integer', example: 100), new OA\Property(property: 'page', type: 'integer', example: 1), new OA\Property(property: 'per_page', type: 'integer', example: 15), ], type: 'object'), ]) ), new OA\Response(response: 401, description: '未认证', content: new OA\JsonContent(ref: '#/components/schemas/ErrorResponse')), new OA\Response(response: 403, description: '无权限', content: new OA\JsonContent(ref: '#/components/schemas/ErrorResponse')), ] )] #[RequestMapping(path: "", methods: "GET")] public function index(): \Psr\Http\Message\ResponseInterface|array { return parent::index(); } /** * 产品详情 */ #[OA\Get( path: '/products/{id}', summary: '产品详情', description: '获取产品详情,返回所有业务字段和 ext,不含 raw/hash。', security: [['bearerAuth' => []]], tags: ['Products'], parameters: [ new OA\Parameter(name: 'id', in: 'path', required: true, description: '产品 ID', schema: new OA\Schema(type: 'integer')), ], responses: [ new OA\Response( response: 200, description: '获取成功', content: new OA\JsonContent(properties: [ new OA\Property(property: 'code', type: 'integer', example: 0), new OA\Property(property: 'message', type: 'string', example: '获取成功'), new OA\Property(property: 'data', ref: '#/components/schemas/Product'), ]) ), new OA\Response(response: 401, description: '未认证', content: new OA\JsonContent(ref: '#/components/schemas/ErrorResponse')), new OA\Response(response: 403, description: '无权限', content: new OA\JsonContent(ref: '#/components/schemas/ErrorResponse')), new OA\Response(response: 404, description: '数据不存在', content: new OA\JsonContent(ref: '#/components/schemas/ErrorResponse')), ] )] #[RequestMapping(path: "{id}", methods: "GET")] public function show(int $id): \Psr\Http\Message\ResponseInterface|array { return parent::show($id); } }