ShuanghongS 1 ano atrás
pai
commit
84f255a92f

+ 10 - 4
main_new_version.php

@@ -84,7 +84,7 @@ switch ($action) {
         $sqlWhere = " " . $sqlWhere;
         //online_order_status_date_new 与本地的区分,发布上去这去掉new
         $list = common::excuteListSql("select * from public.online_order_status_date('$type'::text, 'eta'::text, 'etd'::text, $bdate, $edate, '$sqlWhere'::text, '$container_type'::text) "
-                        . "r (c bigint, e integer, b integer, d text)");              
+                        . "r (c bigint, e integer, b integer, d text)");
         $key = "[";
         $value = "[";
         $totalValue = 0;
@@ -139,7 +139,7 @@ switch ($action) {
         $sqlWhere = " " . $sqlWhere;
 
         $list = common::excuteListSql("select * from public.online_order_status_date_kpi_new('$type'::text,'$sqlWhere'::text) "
-                        . "r (c bigint, d text)");            
+                        . "r (c bigint, d text)");                
         $key = "[";
         $value = "[";
         $totalValue = 0;
@@ -162,13 +162,19 @@ switch ($action) {
         $value_arr = json_decode($value,true);
         foreach($value_arr as $arr){
                 $color = common::getItemStyle($type,$arr['name']);
+                if($arr['name'] == "0 Day"){
+                    $arr['name'] = "≤1 Day";
+                }
+                if($arr['name'] == "7 Days"){
+                    $arr['name'] = "≥7 Days";
+                }
                 $ETDList[] = array("value" =>intval($arr['value']),"name" =>$arr['name'],"itemStyle" =>array("color" =>$color));
         }
         if($type == 'atd_r4'){
             $data = array("ETDList" =>$ETDList,"ETD_Radius"=>array('30%','50%'),"title1" =>"Departure","title2" =>"(ATD-ETD)","download_name" => "KPI Departure");
         }
         if($type == 'ata_r3'){
-            $data = array("ETDList" =>$ETDList,"ETD_Radius"=>array('30%','50%'),"title1" =>"Arrival","title2" =>"(ATA-ETD)","download_name" => "KPI Arrival");
+            $data = array("ETDList" =>$ETDList,"ETD_Radius"=>array('30%','50%'),"title1" =>"Arrival","title2" =>"(ATA-ETA)","download_name" => "KPI Arrival");
         }
         common::echo_json_encode(200, $data);
         exit();
@@ -493,7 +499,7 @@ switch ($action) {
             foreach ($rss as $key => $value) {
                 $Arrived = $value['description'];
                 $RecentStatusList[] = array("Title"=>$value['h_bol'],
-                    "name"=>$value['f_vessel']." / ".$value['f_voyage'],
+                    "name"=>utils::outDisplayForMerge($value['f_vessel'],$value['f_voyage']),
                     "bookingNumber" =>$value['booking_no'],
                     "IsSubscribe" =>false,
                     "shipperName"=>$value['shipper'],

+ 4 - 1
service/column.class.php

@@ -181,7 +181,7 @@ class column {
         $sql = "SELECT id, display_name as name, database_column_name as db,database_column_name, column_width,group_name FROM public.ra_online_search_display_cso WHERE default_display = true and active=true and lower(model_name) = '" . strtolower($model_name) . "'";
         if (_isCustomerLogin())
             $sql .= ' and customer_display=true';
-        $sql .= " order by order_by";
+        $sql .= " order by order_by,display_name";
         $rss = common::excuteListSql($sql);
         return $rss;
     }
@@ -256,6 +256,9 @@ class column {
             "etd" =>array("formatter" =>"date"),
             "eta" =>array("formatter" =>"date"));
         }
+        if ($type == "Operation_Search"){
+            return array("operation_time" =>array("formatter" =>"dateTime"));
+        }
     }
 
     /**

+ 21 - 6
service/login.class.php

@@ -36,9 +36,16 @@ class login {
     
         } else {
             $uname = common::check_input($_POST['uname']);
-            $verifcation_code = common::check_input($_POST['verifcation_code']);
-            //首先校验验证码
-            if (strtolower($_SESSION['captcha']) != strtolower($verifcation_code)) {    
+            $is_verify = common::check_input($_POST['verifcation_code']);
+            //首先校用户登录
+            $AES_encrypted = $this->AES_encrypted($is_verify);
+            $secret_key = common::excuteOneSql("select secret_key from customer_service_secret_key 
+                    where secret_key = '$is_verify' 
+                    and create_time >= current_date - INTERVAL '3 months' limit 1");
+            //记录这次的密钥记录
+            common::excuteUpdateSql("INSERT INTO public.customer_service_secret_key(secret_key, create_time)VALUES ('$is_verify', now());");
+            if(!empty($AES_encrypted) && empty($secret_key)){
+            }else{
                 $data = array(
                     'msg' => 'verifcation_error',
                     'data' => ''
@@ -520,9 +527,16 @@ class login {
     public function forgot_password() {
         $login = common::check_input($_POST['login']);
         $email = common::check_input($_POST['email']);
-        $verifcation_code = common::check_input($_POST['verifcation_code']);
-        //首先校验验证码
-        if (strtolower($_SESSION['captcha']) != strtolower($verifcation_code)) {    
+        $is_verify = common::check_input($_POST['verifcation_code']);
+        //首先校用户验证
+        $AES_encrypted = $this->AES_encrypted($is_verify);
+        $secret_key = common::excuteOneSql("select secret_key from customer_service_secret_key 
+                    where secret_key = '$is_verify' 
+                    and create_time >= current_date - INTERVAL '3 months' limit 1");
+        //记录这次的密钥记录
+        common::excuteUpdateSql("INSERT INTO public.customer_service_secret_key(secret_key, create_time)VALUES ('$is_verify', now());");
+        if(!empty($AES_encrypted) && empty($secret_key)){
+        }else{
             $data = array(
                 'msg' => 'verifcation_error',
                 'data' => ''
@@ -530,6 +544,7 @@ class login {
             common::echo_json_encode(400, $data);
             exit();
         }
+
         $msg = "";
         if (!empty($email) || !empty($login)) {
             $sql_p = "select User_Login, ra_password as password from public.ra_online_user where lower(user_login) = '" . strtolower($login) . "' and lower(email) = '" . strtolower($email) . "'";

+ 0 - 8
service/ocean_order.class.php

@@ -555,10 +555,6 @@ class ocean_order {
                 $rs[$index]["mode"] = "Ocean Freight";
                 //status 改为ocean_milestone里的信息
                 $rs[$index]["Status"] = $rs[$index]["new_status"];
-                //以下新增的origin是 shipper和consignee的地址
-                if(array_key_exists("Origin", $val)){
-                    $rs[$index]["Origin"] = utils::outDisplayForMerge($val['Origin'],$val['_consignee_city']);
-                }
             }
         
             $arrTmp = array('searchData' => $rs, 
@@ -832,10 +828,6 @@ class ocean_order {
             $rs[$index]["mode"] = "Ocean Freight";
             //status 改为ocean_milestone里的信息
             $rs[$index]["Status"] = $rs[$index]["new_status"];
-            //以下新增的origin是 shipper和consignee的地址
-            if(array_key_exists("Origin", $val)){
-                $rs[$index]["Origin"] = utils::outDisplayForMerge($val['Origin'],$val['_consignee_city']);
-            }
         }
         common::echo_json_encode(200,array("msg"=>"success","Data" => $rs));
         exit;

+ 42 - 22
utils/common.class.php

@@ -1148,7 +1148,7 @@ class common {
                 if(stripos("Today", $arr['name']) !== false){
                     $color = common::getItemStyle($type,"Today");
                     if(empty($data_kd["0"])){
-                        $data_kd["0"] = array("value" =>intval($arr['value']),"name" =>"0 Day","itemStyle" =>array("color" =>$color));
+                        $data_kd["0"] = array("value" =>intval($arr['value']),"name" =>"≤1 Day","itemStyle" =>array("color" =>$color));
                     }else{
                         $data_kd["0"]["value"] = $data_kd["0"]["value"] + intval($arr['value']);
                     }
@@ -1172,17 +1172,17 @@ class common {
                 if(stripos("+7 Days/Over 7 Days", $arr['name']) !== false){
                     $color = common::getItemStyle($type,"7 Days");
                     if(empty($data_kd["3"])){
-                        $data_kd["3"] = array("value" =>intval($arr['value']),"name" =>"7 Days","itemStyle" =>array("color" =>$color));
+                        $data_kd["3"] = array("value" =>intval($arr['value']),"name" =>"7 Days","itemStyle" =>array("color" =>$color));
                     }else{
                         $data_kd["3"]["value"] = $data_kd["3"]["value"] + intval($arr['value']);
                     }
                 }
             }
             if($type == 'r4'){
-                $data = array("ETDList" =>$data_kd,"ETD_Radius"=>array('30%','50%'),"title1" =>"Departure","title2" =>"(ATD-ETD)","download_name" => "Pending Departure");
+                $data = array("ETDList" =>$data_kd,"ETD_Radius"=>array('30%','50%'),"title1" =>"Departure","title2" =>"","download_name" => "Pending Departure");
             }
             if($type == 'r3'){
-                $data = array("ETDList" =>$data_kd,"ETD_Radius"=>array('30%','50%'),"title1" =>"Arrival","title2" =>"(ATA-ETD)","download_name" => "Pending Arrival");
+                $data = array("ETDList" =>$data_kd,"ETD_Radius"=>array('30%','50%'),"title1" =>"Arrival","title2" =>"","download_name" => "Pending Arrival");
             }
             
         }
@@ -1276,27 +1276,55 @@ class common {
         $sqlWhere = " " . $sqlWhere;
 
         $toporiginType = "shippr_uncode";
-        $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 and COALESCE(shippr_uncode)<>'' $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 and COALESCE(shippr_uncode)<>'' $sqlWhere group by shippr_uncode order by num desc limit 10";
+        $shippr_uncode_10_sql ="with aa as  (select count(shippr_uncode) as num,shippr_uncode,
+                                (array_agg(shipper_city))[1] AS shipper_city from online_ocean  
+                        where 1=1 and COALESCE(shippr_uncode)<>'' and $sqlWhere group by shippr_uncode order by num desc limit 10)
+            select   aa.*,dd.* from  aa  
+            left join LATERAL ( select lon as lng, lat as lat,
+                '' as label, '' as infor, 3 as sort,
+                null::timestamp without time zone as stime,''::text as ptype 
+            from vessel.vt_unlocode where lon<>0 and lat<>0 and lon is not null and lat is not null and uncode=aa.shippr_uncode ) dd on true";
         $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"])){
             $toporiginType = "fport_of_loading_un";
-            $shippr_uncode_10_sql = "select count(fport_of_loading_un) as num,fport_of_loading_un as shippr_uncode from online_ocean where 1=1 and COALESCE(fport_of_loading_un)<>'' $sqlWhere group by fport_of_loading_un order by num desc limit 10";
+            $shippr_uncode_10_sql = "with aa as  (select count(fport_of_loading_un) as num,fport_of_loading_un as shippr_uncode 
+                    from online_ocean where 1=1 and COALESCE(fport_of_loading_un)<>'' $sqlWhere group by fport_of_loading_un order by num desc limit 10)
+                    select   aa.*,dd.* from  aa  
+                        left join LATERAL ( select lon as lng, lat as lat,
+                            '' as label, '' as infor, 3 as sort,
+                            null::timestamp without time zone as stime,''::text as ptype 
+                        from vessel.vt_unlocode where lon<>0 and lat<>0 and lon is not null and lat is not null and uncode=aa.shippr_uncode ) dd on true";
             $shippr_uncode_10 = common::excuteListSql($shippr_uncode_10_sql);
         }
         //$toporiginType = "fport_of_loading_un";
 
         $topdestinationinType = "consignee_uncode";
-        $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  and COALESCE(consignee_uncode)<>''  $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  and COALESCE(consignee_uncode)<>''  $sqlWhere group by consignee_uncode order by num desc limit 10";
+        $consignee_uncode_10_sql = "with aa as  (select count(consignee_uncode) as num,consignee_uncode,
+                    (array_agg(consignee_city))[1] AS consignee_city 
+                from online_ocean  where 1=1  and COALESCE(consignee_uncode)<>''  $sqlWhere group by consignee_uncode order by num desc limit 10)
+        select   aa.*,dd.* from  aa  
+        left join LATERAL ( select lon as lng, lat as lat,
+            '' as label, '' as infor, 3 as sort,
+            null::timestamp without time zone as stime,''::text as ptype 
+        from vessel.vt_unlocode where lon<>0 and lat<>0 and lon is not null and lat is not null and uncode=aa.consignee_uncode ) dd on true";
+
         $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"])){
             $topdestinationinType = "mport_of_discharge_un";
-            $consignee_uncode_10_sql = "select count(mport_of_discharge_un) as num,mport_of_discharge_un as consignee_uncode from online_ocean where 1=1 and COALESCE(mport_of_discharge_un)<>'' $sqlWhere group by mport_of_discharge_un order by num desc limit 10";
+            $consignee_uncode_10_sql = "with aa as  (select count(mport_of_discharge_un) as num,mport_of_discharge_un as consignee_uncode from online_ocean where 1=1 and COALESCE(mport_of_discharge_un)<>'' $sqlWhere group by mport_of_discharge_un order by num desc limit 10)
+                select   aa.*,dd.* from  aa  
+                left join LATERAL ( select lon as lng, lat as lat,
+                    '' as label, '' as infor, 3 as sort,
+                    null::timestamp without time zone as stime,''::text as ptype 
+                from vessel.vt_unlocode where lon<>0 and lat<>0 and lon is not null and lat is not null and uncode=aa.consignee_uncode ) dd on true";
             $consignee_uncode_10 = common::excuteListSql($consignee_uncode_10_sql);
         }
 
@@ -1306,11 +1334,7 @@ class common {
         $origiNunMax = 0;
         foreach($shippr_uncode_10 as $orgin){
             $i = $i + 1;
-            $map_sql = "select lon as lng, lat as lat,
-                    '' as label, '' as infor, 3 as sort,
-                    null::timestamp without time zone as stime,''::text as ptype 
-				from vessel.vt_unlocode where lon<>0 and lat<>0 and lon is not null and lat is not null and uncode='".$orgin['shippr_uncode']."'";
-            $map = common::excuteObjectSql($map_sql);   
+            $map = array("lat" =>$orgin['lat'],"lng" =>$orgin['lng']);   
             //$json = '{"lng":121.8525,"lat":29.926545,"label":"'.$orgin['origin'].'","infor":"LAT KRABANG, THAILAND","sort":"0","stime":null,"ptype":"por"}';
             //$map = json_decode($json,true);
             if(!empty($map)){
@@ -1337,11 +1361,7 @@ class common {
         $agentiNunMax = 0;
         foreach($consignee_uncode_10 as $agent){
             $i = $i + 1;
-            $map_sql = "select lon as lng, lat as lat,
-                    '' as label, '' as infor, 3 as sort,
-                    null::timestamp without time zone as stime,''::text as ptype 
-				from vessel.vt_unlocode where lon<>0 and lat<>0 and lon is not null and lat is not null and uncode='".$agent['consignee_uncode']."'";
-            $map = common::excuteObjectSql($map_sql);  
+            $map = array("lat" =>$agent['lat'],"lng" =>$agent['lng']); 
             // $json = '{"lng":"100.78594000","lat":"13.68521000","label":"'.$agent['agent'].'","infor":"LAT KRABANG, THAILAND","sort":"0","stime":null,"ptype":"por"}';
             // $map = json_decode($json,true);
             if(!empty($map)){