1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- <?php
- /**
- * Created by PhpStorm.
- * User: z-yang
- * Date: 2019/1/10
- * Time: 11:30
- */
- namespace App\Modules\YunQi\Services;
- use App\Modules\YunQi\Models\BookUser;
- use Redis;
- class BookUserService
- {
- public static function getByUid($uid){
- return BookUser::where('uid',$uid)->select('id','uid','area','type')->first();
- }
- public static function updateUser($uid,$data){
- return BookUser::where('uid',$uid)->update($data);
- }
- public static function popUser($uid){
- Redis::srem('xx',$uid);
- }
- public static function isUserInRedis($uid){
- return Redis::SISMEMBER('key',$uid);
- }
- /**
- * 判断用户的区域是否已经获取
- * @param $uid
- * @return bool
- */
- public static function selectUser($uid){
- if(!self::isUserInRedis($uid)){
- return false;
- }
- $user = self::getByUid($uid);
- if(!$user)
- return false;
- if($user->area)
- return false;
- return true;
- }
- }
|