Ver Fonte

map test

ShuanghongS há 1 ano atrás
pai
commit
62cd8a1ec2
4 ficheiros alterados com 66 adições e 18 exclusões
  1. 0 1
      .gitignore
  2. 46 0
      libs/map_config.ini.php
  3. 15 15
      main_new_version.php
  4. 5 2
      utils/common.class.php

+ 0 - 1
.gitignore

@@ -7,4 +7,3 @@ cache/
 .vscode/
 .svn/
 demo.txt
-map_config.ini.php

+ 46 - 0
libs/map_config.ini.php

@@ -0,0 +1,46 @@
+<?php
+
+if (!defined('IN_ONLINE')) {
+    exit('Access Denied');
+}
+
+if ($_SESSION['ONLINE_USER']['is_demo'] == "t") {
+    $_CBP_DB['host'] = '192.168.0.168';
+    $_CBP_DB['username'] = 'root';
+    $_CBP_DB['password'] = 'uls';
+    $_CBP_DB['dbname'] = 'redant_to_cbp_demo';
+    $_CBP_DB['port'] = '5432';
+    $_CBP_DB['type'] = 'postgres';
+} else {
+    $_CBP_DB['host'] = '192.168.8.82';
+    $_CBP_DB['username'] = 'ksmap';
+    $_CBP_DB['password'] = 'A876ctG$Fex!!';
+    $_CBP_DB['dbname'] = 'redant_online';
+    $_CBP_DB['port'] = '5437';
+    $_CBP_DB['type'] = 'postgres';
+}
+
+$mapdb_url = "host=" . $_CBP_DB['host'] . " port=" . $_CBP_DB['port'] . " dbname=" . $_CBP_DB['dbname'] . " user=" . $_CBP_DB['username'] . " password=" . $_CBP_DB['password'];
+$mapdb = NewADOConnection($_CBP_DB['type']);
+$mapdb->Connect($mapdb_url) or die('Connect Database Error');
+$ADODB_FETCH_MODE = ADODB_FETCH_ASSOC;
+//$mapdb->Execute("set client_encoding to 'gbk'");
+
+//打開詳細頁面時指定模式
+if (!empty($_REQUEST['_schemas'])) {
+    $mapdb->Execute("SET search_path TO " . $_REQUEST['_schemas'] . ";");
+} elseif (!empty($_REQUEST['__schemas'])) {//部分report
+    $mapdb->Execute("SET search_path TO " . $_REQUEST['__schemas'] . ";");
+} else {
+    //超级管理员有没有选择数据库模式
+    if (!empty($_SESSION['_current_schemas'])) {
+        $mapdb->Execute("SET search_path TO " . $_SESSION['_current_schemas'] . ";");
+    } else {
+        if (empty($_SESSION['ONLINE_USER']['main_schemas'])) {
+            $mapdb->Execute("SET search_path TO public;");
+        } else {
+            $mapdb->Execute("SET search_path TO " . $_SESSION['ONLINE_USER']['main_schemas'] . ";");
+        }
+    }
+}
+?>

+ 15 - 15
main_new_version.php

