75 lines
2.4 KiB
PHP
75 lines
2.4 KiB
PHP
<?php
|
||
|
||
declare(strict_types=1);
|
||
|
||
namespace App\Model;
|
||
|
||
|
||
|
||
use Hyperf\Database\Model\Collection;
|
||
use Hyperf\Snowflake\Concern\Snowflake;
|
||
|
||
/**
|
||
* @property int $notice_id 主键id
|
||
* @property int $notice_type 消息类型(1:医生服务通知 2:医生系统公告 3:患者系统消息)
|
||
* @property int $notice_system_type 系统消息类型(患者端系统消息存在 1:服务消息 2:福利消息 3:退款消息 4:物流消息)
|
||
* @property string $from_name 发送人姓名
|
||
* @property string $notice_title 消息标题
|
||
* @property string $notice_content 内容
|
||
* @property int $send_status 发送状态(0:未处理 1:已发送 2:发送失败)
|
||
* @property string $notice_send_time 发送时间
|
||
* @property string $send_fail_reason 发送失败原因
|
||
* @property int $link_type 链接类型(1:无按钮 2:我的账户 3:联系客服 4:问诊消息 5:多点执业认证 6:协议书)
|
||
* @property string $notice_params 通知参数(json数据,此字段内容和link_type字段有关联)
|
||
* @property \Carbon\Carbon $created_at 创建时间
|
||
* @property \Carbon\Carbon $updated_at 修改时间
|
||
*/
|
||
class MessageNoticeSystem extends Model
|
||
{
|
||
use Snowflake;
|
||
|
||
/**
|
||
* The table associated with the model.
|
||
*/
|
||
protected ?string $table = 'message_notice_system';
|
||
|
||
/**
|
||
* The attributes that are mass assignable.
|
||
*/
|
||
protected array $fillable = ['notice_id', 'notice_type', 'notice_system_type', 'from_name', 'notice_title', 'notice_content', 'send_status', 'notice_send_time', 'send_fail_reason', 'link_type', 'notice_params', 'created_at', 'updated_at'];
|
||
|
||
protected string $primaryKey = "message_id";
|
||
|
||
/**
|
||
* 获取是否存在
|
||
* @param array $params
|
||
* @return bool
|
||
*/
|
||
public static function getExists(array $params): bool
|
||
{
|
||
return self::where($params)->exists();
|
||
}
|
||
|
||
/**
|
||
* 获取信息-单条
|
||
* @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);
|
||
}
|
||
}
|