SystemLog.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <?php
  2. namespace app\user\model;
  3. class SystemLog extends Base{
  4. // CREATE TABLE `sys_system_log` (
  5. // `id` bigint(20) NOT NULL AUTO_INCREMENT,
  6. // `system` varchar(255) NOT NULL,
  7. // `controller` varchar(255) NOT NULL,
  8. // `action` varchar(255) NOT NULL,
  9. // `param` text NOT NULL,
  10. // `response` text NOT NULL,
  11. // `action_name` varchar(255) NOT NULL,
  12. // `action_id` int(11) NOT NULL,
  13. // `createTime` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  14. // PRIMARY KEY (`id`)
  15. // ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4
  16. protected $schema = [
  17. 'id' => 'bigint',
  18. 'system' => 'string',
  19. 'controller' => 'string',
  20. 'action' => 'string',
  21. 'param' => 'text',
  22. 'response' => 'text',
  23. 'action_name' => 'string',
  24. 'action_id' => 'int',
  25. 'client_ip'=>'string',
  26. 'createTime' => 'datetime',
  27. ];
  28. protected $type = [
  29. 'id' => 'integer',
  30. 'createTime' => 'datetime',
  31. ];
  32. protected $createTime = 'createTime';
  33. protected $append=['action_msg'];
  34. public function getActionMsgAttr($value,$data){
  35. return \SystemLog::GET_LOG_PATH($data,$data['action_name'],$data['param']);
  36. }
  37. public function getParamAttr($value){
  38. return json_decode($value,true);
  39. }
  40. public function getResponseAttr($value){
  41. return json_decode($value,true);
  42. }
  43. }