ShuanghongS 1 年之前
父节点
当前提交
c9b8363b6b
共有 1 个文件被更改,包括 12 次插入18 次删除
  1. 12 18
      utils/common.class.php

+ 12 - 18
utils/common.class.php

@@ -1272,7 +1272,9 @@ class common {
         $sqlWhere = " " . $sqlWhere;
 
         $toporiginType = "shippr_uncode";
-        $shippr_uncode_10_sql = "select count(shippr_uncode) as num,shippr_uncode from online_ocean  where 1=1 $sqlWhere group by shippr_uncode order by num desc limit 10";
+        $shippr_uncode_10_sql = "select count(shippr_uncode) as num,shippr_uncode,
+            (array_agg(shipper_city))[1] AS shipper_city from online_ocean  
+        where 1=1 $sqlWhere group by shippr_uncode order by num desc limit 10";
         $shippr_uncode_10 = common::excuteListSql($shippr_uncode_10_sql);
         //如果值没有:客户地址-->站点地址-->Port地址(POL/POD) 
         if(count($shippr_uncode_10) == 1 && empty($shippr_uncode_10[0]["shippr_uncode"])){
@@ -1283,7 +1285,9 @@ class common {
         //$toporiginType = "fport_of_loading_un";
 
         $topdestinationinType = "consignee_uncode";
-        $consignee_uncode_10_sql = "select count(consignee_uncode) as num,consignee_uncode from online_ocean  where 1=1 $sqlWhere group by consignee_uncode order by num desc limit 10";
+        $consignee_uncode_10_sql = "select count(consignee_uncode) as num,consignee_uncode,
+        (array_agg(consignee_city))[1] AS consignee_city 
+        from online_ocean  where 1=1 $sqlWhere group by consignee_uncode order by num desc limit 10";
         $consignee_uncode_10 = common::excuteListSql($consignee_uncode_10_sql);
         //如果值没有:客户地址-->站点地址-->Port地址(POL/POD) 
         if(count($consignee_uncode_10) == 1 && empty($consignee_uncode_10[0]["consignee_uncode"])){
@@ -1314,17 +1318,12 @@ class common {
                     "textcolor" =>"#FFF");
             }
             //查询uncode,对应的city
-            $city = array();
-            $city['city'] = "";
+            $city = "";
             if($toporiginType == "shippr_uncode"){
-                $public_ports_sql = "select shipper_city as city from online_ocean 
-                    where 1=1 $sqlWhere and  shippr_uncode = '".$orgin['shippr_uncode']."'
-                    order by id limit 1";
-                $city = common::excuteObjectSql($public_ports_sql);
+                $city = $orgin['shipper_city'];
             }
             //$city 做假数据
-            //$city['city'] = "CATARINA, TX".$i;
-            $toporigin[] = array("name"=>$orgin['shippr_uncode'],"city_name"=>$city['city'],"value"=>$orgin['num'],"color"=>common::getItemStyle("top",$i));
+            $toporigin[] = array("name"=>$orgin['shippr_uncode'],"city_name"=>$city,"value"=>$orgin['num'],"color"=>common::getItemStyle("top",$i));
             $origiNunMax = $origiNunMax < $orgin['num'] ? $orgin['num'] : $origiNunMax;
         }
 
@@ -1351,17 +1350,12 @@ class common {
             }
 
             //查询uncode,对应的city
-            $city = array();
-            $city['city'] = "";
+            $city = "";
             if($topdestinationinType == "consignee_uncode"){
-                $public_ports_sql = "select consignee_city as city from online_ocean  
-                    where 1=1 $sqlWhere and consignee_uncode = '".$agent['consignee_uncode']."' 
-                    order by id limit 1";
-                $city = common::excuteObjectSql($public_ports_sql);
+                $city = $agent['consignee_city'];
             }
             //$city 做假数据
-            //$city['city'] = "CATARINA, TX".$i;
-            $topdestination[] = array("name"=>$agent['consignee_uncode'],"city_name"=>$city['city'],"value"=>$agent['num'],"color"=>common::getItemStyle("top",$i));
+            $topdestination[] = array("name"=>$agent['consignee_uncode'],"city_name"=>$city,"value"=>$agent['num'],"color"=>common::getItemStyle("top",$i));
             $agentiNunMax = $agentiNunMax < $agent['num'] ? $agent['num'] : $agentiNunMax;
         }