BookUserService.php 1023 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: z-yang
  5. * Date: 2019/1/10
  6. * Time: 11:30
  7. */
  8. namespace App\Modules\YunQi\Services;
  9. use App\Modules\YunQi\Models\BookUser;
  10. use Redis;
  11. class BookUserService
  12. {
  13. public static function getByUid($uid){
  14. return BookUser::where('uid',$uid)->select('id','uid','area','type','bid','flag')->first();
  15. }
  16. public static function updateUser($uid,$data){
  17. return BookUser::where('uid',$uid)->update($data);
  18. }
  19. public static function popUser($uid){
  20. /*try{
  21. Redis::srem('YQ_USER_TEST_BOOK:USER',$uid);
  22. }catch (\Exception $e){}*/
  23. }
  24. public static function isUserInRedis($uid){
  25. return Redis::SISMEMBER('YQ_USER_TEST_BOOK:USER',$uid);
  26. }
  27. /**
  28. * 判断用户是否存在
  29. * @param $uid
  30. * @return bool
  31. */
  32. public static function selectUser($uid){
  33. /*if(!self::isUserInRedis($uid)){
  34. return null;
  35. }*/
  36. $user = self::getByUid($uid);
  37. return $user;
  38. }
  39. }