创建服务包订单增加健康包订单关联商品、新增了获取患者服务包订单服务权益详情(待完成)
This commit is contained in:
@@ -17,8 +17,8 @@ use Hyperf\Snowflake\Concern\Snowflake;
|
||||
* @property string $effective_days 服务有效天数
|
||||
* @property string $service_rate 服务费率。100为满值,表示1,正常费率。
|
||||
* @property string $discount_product_total_amount 折扣商品总价格
|
||||
* @property \Carbon\Carbon $created_at 创建时间
|
||||
* @property \Carbon\Carbon $updated_at 修改时间
|
||||
* @property Carbon $created_at 创建时间
|
||||
* @property Carbon $updated_at 修改时间
|
||||
*/
|
||||
class HealthPackage extends Model
|
||||
{
|
||||
|
||||
@@ -0,0 +1,81 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Model;
|
||||
|
||||
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Hyperf\Database\Model\Collection;
|
||||
use Hyperf\Snowflake\Concern\Snowflake;
|
||||
|
||||
/**
|
||||
* @property int $service_product_id 主键id
|
||||
* @property int $order_service_id 订单-服务包id
|
||||
* @property int $product_id 商品id
|
||||
* @property string $product_name 商品名称
|
||||
* @property int $quantity 商品数量
|
||||
* @property string $discount_product_price 折扣商品价格
|
||||
* @property Carbon $created_at 创建时间
|
||||
* @property Carbon $updated_at 修改时间
|
||||
*/
|
||||
class OrderServicePackageProduct extends Model
|
||||
{
|
||||
use Snowflake;
|
||||
|
||||
/**
|
||||
* The table associated with the model.
|
||||
*/
|
||||
protected ?string $table = 'order_service_package_product';
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*/
|
||||
protected array $fillable = ['service_product_id', 'order_service_id', 'product_id', 'product_name', 'quantity', 'discount_product_price', 'created_at', 'updated_at'];
|
||||
|
||||
protected string $primaryKey = "service_product_id";
|
||||
|
||||
/**
|
||||
* 获取信息-单条
|
||||
* @param array $params
|
||||
* @param array $fields
|
||||
* @return object|null
|
||||
*/
|
||||
public static function getOne(array $params, array $fields = ['*']): object|null
|
||||
{
|
||||
return self::where($params)->first($fields);
|
||||
}
|
||||
|
||||
/**
|
||||
* 多条
|
||||
* @param array $params
|
||||
* @param array $fields
|
||||
* @return Collection|array
|
||||
*/
|
||||
public static function getList(array $params, array $fields = ['*']): Collection|array
|
||||
{
|
||||
return self::where($params)->get($fields);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增
|
||||
* @param array $data
|
||||
* @return OrderServicePackageProduct|\Hyperf\Database\Model\Model
|
||||
*/
|
||||
public static function addOrderServicePackageProduct(array $data): \Hyperf\Database\Model\Model|OrderServicePackageProduct
|
||||
{
|
||||
return self::create($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改
|
||||
* @param array $params
|
||||
* @param array $data
|
||||
* @return int
|
||||
*/
|
||||
public static function edit(array $params = [], array $data = []): int
|
||||
{
|
||||
return self::where($params)->update($data);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user