|
@@ -32,6 +32,7 @@ class Product extends BaseController {
|
|
|
* @OA\Parameter(name="brandId", in="query", description="品牌id", @OA\Schema(type="integer")),
|
|
|
* @OA\Parameter(name="companyId", in="query", description="公司id", @OA\Schema(type="integer")),
|
|
|
* @OA\Parameter(name="productTypeId", in="query", description="产品类型id", @OA\Schema(type="integer")),
|
|
|
+ * @OA\Parameter(name="type", in="query", description="产品分类 1洗浴 2小食", @OA\Schema(type="integer")),
|
|
|
* @OA\RequestBody(
|
|
|
* ),
|
|
|
* @OA\Response(response="200", description="请求成功")
|
|
@@ -65,6 +66,10 @@ class Product extends BaseController {
|
|
|
$where[] = ['pt.id', '=', $input['productTypeId']];
|
|
|
$where[] = ['pt.status', '=', 1];
|
|
|
}
|
|
|
+
|
|
|
+ if (!empty($input['type'])) {
|
|
|
+ $where[] = ['p.type', '=', (int)$input['type']];
|
|
|
+ }
|
|
|
$model->setWhere($where);
|
|
|
$data = $model->getProductList();
|
|
|
Until::output($data);
|
|
@@ -181,6 +186,7 @@ class Product extends BaseController {
|
|
|
* @OA\Property(description="品牌id", property="brandId", type="string", default="1"),
|
|
|
* @OA\Property(description="状态 1正常 2下架", property="status", type="integer", default="1"),
|
|
|
* @OA\Property(description="产品类型id", property="productTypeId", type="integer", default="1"),
|
|
|
+ * @OA\Property(description="产品分类 1 洗浴 2小食", property="type", type="integer", default="1"),
|
|
|
* required={"name","imgUrl","oldPrice","currentPrice","companyId","brandId","productContent"})
|
|
|
* )
|
|
|
* ),
|
|
@@ -224,7 +230,8 @@ class Product extends BaseController {
|
|
|
'brand_id' => $input['brandId'],
|
|
|
'product_content' => $input['productContent'],
|
|
|
'status' => $input['status'] ?? 1,
|
|
|
- 'product_type_id' => $input['productTypeId']
|
|
|
+ 'product_type_id' => $input['productTypeId'],
|
|
|
+ 'type' => $input['type'] ?? 1
|
|
|
]);
|
|
|
}
|
|
|
$model->setWhere([['p.id', '=', (int)$id]]);
|