配置gitlab仓库
"repositories": {
"lackoxygen/exception-push": {
"type": "git",
"url": "http://47.107.73.162:8099/lackoxygen/exception-push.git"
},
},
"config": {
"secure-http": false
},
安装
composer require lackoxygen/exception-push
配置文件
//路径 config/tiktok.shop.php
[
'agents' => [
Wx::class => [
'key' => '',
'enable' => false //启用或停用
], Ding::class => [
'token' => '',
'secret' => '',
'enable' => false //启用或停用
]
],
'client' => [
'timeout' => 30.00, //超时时间
],
'callbacks' => [
'formatter' => null, //格式化内容
'dispatcher' => null //触发发送内容
]
];
配置发布
php artisan vendor:publish --provider=Lackoxygen\\ExceptionPush\\ExceptionPushProvider
同步
none
异步
namespace App\Jobs;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldBeUnique;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
use Lackoxygen\ExceptionPush\Dispatcher;
class Send implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
/**
* Create a new job instance.
*
* @return void
*/
public function __construct($agents, $body)
{
$this->agents = $agents;
$this->body = $body;
}
/**
* Execute the job.
*
* @return void
*/
public function handle()
{
$dis = new Dispatcher();
$func = $dis->default();
$func($this->agents, $this->body);
}
}
# rewrite callbacks.dispatcher
$dispatcher = function ($agents, $body){
Send::dispatch($agents, $body);
}
日志
use function Lackoxygen\ExceptionPush\notify as notify
notify('hello world', 'debug');