コード例 #1
0
 public function __construct($lastCheckedSubscription)
 {
     $userMail = UserMail::whereRaw('user_mail.id > ? and (user_mail.verify = ? or user_mail.pushbullet_verify = ?)', array($lastCheckedSubscription, 'verified', 'verified'))->first();
     $userLists = Subscription::where('subscription.user_id', $userMail->user_id)->whereNull('user_list.deleted_at')->whereNull('subscription.deleted_at')->leftJoin('user_list', 'subscription.user_list_id', '=', 'user_list.id')->distinct()->get(['user_list.id', 'subscription.id as sub_id', 'subscription.created_at', 'subscription.updated_at']);
     $subscriptionIds = $userLists->lists('sub_id');
     $profiles = UserListProfile::whereIn('user_list_profile.user_list_id', $userLists->lists('id'))->leftJoin('profile', 'user_list_profile.profile_id', '=', 'profile.id')->leftJoin('profile_ban', 'profile_ban.profile_id', '=', 'profile.id')->whereNull('user_list_profile.deleted_at')->distinct()->get(['user_list_profile.user_list_id', 'profile.id', 'profile.display_name', 'profile.small_id', 'profile.avatar_thumb', 'profile_ban.vac', 'profile_ban.community', 'profile_ban.trade', 'profile_ban.unban', 'profile_ban.created_at', 'profile_ban.updated_at', 'profile_ban.vac_banned_on']);
     $this->profiles = $profiles;
     $this->userMail = $userMail;
     $this->userLists = $userLists;
     $this->subscriptionIds = $subscriptionIds;
 }
コード例 #2
0
ファイル: MostTracked.php プロジェクト: RobinJ1995/VacStatus
 private function grabFromDB()
 {
     $userListProfiles = UserListProfile::select('profile.id', 'profile.display_name', 'profile.avatar_thumb', 'profile.small_id', 'profile_ban.vac', 'profile_ban.vac_banned_on', 'profile_ban.community', 'profile_ban.trade', 'users.site_admin', 'users.donation', 'users.beta', \DB::raw('max(user_list_profile.created_at) as created_at'), \DB::raw('count(user_list_profile.id) as total'))->groupBy('profile.id')->orderBy('total', 'desc')->whereNull('user_list_profile.deleted_at')->leftjoin('profile', 'user_list_profile.profile_id', '=', 'profile.id')->leftjoin('profile_ban', 'profile.id', '=', 'profile_ban.profile_id')->leftjoin('users', 'profile.small_id', '=', 'users.small_id')->take(20)->get();
     $return = [];
     foreach ($userListProfiles as $userListProfile) {
         $vacBanDate = new DateTime($userListProfile->vac_banned_on);
         $return[] = ['id' => $userListProfile->id, 'display_name' => $userListProfile->display_name, 'avatar_thumb' => $userListProfile->avatar_thumb, 'small_id' => $userListProfile->small_id, 'steam_64_bit' => Steam::to64Bit($userListProfile->small_id), 'vac' => $userListProfile->vac, 'vac_banned_on' => $vacBanDate->format("M j Y"), 'community' => $userListProfile->community, 'trade' => $userListProfile->trade, 'site_admin' => (int) $userListProfile->site_admin ?: 0, 'donation' => (int) $userListProfile->donation ?: 0, 'beta' => (int) $userListProfile->beta ?: 0, 'times_added' => ['number' => $userListProfile->total, 'time' => (new DateTime($userListProfile->created_at))->format("M j Y")]];
     }
     $multiProfile = new MultiProfile($return);
     $return = $multiProfile->run();
     $this->updateCache($return);
     return $return;
 }
