public function newcardAction() { $VTs = new clsSystem(); $VTs->initialization("tmpCardDB"); try { //-----BI開始----- $action = array(); $action["status"] = false; if ($_POST["newVal"]) { $strSQL = "insert into tc_card_info(number) values('" . $_POST["newVal"] . "');"; $VTs->ExecuteNonQuery($strSQL); $action["newCard"]["uid"] = $VTs->NewInsertID(); $action["status"] = true; } else { $action["msg"] = "value is empty"; } $pageContent = $VTs->Data2Json($action); //----BI結束---- } catch (Exception $error) { //依據Controller, Action補上對應位置, $error->getMessage()為固定部份 $VTs->WriteLog("IndexController", "indexAction", $error->getMessage()); } $VTs = null; $this->viewContnet['pageContent'] = $pageContent; return new ViewModel($this->viewContnet); }
function ImgSet($Imgs) { $VTs = new clsSystem(); $VTs->initialization("oldhouseDB"); //-----BI開始----- if (!empty($Imgs)) { //$VTs->debug($Imgs); //檔名 $strSQL = "select uid from img_picture order by uid desc Limit 1"; //echo $strSQL; $data = $VTs->QueryData($strSQL); //echo "uid : ".$data[0]["uid"]; if (!empty($data)) { $lastFileName = (int) $data[0]["uid"] + 1; } else { $lastFileName = 1; } //echo "lastFileName:" . $lastFileName; $imgFileName = date("YmdHisu"); if (strlen($imgFileName) > 16) { $imgFileName = substr($imgFileName, 0, 16); } $imgFileName .= $lastFileName; //放入執行 $strSQL = "insert into img_picture(imgfile,location) "; $strSQL .= "values('" . $imgFileName . "','')"; $VTs->ExecuteNonQuery($strSQL); //新增的ID $newID = $VTs->NewInsertID(); //$imgArr = explode("[||]",$Imgs); $fileStr = ''; foreach ($Imgs as $i => $content) { $fileStr .= "img" . $i . " = \"" . $content . "\"\n"; } $filePath = dirname(__DIR__) . "\\..\\..\\..\\..\\public\\old_house_img\\" . $imgFileName; $action["status"] = $VTs->CreateFile($filePath, $fileStr); #取得照片ID $strSQL = "select uid from img_picture where imgfile = '" . $imgFileName . "'"; $data = $VTs->QueryData($strSQL); //echo $strSQL; } //-----BI結束----- $VTs = null; return $data[0]["uid"]; }
public function DBinsertAction() { $VTs = new clsSystem(); //先初始化 $VTs->initialization(); //-----------BI開始------------ $type = $_POST["unit1"]; $type = "typeunit"; switch ($type) { case "typeunit": $strSQL = "INSERT INTO `el_type_unit` ( `unit1`, `unit2`, `typeid_a`) VALUES ('t1', 't2', '2');"; $VTs->ExecuteNonQuery($strSQL); //$strSQL = "SELECT @@IDENTITY;"; $data = $VTs->NewInsertID(); $VTs->debug($data); break; } //-----------BI結束------------ //關閉資料庫連線 $VTs->DBClose(); //釋放 $VTs = null; return new ViewModel($this->viewContnet); }
public function imgsetAction() { $VTs = new clsSystem(); $VTs->initialization(); //-----BI開始----- $action = array(); $action["status"] = false; if (!empty($_POST)) { //檔名 $imgFileName = date("YmdHisu"); if (strlen($imgFileName) > 16) { $imgFileName = substr($imgFileName, 0, 16); } //放入執行 $strSQL = "insert into img_picture(imgfile,location) "; $strSQL .= "values('" . $imgFileName . "','" . $_POST["latitude"] . "," . $_POST["longitude"] . "')"; $VTs->ExecuteNonQuery($strSQL); //新增的ID $newID = $VTs->NewInsertID(); $imgArr = explode("[||]", $_POST["img_txt"]); $fileStr = ''; foreach ($imgArr as $i => $content) { $fileStr .= "img" . $i . " = \"" . $content . "\"\n"; } $filePath = dirname(__DIR__) . "\\..\\..\\..\\..\\public\\qc_img\\" . $imgFileName; $action["status"] = $VTs->CreateFile($filePath, $fileStr); //先取得Dataid $strSQL = "select typeid,dataid from qc_checklist where uid=" . $_POST["qcid"]; $data = $VTs->QueryData($strSQL); $typeid = $data[0]["typeid"]; $dataid = $data[0]["dataid"]; $nowTime = $VTs->DateTime("CTime_Now"); $QC_Click = $_POST["QC_Click"] ? 1 : 0; //更新列表 $strSQL = "update qc_checklist set imgid = " . $newID . ", remark='" . $_POST["memo"] . "',datec='" . $nowTime . "',isok='" . $QC_Click . "' where uid=" . $_POST["qcid"] . ";"; //目前暫定2的時候才做 if ($typeid == 2) { $strSQL .= "update eng_worklist_areaitem set dateq = '" . $nowTime . "' where uid=" . $dataid . ";"; } $VTs->ExecuteNonQuery($strSQL); } else { $action["msg"] = 'Post Info Error'; } $pageContent = $VTs->Data2Json($action); //-----BI結束----- $VTs = null; $this->viewContnet['pageContent'] = $pageContent; return new ViewModel($this->viewContnet); }