变更命名空间

This commit is contained in:
ykxiao 2024-01-31 09:54:51 +08:00
parent 868b98e0b5
commit cb25278417
16 changed files with 55 additions and 55 deletions

View File

@ -22,7 +22,7 @@ composer require ykxiao/easy-message -vvv
发布配置文件`config/message.php`
```bash
hyperf vendor:publish ykxiao/easy-message
php bin/hyperf.php vendor:publish ykxiao/easy-message
```

View File

@ -2,27 +2,27 @@
declare(strict_types=1);
use MessageNotify\Channel\DingTalkChannel;
use MessageNotify\Channel\FeiShuChannel;
use MessageNotify\Channel\MailChannel;
use MessageNotify\Channel\WechatChannel;
use MessageNotify\Contracts\MessageNotifyInterface;
use EasyMessage\Channel\DingTalkChannel;
use EasyMessage\Channel\FeiShuChannel;
use EasyMessage\Channel\MailChannel;
use EasyMessage\Channel\WechatChannel;
use EasyMessage\Contracts\EasyMessageInterface;
return [
'default' => env('NOTIFY_DEFAULT_CHANNEL', 'mail'),
'channels' => [
// 钉钉群机器人
DingTalkChannel::class => [
'default' => MessageNotifyInterface::INFO,
'default' => EasyMessageInterface::INFO,
'pipeline' => [
// 业务信息告警群
MessageNotifyInterface::INFO => [
EasyMessageInterface::INFO => [
'token' => env('NOTIFY_DINGTALK_TOKEN', ''),
'secret' => env('NOTIFY_DINGTALK_SECRET', ''),
'keyword' => env('NOTIFY_DINGTALK_KEYWORD', []),
],
// 错误信息告警群
MessageNotifyInterface::ERROR => [
EasyMessageInterface::ERROR => [
'token' => env('NOTIFY_DINGTALK_TOKEN', ''),
'secret' => env('NOTIFY_DINGTALK_SECRET', ''),
'keyword' => env('NOTIFY_DINGTALK_KEYWORD', []),
@ -32,7 +32,7 @@ return [
// 飞书群机器人
FeiShuChannel::class => [
'default' => MessageNotifyInterface::INFO,
'default' => EasyMessageInterface::INFO,
'pipeline' => [
'info' => [
'token' => env('NOTIFY_FEISHU_TOKEN', ''),
@ -44,7 +44,7 @@ return [
// 邮件
MailChannel::class => [
'default' => MessageNotifyInterface::INFO,
'default' => EasyMessageInterface::INFO,
'pipeline' => [
'info' => [
'dsn' => env('NOTIFY_MAIL_DSN'),
@ -56,7 +56,7 @@ return [
// 企业微信群机器人
WechatChannel::class => [
'default' => MessageNotifyInterface::INFO,
'default' => EasyMessageInterface::INFO,
'pipeline' => [
'info' => [
'token' => env('NOTIFY_WECHAT_TOKEN'),

View File

@ -2,11 +2,11 @@
declare(strict_types=1);
namespace MessageNotify\Channel;
namespace EasyMessage\Channel;
use Hyperf\Contract\ConfigInterface;
use MessageNotify\Exceptions\MessageNotificationException;
use MessageNotify\Template\AbstractTemplate;
use EasyMessage\Exceptions\MessageNotificationException;
use EasyMessage\Template\AbstractTemplate;
abstract class AbstractChannel
{

View File

@ -2,13 +2,13 @@
declare(strict_types=1);
namespace MessageNotify\Channel;
namespace EasyMessage\Channel;
use GuzzleHttp\Client;
use GuzzleHttp\Exception\GuzzleException;
use GuzzleHttp\RequestOptions;
use MessageNotify\Exceptions\MessageNotificationException;
use MessageNotify\Template\AbstractTemplate;
use EasyMessage\Exceptions\MessageNotificationException;
use EasyMessage\Template\AbstractTemplate;
class DingTalkChannel extends AbstractChannel
{

View File

@ -2,13 +2,13 @@
declare(strict_types=1);
namespace MessageNotify\Channel;
namespace EasyMessage\Channel;
use GuzzleHttp\Client;
use GuzzleHttp\Exception\GuzzleException;
use GuzzleHttp\RequestOptions;
use MessageNotify\Exceptions\MessageNotificationException;
use MessageNotify\Template\AbstractTemplate;
use EasyMessage\Exceptions\MessageNotificationException;
use EasyMessage\Template\AbstractTemplate;
class FeiShuChannel extends AbstractChannel
{

View File

@ -2,9 +2,9 @@
declare(strict_types=1);
namespace MessageNotify\Channel;
namespace EasyMessage\Channel;
use MessageNotify\Template\AbstractTemplate;
use EasyMessage\Template\AbstractTemplate;
class MailChannel extends AbstractChannel
{

View File

@ -2,12 +2,12 @@
declare(strict_types=1);
namespace MessageNotify\Channel;
namespace EasyMessage\Channel;
use GuzzleHttp\Client;
use GuzzleHttp\RequestOptions;
use MessageNotify\Exceptions\MessageNotificationException;
use MessageNotify\Template\AbstractTemplate;
use EasyMessage\Exceptions\MessageNotificationException;
use EasyMessage\Template\AbstractTemplate;
class WechatChannel extends AbstractChannel
{

View File

@ -2,13 +2,13 @@
declare(strict_types=1);
namespace MessageNotify;
namespace EasyMessage;
use MessageNotify\Channel\AbstractChannel;
use MessageNotify\Contracts\MessageNotifyInterface;
use MessageNotify\Exceptions\MessageNotificationException;
use MessageNotify\Template\AbstractTemplate;
use MessageNotify\Template\Text;
use EasyMessage\Channel\AbstractChannel;
use EasyMessage\Contracts\EasyMessageInterface;
use EasyMessage\Exceptions\MessageNotificationException;
use EasyMessage\Template\AbstractTemplate;
use EasyMessage\Template\Text;
class Client
{
@ -18,7 +18,7 @@ class Client
protected array $at = [];
protected string $pipeline = MessageNotifyInterface::INFO;
protected string $pipeline = EasyMessageInterface::INFO;
protected string $title = '';
@ -78,7 +78,7 @@ class Client
public function setPipeline(string $pipeline = ''): Client
{
$this->pipeline = $pipeline ?? MessageNotifyInterface::INFO;
$this->pipeline = $pipeline ?? EasyMessageInterface::INFO;
return $this;
}

View File

@ -2,9 +2,9 @@
declare(strict_types=1);
namespace MessageNotify;
namespace EasyMessage;
use MessageNotify\Contracts\MessageNotifyInterface;
use EasyMessage\Contracts\EasyMessageInterface;
class ConfigProvider
{
@ -12,7 +12,7 @@ class ConfigProvider
{
return [
'dependencies' => [
MessageNotifyInterface::class => Client::class,
EasyMessageInterface::class => Client::class,
],
'annotations' => [
'scan' => [

View File

@ -2,9 +2,9 @@
declare(strict_types=1);
namespace MessageNotify\Contracts;
namespace EasyMessage\Contracts;
interface MessageNotifyInterface
interface EasyMessageInterface
{
public const INFO = 'info';

View File

@ -2,7 +2,7 @@
declare(strict_types=1);
namespace MessageNotify\Exceptions;
namespace EasyMessage\Exceptions;
class MessageNotificationException extends \RuntimeException
{

View File

@ -2,7 +2,7 @@
declare(strict_types=1);
namespace MessageNotify;
namespace EasyMessage;
use Hyperf\Utils\ApplicationContext;

View File

@ -2,15 +2,15 @@
declare(strict_types=1);
namespace MessageNotify\Template;
namespace EasyMessage\Template;
use MessageNotify\Contracts\MessageNotifyInterface;
use EasyMessage\Contracts\EasyMessageInterface;
abstract class AbstractTemplate
{
protected array $at = [];
protected string $pipeline = MessageNotifyInterface::INFO;
protected string $pipeline = EasyMessageInterface::INFO;
protected string $text = '';

View File

@ -2,7 +2,7 @@
declare(strict_types=1);
namespace MessageNotify\Template;
namespace EasyMessage\Template;
class Markdown extends AbstractTemplate
{

View File

@ -2,7 +2,7 @@
declare(strict_types=1);
namespace MessageNotify\Template;
namespace EasyMessage\Template;
class Text extends AbstractTemplate
{

View File

@ -2,15 +2,15 @@
declare(strict_types=1);
namespace MessageNotifyTest;
namespace EasyMessageTest;
use MessageNotify\Channel\DingTalkChannel;
use MessageNotify\Channel\FeiShuChannel;
use MessageNotify\Channel\WechatChannel;
use MessageNotify\Contracts\MessageNotifyInterface;
use MessageNotify\Notify;
use MessageNotify\Template\Markdown;
use MessageNotify\Template\Text;
use EasyMessage\Channel\DingTalkChannel;
use EasyMessage\Channel\FeiShuChannel;
use EasyMessage\Channel\WechatChannel;
use EasyMessage\Contracts\EasyMessageInterface;
use EasyMessage\Notify;
use EasyMessage\Template\Markdown;
use EasyMessage\Template\Text;
use PHPUnit\Framework\TestCase;
/**
@ -32,7 +32,7 @@ class NotifyTest extends TestCase
->setAt(['all'])
->setTitle('标题')
->setText('测试')
->setPipeline(MessageNotifyInterface::INFO)
->setPipeline(EasyMessageInterface::INFO)
->setTemplate(Markdown::class)
->send();