コード例 #3
0
 private function grabFromDB()
 {
     $profile = Profile::where('profile.small_id', $this->smallId)->leftjoin('profile_ban', 'profile.id', '=', 'profile_ban.profile_id')->leftjoin('users', 'profile.small_id', '=', 'users.small_id')->first(['profile.id', 'profile.display_name', 'profile.avatar', 'profile.avatar_thumb', 'profile.small_id', 'profile.profile_created', 'profile.privacy', 'profile.alias', 'profile.created_at', 'profile_ban.vac', 'profile_ban.vac_banned_on', 'profile_ban.community', 'profile_ban.trade', 'users.site_admin', 'users.donation', 'users.beta']);
     /* Copied and pasted from function above */
     $profileOldAlias = $profile->ProfileOldAlias()->whereProfileId($profile->id)->orderBy('id', 'desc')->get();
     $gettingCount = UserListProfile::whereProfileId($profile->id)->orderBy('id', 'desc')->whereNull('deleted_at')->get();
     $profileTimesAdded = ['number' => $gettingCount->count(), 'time' => isset($gettingCount[0]) ? (new DateTime($gettingCount[0]->created_at))->format("M j Y") : null];
     $profileCheckCache = "profile_checked_";
     $currentProfileCheck = ['number' => 0, 'time' => date("M j Y", time())];
     if (Cache::has($profileCheckCache . $this->smallId)) {
         $currentProfileCheck = Cache::get($profileCheckCache . $this->smallId);
     }
     $newProfileCheck = ['number' => $currentProfileCheck['number'] + 1, 'time' => date("M j Y", time())];
     Cache::forever($profileCheckCache . $this->smallId, $newProfileCheck);
     /* WOW THAT WAS SHORT!!!!! */
     $steam64BitId = Steam::to64Bit($profile->small_id);
     $oldAliasArray = [];
     foreach ($profileOldAlias as $k => $oldAlias) {
         $oldAliasArray[] = ["newname" => $oldAlias->seen_alias, "timechanged" => $oldAlias->seen->format("M j Y")];
     }
     $return = ['id' => $profile->id, 'display_name' => $profile->display_name, 'avatar' => $profile->avatar, 'small_id' => $profile->small_id, 'steam_64_bit' => $steam64BitId, 'steam_32_bit' => Steam::to32Bit($steam64BitId), 'profile_created' => isset($profile->profile_created) ? date("M j Y", $profile->profile_created) : "Unknown", 'privacy' => $profile->privacy, 'alias' => Steam::friendlyAlias(json_decode($profile->alias)), 'created_at' => $profile->created_at->format("M j Y"), 'vac' => $profile->vac, 'vac_banned_on' => $profile->vac_banned_on->format("M j Y"), 'community' => $profile->community, 'trade' => $profile->trade, 'site_admin' => (int) $profile->site_admin ?: 0, 'donation' => (int) $profile->donation ?: 0, 'beta' => (int) $profile->beta ?: 0, 'profile_old_alias' => $oldAliasArray, 'times_checked' => $currentProfileCheck, 'times_added' => $profileTimesAdded];
     return $return;
 }
コード例 #4
0
 public function addManyToList()
 {
     $input = Input::all();
     $search = Steam::parseSearch($input['search']);
     $description = isset($input['description']) && !empty($input['description']) ? $input['description'] : null;
     if (!is_array($search)) {
         return ['error' => 'Invalid Search Option'];
     }
     $validProfile = array();
     $invalidProfile = array();
     foreach ($search as $potentialProfile) {
         $steam3Id = Steam::findUser($potentialProfile);
         if (isset($steam3Id['error'])) {
             $invalidProfile[] = $potentialProfile;
         } else {
             $validProfile[] = $steam3Id['success'];
         }
     }
     $smallIds = Steam::toSmallId($validProfile);
     $profiles = Profile::whereIn('small_id', $smallIds)->get(['small_id']);
     $profilesParsed = [];
     foreach ($smallIds as $smallId) {
         $profile = $profiles->where('small_id', $smallId)->first();
         if (is_null($profile)) {
             $profilesParsed[] = ['small_id' => $smallId];
             continue;
         }
     }
     $multiProfile = new MultiProfile($profilesParsed);
     $multiProfile->run();
     $listId = (int) $input['list_id'];
     $userList = UserList::where('id', $listId)->first();
     $userListProfiles = UserListProfile::whereIn('profile.small_id', $smallIds)->leftjoin('profile', 'profile.id', '=', 'user_list_profile.profile_id')->where('user_list_profile.user_list_id', $listId)->where('user_list_profile.deleted_at', null)->get(['profile.small_id', 'profile.id']);
     $userListProfilesSmallId = [];
     foreach ($userListProfiles as $userListProfile) {
         $userListProfilesSmallId[] = $userListProfile->small_id;
     }
     $smallIds = array_diff($smallIds, $userListProfilesSmallId);
     $profiles = Profile::whereIn('small_id', $smallIds)->get();
     $toAddtoList = [];
     foreach ($profiles as $k => $profile) {
         if (Auth::user()->unlockUser() <= $userList->UserListProfile()->count() + $k) {
             break;
         }
         $toAddtoList[] = new UserListProfile(["profile_id" => $profile->id, "profile_name" => $profile->display_name, "profile_description" => $description]);
     }
     $userList->UserListProfile()->saveMany($toAddtoList);
     $customList = new CustomList(UserList::where('id', $listId)->first());
     if ($customList->error()) {
         return $customList->error();
     }
     return $customList->getCustomList();
 }