|
|
@@ -1457,6 +1457,147 @@ class common {
|
|
|
return $returnData;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ public static function getTopBarNew(){
|
|
|
+ //分担查询
|
|
|
+ include ONLINE_ROOT . 'libs' . DS . 'map_config.ini.php';
|
|
|
+
|
|
|
+ $sqlWhere = ' and ' . common::searchExtendHand_KLN("ocean", $_SESSION["ONLINE_USER"]);
|
|
|
+ $sqlWhere = " " . $sqlWhere;
|
|
|
+
|
|
|
+ $date_type = strtolower($_REQUEST["date_type"]);
|
|
|
+ if (isset($_REQUEST['date_start']) && !empty($_REQUEST['date_start']))
|
|
|
+ $sqlWhere .= " and $date_type >= '" . common::usDate2sqlDate($_REQUEST['date_start']) . " 00:00:00'";
|
|
|
+ if (isset($_REQUEST['date_end']) && !empty($_REQUEST['date_end']))
|
|
|
+ $sqlWhere .= " and $date_type <= '" . common::usDate2sqlDate($_REQUEST['date_end']) . " 23:59:59'";
|
|
|
+
|
|
|
+ $transportation = $_REQUEST["transportation"];
|
|
|
+ if(!is_array($transportation)){
|
|
|
+ $transportation = array($transportation);
|
|
|
+ }
|
|
|
+ $mode_param = "";
|
|
|
+ if(utils::count($transportation) == 1 && strtolower($transportation[0]) == 'all' ){
|
|
|
+ $mode_param = "'sea','air','road'";
|
|
|
+ }else{
|
|
|
+ $transport_mode = utils::implode(';', $transportation);
|
|
|
+ $mode_param = common::getInNotInSqlForSearch($transport_mode);
|
|
|
+ }
|
|
|
+ $sqlWhere .= " and transport_mode in ($mode_param)";
|
|
|
+
|
|
|
+ $toporiginType = "shippr_uncode";
|
|
|
+ $shippr_uncode_10_sql ="with aa as (select count(shippr_uncode) as num,shippr_uncode,
|
|
|
+ (array_agg(shipper_city))[1] AS shipper_city from public.kln_ocean
|
|
|
+ where 1=1 and COALESCE(shippr_uncode,'')<>'' $sqlWhere group by shippr_uncode order by num desc limit 10)
|
|
|
+ select aa.* from aa ";
|
|
|
+
|
|
|
+ $shippr_uncode_10 = $mapdb->GetAll($shippr_uncode_10_sql) or ( (!$mapdb->ErrorMsg()) or error_log(common::dbLog($mapdb, $shippr_uncode_10_sql), 0));
|
|
|
+ //如果值没有:客户地址-->站点地址-->Port地址(POL/POD)
|
|
|
+ if(utils::count($shippr_uncode_10) == 1 && empty($shippr_uncode_10[0]["shippr_uncode"])){
|
|
|
+ $toporiginType = "fport_of_loading_un";
|
|
|
+ $shippr_uncode_10_sql = "with aa as (select count(fport_of_loading_un) as num,fport_of_loading_un as shippr_uncode
|
|
|
+ from public.kln_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.* from aa ";
|
|
|
+ $shippr_uncode_10 = $mapdb->GetAll($shippr_uncode_10_sql) or ( (!$mapdb->ErrorMsg()) or error_log(common::dbLog($mapdb, $shippr_uncode_10_sql), 0));
|
|
|
+ }
|
|
|
+
|
|
|
+ $topdestinationinType = "consignee_uncode";
|
|
|
+ $consignee_uncode_10_sql = "with aa as (select count(consignee_uncode) as num,consignee_uncode,
|
|
|
+ (array_agg(consignee_city))[1] AS consignee_city
|
|
|
+ from public.kln_ocean where 1=1 and COALESCE(consignee_uncode,'')<>'' $sqlWhere group by consignee_uncode order by num desc limit 10)
|
|
|
+ select aa.* from aa";
|
|
|
+
|
|
|
+ $consignee_uncode_10 = $mapdb->GetAll($consignee_uncode_10_sql) or ( (!$mapdb->ErrorMsg()) or error_log(common::dbLog($mapdb, $consignee_uncode_10_sql), 0));
|
|
|
+ //如果值没有:客户地址-->站点地址-->Port地址(POL/POD)
|
|
|
+ if(utils::count($consignee_uncode_10) == 1 && empty($consignee_uncode_10[0]["consignee_uncode"])){
|
|
|
+ $topdestinationinType = "mport_of_discharge_un";
|
|
|
+ $consignee_uncode_10_sql = "with aa as (select count(mport_of_discharge_un) as num,mport_of_discharge_un as consignee_uncode from public.kln_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.* from aa";
|
|
|
+ $consignee_uncode_10 = $mapdb->GetAll($consignee_uncode_10_sql) or ( (!$mapdb->ErrorMsg()) or error_log(common::dbLog($mapdb, $consignee_uncode_10_sql), 0));
|
|
|
+ }
|
|
|
+
|
|
|
+ $toporigin = array();
|
|
|
+ $toporiginMap = array();
|
|
|
+ $i = 0;
|
|
|
+ $origiNunMax = 0;
|
|
|
+ foreach($shippr_uncode_10 as $orgin){
|
|
|
+ $i = $i + 1;
|
|
|
+ $map =common::excuteObjectSql("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 (lat<=90 and lat>=-90) and (lon<=180 and lon>=-180) and lon is not null and lat is not null and uncode='".$orgin['shippr_uncode']."'");
|
|
|
+
|
|
|
+ //$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['lat']),floatval($map['lng'])),
|
|
|
+ "divIcon" => array("iconSize"=>0),
|
|
|
+ "name" =>$orgin['shippr_uncode'],
|
|
|
+ "color" =>common::getItemStyle("top",$i),
|
|
|
+ "value" =>$orgin['num'],
|
|
|
+ "textcolor" =>"#FFF");
|
|
|
+ }
|
|
|
+ //查询uncode,对应的city
|
|
|
+ $city = "";
|
|
|
+ if($toporiginType == "shippr_uncode"){
|
|
|
+ $city = $orgin['shipper_city'];
|
|
|
+ }
|
|
|
+ //$city 做假数据
|
|
|
+ $toporigin[] = array("name"=>$orgin['shippr_uncode'],"city_name"=>$city,"value"=>$orgin['num'],"color"=>common::getItemStyle("top",$i));
|
|
|
+ $origiNunMax = $origiNunMax < $orgin['num'] ? $orgin['num'] : $origiNunMax;
|
|
|
+ }
|
|
|
+
|
|
|
+ $topdestination = array();
|
|
|
+ $topdestinationinMap = array();
|
|
|
+ $i = 0;
|
|
|
+ $agentiNunMax = 0;
|
|
|
+ foreach($consignee_uncode_10 as $agent){
|
|
|
+ $i = $i + 1;
|
|
|
+ $map =common::excuteObjectSql("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 (lat<=90 and lat>=-90) and (lon<=180 and lon>=-180) and lon is not null and lat is not null and uncode='".$agent['consignee_uncode']."' ");
|
|
|
+
|
|
|
+ // $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)){
|
|
|
+ $topdestinationinMap[] = array("qandl"=>array(floatval($map['lat']),floatval($map['lng'])),
|
|
|
+ "divIcon" => array("iconSize"=>0),
|
|
|
+ "name" =>$agent['consignee_uncode'],
|
|
|
+ "color" =>common::getItemStyle("top",$i),
|
|
|
+ "value" =>$agent['num'],
|
|
|
+ "textcolor" =>"#FFF");
|
|
|
+ }
|
|
|
+
|
|
|
+ //查询uncode,对应的city
|
|
|
+ $city = "";
|
|
|
+ if($topdestinationinType == "consignee_uncode"){
|
|
|
+ $city = $agent['consignee_city'];
|
|
|
+ }
|
|
|
+ //$city 做假数据
|
|
|
+ $topdestination[] = array("name"=>$agent['consignee_uncode'],"city_name"=>$city,"value"=>$agent['num'],"color"=>common::getItemStyle("top",$i));
|
|
|
+ $agentiNunMax = $agentiNunMax < $agent['num'] ? $agent['num'] : $agentiNunMax;
|
|
|
+ }
|
|
|
+
|
|
|
+ //处理返回原表数据格式
|
|
|
+ $interval = utils::calculateTicks(0,$origiNunMax,10);
|
|
|
+ if($interval == 0){
|
|
|
+ //处理返回默认值
|
|
|
+ $interval = 1;
|
|
|
+ }
|
|
|
+
|
|
|
+ $dest_interval = utils::calculateTicks(0,$agentiNunMax,10);
|
|
|
+ if($dest_interval == 0){
|
|
|
+ //处理返回默认值
|
|
|
+ $dest_interval = 1;
|
|
|
+ }
|
|
|
+
|
|
|
+ $returnData = array("seller_data_list_origin"=>$toporigin,"toporiginMap"=>array_reverse($toporiginMap),"toporiginType"=>$toporiginType,
|
|
|
+ "seller_data_list_destination"=>$topdestination,"topdestinationinMap"=>array_reverse($topdestinationinMap),"topdestinationinType"=>$topdestinationinType,
|
|
|
+ "min" => 0,"Max" =>$interval*10,"interval" =>$interval,
|
|
|
+ "dest_min" => 0,"dest_Max" =>$dest_interval*10,"dest_interval" =>$dest_interval);
|
|
|
+ return $returnData;
|
|
|
+ }
|
|
|
+
|
|
|
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);
|
|
|
@@ -2204,6 +2345,23 @@ class common {
|
|
|
return $is_subscribe;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * get webiste
|
|
|
+ */
|
|
|
+ public static function getWebiste($carrier) {
|
|
|
+ $website = "";
|
|
|
+ if (!empty($carrier)){
|
|
|
+ $website = common::excuteOneSql("select website from vessel_company where scac = '$carrier'");
|
|
|
+ }
|
|
|
+ if (strpos($website, ";") === FALSE){
|
|
|
+
|
|
|
+ }else{
|
|
|
+ $site = explode(";", $website);
|
|
|
+ $website = $site[0];
|
|
|
+ }
|
|
|
+ return $website;
|
|
|
+ }
|
|
|
+
|
|
|
public static function getWeek($week){
|
|
|
if ($week == "0"){
|
|
|
$week = "Sunday";
|
|
|
@@ -2297,5 +2455,32 @@ class common {
|
|
|
}
|
|
|
return !empty($num) ? intval($num): $num;
|
|
|
}
|
|
|
+
|
|
|
+ //检查user name length
|
|
|
+ public static function checkUserNameLength($input) {
|
|
|
+ if(!empty($input) && strlen($input) > 50){
|
|
|
+ $data = array(
|
|
|
+ 'code' => 'no_exist',
|
|
|
+ 'login_version' => '',
|
|
|
+ 'msg' => 'The username or password you entered is incorrect'
|
|
|
+ );
|
|
|
+ common::echo_json_encode(500, $data);
|
|
|
+ exit();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //预加载写法
|
|
|
+ public static function excuteObjectPrepareSql($sql,$param) {
|
|
|
+ if (empty($sql))
|
|
|
+ exit(json_encode("Program encountered an error."));
|
|
|
+ global $db;
|
|
|
+ $stmt = $db->Prepare($sql);
|
|
|
+ $result = $db->Execute($stmt, $param);
|
|
|
+ if ($result && $result->RecordCount() > 0) {
|
|
|
+ $row = $result->fields;
|
|
|
+ return $row;
|
|
|
+ }
|
|
|
+ return null;
|
|
|
+ }
|
|
|
}
|
|
|
?>
|