新增热门搜索

This commit is contained in:
2023-05-04 10:17:48 +08:00
parent 113f9e34a1
commit 06fa3e6efd
6 changed files with 120 additions and 3 deletions
+57
View File
@@ -0,0 +1,57 @@
<?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);
}
}