コード例 #1
0
 public function setlogininfoAction()
 {
     $SysClass = new ctrlSystem();
     // 預設不連資料庫
     $SysClass->initialization();
     // 連線指定資料庫
     // $SysClass->initialization("設定檔[名稱]",true); -> 即可連資料庫
     // 連線預設資料庫
     // $SysClass->initialization(null,true);
     try {
         //-----BI開始-----
         $action = array();
         $action["status"] = false;
         if (!empty($_POST)) {
             if ($_POST["uuid"]) {
                 $APIUrl = $SysClass->GetAPIUrl('rsApiURL');
                 $APIUrl .= "verifyAPI";
                 // 進行UUID驗證
                 $sendData = array();
                 $sendData["uuid"] = $_POST["uuid"];
                 // 送出
                 $userPosition = $SysClass->UrlDataPost($APIUrl, $sendData);
                 // print_r($userPosition);
                 // exit();
                 $userPosition = $SysClass->Json2Data($userPosition["result"], false);
                 // print_r($userPosition);
                 // exit();
                 if ($userPosition["status"]) {
                     // 設置相關的帳號
                     $_SESSION["uuid"] = $userPosition["uuid"];
                     $_SESSION["userAc"] = $userPosition["userAc"];
                     // 選單權限
                     $_SESSION["menuPosition"] = $userPosition["menuPosition"];
                     $_SESSION["isAdmin"] = $userPosition["isAdmin"];
                     $_SESSION["sysList"] = $userPosition["sysList"];
                     $_SESSION["userIDList"] = $userPosition["userIDList"];
                     $action["msg"] = "驗證成功";
                     $action["sysList"] = $userPosition["sysList"];
                     $action["status"] = true;
                 } else {
                     // 驗證失敗,請重新登入
                     $action["msg"] = 'uuid is error, This Login is False';
                 }
             } else {
                 $action["msg"] = 'This Login is False';
                 $action["code"] = 2;
             }
         } else {
             $action["msg"] = 'This Status is False';
             $action["code"] = 1;
         }
         $pageContent = json_encode($action);
         //----BI結束----
     } catch (Exception $error) {
         //依據Controller, Action補上對應位置, $error->getMessage()為固定部份
         // $SysClass->WriteLog("MenterController", "setloginAction", $error->getMessage());
     }
     $this->viewContnet['pageContent'] = $pageContent;
     return new ViewModel($this->viewContnet);
 }
コード例 #2
0
 public function indexAction()
 {
     $SysClass = new ctrlSystem();
     // 預設不連資料庫
     // $SysClass->initialization();
     // 連線指定資料庫
     // $SysClass->initialization("設定檔[名稱]",true); -> 即可連資料庫
     // 連線預設資料庫
     // $SysClass->initialization(null,true);
     $SysClass->initialization();
     try {
         $APIUrl = $SysClass->GetAPIUrl('rsApiURL');
         $APIUrl .= "menuAPI/userMenu";
         $SendArray = array();
         $SendArray["menuPosition"] = $_SESSION["menuPosition"];
         // print_r($SendArray);
         $data = $SysClass->UrlDataPost($APIUrl, $SendArray);
         $pageContent = $data["result"];
         $userMenu = $SysClass->Json2Data($data["result"], false);
         $userMenu = $userMenu["data"];
         $tmpMenu = array();
         foreach ($userMenu as $content) {
             if ($content["url"] != "#" and $content["url"] != "./") {
                 $tmpMenu[] = $content["url"];
             }
         }
         $_SESSION["userMenu"] = $tmpMenu;
         // print_r($data);
     } catch (Exception $error) {
         //依據Controller, Action補上對應位置, $error->getMessage()為固定部份
         // $SysClass->WriteLog("MenterController", "setloginAction", $error->getMessage());
     }
     //關閉資料庫連線
     // $SysClass->DBClose();
     //釋放
     $SysClass = null;
     $this->viewContnet['pageContent'] = $pageContent;
     return new ViewModel($this->viewContnet);
 }