@@ -587,7 +587,7 @@ switch ($action) {
         exit();
         break;
     case 'main_map_new':
-        //include ONLINE_ROOT . 'libs' . DS . 'map_config.ini.php';
+        include ONLINE_ROOT . 'libs' . DS . 'map_config.ini.php';
         //修改添加port_of_transshipment 和port_of_transshipment_name的坐标获取(有为空的可能)
         $serial_no = $_REQUEST["serial_no"];
         //$serial_no = "F41E6016-1A97-4C93-8198-53D8B3B26220";
@@ -620,21 +620,21 @@ switch ($action) {
         //           {"lng":"100.88333333","lat":"13.08333333","label":"Destination","infor":"LAEM CHABANG PORT,THAILAND","sort":"1","stime":null,"ptype":"pol"},
         //           {"lng":"-122.28640000","lat":"37.79784000","label":"Transfer","infor":"OAKLAND, CA, USA","sort":"2","stime":null,"ptype":"pod"}]';
         //$rss = json_decode($json,true);
-        //global $mapdb;
+        global $mapdb;
         //查询线(包含所有的线)
-        // $Line = $mapdb->GetAll("select * from get_track_data('$serial_no',true)");
-        // $solidLine = array();
-        // $dottedLine = array();
-        // foreach($Line as $line){
-        //     if($line['tp'] == "1"){
-        //         $solidLine[] = $line;
-        //     }else{
-        //         $dottedLine[] = $line;
-        //     }
-        // }
-        // $data = array("point"=>$rss,"solidLine"=>$solidLine,"dottedLine"=>$dottedLine);
-        // common::echo_json_encode(200, $data);
-        common::echo_json_encode(200, $rss);
+        $Line = $mapdb->GetAll("select * from get_track_data('$serial_no',true)");
+        $solidLine = array();
+        $dottedLine = array();
+        foreach($Line as $line){
+            if($line['tp'] == "1"){
+                $solidLine[] = $line;
+            }else{
+                $dottedLine[] = $line;
+            }
+        }
+        $data = array("point"=>$rss,"solidLine"=>$solidLine,"dottedLine"=>$dottedLine);
+        common::echo_json_encode(200, $data);
+        //common::echo_json_encode(200, $rss);
         exit();
         break;
     case 'main_welcome':

+ 5 - 2
utils/common.class.php

@@ -1545,8 +1545,11 @@ class common {
     }
 
     public static function getRevenue(){
-       $data = '{"bar_title":"Total: 0","barList":["DEC,23","JAN,24","FEB,24","MAR,24","APR,24","MAY,24","JUN,24","JUL,24","AUG,24","SEP,24","OCT,24","NOV,24"],"barSeries":[{"name":"USD","type":"bar","data":[1,1,1,1,1,1,1,1,1,1,1,1],"emphasis":{"disabled":true,"focus":"none"},"itemStyle":{"color":"#FF7500","borderRadius":6},"label":{"show":false,"color":"#646A73","position":"top","fontFamily":"Lato-Light","hideWhenMouseLeave":false}},{"name":"THB","type":"bar","data":[2,2,2,2,2,2,2,2,2,2,2,2],"emphasis":{"disabled":true,"focus":"none"},"itemStyle":{"color":"#FFAC66","borderRadius":6},"label":{"show":false,"color":"#646A73","position":"top","fontFamily":"Lato-Light","hideWhenMouseLeave":false}},{"name":"SGD","type":"bar","data":[3,3,3,3,3,3,3,3,3,3,3,3],"emphasis":{"disabled":true,"focus":"none"},"itemStyle":{"color":"#FFE3CC","borderRadius":6},"label":{"show":false,"color":"#646A73","position":"top","fontFamily":"Lato-Light","hideWhenMouseLeave":false}}],"Max":5,"interval":1,"download_name":"Rvenue","isShowTooltips":true}';    
-       return json_decode($data,true); 
+        $data = '{"bar_title":"Total: 0","barList":["DEC,23","JAN,24","FEB,24","MAR,24","APR,24","MAY,24","JUN,24","JUL,24","AUG,24","SEP,24","OCT,24","NOV,24"],"barSeries":[{"name":"USD","type":"bar","data":[1,1,1,1,1,1,1,1,1,1,1,1],"emphasis":{"disabled":true,"focus":"none"},"itemStyle":{"color":"#FF7500","borderRadius":6},"label":{"show":false,"color":"#646A73","position":"top","fontFamily":"Lato-Light","hideWhenMouseLeave":false}},{"name":"THB","type":"bar","data":[2,2,2,2,2,2,2,2,2,2,2,2],"emphasis":{"disabled":true,"focus":"none"},"itemStyle":{"color":"#FFAC66","borderRadius":6},"label":{"show":false,"color":"#646A73","position":"top","fontFamily":"Lato-Light","hideWhenMouseLeave":false}},{"name":"SGD","type":"bar","data":[3,3,3,3,3,3,3,3,3,3,3,3],"emphasis":{"disabled":true,"focus":"none"},"itemStyle":{"color":"#FFE3CC","borderRadius":6},"label":{"show":false,"color":"#646A73","position":"top","fontFamily":"Lato-Light","hideWhenMouseLeave":false}}],"Max":5,"interval":1,"download_name":"Rvenue","isShowTooltips":true}';   
+        // global $db;
+        // $param = '{"user_login":"","report_type":"ALL","date_from":"2024-01-01","date_to":"2024-12-31"}';
+        // $r1 = $db->Execute("SELECT * FROM get_customer_revenue_report('$param');FETCH ALL FROM r2;");
+        return json_decode($data,true); 
     }
 
     public static function getdefaultManagement(){