mirror of
https://gitee.com/ulthon/ulthon_admin.git
synced 2026-11-07 19:40:49 +08:00
feat(notice): NoticeService 发送核心/场景注册/订阅过滤与站内信驱动及测试
This commit is contained in:
34
extend/base/common/notice/NoticeChannelInterface.php
Normal file
34
extend/base/common/notice/NoticeChannelInterface.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace base\common\notice;
|
||||
|
||||
/**
|
||||
* 通知投递渠道驱动契约.
|
||||
*
|
||||
* notice/ 为领域子模块目录:渠道驱动与传输客户端不是 service 注册服务,
|
||||
* 放 service 树将违反 ulthon-naming-convention 的 Service 后缀规范,
|
||||
* 参照 base\common\event、base\common\scheme 的独立模块目录先例;
|
||||
* PSR-4 base\ → extend/base 自动可载。
|
||||
*
|
||||
* 实现约定:
|
||||
* - name() 返回渠道标识(system_notice_target.channel 的取值,如 inmail/email)
|
||||
* - send() 执行真实投递,抛出异常视为投递失败(消费者据此重试/置终态)
|
||||
* - 驱动不做任何 DB 写入:投递行由 NoticeService::send() 统一落库,
|
||||
* 消费者(timer 异步投递)按行状态调用本契约
|
||||
*/
|
||||
interface NoticeChannelInterface
|
||||
{
|
||||
/**
|
||||
* 渠道标识.
|
||||
*/
|
||||
public static function name(): string;
|
||||
|
||||
/**
|
||||
* 投递一条通知.
|
||||
*
|
||||
* @param array $target 投递行(system_notice_target 一行,含 channel/target_addr/status 等)
|
||||
* @param array $notice 通知主体(system_notice 一行)
|
||||
* @return bool 是否成功;抛出异常视为失败
|
||||
*/
|
||||
public function send(array $target, array $notice): bool;
|
||||
}
|
||||
Reference in New Issue
Block a user