92 lines
2.4 KiB
PHP
92 lines
2.4 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Model;
|
|
|
|
|
|
|
|
use Hyperf\Database\Model\Collection;
|
|
use Hyperf\Snowflake\Concern\Snowflake;
|
|
|
|
/**
|
|
* @property int $logistics_id 主键id
|
|
* @property int $order_product_id 药品订单id
|
|
* @property int $logistics_status 运单签收状态(0在途 1揽收 2疑难 3签收 4退签 5派件 8清关 14拒签)
|
|
* @property string $logistics_no 物流编号
|
|
* @property string $company_name 快递公司名称
|
|
* @property string $company_code 快递公司编码
|
|
* @property string $logistics_content 内容
|
|
* @property \Carbon\Carbon $created_at 创建时间
|
|
* @property \Carbon\Carbon $updated_at 修改时间
|
|
*/
|
|
class OrderProductLogistic extends Model
|
|
{
|
|
use Snowflake;
|
|
|
|
/**
|
|
* The table associated with the model.
|
|
*/
|
|
protected ?string $table = 'order_product_logistics';
|
|
|
|
/**
|
|
* The attributes that are mass assignable.
|
|
*/
|
|
protected array $fillable = ['logistics_id', 'order_product_id', 'logistics_status', 'logistics_no', 'company_name', 'company_code', 'logistics_content', 'created_at', 'updated_at'];
|
|
|
|
protected string $primaryKey = "logistics_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 $data
|
|
* @return \Hyperf\Database\Model\Model|OrderProductLogistic
|
|
*/
|
|
public static function addOrderProductLogistic(array $data): \Hyperf\Database\Model\Model|OrderProductLogistic
|
|
{
|
|
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);
|
|
}
|
|
}
|