2026-01-05 14:33:21 +08:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace app\common\controller;
|
|
|
|
|
|
2026-01-05 17:18:45 +08:00
|
|
|
use support\Log;
|
2026-01-05 14:33:21 +08:00
|
|
|
use support\Request;
|
|
|
|
|
use support\Response;
|
|
|
|
|
use app\common\utils\FeishuMessage;
|
|
|
|
|
use app\inquiry\service\InquiryLogService;
|
|
|
|
|
use app\common\model\CrmCustomer;
|
|
|
|
|
use app\common\model\InquiryLog;
|
|
|
|
|
use app\common\model\User;
|
|
|
|
|
use support\exception\BusinessException;
|
|
|
|
|
|
|
|
|
|
class NotifyController
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 不用头部数据
|
|
|
|
|
* @var array
|
|
|
|
|
*/
|
|
|
|
|
protected $noNeedHeaderData = ['feishuCallback', 'feishuEvent'];
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 不登录不鉴权
|
|
|
|
|
* @var array
|
|
|
|
|
*/
|
|
|
|
|
protected $noNeedLogin = ['feishuCallback', 'feishuEvent'];
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 飞书回调
|
|
|
|
|
* @param Request $request
|
|
|
|
|
* @return Response
|
|
|
|
|
*/
|
|
|
|
|
public function feishuCallback(Request $request)
|
|
|
|
|
{
|
|
|
|
|
try {
|
|
|
|
|
$param = $request->post();
|
|
|
|
|
|
2026-01-05 17:18:45 +08:00
|
|
|
Log::info('feishuCallback',[$param]);
|
2026-01-05 14:33:21 +08:00
|
|
|
// 响应消息
|
2026-01-05 17:18:45 +08:00
|
|
|
return new Response(200, ['Content-Type' => 'application/json'], $param);
|
2026-01-05 14:33:21 +08:00
|
|
|
} catch (\Throwable $e) {
|
|
|
|
|
return $this->error($e->getMessage());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function error($msg = '')
|
|
|
|
|
{
|
|
|
|
|
$data = '{
|
|
|
|
|
"toast": {
|
|
|
|
|
"type": "error",
|
|
|
|
|
"content": "'.$msg.'"
|
|
|
|
|
}
|
|
|
|
|
}';
|
|
|
|
|
return new Response(200, ['Content-Type' => 'application/json'], $data);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 飞书事件
|
|
|
|
|
* @param Request $request
|
|
|
|
|
* @return Response
|
|
|
|
|
*/
|
|
|
|
|
public function feishuEvent(Request $request)
|
|
|
|
|
{
|
|
|
|
|
try {
|
|
|
|
|
$data = $request->post();
|
|
|
|
|
|
|
|
|
|
var_dump($data);
|
|
|
|
|
|
|
|
|
|
return json($data);
|
|
|
|
|
} catch (\Throwable $e) {
|
|
|
|
|
return json($e->getMessage());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|