105 lines
2.8 KiB
PHP
105 lines
2.8 KiB
PHP
<?php
|
||
|
||
declare(strict_types=1);
|
||
|
||
namespace App\Model;
|
||
|
||
|
||
|
||
use Hyperf\Database\Model\Collection;
|
||
use Hyperf\Snowflake\Concern\Snowflake;
|
||
|
||
/**
|
||
* @property int $product_refund_id 主键id
|
||
* @property int $patient_id 患者id
|
||
* @property int $order_product_id 订单-药品订单id
|
||
* @property string $order_product_no 系统订单编号
|
||
* @property string $product_refund_no 系统退款编号
|
||
* @property string $refund_id 第三方退款单号
|
||
* @property int $product_refund_status 商品订单退款状态(0:无退款 1:申请退款 2:退款中 3:退款成功 4:拒绝退款 5:退款关闭 6:退款异常)
|
||
* @property string $refund_total 退款金额
|
||
* @property string $refund_reason 退款原因
|
||
* @property string $success_time 退款成功时间
|
||
* @property \Carbon\Carbon $created_at 创建时间
|
||
* @property \Carbon\Carbon $updated_at 修改时间
|
||
*/
|
||
class OrderProductRefund extends Model
|
||
{
|
||
use Snowflake;
|
||
|
||
/**
|
||
* The table associated with the model.
|
||
*/
|
||
protected ?string $table = 'order_product_refund';
|
||
|
||
/**
|
||
* The attributes that are mass assignable.
|
||
*/
|
||
protected array $fillable = ['product_refund_id', 'patient_id', 'order_product_id', 'order_product_no', 'product_refund_no', 'refund_id', 'product_refund_status', 'refund_total', 'refund_reason', 'success_time', 'created_at', 'updated_at'];
|
||
|
||
protected string $primaryKey = "product_refund_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 $params
|
||
* @return bool
|
||
*/
|
||
public static function getExists(array $params): bool
|
||
{
|
||
return self::where($params)->exists();
|
||
}
|
||
|
||
/**
|
||
* 获取数量
|
||
* @param array $params
|
||
* @return int
|
||
*/
|
||
public static function getCount(array $params): int
|
||
{
|
||
return self::where($params)->count();
|
||
}
|
||
|
||
/**
|
||
* 修改
|
||
* @param array $params
|
||
* @param array $data
|
||
* @return int
|
||
*/
|
||
public static function edit(array $params = [], array $data = []): int
|
||
{
|
||
return self::where($params)->update($data);
|
||
}
|
||
|
||
/**
|
||
* 新增
|
||
* @param array $data
|
||
* @return \Hyperf\Database\Model\Model|OrderProductRefund
|
||
*/
|
||
public static function addOrderProductRefund(array $data): \Hyperf\Database\Model\Model|OrderProductRefund
|
||
{
|
||
return self::create($data);
|
||
}
|
||
}
|