active_time > 600) { $user->active_time = $now; $user->update(); $onlineRepo = new OnlineRepo(); $online = $onlineRepo->findByUserDate($user->id, date('Y-m-d')); if ($online) { $online->active_time = $now; $online->client_type = $this->getClientType(); $online->client_ip = $this->getClientIp(); $online->update(); } else { $online = new OnlineModel(); $online->user_id = $user->id; $online->active_time = $now; $online->client_type = $this->getClientType(); $online->client_ip = $this->getClientIp(); $online->create(); } } } }