58 lines
1.6 KiB
PHP
58 lines
1.6 KiB
PHP
<?php
|
||
|
||
declare(strict_types=1);
|
||
|
||
namespace App\Model;
|
||
|
||
|
||
|
||
use Hyperf\Database\Model\Collection;
|
||
use Hyperf\Snowflake\Concern\Snowflake;
|
||
|
||
/**
|
||
* @property int $keyword_id 主键id
|
||
* @property string $keyword_name 名称
|
||
* @property int $client_type 类型(1:患者端 2:医生端 3:药师端)
|
||
* @property int $keyword_status 状态(0:删除 1:正常 2:禁用)
|
||
* @property int $keyword_place 位置(1:患者端热门搜索)
|
||
* @property int $keyword_sort 排序值(越小越靠前)
|
||
* @property \Carbon\Carbon $created_at 创建时间
|
||
* @property \Carbon\Carbon $updated_at 修改时间
|
||
*/
|
||
class HotSearchKeyword extends Model
|
||
{
|
||
use Snowflake;
|
||
|
||
/**
|
||
* The table associated with the model.
|
||
*/
|
||
protected ?string $table = 'hot_search_keyword';
|
||
|
||
/**
|
||
* The attributes that are mass assignable.
|
||
*/
|
||
protected array $fillable = ['keyword_id', 'keyword_name', 'client_type', 'keyword_status', 'keyword_place', 'keyword_sort', 'created_at', 'updated_at'];
|
||
|
||
/**
|
||
* 获取信息-单条
|
||
* @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)->orderBy('keyword_sort')->get($fields);
|
||
}
|
||
}
|