LogAdminLogin.php 2.5 KB

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