LogSystem.php 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. <?php
  2. namespace common\models;
  3. use common\components\MongoActiveRecord;
  4. use Yii;
  5. /**
  6. * This is the model class for collection "ar_bonus_system_log".
  7. *
  8. * @property \MongoDB\BSON\ObjectID|string $_id
  9. * @property mixed $ip
  10. * @property mixed $created_at
  11. * @property mixed $request_route
  12. * @property mixed $opt_type
  13. * @property mixed $request_content
  14. * @property mixed $response_content
  15. * @property mixed $opt_obj_id
  16. * @property mixed $opt_obj_name
  17. * @property mixed $opt_target_name
  18. * @property mixed $opt_user
  19. * @property mixed $user_agent
  20. * @property mixed $period_num
  21. * @property mixed $is_batch
  22. * @property mixed $device
  23. */
  24. class LogSystem extends MongoActiveRecord
  25. {
  26. /**
  27. * {@inheritdoc}
  28. */
  29. public static function collectionName()
  30. {
  31. return 'ar_bonus_system_log';
  32. }
  33. /**
  34. * @return \yii\mongodb\Connection the MongoDB connection used by this AR class.
  35. */
  36. public static function getDb()
  37. {
  38. return Yii::$app->get('dbLog');
  39. }
  40. /**
  41. * 获取id
  42. * @return string
  43. */
  44. public function getId() {
  45. return (string) $this->_id;
  46. }
  47. /**
  48. * {@inheritdoc}
  49. */
  50. public function attributes()
  51. {
  52. return [
  53. '_id',
  54. 'ip',
  55. 'created_at',
  56. 'request_route',
  57. 'opt_type',
  58. 'request_content',
  59. 'response_content',
  60. 'opt_obj_id',
  61. 'opt_obj_name',
  62. 'opt_target_name',
  63. 'opt_user',
  64. 'user_agent',
  65. 'period_num',
  66. 'is_batch',
  67. 'device',
  68. ];
  69. }
  70. /**
  71. * {@inheritdoc}
  72. */
  73. public function rules()
  74. {
  75. return [
  76. [['request_route', 'opt_type'], 'required'],
  77. [['created_at', 'period_num', 'is_batch'], 'integer'],
  78. [['opt_obj_id'], 'string', 'max' => 32],
  79. [['ip', 'opt_obj_name'], 'string', 'max' => 16],
  80. [['_id', 'opt_type', 'request_content', 'response_content', 'device'], 'safe'],
  81. [['user_agent', 'request_route'], 'string', 'max' => 1000],
  82. ];
  83. }
  84. /**
  85. * {@inheritdoc}
  86. */
  87. public function attributeLabels()
  88. {
  89. return [
  90. '_id' => 'ID',
  91. 'ip'=>'操作ip',
  92. 'created_at'=>'创建时间',
  93. 'request_route'=>'请求路由',
  94. 'opt_type'=>'操作类型',
  95. 'request_content'=>'请求内容',
  96. 'response_content'=>'响应内容',
  97. 'opt_obj_id'=>'操作对象id',
  98. 'opt_obj_name'=>'操作对象名称',
  99. 'opt_target_name'=>'操作对象',
  100. 'opt_user'=>'操作人',
  101. 'user_agent'=>'浏览器特征',
  102. 'period_num'=>'期数',
  103. 'is_batch'=>'批量保存',
  104. 'device'=>'客户端',
  105. ];
  106. }
  107. }