You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
<?php
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
|
namespace App\Model;
|
|
|
|
|
|
|
|
class RequestLog extends Model
|
|
|
|
{
|
|
|
|
protected $table = 'request_logs';
|
|
|
|
|
|
|
|
protected $casts = [
|
|
|
|
'request_data' => 'array',
|
|
|
|
];
|
|
|
|
|
|
|
|
public function generateToken() {
|
|
|
|
return md5($this->app_id . '_' . $this->request_id);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getDataValue($key, $defaultValue = null) {
|
|
|
|
$data = $this->getData();
|
|
|
|
return $data[$key] ?? $defaultValue;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getData() {
|
|
|
|
$data = $this->request_data['data'] ?? null;
|
|
|
|
if ($data) {
|
|
|
|
return json_decode($data, true);
|
|
|
|
}
|
|
|
|
return [];
|
|
|
|
}
|
|
|
|
}
|