修正获取服务包内某一药品的剩余数量计算

This commit is contained in:
2024-04-24 09:44:49 +08:00
parent ed39096790
commit 955b24a205
9 changed files with 205 additions and 66 deletions
+17 -7
View File
@@ -13,13 +13,13 @@ use Hyperf\Snowflake\Concern\Snowflake;
/**
* @property int $service_product_id 主键id
* @property int $order_service_id 订单-服务包id
* @property int $order_product_id 订单-商品id
* @property string $order_product_no 订单-商品系统编号
* @property int $product_item_id 订单-商品明细id
* @property int $product_id 商品id
* @property string $product_name 商品名称
* @property int $quantity 商品数量
* @property int $used_quantity 已使用数量
* @property string $discount_product_price 折扣商品价格
* @property \Carbon\Carbon $created_at 创建时间
* @property \Carbon\Carbon $updated_at 修改时间
* @property int $used_quantity 订单使用数量
* @property Carbon $created_at 创建时间
* @property Carbon $updated_at 修改时间
*/
class OrderServicePackageProduct extends Model
{
@@ -33,7 +33,7 @@ class OrderServicePackageProduct extends Model
/**
* The attributes that are mass assignable.
*/
protected array $fillable = ['service_product_id', 'order_service_id', 'product_id', 'product_name', 'quantity', 'used_quantity', 'discount_product_price', 'created_at', 'updated_at'];
protected array $fillable = ['service_product_id', 'order_service_id', 'order_product_id', 'order_product_no', 'product_item_id', 'product_id', 'used_quantity', 'created_at', 'updated_at'];
protected string $primaryKey = "service_product_id";
@@ -79,4 +79,14 @@ class OrderServicePackageProduct extends Model
{
return self::where($params)->update($data);
}
/**
* 删除
* @param array $params
* @return int|mixed
*/
public static function deleteOrderServicePackageProduct(array $params): mixed
{
return self::where($params)->delete();
}
}