getPage(); $keywords = $this->request->get('keywords'); $result = MedicalCareProductServer::getProductList($page, $limit,$keywords); return json_success($result, '成功'); } /** * Notes:添加产品 * @return \support\Response * User: QJF * Date: 2022/9/23 * */ public function addProduct() { $param = $this->request->post(); $this->validateCheck('medical\MedicalCareProductValidate', [ 'product_name' => $param['product_name'], 'product_shop_id' => $param['product_shop_id'], 'product_category_id' => $param['product_category_id'], 'product_is_show' => $param['product_is_show'], 'product_sort' => $param['product_sort'], 'product_sales' => $param['product_sales'], 'product_price' => $param['product_price'], 'product_cost' => $param['product_cost'], 'product_ot_price' => $param['product_ot_price'], 'product_stock' => $param['product_stock'], 'product_ficti' => $param['product_ficti'], 'product_image' => $param['product_image'], 'product_type' => $param['product_type'], 'product_postage_id' => $param['product_postage_id'], ], 'add'); $result = MedicalCareProductServer::insertProduct($param); return json_success($result, '添加成功'); } /** * Notes:修改产品 * @return \support\Response * User: QJF * Date: 2022/9/23 */ public function updateProduct() { $param = $this->request->post(); $this->validateCheck('medical\MedicalCareProductValidate', [ 'product_id' => $param['product_id'], 'product_shop_id' => $param['product_shop_id'], 'product_category_id' => $param['product_category_id'], 'product_name' => $param['product_name'], 'product_is_show' => $param['product_is_show'], 'product_sort' => $param['product_sort'], 'product_sales' => $param['product_sales'], 'product_price' => $param['product_price'], 'product_cost' => $param['product_cost'], 'product_ot_price' => $param['product_ot_price'], 'product_stock' => $param['product_stock'], 'product_ficti' => $param['product_ficti'], 'product_image' => $param['product_image'], 'product_type' => $param['product_type'], 'product_postage_id' => $param['product_postage_id'], ], 'update'); $result = MedicalCareProductServer::updateProduct($param); return json_success($result, '修改成功'); } /** * Notes:删除权益包 * @return \support\Response * User: QJF * Date: 2022/9/23 */ public function delProduct() { $product_id = $this->request->get('product_id'); $this->validateCheck('medical\MedicalCareProductValidate', ['product_id' => $product_id], 'del'); $result = MedicalCareProductServer::delProduct($product_id); if ($result){ return json_success($result, '删除成功'); }else{ throw new \Exception('删除失败!'); } } /** * Notes:查看产品详情 * @return \support\Response * User: QJF * Date: 2022/9/23 */ public function infoProduct() { $product_id = $this->request->get('product_id'); $this->validateCheck('medical\MedicalCareProductValidate', ['product_id' => $product_id], 'info'); $result = MedicalCareProductServer::infoProduct($product_id); if ($result){ return json_success($result, '获取成功'); }else{ throw new \Exception('获取失败!'); } } //产品上下架 public function showProduct(){ $product_id = $this->request->get('product_id'); $product_is_show = $this->request->get('product_is_show'); $this->validateCheck('medical\MedicalCareProductValidate', ['product_id' => $product_id], 'del'); $result = MedicalCareProductServer::showProduct($product_id,$product_is_show); if ($result){ return json_success($result, '成功'); }else{ throw new \Exception('失败!'); } } }