60 lines
1.5 KiB
PHP
60 lines
1.5 KiB
PHP
<?php
|
||
|
||
declare(strict_types=1);
|
||
|
||
namespace App\Model;
|
||
|
||
|
||
|
||
use Carbon\Carbon;
|
||
use Hyperf\Database\Model\Collection;
|
||
use Hyperf\Snowflake\Concern\Snowflake;
|
||
|
||
/**
|
||
* @property string $basics_words_id 主键id
|
||
* @property int $basics_words_type 类型(1:图文问诊 2:开具处方 3:问诊结束)
|
||
* @property int $basics_words_status 状态(0:禁用 1:正常)
|
||
* @property int $sort 排序值(越大排序越靠前)
|
||
* @property string $basics_words 回复语
|
||
* @property Carbon $created_at 创建时间
|
||
* @property Carbon $updated_at 修改时间
|
||
*/
|
||
class BasicWord extends Model
|
||
{
|
||
use Snowflake;
|
||
|
||
/**
|
||
* The table associated with the model.
|
||
*/
|
||
protected ?string $table = 'basic_words';
|
||
|
||
/**
|
||
* The attributes that are mass assignable.
|
||
*/
|
||
protected array $fillable = ['basics_words_id', 'basics_words_type', 'basics_words_status', 'sort', 'basics_words', 'created_at', 'updated_at'];
|
||
|
||
protected string $primaryKey = "basics_words_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)->orderBy('sort','desc')->get($fields);
|
||
}
|
||
}
|