LogUserHandle.php 3.1 KB

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