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 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); }