RequestLog.php 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. <?php
  2. namespace UCore\Model;
  3. use UCore\Helper\Cache;
  4. use UCore\ModelCore;
  5. /**
  6. * 请求日志
  7. * field start
  8. * @property int $id
  9. * @property string $router
  10. * @property string $query get参数
  11. * @property string $post 原始请求数据
  12. * @property string $protobuf_json Protobuf转换后的JSON数据
  13. * @property string $unid
  14. * @property string $path
  15. * @property string $error
  16. * @property string $headers
  17. * @property string $method 请求类型
  18. * @property string $request_unid
  19. * @property string $run_unid
  20. * @property string $response 返回消息
  21. * @property string $ipaddress ip地址
  22. * @property int $user_id 用户ID
  23. * @property string $host 主机
  24. * @property string $server
  25. * @property int $sale_date 日期
  26. * @property \Carbon\Carbon $created_at
  27. * @property \Carbon\Carbon $updated_at
  28. * @property string $module 模块
  29. * @property string $token token
  30. * @property int $run_ms 运行毫秒数
  31. * @property int $sql_num sql语句数量
  32. * field end
  33. */
  34. class RequestLog extends ModelCore
  35. {
  36. protected $table = 'sys_request_logs';
  37. static public function selectPath()
  38. {
  39. $data = Cache::cacheCall([__CLASS__, __FUNCTION__, 2], function () {
  40. $data = RequestLog::query()
  41. ->groupBy('path')
  42. ->distinct()
  43. ->whereIn('module', [
  44. 'oapi', 'app'
  45. ])
  46. ->pluck('path', 'path')
  47. ->toArray();
  48. return $data;
  49. }, [], 100);
  50. return $data;
  51. }
  52. }