Admin.php 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. <?php
  2. namespace frontend\models;
  3. use Yii;
  4. /**
  5. * This is the model class for table "bit_admin".
  6. *
  7. * @property integer $id
  8. * @property string $create_date
  9. * @property string $modify_date
  10. * @property string $department
  11. * @property string $email
  12. * @property integer $is_account_enabled
  13. * @property integer $is_account_expired
  14. * @property integer $is_account_locked
  15. * @property integer $is_credentials_expired
  16. * @property string $locked_date
  17. * @property string $login_date
  18. * @property integer $login_failure_count
  19. * @property string $login_ip
  20. * @property string $name
  21. * @property string $password
  22. * @property string $username
  23. */
  24. class Admin extends \yii\db\ActiveRecord
  25. {
  26. /**
  27. * @inheritdoc
  28. */
  29. public static function tableName()
  30. {
  31. return 'bit_admin';
  32. }
  33. /**
  34. * @inheritdoc
  35. */
  36. public function rules()
  37. {
  38. return [
  39. [['create_date', 'modify_date', 'login_ip'], 'safe'],
  40. [['username', 'password'], 'required'],
  41. [['department', 'email', 'locked_date', 'login_date', 'name'], 'string'],
  42. [['is_account_enabled', 'is_account_expired', 'is_account_locked', 'is_credentials_expired'], 'boolean'],
  43. ];
  44. }
  45. /**
  46. * @inheritdoc
  47. */
  48. public function attributeLabels()
  49. {
  50. return [
  51. 'id' => 'ID',
  52. 'create_date' => '创建日期',
  53. 'modify_date' => '修改日期',
  54. 'department' => '部门',
  55. 'email' => '电子邮箱',
  56. 'is_account_enabled' => '是否启用',
  57. 'is_account_expired' => '是否过期',
  58. 'is_account_locked' => '是否锁定',
  59. 'is_credentials_expired' => '凭证过期',
  60. 'locked_date' => '锁定日期',
  61. 'login_date' => '登录日期',
  62. 'login_failure_count' => '登录失败次数',
  63. 'login_ip' => '登录IP',
  64. 'name' => '姓名',
  65. 'password' => '密码',
  66. 'username' => '用户名',
  67. // 'description' => '描述',
  68. ];
  69. }
  70. /**
  71. * 加密方法
  72. * @param string $password
  73. * @return string
  74. */
  75. public static function hash($password)
  76. {
  77. return md5($password);
  78. }
  79. }