AdminUser.php 817 B

12345678910111213141516171819202122232425262728293031323334353637
  1. <?php
  2. /**
  3. * Created by PhpStorm
  4. * User:林志杰
  5. * Email:[email protected]
  6. * Motto:纵有疾风起,人生不言弃!
  7. * Time:2020/1/3 0:29
  8. */
  9. namespace app\common\model\mysql;
  10. use think\Model;
  11. class AdminUser extends Model
  12. {
  13. /**
  14. * 根据用户名获取后端用户表的数据
  15. * @param $username
  16. * @return array|bool|Model|null
  17. * @throws \think\db\exception\DataNotFoundException
  18. * @throws \think\db\exception\DbException
  19. * @throws \think\db\exception\ModelNotFoundException
  20. */
  21. public function getAdminUserByUsername($username)
  22. {
  23. if (empty($username)) {
  24. return false;
  25. }
  26. $where = [
  27. 'username' => trim($username),
  28. ];
  29. $result = $this->where($where)->find();
  30. return $result;
  31. }
  32. }