Ding.php 655 字节
<?php

namespace Lackoxygen\ExceptionPush\Agents;

use DingNotice\DingTalkService;
use Lackoxygen\ExceptionPush\Attribute\Attribute;
use Lackoxygen\ExceptionPush\Contracts\AgentInterface;

class Ding implements AgentInterface
{
    use Attribute;

    public string $token = '';

    public string $secret = '';

    public bool $enable = true;

    public function report(array $content)
    {
        $talk = new DingTalkService(['token' => $this->token, 'enabled' => true, 'secret' => $this->secret]);
        $talk->setTextMessage(join("\n", $content))->send();
    }

    public function dsiabled(): bool
    {
        return !$this->enable;
    }
}