83 lines
2.1 KiB
PHP
83 lines
2.1 KiB
PHP
<?php
|
||
|
||
declare(strict_types=1);
|
||
|
||
namespace App\Model;
|
||
|
||
|
||
|
||
use Hyperf\Database\Model\Collection;
|
||
use Hyperf\Snowflake\Concern\Snowflake;
|
||
|
||
/**
|
||
* @property int $system_id 主键id
|
||
* @property string $system_name 配置名称
|
||
* @property string $system_remarks 配置备注
|
||
* @property int $system_status 配置状态(1:开启 2:关闭)
|
||
* @property string $system_permission 事件标识
|
||
* @property int $is_sms 是否需要短信通知(0:否 1:是)
|
||
* @property string $sms_mobile 短信通知手机号
|
||
* @property \Carbon\Carbon $created_at 创建时间
|
||
* @property \Carbon\Carbon $updated_at 修改时间
|
||
*/
|
||
class OrderSystem extends Model
|
||
{
|
||
use Snowflake;
|
||
|
||
/**
|
||
* The table associated with the model.
|
||
*/
|
||
protected ?string $table = 'order_system';
|
||
|
||
/**
|
||
* The attributes that are mass assignable.
|
||
*/
|
||
protected array $fillable = ['system_id', 'system_name', 'system_remarks', 'system_status', 'system_permission', 'is_sms', 'sms_mobile', 'created_at', 'updated_at'];
|
||
|
||
protected string $primaryKey = "family_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 \Hyperf\Database\Model\Model|OrderSystem
|
||
*/
|
||
public static function addOrderSystem(array $data = []): \Hyperf\Database\Model\Model|OrderSystem
|
||
{
|
||
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);
|
||
}
|
||
|
||
}
|