diff --git a/app/Services/BasicDataService.php b/app/Services/BasicDataService.php index 53fc67b..04d6b0f 100644 --- a/app/Services/BasicDataService.php +++ b/app/Services/BasicDataService.php @@ -447,8 +447,8 @@ class BasicDataService extends BaseService ]; $params = array(); - - + $params['product_status'] = 1; + $params['is_delete'] = 0; $product = Product::getWithAmountPage($params, $keyword,$fields, $page, $per_page); if (empty($product['data'])) { return success($product); diff --git a/app/Services/UserDoctorService.php b/app/Services/UserDoctorService.php index 0fe3404..d2934d7 100644 --- a/app/Services/UserDoctorService.php +++ b/app/Services/UserDoctorService.php @@ -1433,6 +1433,16 @@ class UserDoctorService extends BaseService return fail(HttpEnumCode::SERVER_ERROR,"商品错误"); } + if ($product['product_status'] == 2){ + Db::rollBack(); + return fail(HttpEnumCode::HTTP_ERROR,"药品" . $product['product_name'] . "已下架"); + } + + if ($product['is_delete'] == 1){ + Db::rollBack(); + return fail(HttpEnumCode::HTTP_ERROR,"药品" . $product['product_name'] . "已被删除,无法开具"); + } + // 获取商品库存 $params =array(); $params['product_platform_id'] = $product['product_platform_id']; @@ -1444,6 +1454,7 @@ class UserDoctorService extends BaseService } if ($product_platform_amount['stock'] <= 0){ + Db::rollBack(); return fail(HttpEnumCode::HTTP_ERROR,"商品库存不足"); } diff --git a/app/Services/UserPatientService.php b/app/Services/UserPatientService.php index 69b6e95..c0d9c5c 100644 --- a/app/Services/UserPatientService.php +++ b/app/Services/UserPatientService.php @@ -278,6 +278,7 @@ class UserPatientService extends BaseService if (empty($product)){ return fail(); } + // 获取商品库存 $params =array(); $params['product_platform_id'] = $product['product_platform_id'];