示例#1
0
 public static function insertBoxByRoadToOtherTable($arrayList)
 {
     try {
         $strSql = "update t_box set f_user = ? where f_area = ? and f_road = ?";
         $rs = DbOperator::executeArraySql($strSql, array($arrayList));
         $selectBoxSql = "SELECT f_user,f_code,f_area,f_road,f_address,f_collector,f_index,f_standard,f_value,f_channel,f_status,f_time,f_mac,f_name,f_longitude,f_latitude FROM t_box WHERE f_user = '******'";
         $selectOperatorSql = "select f_user,f_code from t_operator where f_user = '******'";
         $userBoxCode = DbOperator::queryAll($selectBoxSql);
         $userOperatorCode = DbOperator::queryAll($selectOperatorSql);
         $insertSql = "INSERT INTO t_operator SELECT f_user,f_code,f_area,f_road,f_address,f_collector,f_index,f_standard,f_value,f_channel,f_status,f_time,f_mac,f_name,f_longitude,f_latitude FROM t_box WHERE f_area = ? and f_road = ?";
         if (count($userOperatorCode) == 0) {
             $rs = DbOperator::executeArraySql($insertSql, array(array($arrayList[1], $arrayList[2])));
         } else {
             $nCount = 0;
             foreach ($userBoxCode as $arrayBoxIndex) {
                 foreach ($userOperatorCode as $arrayOperatorIndex) {
                     if ($arrayBoxIndex['F_USER'] == $arrayOperatorIndex['F_USER'] && $arrayBoxIndex['F_CODE'] == $arrayOperatorIndex['F_CODE']) {
                         unset($userBoxCode[$nCount]);
                         break;
                     }
                 }
                 $nCount++;
             }
             if (count($userBoxCode) != 0) {
                 $insertSql = "insert into t_operator(f_user,f_code,f_area,f_road,f_address,f_collector,f_index,f_standard,f_value,f_channel,f_status,f_time,f_mac,f_name,f_longitude,f_latitude) values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
                 $inserArray = array();
                 foreach ($userBoxCode as $arrayIndex) {
                     $arrayBean = array();
                     $arrayBean[] = $arrayIndex['F_USER'];
                     $arrayBean[] = $arrayIndex['F_CODE'];
                     $arrayBean[] = $arrayIndex['F_AREA'];
                     $arrayBean[] = $arrayIndex['F_ROAD'];
                     $arrayBean[] = $arrayIndex['F_ADDRESS'];
                     $arrayBean[] = $arrayIndex['F_COLLECTOR'];
                     $arrayBean[] = $arrayIndex['f_index'];
                     $arrayBean[] = $arrayIndex['f_standard'];
                     $arrayBean[] = $arrayIndex['f_value'];
                     $arrayBean[] = $arrayIndex['f_channel'];
                     $arrayBean[] = $arrayIndex['f_status'];
                     $arrayBean[] = $arrayIndex['f_time'];
                     $arrayBean[] = $arrayIndex['f_mac'];
                     $arrayBean[] = $arrayIndex['f_name'];
                     $arrayBean[] = $arrayIndex['f_longitude'];
                     $arrayBean[] = $arrayIndex['f_latitude'];
                     $inserArray[] = $arrayBean;
                 }
                 $rs = DbOperator::executeArraySql($insertSql, $inserArray);
             }
         }
         return $rs;
     } catch (Exception $e) {
         print "Error: " . $e->getMessage() . "<br/>";
         die;
     }
 }
示例#2
0
 public static function addRank($arrayBean)
 {
     try {
         $insertSql = "insert into t_rank(f_type,f_title,f_desc,f_time)values(?,?,?,?)";
         $bRet = DbOperator::executeArraySql($insertSql, array($arrayBean));
         return $bRet;
     } catch (Exception $e) {
         print "Error: " . $e->getMessage() . "<br/>";
         die;
     }
     return $rs;
 }
示例#3
0
 public static function deleteAreaById($id)
 {
     try {
         $strSql = "delete from t_area where f_id=?";
         $bRet = DbOperator::executeArraySql($strSql, array(array($id)));
         return $bRet;
     } catch (Exception $e) {
         print "Error: " . $e->getMessage() . "<br/>";
         die;
     }
 }
示例#4
0
 public static function deleteByUserName($userName)
 {
     try {
         $strSql = "delete from t_users where f_fullname=?";
         $bRet = DbOperator::executeArraySql($strSql, array(array($userName)));
         return $bRet;
     } catch (Exception $e) {
         print "Error: " . $e->getMessage() . "<br/>";
         die;
     }
 }