namespace App\Http\Controllers\Dueros;
use Baidu\Duer\Botsdk\Bot as DuerosBot;
class Bot extends DuerosBot
{
public function __construct($postData = [])
{
parent::__construct($postData);
// 日志配置 日志报错了
$this->log = new \Baidu\Duer\Botsdk\Log([
//日志存储路径
'path' => storage_path('app') . "\logs",
'level' => \Baidu\Duer\Botsdk\Log::NOTICE,
]);
// 记录这次请求
$requestJson = json_encode($this->request->getData());
$this->log->setField('[logid]',$this->request->getLogId());
$this->log->setField('[request]',$requestJson);
$this->addLaunchHandler(function () {
return [
'card' => null,
'outputSpeech' => 'Hello, 欢迎使用智能设备语音控制系统',
'directives' => [],
'resource' => null,
'reprompt' => null,
];
});
}
}
[-12-17 01:42:01] local.ERROR: Undefined index: HTTP_SAIYALOGID {"exception":"[object] (ErrorException(code: 0): Undefined index: HTTP_SAIYALOGID