2023-02-17 17:10:16 +08:00

70 lines
2.2 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
declare(strict_types=1);
namespace App\Model;
use Hyperf\Snowflake\Concern\Snowflake;
/**
* @property int $banner_id 主键id
* @property string $banner_name 图片名称
* @property string $banner_path 图片路径
* @property int $app_type 应用程序类型1:小程序 2:app
* @property int $client_type 客户端类型1:患者端 2:医生端 3:药师端)
* @property int $banner_place 展示位置1:首页)
* @property int $banner_status 状态0:删除 1:正常 2:禁用)
* @property int $banner_sort 排序值(越大排序越靠前)
* @property string $banner_link 跳转地址
* @property \Carbon\Carbon $created_at 创建时间
* @property \Carbon\Carbon $updated_at 修改时间
*/
class Banner extends Model
{
use Snowflake;
/**
* The table associated with the model.
*/
protected ?string $table = 'banner';
/**
* The attributes that are mass assignable.
*/
protected array $fillable = ['banner_id', 'banner_name', 'banner_path', 'app_type', 'client_type', 'banner_place', 'banner_status', 'banner_sort', 'banner_link', 'created_at', 'updated_at'];
/**
* The attributes that should be cast to native types.
*/
protected array $casts = ['banner_id' => 'integer', 'app_type' => 'integer', 'client_type' => 'integer', 'banner_place' => 'integer', 'banner_status' => 'integer', 'banner_sort' => 'integer', 'created_at' => 'datetime', 'updated_at' => 'datetime'];
protected string $primaryKey = "banner_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
* @param string $order
* @param string $direction
* @return object|null
*/
public static function getList(array $params, array $fields = ['*'], string $order = "banner_sort", string $direction = 'desc'): object|null
{
return self::where($params)->orderBy($order, $direction)->get($fields);
}
}