示例#1
0
 /**
  * Index Action
  *
  * @package     las
  * @version     1.0
  */
 public function indexAction()
 {
     $this->tag->setTitle(__('Home'));
     $this->site_desc = __('Home');
     $ip = \Las\Library\Info::ip();
     $this->view->setVar('ip', $ip);
     if ($device = Devices::findFirst(['IP = :ip:', 'bind' => ['ip' => ip2long($ip)]])) {
         $client = $device->getClient();
         $this->view->setVars(['device' => $device, 'client' => $client, 'tariff' => $client->getTariff(), 'balance' => Payments::sum(['conditions' => 'status=' . Payments::SUCCESS . ' AND client_id=' . $client->id, 'column' => 'amount'])]);
     }
 }
示例#2
0
 /**
  * Index Action
  *
  * @package     las
  * @version     1.0
  */
 public function temporarilyAction()
 {
     $params = $this->router->getParams();
     if (isset($params[0]) && ($id = $params[0])) {
         $ip = \Las\Library\Info::ip();
         if ($device = Devices::findFirst(['IP = :ip:', 'bind' => ['ip' => ip2long($ip)]])) {
             $client = $device->getClient();
             if ($client->id == $id && $client->status == Clients::INDEBTED) {
                 $client->status = Clients::ACTIVE;
                 $client->save();
             }
         }
         $this->response->redirect('tasks/tmp');
     }
 }