111 lines
3.4 KiB
PHP
111 lines
3.4 KiB
PHP
<?php
|
|
|
|
namespace App\Models\YiiModels;
|
|
|
|
/**
|
|
* App\Models\YiiModels\SystemNotice
|
|
*
|
|
* @property int $id ID
|
|
* @property int $store_id 门店id
|
|
* @property string $content 通知内容
|
|
* @property string|null $url 链接
|
|
* @property int|null $url_type 链接类型
|
|
* @property int|null $base_type 通知类型1订单通知2挂号通知3拒诊通知4处方开具消息5处方审核消息 99系统通知
|
|
* @property int $scene_type 场景类型:1用户端,2服务端(角色)
|
|
* @property int|null $user_role 通知用户类型
|
|
* @property int|null $user_id 用户id
|
|
* @property string|null $notice_at 通知时间
|
|
* @property int $read_status 是否读取0否1是
|
|
* @property \Illuminate\Support\Carbon $created_at 创建时间
|
|
* @property \Illuminate\Support\Carbon $updated_at 更新时间
|
|
* @property-read string $base_type_string 通知类型
|
|
* @property-read string $created_at_format 创建时间的格式化
|
|
* @property-read string $read_status_string 通知类型
|
|
* @property-read string $scene_type_string 场景类型
|
|
* @property-read string $status_string 状态名称
|
|
* @property-read string $updated_at_format 更新时间的格式化
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\YiiModels\SystemNotice newModelQuery()
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\YiiModels\SystemNotice newQuery()
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\YiiModels\SystemNotice query()
|
|
* @mixin \Eloquent
|
|
*/
|
|
class SystemNotice extends YiiBaseModel
|
|
{
|
|
protected $attributes = [
|
|
'read_status' => 0,
|
|
'user_role' => 0,
|
|
];
|
|
|
|
// 链接类型
|
|
const URL_TYPE = [];
|
|
|
|
// 通知类型
|
|
const BASE_TYPE_ORDER = 1;
|
|
const BASE_TYPE_REGISTER = 2;
|
|
const BASE_TYPE_REFUSAL = 3;
|
|
const BASE_TYPE_PRESCRIPTION_ISSUANCE = 4;
|
|
const BASE_TYPE_PRESCRIPTION_AUDIT = 5;
|
|
const BASE_TYPE_SYSTEM = 99;
|
|
|
|
const BASE_TYPE = [
|
|
self::BASE_TYPE_ORDER => '订单通知',
|
|
self::BASE_TYPE_REGISTER => '挂号通知',
|
|
self::BASE_TYPE_REFUSAL => '拒诊通知',
|
|
self::BASE_TYPE_PRESCRIPTION_ISSUANCE => '处方开具消息',
|
|
self::BASE_TYPE_PRESCRIPTION_AUDIT => '处方审核消息',
|
|
self::BASE_TYPE_SYSTEM => '系统通知',
|
|
];
|
|
|
|
// 场景类型
|
|
const SCENE_TYPE_MEMBER = 1;
|
|
const SCENE_TYPE_SERVICE = 2;
|
|
const SCENE_TYPE = [
|
|
self::SCENE_TYPE_MEMBER => '用户端',
|
|
self::SCENE_TYPE_SERVICE => '服务端(角色)',
|
|
];
|
|
|
|
// 通知用户类型
|
|
const USER_ROLE = [];
|
|
|
|
// 是否读取
|
|
const READ_STATUS_FALSE = 0;
|
|
const READ_STATUS_TRUE = 1;
|
|
const READ_STATUS = [
|
|
self::READ_STATUS_FALSE => '未读',
|
|
self::READ_STATUS_TRUE => '已读',
|
|
];
|
|
|
|
/**
|
|
* base_type_string
|
|
*
|
|
* @comment 通知类型
|
|
* @return string
|
|
*/
|
|
public function getBaseTypeStringAttribute(): string
|
|
{
|
|
return self::BASE_TYPE[$this->base_type];
|
|
}
|
|
|
|
/**
|
|
* scene_type_string
|
|
*
|
|
* @comment 场景类型
|
|
* @return string
|
|
*/
|
|
public function getSceneTypeStringAttribute(): string
|
|
{
|
|
return self::SCENE_TYPE[$this->scene_type];
|
|
}
|
|
|
|
/**
|
|
* read_status_string
|
|
*
|
|
* @comment 通知类型
|
|
* @return string
|
|
*/
|
|
public function getReadStatusStringAttribute(): string
|
|
{
|
|
return self::READ_STATUS[$this->read_status];
|
|
}
|
|
}
|