ShuanghongS 1 год назад
Родитель
Сommit
c57eee8763
3 измененных файлов с 68 добавлено и 55 удалено
  1. 35 29
      service/login.class.php
  2. 15 11
      service/ocean_order.class.php
  3. 18 15
      utils/common.class.php

+ 35 - 29
service/login.class.php

@@ -49,14 +49,13 @@ class login {
 
             $sql = $this->getLoginSql($uname);
             $rs = common::excuteObjectSql($sql);
-            if (empty($rs['belong_schemas'])) {
-                $rs['belong_schemas'] = "public";
-            }
-            if (empty($rs['main_schemas'])) {
-                $rs['main_schemas'] = "public";
-            }
-
             if (!empty($rs)) {
+                if (empty($rs['belong_schemas'])) {
+                    $rs['belong_schemas'] = "public";
+                }
+                if (empty($rs['main_schemas'])) {
+                    $rs['main_schemas'] = "public";
+                }
                 //验证employee是否active
                 if (!empty($rs["employee_id"]) && $rs["employee_id_active"] != "t") {
                     if (strtolower(Soure) =='topocean'){
@@ -71,10 +70,10 @@ class login {
                     }
                     
                     $data = array(
-                        'msg' => 'no_active',
+                        'code' => 'no_active',
                         'login_version' => $rs["login_version"],
                         'data' => $data,
-                        'desc' => "Please check with Doc Center $data for searching function"
+                        'msg' => "Please check with Doc Center $data for searching function"
                     );
                     common::echo_json_encode(500, $data);
                     $this->failedLogin($uname, 'Employee not active');
@@ -109,10 +108,10 @@ class login {
                 if ($rs['is_online'] != 't') {
                     if (strtolower($rs['user_type']) != "employee") {
                         $data =array(
-                            'msg' => 'no_online',
+                            'code' => 'no_online',
                             'login_version' => $rs["login_version"],
                             'data' => '',
-                            'desc' => 'No activation or insufficient permissions'
+                            'msg' => 'No activation or insufficient permissions'
                         );
                         common::echo_json_encode(500, $data);
                         $this->failedLogin($uname, 'Online is not active');
@@ -139,10 +138,10 @@ class login {
                    
                 if ($rs['online_active'] != 't') {
                     $data = array(
-                        'msg' => 'no_active',
+                        'code' => 'no_active',
                         'login_version' => $rs["login_version"],
                         'data' => '',
-                        'desc' => 'Please check with Doc Center for searching function'
+                        'msg' => 'Please check with Doc Center for searching function'
                     );
                     common::echo_json_encode(500, $data);
                     $this->failedLogin($uname, 'Online is not active');
@@ -152,20 +151,20 @@ class login {
                 $tar = utils::checkPassword($rs['password']);
                 if (!empty($tar)) {
                     $data = array(
-                        'msg' => $tar,
+                        'code' => $tar,
                         'login_version' => $rs["login_version"],
                         'data' => '',
-                        'desc' => $tar
+                        'msg' => $tar
                     );
                     common::echo_json_encode(500, $data);
                     exit();
                 }
                 if (empty($rs['last_pwd_change'])) {
                     $data = array(
-                        'msg' => 'first_login',
+                        'code' => 'first_login',
                         'login_version' => $rs["login_version"],
                         'data' => '',
-                        'desc' => 'First login, please change your password'
+                        'msg' => 'First login, please change your password'
                     );
                     common::echo_json_encode(500, $data);
                     exit();
@@ -233,9 +232,9 @@ class login {
                     if(empty($email)){
                         $data = array(
                             'status' => '0',
-                            'msg' => 'login user email is empty',
+                            'code' => 'login user email is empty',
                             'login_version' => $rs["login_version"],
-                            'desc' => 'login user email is empty'
+                            'msg' => 'login user email is empty'
                         );
                         common::echo_json_encode(500, $data);
                         exit();
@@ -402,18 +401,18 @@ class login {
                     exit();
                 } else {
                     $data = array(
-                        'msg' => 'database_error',
+                        'code' => 'database_error',
                         'login_version' => $rs["login_version"],
-                        'desc' => 'database_error'
+                        'msg' => 'database_error'
                     );
                     common::echo_json_encode(500, $data);
                     exit();
                 }
             } else {
                 $data = array(
-                    'msg' => 'no_exist',
+                    'code' => 'no_exist',
                     'login_version' => $rs["login_version"],
-                    'desc' => 'The username or password you entered is incorrect'
+                    'msg' => 'The username or password you entered is incorrect'
                 );
                 common::echo_json_encode(500, $data);
                 exit();
@@ -549,10 +548,17 @@ class login {
             $msg = "Login Name or Email Required !";
         }
 
-        $data = array(
-            'msg' => $msg,
-        );
-        common::echo_json_encode(200, $data);
+        if($msg == 'success'){
+            $data = array(
+                'msg' => $msg,
+            );
+            common::echo_json_encode(200, $data);
+        }else{
+            $data = array(
+                'msg' => $msg,
+            );
+            common::echo_json_encode(500, $data);
+        }
         exit();
     }
 
@@ -1147,7 +1153,7 @@ class login {
                                 when a.code='IFFDEP' then 'Departed'
                                 when a.code='IFFARR' then 'Arrived'
                                 when a.code='IFFAFD' then 'Completed'
-                                else 'Booked' END as status,
+                                else 'Booked' END as status
                         from  ocean_milestone a 
                 where a.serial_no=o.serial_no 
                     and a.code in (select regexp_split_to_table('IFFBCF,IFFCPU,IFFREC,IFFDEP,IFFARR,IFFAFD', ','))
@@ -1277,7 +1283,7 @@ class login {
                             when a.code='IFFDEP' then 'Departed'
                             when a.code='IFFARR' then 'Arrived'
                             when a.code='IFFAFD' then 'Completed'
-                            else 'Booked' END as status,
+                            else 'Booked' END as status
                     from  ocean_milestone a 
             where a.serial_no=o.serial_no 
                 and a.code in (select regexp_split_to_table('IFFBCF,IFFCPU,IFFREC,IFFDEP,IFFARR,IFFAFD', ','))

+ 15 - 11
service/ocean_order.class.php

@@ -383,19 +383,19 @@ class ocean_order {
 
             $_sqlwhere = "1<>1";
             if (stripos($filterTag, "Booked") !== FALSE) {
-                $_sqlwhere .= " or (dd.status = 'Booked')";
+                $_sqlwhere .= " or (dd.new_status = 'Booked')";
             }
             if (stripos($filterTag, "Cargo Received") !== FALSE) {
-                $_sqlwhere .= " or (dd.status = 'Cargo Received')";
+                $_sqlwhere .= " or (dd.new_status = 'Cargo Received')";
             }
             if (stripos($filterTag, "Departed") !== FALSE) {
-                $_sqlwhere .= " or (dd.status = 'Departed')";
+                $_sqlwhere .= " or (dd.new_status = 'Departed')";
             }
             if (stripos($filterTag, "Arrived") !== FALSE) {
-                $_sqlwhere .= " or (dd.status = 'Arrived')";
+                $_sqlwhere .= " or (dd.new_status = 'Arrived')";
             }
             if (stripos($filterTag, "Completed") !== FALSE) {
-                $_sqlwhere .= " or (dd.status = 'Completed')";
+                $_sqlwhere .= " or (dd.new_status = 'Completed')";
             }
             if(strtolower($filterTag) <> "all" && !empty($filterTag)){
                 $sqlWhere .= " and ($_sqlwhere)";
@@ -755,12 +755,14 @@ class ocean_order {
                                     $file_arr[] = array("url"=>$OutFileURL."/download.php?_schemas=&a=".base64_encode(base64_encode($rs['serial_no'])),
                                         "file_name" => $rs['file_name'],
                                         "detail"=>$rs['upload_date'],
-                                        "can_delete"=>_getLoginName() == $rs['upload_by']);
+                                        "can_delete"=>_getLoginName() == $rs['upload_by'],
+                                        "from_system" =>'TOPOCEAN_KSMART');
                                 }else{
-                                    $file_arr[] = array("url"=>"main_new_version?action=ocean_order&operate=download&url=". (common::deCode($rs['file_path'] . DS . $rs['file_name'], 'E')),
+                                    $file_arr[] = array("url"=>"main_new_version.php?action=ocean_order&operate=download&url=". (common::deCode($rs['file_path'] . DS . $rs['file_name'], 'E')),
                                         "file_name" => $rs['file_name'],
                                         "detail"=>$rs['upload_date'],
-                                        "can_delete"=>_getLoginName() == $rs['upload_by']);
+                                        "can_delete"=>_getLoginName() == $rs['upload_by'],
+                                        "from_system" =>'');
                                 }
                             }
                         }
@@ -963,12 +965,14 @@ class ocean_order {
                         $file[] = array("url"=>$OutFileURL.'/download.php?_schemas=&a='.base64_encode(base64_encode($rs['serial_no'])),
                             "file_name" => $rs['file_name'],
                             "detail"=>$rs['upload_date'],
-                            "can_delete"=>_getLoginName() == $rs['upload_by']);
+                            "can_delete"=>_getLoginName() == $rs['upload_by'],
+                            "from_system" =>'TOPOCEAN_KSMART');
                     }else {
-                        $file[] = array("url"=>"main_new_version?action=ocean_order&operate=download&url=". (common::deCode($rs['file_path'] . DS . $rs['file_name'], 'E')),
+                        $file[] = array("url"=>"main_new_version.php?action=ocean_order&operate=download&url=". (common::deCode($rs['file_path'] . DS . $rs['file_name'], 'E')),
                         "file_name" => $rs['file_name'],
                         "detail"=>$rs['upload_date'],
-                        "can_delete"=>_getLoginName() == $rs['upload_by']);
+                        "can_delete"=>_getLoginName() == $rs['upload_by'],
+                        "from_system" =>'');
                     }
                 }
             }

+ 18 - 15
utils/common.class.php

@@ -1285,14 +1285,16 @@ class common {
                     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);   
-            // $json = '{"lng":"100.78594000","lat":"13.68521000","label":"'.$orgin['origin'].'","infor":"LAT KRABANG, THAILAND","sort":"0","stime":null,"ptype":"por"}';
-            // $map = json_decode($json,true); 
-            $toporiginMap[] = array("qandl"=>array(floatval($map['lng']),floatval($map['lat'])),
-                "divIcon" => array("iconSize"=>0),
-                "name" =>$orgin['shippr_uncode'],
-                "color" =>common::getItemStyle("top",$i),
-                "value" =>$orgin['num'],
-                "textcolor" =>"#FFF");
+            //$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)){
+                $toporiginMap[] = array("qandl"=>array(floatval($map['lng']),floatval($map['lat'])),
+                    "divIcon" => array("iconSize"=>0),
+                    "name" =>$orgin['shippr_uncode'],
+                    "color" =>common::getItemStyle("top",$i),
+                    "value" =>$orgin['num'],
+                    "textcolor" =>"#FFF");
+            }
             $toporigin[] = array("name"=>$orgin['shippr_uncode'],"value"=>$orgin['num'],"color"=>common::getItemStyle("top",$i));
             $origiNunMax = $origiNunMax < $orgin['num'] ? $orgin['num'] : $origiNunMax;
         }
@@ -1310,13 +1312,14 @@ class common {
             $map = common::excuteObjectSql($map_sql);  
             // $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);
-
-            $topdestinationinMap[] = array("qandl"=>array(floatval($map['lng']),floatval($map['lat'])),
-                "divIcon" => array("iconSize"=>0),
-                "name" =>$agent['consignee_uncode'],
-                "color" =>common::getItemStyle("top",$i),
-                "value" =>$agent['num'],
-                "textcolor" =>"#FFF");
+            if(!empty($map)){
+                $topdestinationinMap[] = array("qandl"=>array(floatval($map['lng']),floatval($map['lat'])),
+                    "divIcon" => array("iconSize"=>0),
+                    "name" =>$agent['consignee_uncode'],
+                    "color" =>common::getItemStyle("top",$i),
+                    "value" =>$agent['num'],
+                    "textcolor" =>"#FFF");
+            }
             $topdestination[] = array("name"=>$agent['consignee_uncode'],"value"=>$agent['num'],"color"=>common::getItemStyle("top",$i));
             $agentiNunMax = $agentiNunMax < $agent['num'] ? $agent['num'] : $agentiNunMax;
         }