LogUserLogin.php 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  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_admin_login".
  7. *
  8. * @property \MongoDB\BSON\ObjectID|string $_id
  9. * @property mixed $user_name
  10. * @property mixed $opt_type
  11. * @property mixed $return_result
  12. * @property mixed $success_times
  13. * @property mixed $fail_times
  14. * @property mixed $device
  15. * @property mixed $request_route
  16. * @property mixed $ip
  17. * @property mixed $created_at
  18. * @property mixed $user_agent
  19. * @property mixed $period_num
  20. * @property mixed $version
  21. */
  22. class LogUserLogin extends MongoActiveRecord
  23. {
  24. /**
  25. * {@inheritdoc}
  26. */
  27. public static function collectionName()
  28. {
  29. return 'ar_bonus_user_login';
  30. }
  31. /**
  32. * @return \yii\mongodb\Connection the MongoDB connection used by this AR class.
  33. */
  34. public static function getDb()
  35. {
  36. return Yii::$app->get('dbLog');
  37. }
  38. /**
  39. * 获取id
  40. * @return string
  41. */
  42. public function getId() {
  43. return (string) $this->_id;
  44. }
  45. /**
  46. * {@inheritdoc}
  47. */
  48. public function attributes()
  49. {
  50. return [
  51. '_id',
  52. 'user_name',
  53. 'ip',
  54. 'created_at',
  55. 'user_agent',
  56. 'period_num',
  57. 'opt_type',
  58. 'success_times',
  59. 'fail_times',
  60. 'device',
  61. 'request_route',
  62. 'return_result',
  63. 'version'
  64. ];
  65. }
  66. /**
  67. * {@inheritdoc}
  68. */
  69. public function rules()
  70. {
  71. return [
  72. [['user_name', 'ip', 'request_route'], 'required'],
  73. [['created_at', 'success_times', 'period_num', 'fail_times'], 'integer'],
  74. [['user_name', 'ip', 'opt_type'], 'string', 'max' => 16],
  75. [['_id', 'return_result', 'device',], 'safe'],
  76. [['user_agent', 'request_route'], 'string', 'max' => 1000],
  77. ];
  78. }
  79. /**
  80. * {@inheritdoc}
  81. */
  82. public function attributeLabels()
  83. {
  84. return [
  85. '_id' => 'ID',
  86. 'user_name' => '对象编号',
  87. 'ip' => '操作ip',
  88. 'created_at' => '创建时间',
  89. 'user_agent' => '浏览器特征',
  90. 'period_num' => '期数',
  91. 'opt_type' => '操作类型',
  92. 'success_times' => '登陆成功次数',
  93. 'fail_times' => '登录失败次数',
  94. 'device' => '客户端',
  95. 'request_route' => '请求路径',
  96. 'return_result' => '返回内容',
  97. 'version' => '版本',
  98. ];
  99. }
  100. }