예제 #1
0
 public function beforeExecuteRoute($dispatcher)
 {
     $members = new \Phalcon_wifi\Common\Models\Members();
     $this->moduleName = $dispatcher->getModuleName();
     $this->controllerName = $dispatcher->getControllerName();
     $this->actionName = $dispatcher->getActionName();
     $currentRouter = $this->moduleName . '/' . $this->controllerName . '/' . $this->actionName;
     if (!$this->ifNotCheckUri($currentRouter)) {
         if (!$members->checkLogin()) {
             $this->redirect($this->createLocalUrl(array('for' => 'common', 'controller' => 'Members', 'action' => 'login')));
             return false;
         }
     }
 }
예제 #2
0
 public function record()
 {
     $operation = $this->controllerName . "/" . $this->actionName;
     $request = new \Phalcon\Http\Request();
     $ip = $request->getClientAddress();
     $members = new \Phalcon_wifi\Common\Models\Members();
     $mid = $members->checkLogin();
     $record = new \Phalcon_wifi\Common\Models\Record();
     $record->operation = $operation;
     $record->loginip = $ip;
     $record->mid = $mid;
     $record->log_time = date("Y-m-d H:i:s");
     $record->save();
 }
예제 #3
0
 public function indexAction()
 {
     $this->view->disableLevel(\Phalcon\MVC\View::LEVEL_MAIN_LAYOUT);
     $this->view->setVar("title", '用户管理');
     $currentPage = $this->getParam("currentPage", 1);
     $perPage = $this->getParam("perPage", 10);
     $mchild = $this->request->get("mchild");
     $keyword = $this->request->get("keyword");
     $where = "1";
     if ($mchild) {
         $where .= " AND mchild = {$mchild} ";
     }
     if ($keyword) {
         $where .= " AND mname LIKE '%{$keyword}%' ";
     }
     $memberModel = new \Phalcon_wifi\Common\Models\Members();
     $members = $memberModel->baseList($currentPage, "mid DESC", $where, $perPage);
     $members["pager"]->getParams["mchild"] = $mchild;
     $members["pager"]->getParams["keyword"] = $keyword;
     $members["pager"]->uri = $this->createLocalUrl(array('for' => 'common', 'controller' => 'Members', 'action' => 'index'));
     $this->view->setVar("members", $members);
     $this->view->setVar("pager", $members["pager"]);
 }
예제 #4
0
 public function addUserAction()
 {
     $mname = $this->getParam("mname", "");
     $mobile = $this->getParam("mobile", "");
     $mchild = $this->getParam("mchild", "");
     $email = $this->getParam("email", "");
     if (!$mname || !$mobile || !$mchild || !$email) {
         $this->error("缺少参数");
         return false;
     }
     $members = new \Phalcon_wifi\Common\Models\Members();
     $result = $members->addUser($mname, $mchild, $email, $mobile);
     if ($result) {
         $this->success();
         return false;
     }
     $this->error($members->error);
     return false;
 }