mirror of
https://gitee.com/ulthon/ulthon_admin.git
synced 2026-11-07 19:40:49 +08:00
feat(notice): 通知三表模型 Base/App 双层
This commit is contained in:
9
app/admin/model/SystemNotice.php
Normal file
9
app/admin/model/SystemNotice.php
Normal file
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\model;
|
||||
|
||||
use base\admin\model\SystemNoticeBase;
|
||||
|
||||
class SystemNotice extends SystemNoticeBase
|
||||
{
|
||||
}
|
||||
9
app/admin/model/SystemNoticeSubscribe.php
Normal file
9
app/admin/model/SystemNoticeSubscribe.php
Normal file
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\model;
|
||||
|
||||
use base\admin\model\SystemNoticeSubscribeBase;
|
||||
|
||||
class SystemNoticeSubscribe extends SystemNoticeSubscribeBase
|
||||
{
|
||||
}
|
||||
9
app/admin/model/SystemNoticeTarget.php
Normal file
9
app/admin/model/SystemNoticeTarget.php
Normal file
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\model;
|
||||
|
||||
use base\admin\model\SystemNoticeTargetBase;
|
||||
|
||||
class SystemNoticeTarget extends SystemNoticeTargetBase
|
||||
{
|
||||
}
|
||||
32
extend/base/admin/model/SystemNoticeBase.php
Normal file
32
extend/base/admin/model/SystemNoticeBase.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace base\admin\model;
|
||||
|
||||
use app\common\model\TimeModel;
|
||||
|
||||
/**
|
||||
* @property int $id
|
||||
* @property string $scene 通知场景
|
||||
* @property string $title 通知标题
|
||||
* @property string $content 通知内容
|
||||
* @property string $biz_id 业务关联ID
|
||||
* @property int $send_admin_id 发送管理员ID
|
||||
* @property int $create_time 创建时间
|
||||
* @property int $update_time 更新时间
|
||||
* @property int $delete_time 删除时间
|
||||
* @property \app\admin\model\SystemAdmin|null $sendAdmin 发送管理员
|
||||
*/
|
||||
class SystemNoticeBase extends TimeModel
|
||||
{
|
||||
protected $deleteTime = 'delete_time';
|
||||
|
||||
/**
|
||||
* 发送管理员.
|
||||
* 仅按需显式调用时才查询;列表页请勿用 withJoin 预载
|
||||
* (system_admin 与主表存在 id/status 等同名字段,join 会产生歧义)。
|
||||
*/
|
||||
public function sendAdmin()
|
||||
{
|
||||
return $this->belongsTo('app\admin\model\SystemAdmin', 'send_admin_id', 'id');
|
||||
}
|
||||
}
|
||||
23
extend/base/admin/model/SystemNoticeSubscribeBase.php
Normal file
23
extend/base/admin/model/SystemNoticeSubscribeBase.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace base\admin\model;
|
||||
|
||||
use app\common\model\TimeModel;
|
||||
|
||||
/**
|
||||
* @property int $id
|
||||
* @property int $admin_id 管理员ID
|
||||
* @property string $scene 通知场景
|
||||
* @property string $channel 投递渠道
|
||||
* @property int $status 订阅状态 0:退订,1:订阅
|
||||
* @property int $create_time 创建时间
|
||||
* @property int $update_time 更新时间
|
||||
*/
|
||||
class SystemNoticeSubscribeBase extends TimeModel
|
||||
{
|
||||
/**
|
||||
* 表无 delete_time 字段,显式关闭软删作用域.
|
||||
* @var bool
|
||||
*/
|
||||
protected $deleteTime = false;
|
||||
}
|
||||
71
extend/base/admin/model/SystemNoticeTargetBase.php
Normal file
71
extend/base/admin/model/SystemNoticeTargetBase.php
Normal file
@@ -0,0 +1,71 @@
|
||||
<?php
|
||||
|
||||
namespace base\admin\model;
|
||||
|
||||
use app\common\model\TimeModel;
|
||||
|
||||
/**
|
||||
* @property int $id
|
||||
* @property int $notice_id 通知ID
|
||||
* @property int $admin_id 接收管理员ID
|
||||
* @property string $channel 投递渠道
|
||||
* @property string $target_addr 投递目标地址
|
||||
* @property int $status 状态 0:待发,1:发送中,2:成功,3:失败
|
||||
* @property int $send_time 发送时间
|
||||
* @property int $read_time 阅读时间
|
||||
* @property int $claim_time 抢占时间
|
||||
* @property string $claim_token 抢占令牌
|
||||
* @property int $retry_count 重试次数
|
||||
* @property int $next_retry_time 下次重试时间
|
||||
* @property string $error_message 错误信息
|
||||
* @property int $create_time 创建时间
|
||||
* @property int $update_time 更新时间
|
||||
* @property \app\admin\model\SystemNotice|null $notice 所属通知
|
||||
* @property \app\admin\model\SystemAdmin|null $admin 接收管理员
|
||||
*/
|
||||
class SystemNoticeTargetBase extends TimeModel
|
||||
{
|
||||
/**
|
||||
* 投递状态:待发送(队列候选,消费者按 (status,id) 索引抢占).
|
||||
*/
|
||||
public const STATUS_PENDING = 0;
|
||||
|
||||
/**
|
||||
* 投递状态:发送中(已被消费者原子抢占,超时由回收任务重置回待发送).
|
||||
*/
|
||||
public const STATUS_SENDING = 1;
|
||||
|
||||
/**
|
||||
* 投递状态:发送成功(终态).
|
||||
*/
|
||||
public const STATUS_SUCCESS = 2;
|
||||
|
||||
/**
|
||||
* 投递状态:发送失败(终态,可人工重发回置待发送).
|
||||
*/
|
||||
public const STATUS_FAILED = 3;
|
||||
|
||||
/**
|
||||
* 表无 delete_time 字段,显式关闭软删作用域.
|
||||
* @var bool
|
||||
*/
|
||||
protected $deleteTime = false;
|
||||
|
||||
/**
|
||||
* 所属通知.
|
||||
*/
|
||||
public function notice()
|
||||
{
|
||||
return $this->belongsTo('app\admin\model\SystemNotice', 'notice_id', 'id');
|
||||
}
|
||||
|
||||
/**
|
||||
* 接收管理员.
|
||||
* 仅按需显式调用时才查询;列表页请勿用 withJoin 预载
|
||||
* (system_admin 与主表存在 id/status 等同名字段,join 会产生歧义)。
|
||||
*/
|
||||
public function admin()
|
||||
{
|
||||
return $this->belongsTo('app\admin\model\SystemAdmin', 'admin_id', 'id');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user