main_new_version.php 47 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873
  1. <?php
  2. $max_ec = ini_get('max_execution_time'); //set max_excution_time
  3. ini_set('max_execution_time', '600');
  4. $memory_limit = "";
  5. $action = "";
  6. if (isset($_GET['action']))
  7. $action = strtolower($_GET['action']);
  8. if (isset($_POST['action']))
  9. $action = strtolower($_POST['action']);
  10. include "include.ini.php";
  11. include 'service/ocean_booking.class.php';
  12. include 'service/ocean_order.class.php';
  13. include 'service/operation_log.class.php';
  14. include 'service/search.class.php';
  15. include 'service/column.class.php';
  16. include 'service/ajax.class.php';
  17. include 'service/login.class.php';
  18. include 'service/tools.class.php';
  19. include 'service/robot.class.php';
  20. include 'service/AIClientFactory.php';
  21. include 'service/destination_delivery.class.php';
  22. //为了调用,临时做一个登录动作 如果是正式版 要注释掉菜单System Settings
  23. //$_POST['uname'] = "ra.admin";
  24. //$_POST['psw'] = common::excuteOneSql("select ra_password from public.ra_online_user where user_login = 'ra.admin'");
  25. //$name = "dddde";
  26. // $name = "ra.admin";
  27. // $_POST['uname'] = $name;
  28. // $_POST['psw'] = common::excuteOneSql("select ra_password from public.ra_online_user where user_login = '".$name."'");
  29. // login::getInstance()->do_login_auto();
  30. //验证路由权限
  31. common::securityCheckHandNew($action);
  32. if (_is_only_vgm()) {
  33. Header("Location:main.php?action=main");
  34. }
  35. error_log("--------------前端请求post参数---------------");
  36. error_log(utils::jsonFiltration("null", "\"\"", json_encode($_POST)));
  37. error_log("--------------前端请求get参数---------------");
  38. error_log(utils::jsonFiltration("null", "\"\"", json_encode($_GET)));
  39. //Operation log 日志记录
  40. utils::operation_log_records();
  41. switch ($action) {
  42. case 'ocean_booking':
  43. ocean_booking::getInstance()->ocean_booking();
  44. break;
  45. case 'ocean_order':
  46. ocean_order::getInstance()->ocean_order();
  47. break;
  48. case 'ajax':
  49. echo ajax::getInstance()->run();
  50. break;
  51. case 'opreation_log':
  52. echo operation_log::getInstance()->operation_log();
  53. break;
  54. case 'main':
  55. //如果在没有登录前,没有登录信息,指定用户
  56. if(!isset($_SESSION['ONLINE_USER'])){
  57. $menuList = array();
  58. $menuList[] = array("index"=>'1',"label"=>"Dashboard","icon"=>"icon_data_fill_b","path"=>"/dashboard");
  59. $menuList[] = array("index"=>'2',"label"=>"Booking","icon"=>"icon_booking__fill_b","path"=>"/booking");
  60. $menuList[] = array("index"=>'3',"label"=>"Tracking","icon"=>"icon_tracking__fill_b","path"=>"/tracking");
  61. } else {
  62. //d登录后,根据配置的权限,是否显示
  63. if (_isAdmin())
  64. $sql = "select f_column, min(menu_id) as menu_id, max(menu_icon_font) as menu_icon_font from public.ra_online_permission where has_new_version=true group by f_column order by min(order_by)";
  65. elseif (_isNewUser())
  66. $sql = "select f_column, min(menu_id) as menu_id, max(menu_icon_font) as menu_icon_font from public.ra_online_permission where has_new_version=true and customer_check = true group by f_column ORDER BY min(order_by)";
  67. else
  68. $sql = "select p.f_column, min(menu_id) as menu_id, max(menu_icon_font) as menu_icon_font from public.ra_online_user_permission up left join public.ra_online_permission p on up.p_id = p.id where has_new_version=true and lower(user_name) = '" . common::check_input(strtolower(_getLoginName())) . "' group by p.f_column ORDER BY min(p.order_by)";
  69. $rs = common::excuteListSql($sql);
  70. if (empty($rs) && _isApexLogin()) {
  71. $sql = "select f_column, min(menu_id) as menu_id, max(menu_icon_font) as menu_icon_font from public.ra_online_permission where has_new_version=true and default_check = true group by f_column ORDER BY min(order_by)";
  72. $rs = common::excuteListSql($sql);
  73. }
  74. $menuSetting = array("Ocean Booking" => array("label"=>"Booking","path"=>"/booking","icon"=>"icon_booking__fill_b"),
  75. "Ocean B/L Info." => array("label"=>"Tracking","path"=>"/tracking","icon"=>"icon_tracking__fill_b"));
  76. $menuList = array();
  77. $menuList[] = array("index"=>'1',"label"=>"Dashboard","icon"=>"icon_data_fill_b","path"=>"/dashboard");
  78. $index = 2;
  79. foreach ($rs as $value) {
  80. if ($value['f_column'] == "Shipment Info."){
  81. if (_isAdmin())
  82. $ll = common::excuteListSql("select s_column, url_action, sub_menu_id from public.ra_online_permission where has_new_version=true and f_column = '" . common::check_input($value['f_column']) . "' ORDER BY order_by");
  83. elseif (_isNewUser())
  84. $ll = common::excuteListSql("select s_column, url_action, sub_menu_id from public.ra_online_permission where has_new_version=true and customer_check = true and f_column = '" . common::check_input($value['f_column']) . "' ORDER BY order_by");
  85. else
  86. $ll = common::excuteListSql("select s_column, url_action, sub_menu_id from public.ra_online_permission p left join public.ra_online_user_permission gp on gp.p_id = p.id where has_new_version=true and f_column = '" . common::check_input($value['f_column']) . "' and lower(gp.user_name) = '" . common::check_input(strtolower(_getLoginName())) . "' ORDER BY p.order_by");
  87. if (empty($ll) && _isApexLogin()) {
  88. $ll = common::excuteListSql("select s_column, url_action, sub_menu_id from public.ra_online_permission where has_new_version=true and f_column = '" . common::check_input($value['f_column']) . "' and default_check = true ORDER BY order_by");
  89. }
  90. //单独拼接URL
  91. foreach ($ll as $v) {
  92. //if($v['s_column'] =="Ocean Booking" || $v['s_column'] =="Ocean B/L Info."){
  93. if($v['s_column'] =="Ocean B/L Info."){
  94. $urlData = $menuSetting[$v['s_column']];
  95. $menuList[] = array("index"=>"$index","label"=>$urlData['label'],"icon"=>$urlData['icon'],"path"=>$urlData['path']);
  96. $index = $index + 1;
  97. }
  98. //特殊处理book,需要加二级菜
  99. if($v['s_column'] =="Ocean Booking"){
  100. $urlData = $menuSetting[$v['s_column']];
  101. $menuList[] = array("index"=>"$index","label"=>$urlData['label'],"icon"=>$urlData['icon'],"path"=>$urlData['path']);
  102. // $bookingManagement = array("index"=>"$index","label"=>"Booking","icon"=>"icon_booking__fill_b","type"=>"list");
  103. // $children = array();
  104. // $urlData = $menuSetting[$v['s_column']];
  105. // $children[] = array("index"=>$index.'-1',"label"=>$urlData['label'],"path"=>$urlData['path']);
  106. // $children[] = array("index"=>$index.'-2',"label"=>"Destination Delivery","path"=>"/destination-delivery");
  107. // $bookingManagement["children"] = $children;
  108. // $menuList[] = $bookingManagement;
  109. $index = $index + 1;
  110. }
  111. }
  112. }
  113. }
  114. $systemManagement = array("index"=>"$index","label"=>"System Management","icon"=>"icon_system__management_fill_b","type"=>"list");
  115. $children = array();
  116. $children[] = array("index" =>$index.'-1',"label" =>"System Message","path"=>"/system-message");
  117. $children[] = array("index" =>$index.'-2',"label" =>"System Settings","path"=>"/SystemSettings");
  118. //只有chud的账户可以看日志记录
  119. if(strtolower(_getLoginName()) == "chud"
  120. || strtolower(_getLoginName()) == strtolower("IT.Andywu")
  121. || strtolower(_getLoginName()) == "ra.admin"){
  122. $children[] = array("index" =>$index.'-3',"label" =>"Chat Log","path"=>"/chat-log");
  123. $children[] = array("index" =>$index.'-4',"label" =>"AI API Log","path"=>"/ai-api-log");
  124. $children[] = array("index" =>$index.'-5',"label" =>"Operation Log","path"=>"/Operationlog");
  125. $children[] = array("index" =>$index.'-6',"label" =>"Prompt Configuration","path"=>"/PromptConfiguration");
  126. }
  127. //特殊放开一个帐号
  128. if(strtolower(_getLoginName()) == strtolower("michaelW")){
  129. $children[] = array("index" =>$index.'-4',"label" =>"AI API Log","path"=>"/ai-api-log");
  130. $children[] = array("index" =>$index.'-6',"label" =>"Prompt Configuration","path"=>"/PromptConfiguration");
  131. }
  132. $systemManagement["children"] = $children;
  133. if (!empty($children)){
  134. $menuList[] = $systemManagement;
  135. }
  136. }
  137. common::echo_json_encode(200, $menuList);
  138. exit();
  139. break;
  140. case 'main_filter':
  141. $data = common::getManagement();
  142. common::echo_json_encode(200, $data['dashboard_filter']);
  143. exit();
  144. break;
  145. case 'main_report':
  146. //分担查询
  147. include ONLINE_ROOT . 'libs' . DS . 'map_config.ini.php';
  148. //这里只剩下r3,r4的查询
  149. $type = $_REQUEST["r_type"];
  150. $sqlWhere = ' and ' . common::searchExtendHand_KLN("ocean", $_SESSION["ONLINE_USER"]);
  151. $sqlWhere = " " . $sqlWhere;
  152. $sqlWhere .= common::getDashboardTransportationSqlWhere();
  153. $sqlWhere = common::check_input($sqlWhere);
  154. // $list = common::excuteListSql("select * from public.online_order_status_date_kln_pending('$type'::text, '$sqlWhere'::text) "
  155. // . "r (c bigint, e integer, b integer, d text)");
  156. $sql = "select * from public.online_order_status_date_kln_pending('$type'::text, '$sqlWhere'::text) "
  157. . "r (c bigint, e integer, b integer, d text)";
  158. $list = $mapdb->GetAll($sql) or ( (!$mapdb->ErrorMsg()) or error_log(common::dbLog($mapdb, $sql), 0));
  159. $key = "[";
  160. $value = "[";
  161. $totalValue = 0;
  162. foreach ($list as $vv) {
  163. if ($key != "[") {
  164. $key .= ",";
  165. $value .= ",";
  166. }
  167. if ($type == "r2" || $type == "r3" || $type == "r4") {
  168. $key .= '"' . $vv["d"] . '"';
  169. $value .= '{"value":"' . $vv["c"] . '","name":"' . $vv["d"] . '" }';
  170. $totalValue = $totalValue + $vv["c"];
  171. } else {
  172. if ($vv["e"] == -1) {
  173. $key .= '"Over 80 Days"';
  174. $value .= '{"value":"' . $vv["c"] . '","name":"Over 80 Days"}';
  175. } else {
  176. $key .= '"' . $vv["b"] . '-' . $vv["e"] . ' Days"';
  177. $value .= '{"value":"' . $vv["c"] . '","name":"' . $vv["b"] . '-' . $vv["e"] . ' Days"}';
  178. }
  179. $totalValue = $totalValue + $vv["c"];
  180. }
  181. }
  182. $key .= "]";
  183. $value .= "]";
  184. //处理返回原表数据格式 r1 r3 r4的数据返回
  185. $data = common::mian_repot_do($value,$type,$totalValue);
  186. common::echo_json_encode(200, $data);
  187. exit();
  188. break;
  189. case 'main_report_etd':
  190. //分担查询
  191. include ONLINE_ROOT . 'libs' . DS . 'map_config.ini.php';
  192. //这里只有r1查询
  193. $type = "r1";
  194. $container_type = "";
  195. $date_type = strtolower($_REQUEST["date_type"]);
  196. if (empty($_REQUEST["date_start"])) {
  197. $bdate = "null";
  198. } else {
  199. $bdate = $_REQUEST["date_start"];
  200. $bdate = "'$bdate'";
  201. }
  202. if (empty($_REQUEST["date_end"])) {
  203. $edate = "null";
  204. } else {
  205. $edate = $_REQUEST["date_end"];
  206. $edate = "'$edate'";
  207. }
  208. $sqlWhere = ' and ' . common::searchExtendHand_KLN("ocean", $_SESSION["ONLINE_USER"]);
  209. $sqlWhere = " " . $sqlWhere;
  210. $sqlWhere = $sqlWhere . common::getDashboardTransportationSqlWhere();
  211. $sqlWhere = common::check_input($sqlWhere);
  212. // $list = common::excuteListSql("select * from public.online_order_status_date_kln_r1_r2('$type'::text, 'eta'::text, 'etd'::text, $bdate, $edate, '$sqlWhere'::text, '$container_type'::text,'$date_type'::text) "
  213. // . "r (c bigint, e integer, b integer, d text)");
  214. $sql = "select * from public.online_order_status_date_kln_r1_r2('$type'::text, 'eta'::text, 'etd'::text, $bdate, $edate, '$sqlWhere'::text, '$container_type'::text,'$date_type'::text) "
  215. . "r (c bigint, e integer, b integer, d text)";
  216. $list = $mapdb->GetAll($sql) or ( (!$mapdb->ErrorMsg()) or error_log(common::dbLog($mapdb, $sql), 0));
  217. $key = "[";
  218. $value = "[";
  219. $totalValue = 0;
  220. foreach ($list as $vv) {
  221. if ($key != "[") {
  222. $key .= ",";
  223. $value .= ",";
  224. }
  225. if ($type == "r2" || $type == "r3" || $type == "r4") {
  226. $key .= '"' . $vv["d"] . '"';
  227. $value .= '{"value":"' . $vv["c"] . '","name":"' . $vv["d"] . '" }';
  228. $totalValue = $totalValue + $vv["c"];
  229. } else {
  230. if ($vv["e"] == -1) {
  231. $key .= '"Over 80 Days"';
  232. $value .= '{"value":"' . $vv["c"] . '","name":"Over 80 Days"}';
  233. } else {
  234. $key .= '"' . $vv["b"] . '-' . $vv["e"] . ' Days"';
  235. $value .= '{"value":"' . $vv["c"] . '","name":"' . $vv["b"] . '-' . $vv["e"] . ' Days"}';
  236. }
  237. $totalValue = $totalValue + $vv["c"];
  238. }
  239. }
  240. $key .= "]";
  241. $value .= "]";
  242. //处理返回原表数据格式 r1 r3 r4的数据返回
  243. $data = common::mian_repot_do($value,$type,$totalValue);
  244. common::echo_json_encode(200, $data);
  245. exit();
  246. break;
  247. case 'main_report_kpi':
  248. //分担查询
  249. include ONLINE_ROOT . 'libs' . DS . 'map_config.ini.php';
  250. $type = $_REQUEST["r_type"];
  251. $sqlWhere = ' and ' . common::searchExtendHand_KLN("ocean", $_SESSION["ONLINE_USER"]);
  252. $sqlWhere = " " . $sqlWhere;
  253. $sqlWhere = $sqlWhere . common::getDashboardTransportationSqlWhere();
  254. $sqlWhere = common::check_input($sqlWhere);
  255. $date_type = strtolower($_REQUEST["date_type"]);
  256. if (isset($_REQUEST['date_start']) && !empty($_REQUEST['date_start']))
  257. $sqlWhere .= " and $date_type >= ''" . common::usDate2sqlDate($_REQUEST['date_start']) . " 00:00:00''";
  258. if (isset($_REQUEST['date_end']) && !empty($_REQUEST['date_end']))
  259. $sqlWhere .= " and $date_type <= ''" . common::usDate2sqlDate($_REQUEST['date_end']) . " 23:59:59''";
  260. // $list = common::excuteListSql("select * from public.online_order_status_date_kln_kpi('$type'::text,'$sqlWhere'::text) "
  261. // . "r (c bigint, d text)");
  262. $sql = "select * from public.online_order_status_date_kln_kpi('$type'::text,'$sqlWhere'::text) "
  263. . "r (c bigint, d text)";
  264. $list = $mapdb->GetAll($sql) or ( (!$mapdb->ErrorMsg()) or error_log(common::dbLog($mapdb, $sql), 0));
  265. $key = "[";
  266. $value = "[";
  267. $totalValue = 0;
  268. foreach ($list as $vv) {
  269. if ($key != "[") {
  270. $key .= ",";
  271. $value .= ",";
  272. }
  273. if ($type == "ata_r3" || $type == "atd_r4" ) {
  274. $key .= '"' . $vv["d"] .'"';
  275. $value .= '{"value":"' . $vv["c"] . '","name":"' . $vv["d"] .'"}';
  276. $totalValue = $totalValue + $vv["c"];
  277. }
  278. }
  279. $key .= "]";
  280. $value .= "]";
  281. //处理返回原表数据格式
  282. $ETDList = array();
  283. $value_arr = json_decode($value,true);
  284. foreach($value_arr as $arr){
  285. $color = common::getItemStyle($type,$arr['name']);
  286. if($arr['name'] == "0 Day"){
  287. $arr['name'] = "≤1 Day";
  288. }
  289. if($arr['name'] == "7 Days"){
  290. $arr['name'] = "≥7 Days";
  291. }
  292. $ETDList[] = array("value" =>intval($arr['value']),"name" =>$arr['name'],"itemStyle" =>array("color" =>$color));
  293. }
  294. // 排序依据的键数组(这里我们用一个数字数组来表示)
  295. $order = ["≤1 Day", "1-2 Days", "3-6 Days","≥7 Days"];
  296. $ETDList = utils::arrayOrderBykeys($order,$ETDList,"name");
  297. if($type == 'atd_r4'){
  298. $data = array("ETDList" =>$ETDList,"ETD_Radius"=>array('30%','50%'),"title1" =>"Departure","title2" =>"(ATD-ETD)","download_name" => "KPI Departure");
  299. }
  300. if($type == 'ata_r3'){
  301. $data = array("ETDList" =>$ETDList,"ETD_Radius"=>array('30%','50%'),"title1" =>"Arrival","title2" =>"(ATA-ETA)","download_name" => "KPI Arrival");
  302. }
  303. common::echo_json_encode(200, $data);
  304. exit();
  305. break;
  306. case 'main_report_container_bar':
  307. //新UI 20 40 45 3份数据同时查询,且是柱状图,所以与r3 r4查询分开
  308. $container_type ='';
  309. $ContainerCounSeries = array();
  310. $date_type = strtolower($_REQUEST["date_type"]);
  311. $type = $_REQUEST["r_type"];
  312. if (empty($_REQUEST["date_start"])) {
  313. $bdate = "null";
  314. } else {
  315. $bdate = $_REQUEST["date_start"];
  316. $bdate = "'$bdate'";
  317. }
  318. if (empty($_REQUEST["date_end"])) {
  319. $edate = "null";
  320. } else {
  321. $edate = $_REQUEST["date_end"];
  322. $edate = "'$edate'";
  323. }
  324. $list= array();
  325. $sqlWhere = ' and ' . common::searchExtendHandNew("ocean", $_SESSION["ONLINE_USER"]);
  326. $sqlWhere = common::check_input($sqlWhere);
  327. $sqlWhere = " " . $sqlWhere;
  328. //这个20 40 45都查询出来。否则值查询都对应的size,其他的不查询
  329. $value_arr = common::excuteListSql("select * from public.online_order_status_date_kln_r1_r2('$type'::text, 'eta'::text, 'etd'::text, $bdate, $edate, '$sqlWhere'::text, '$container_type'::text, '$date_type'::text) "
  330. . "r (month_group text, _20_rc numeric, _40_rc numeric, _45_rc numeric)");
  331. $key_arr = array();
  332. $container_type_arr = array("20","40","45");
  333. foreach($container_type_arr as $_container_type){
  334. $data = array();
  335. //每一个size 的所有月份总计
  336. $total = 0;
  337. //每一个size 对应的最大值
  338. $max = 0;
  339. foreach($value_arr as $arr){
  340. $data[] = intval($arr['_'.$_container_type.'_rc']);
  341. $total = $total + intval($arr['_'.$_container_type.'_rc']);
  342. $max = $max < intval($arr['_'.$_container_type.'_rc']) ? intval($arr['_'.$_container_type.'_rc']) : $max;
  343. if ($_container_type == '20'){
  344. $key_arr[] = $arr['month_group'];
  345. }
  346. }
  347. $ContainerCounSeries[$_container_type] = array("data"=>$data,"total"=>$total,"max"=>$max);
  348. }
  349. //处理返回时数据格式
  350. $ContainerCounSeries_return = array();
  351. //横坐标栏位
  352. $ContainerCount_Title = $key_arr;
  353. //所查的所有模式计算总和
  354. $total = 0;
  355. //所有size下的最大值,方便标注计算最长的Y坐标
  356. $max_all = 0;
  357. foreach($ContainerCounSeries as $k =>$v){
  358. //这个type 是页面传过来的。这个固定r2
  359. $color = common::getItemStyle($type,$k);
  360. $total = $total + $v['total'];
  361. $ContainerCounSeries_return[] = array("name"=>strval($k),"type"=>"bar","emphasis" => array("focus" =>"none"),
  362. "stack" =>"总计","data" =>$v['data'],"itemStyle" =>array("color" =>$color));
  363. $max_all = $max_all + $v['max'];
  364. }
  365. //计算Y坐标的间隔
  366. $interval = utils::calculateTicks(0,$max_all,5);
  367. if($interval == 0){
  368. //处理返回默认值
  369. $interval = 2;
  370. }
  371. $returnData = array("ContainerCount_Title"=>"Total: $total","ContainerCountList" =>$ContainerCount_Title,"ContainerCounSeries" =>$ContainerCounSeries_return,
  372. "min" => 0,"Max" =>$interval*5,"interval" =>$interval,"download_name" => "Container Count");
  373. //demo
  374. // $json = '{"code":200,"data":{"ContainerCount_Title":"Total: 463518","ContainerCountList":["OCT,23","NOV,23","DEC,23","JAN,24","FEB,24","MAR,24","APR,24","MAY,24","JUN,24","JUL,24","AUG,24","SEP,24","OCT,24"],"ContainerCounSeries":[{"name":"20","type":"bar","emphasis":{"focus":"none"},"stack":"\u603b\u8ba1","data":[4400,8600,8804,9271,8961,8793,8534,9476,9530,10277,10081,8997,5784],"itemStyle":{"color":"#FF7500"}},{"name":"40","type":"bar","emphasis":{"focus":"none"},"stack":"\u603b\u8ba1","data":[13652,28021,30422,30136,26320,27035,23979,26494,28406,33318,32318,30962,16369],"itemStyle":{"color":"#FFAC66"}},{"name":"45","type":"bar","emphasis":{"focus":"none"},"stack":"\u603b\u8ba1","data":[189,337,415,437,439,321,250,320,324,603,328,415,200],"itemStyle":{"color":"#FFE3CC"}}],"min":0,"Max":45000,"interval":9000}}';
  375. // $returnData = json_decode($json,true);
  376. // echo json_encode($returnData);
  377. // exit();
  378. common::echo_json_encode(200, $returnData);
  379. exit();
  380. break;
  381. case 'main_report_co2e_bar':
  382. $returnData = common::getCo2eBar();
  383. common::echo_json_encode(200, $returnData);
  384. exit();
  385. break;
  386. case 'main_report_top10_bar':
  387. $returnData = common::getTopBarNew();
  388. common::echo_json_encode(200, $returnData);
  389. exit();
  390. break;
  391. case 'main_report_revenue':
  392. $returnData = common::getRevenue();
  393. common::echo_json_encode(200, $returnData);
  394. exit();
  395. break;
  396. case 'main_map':
  397. $uncode = $_POST["uncode"];
  398. $serial_no = $_POST["serial_no"];
  399. $unall = explode("|", $uncode);
  400. $sql = "";
  401. if (!empty($unall[0]) && $unall[0] != "''") {
  402. $sql .= "select lon as lng, lat as lat, uncode, 'Place of receipt: '||name1 as location_namewo, 'por' as type from vessel.vt_unlocode where "
  403. . "lon<>0 and lat<>0 and lon is not null and lat is not null and uncode in "
  404. . "($unall[0])";
  405. }
  406. if (!empty($unall[1]) && $unall[1] != "''") {
  407. if (!empty($sql)) {
  408. $sql .= " union ";
  409. }
  410. $sql .= "select lon as lng, lat as lat, uncode, 'POL: '||name1 as location_namewo, 'pol' as type from vessel.vt_unlocode where "
  411. . "lon<>0 and lat<>0 and lon is not null and lat is not null and uncode in "
  412. . "($unall[1])";
  413. }
  414. if (!empty($unall[2]) && $unall[2] != "''") {
  415. if (!empty($sql)) {
  416. $sql .= " union ";
  417. }
  418. $sql .= "select lon as lng, lat as lat, uncode, 'POD: '||name1 as location_namewo, 'pod' as type from vessel.vt_unlocode where "
  419. . "lon<>0 and lat<>0 and lon is not null and lat is not null and uncode in "
  420. . "($unall[2])";
  421. }
  422. if (!empty($unall[3]) && $unall[3] != "''") {
  423. if (!empty($sql)) {
  424. $sql .= " union ";
  425. }
  426. $sql .= "select lon as lng, lat as lat, uncode, 'Place of delivery: '||name1 as location_namewo, 'poe' as type from vessel.vt_unlocode where "
  427. . "lon<>0 and lat<>0 and lon is not null and lat is not null and uncode in "
  428. . "($unall[3])";
  429. }
  430. $tkStatus = common::excuteListSql("select tl.by_pickup, g.consignee_exp, g.pickup_from_exp, c.ctnr, g.deliveryto_exp, g.serial_no, tl.location, tl.type, tl.id,
  431. to_char(tl.upload_time, 'MM/DD/YYYY HH24:MI:SS') as utime
  432. from public.tk_general g, public.tk_commodity c left join public.tk_location tl on c.serial_no=tl.serial_no
  433. where g.serial_no=c.serial_no and g.bol=(select m_bol from public.ocean where serial_no='$serial_no') order by tl.order_id");
  434. foreach ($tkStatus as $vv) {
  435. $ll = explode(",", $vv["location"]);
  436. if ($vv["by_pickup"] == "t") {
  437. $pf = explode("\r\n", $vv["pickup_from_exp"]);
  438. $pf = common::check_input($pf[0]) . "(" . $vv["ctnr"] . ")";
  439. $dt = explode("\r\n", $vv["consignee_exp"]);
  440. $dt = common::check_input($dt[0]) . "(" . $vv["ctnr"] . ")";
  441. } else {
  442. $pf = explode("\r\n", $vv["consignee_exp"]);
  443. $pf = common::check_input($pf[0]) . "(" . $vv["ctnr"] . ")";
  444. $dt = explode("\r\n", $vv["deliveryto_exp"]);
  445. $dt = common::check_input($dt[0]) . "(" . $vv["ctnr"] . ")";
  446. }
  447. if ($vv["type"] == "26" && !empty($ll[1])) {
  448. if (!empty($sql)) {
  449. $sql .= " union ";
  450. }
  451. $sql .= "select '" . $ll[1] . "' as lng, '" . $ll[0] . "' as lat, '" . $vv["ctnr"] . "' as uncode, 'Pick up: " . $vv["utime"] . "<br>'||'" . $pf . "' as location_namewo, 'pickup' as type";
  452. } elseif ($vv["type"] == "25" && !empty($ll[1])) {
  453. if (!empty($sql)) {
  454. $sql .= " union ";
  455. }
  456. $sql .= "select '" . $ll[1] . "' as lng, '" . $ll[0] . "' as lat, '" . $vv["ctnr"] . "' as uncode, 'Delivery: " . $vv["utime"] . "<br>'||'" . $dt . "' as location_namewo, 'delivery' as type";
  457. }
  458. }
  459. if (!empty($sql)) {
  460. $gps = common::excuteListSql($sql . "");
  461. }
  462. if (!empty($serial_no)) {
  463. $all = explode(",", $serial_no);
  464. foreach ($all as $a) {
  465. $rs = common::excuteOneSql("select public.get_vessel_position('$a'::text)");
  466. if (!empty($rs)) {
  467. $rss = explode("|", $rs);
  468. $lng_lat = explode(",", $rss[1]);
  469. $gps[] = array("lng" => $lng_lat[0], "lat" => $lng_lat[1], "uncode" => "", "location_namewo" => "", "type" => "vessel", "vessel_name" => $rss[2], "m_shipname" => "", "mmsi" => "", "imo" => "", "m_shipstate" => "", "m_shiptype" => "", "m_dest" => "", "m_newshiparrive" => "", "m_newlasttime" => "", "lasttime" => "", "sub" => "");
  470. }
  471. }
  472. }
  473. $data = array("gps" => $gps);
  474. common::echo_json_encode("200", $data);
  475. exit();
  476. break;
  477. case 'main_map_new':
  478. include ONLINE_ROOT . 'libs' . DS . 'map_config.ini.php';
  479. //修改添加port_of_transshipment 和port_of_transshipment_name的坐标获取(有为空的可能)
  480. $serial_no = $_REQUEST["serial_no"];
  481. $_schemas = $_REQUEST['_schemas'];
  482. if(empty($_schemas)){
  483. $_schemas ="public";
  484. }
  485. //$serial_no = "F41E6016-1A97-4C93-8198-53D8B3B26220";
  486. $transport_mode = common::excuteOneSql("SELECT transport_mode FROM public.kln_ocean ko
  487. WHERE ko.serial_no = '$serial_no' and order_from = '$_schemas'");
  488. if($transport_mode == "sea"){
  489. $sql = "with ss as (select '$serial_no' as sn)
  490. , aa as (
  491. select place_of_receipt_un, place_of_delivery_un, fport_of_loading_un, mport_of_discharge_un, port_of_loading, port_of_discharge, place_of_delivery_exp, place_of_receipt_exp,dd.*
  492. from public.kln_ocean oo
  493. left join LATERAL (
  494. select (select uncode from ports where code = o.port_of_transshipment) as port_of_transshipment_un,
  495. port_of_transshipment_name
  496. from $_schemas.ocean o where o.serial_no=oo.serial_no order by id desc limit 1
  497. ) dd on true
  498. where serial_no=(select sn from ss) limit 1
  499. )
  500. , rr as (
  501. select lon as lng, lat as lat, 'Origin' as label, port_of_loading as infor, 1 as sort, null::timestamp without time zone as stime, 'pol'::text as ptype
  502. from vessel.vt_unlocode, aa where (lat<=90 and lat>=-90) and (lon<=180 and lon>=-180) and lon is not null and lat is not null and uncode=fport_of_loading_un
  503. union all
  504. select lon as lng, lat as lat, 'Destination' as label, port_of_discharge as infor, 2 as sort, null::timestamp without time zone as stime, 'pod'::text as ptype
  505. from vessel.vt_unlocode, aa where (lat<=90 and lat>=-90) and (lon<=180 and lon>=-180) and lon is not null and lat is not null and uncode=mport_of_discharge_un
  506. union all
  507. select lon as lng, lat as lat, 'Transfer' as label, port_of_transshipment_name as infor, 3 as sort, null::timestamp without time zone as stime, 'poe'::text as ptype
  508. from vessel.vt_unlocode, aa where (lat<=90 and lat>=-90) and (lon<=180 and lon>=-180) and lon is not null and lat is not null and uncode=port_of_transshipment_un
  509. )
  510. select * from rr order by sort, stime";
  511. } elseif ($transport_mode == "air"){
  512. $sql = "with ss as (select '$serial_no' as sn)
  513. , aa as (
  514. select place_of_receipt_un, place_of_delivery_un, fport_of_loading_un, mport_of_discharge_un, port_of_loading, port_of_discharge, place_of_delivery_exp, place_of_receipt_exp
  515. from public.kln_ocean oo
  516. where serial_no=(select sn from ss) limit 1
  517. )
  518. , rr as (
  519. select lon as lng, lat as lat, 'Origin' as label, port_of_loading as infor, 1 as sort, null::timestamp without time zone as stime, 'pol'::text as ptype
  520. from vessel.vt_unlocode, aa where (lat<=90 and lat>=-90) and (lon<=180 and lon>=-180) and lon is not null and lat is not null and uncode=fport_of_loading_un
  521. union all
  522. select lon as lng, lat as lat, 'Destination' as label, port_of_discharge as infor, 2 as sort, null::timestamp without time zone as stime, 'pod'::text as ptype
  523. from vessel.vt_unlocode, aa where (lat<=90 and lat>=-90) and (lon<=180 and lon>=-180) and lon is not null and lat is not null and uncode=mport_of_discharge_un
  524. )
  525. select * from rr order by sort, stime";
  526. }
  527. $rss = common::excuteListSql($sql);
  528. //$rss = $mapdb->GetAll($sql);
  529. //先固定死
  530. // $json = '[{"lng":"100.78594000","lat":"13.68521000","label":"Origin","infor":"LAT KRABANG, THAILAND","sort":"0","stime":null,"ptype":"por"},
  531. // {"lng":"100.88333333","lat":"13.08333333","label":"Destination","infor":"LAEM CHABANG PORT,THAILAND","sort":"1","stime":null,"ptype":"pol"},
  532. // {"lng":"-122.28640000","lat":"37.79784000","label":"Transfer","infor":"OAKLAND, CA, USA","sort":"2","stime":null,"ptype":"pod"}]';
  533. //$rss = json_decode($json,true);
  534. ///global $mapdb;
  535. //查询线(包含所有的线) 空运不查询航线
  536. if ($transport_mode == "air"){
  537. $Line =array();
  538. }else{
  539. error_log("select * from get_track_data('$serial_no',true)");
  540. $map_sql = "select * from get_track_data('$serial_no',true)";
  541. $Line = $mapdb->GetAll($map_sql) or ( (!$mapdb->ErrorMsg()) or error_log(common::dbLog($mapdb, $map_sql), 0));
  542. }
  543. $solidLine = array();
  544. $dottedLine = array();
  545. $rangePoint = array();
  546. foreach($Line as $line){
  547. if($line['tp'] == "1"){
  548. $solidLine[] = $line;
  549. }elseif($line['tp'] == "0"){
  550. $dottedLine[] = $line;
  551. }else{
  552. $rangePoint[] = $line;
  553. }
  554. }
  555. //如果没有虚线,这这个范围点也是异常的,不需要显示
  556. if(empty($dottedLine)){
  557. $rangePoint = array();
  558. }
  559. $data = array("point"=>$rss,"solidLine"=>$solidLine,"dottedLine"=>$dottedLine,"rangePoint"=>$rangePoint);
  560. common::echo_json_encode(200, $data);
  561. //common::echo_json_encode(200, $rss);
  562. exit();
  563. break;
  564. case 'main_welcome':
  565. //分担查询
  566. include ONLINE_ROOT . 'libs' . DS . 'map_config.ini.php';
  567. $cp = common::check_input($_POST ['cp']); //current_page
  568. $ps = common::check_input($_POST ['ps']); //ps
  569. if (empty($ps))
  570. $ps = 10;
  571. $sqlWhere = ' where ' . common::searchExtendHand_KLN("ocean", $_SESSION["ONLINE_USER"]);
  572. $sqlWhere .= common::getDashboardTransportationSqlWhere();
  573. // test dome
  574. // $_POST['is_default'] = "no";
  575. // $_POST['date_start'] =null;
  576. // $_POST['date_end'] = null;
  577. //默认初始条件:ALL& ETD& Current Month 当前月的1号到最后一天 这个默认条件已经废除,前端不会这样传参数
  578. if (isset($_POST['is_default']) && strtolower($_POST['is_default']) == "yes" && false){
  579. $sqlWhere .= "and etd>='" . date("Y-m") . "-01' and etd<='" . date("Y-m") . "-01'::date + interval '1 month'";
  580. } else {
  581. $date_type = strtolower(common::check_input($_POST ['date_type']));
  582. if (isset($_POST['date_start']) && !empty($_POST['date_start']))
  583. $sqlWhere .= " and $date_type >= '" . common::usDate2sqlDate($_POST['date_start']) . " 00:00:00'";
  584. if (isset($_POST['date_end']) && !empty($_POST['date_end']))
  585. $sqlWhere .= " and $date_type <= '" . common::usDate2sqlDate($_POST['date_end']) . " 23:59:59'";
  586. }
  587. if (isset($_POST['customer']) && !empty($_POST['customer'])){
  588. $sqlWhere .= " and (shipper ilike '%".common::check_input($_POST['customer'])."%' or shipper_id ilike '%".common::check_input($_POST['customer'])."%'
  589. or consignee ilike '%".common::check_input($_POST['customer'])."%' or consignee_id ilike '%".common::check_input($_POST['customer'])."%')";
  590. }
  591. $rc = $_POST ['rc'];
  592. if ($rc == - 1) {
  593. $sql = "SELECT count(1) from public.kln_ocean" . $sqlWhere;
  594. //$rc = common::excuteOneSql($sql);
  595. $rc = $mapdb->GetOne($sql) or ( (!$mapdb->ErrorMsg()) or error_log(common::dbLog($mapdb, $sql), 0));
  596. }
  597. $tp = ceil($rc / $ps);
  598. if ($rc > 0) {
  599. $sql = "SELECT order_from as _schemas,serial_no, consignee, shipper, h_bol,final_desination_uncode, transport_mode,
  600. to_char(etd, 'MM/DD/YYYY'::text) as etd,
  601. to_char(eta, 'MM/DD/YYYY'::text) AS eta,
  602. fport_of_loading_un, mport_of_discharge_un, place_of_receipt_un, place_of_delivery_un, booking_no,
  603. f_vessel,f_voyage,origin,
  604. CASE
  605. WHEN ((m_iffbcf is not null or m_iffbcf is null) and m_iffcpu is null and m_iffrec is null and m_iffdep is null and m_iffarr is null and m_iffdel is null) THEN 'Created'::text
  606. WHEN ((m_iffcpu is not null or m_iffrec is not null) and m_iffdep is null and m_iffarr is null and m_iffdel is null) THEN 'Cargo Received'::text
  607. WHEN (m_iffdep is not null and m_iffarr is null and m_iffdel is null) THEN 'Departure'::text
  608. WHEN (m_iffarr is not null and m_iffdel is null) THEN 'Arrived'::text
  609. WHEN (m_iffdel is not null) THEN 'Completed'::text
  610. ELSE 'Created'::text
  611. END AS new_status
  612. FROM public.kln_ocean $sqlWhere";
  613. //$sqlWhere and last_status_315_update_time is not null";
  614. $sql .= " ORDER BY eta desc,id DESC limit " . $ps . " offset " . ($cp - 1) * $ps;
  615. //$sql .= " ORDER BY last_status_315_update_time DESC limit " . $ps . " offset " . ($cp - 1) * $ps;
  616. //$rss = common::excuteListSql($sql);
  617. $rss = $mapdb->GetAll($sql) or ( (!$mapdb->ErrorMsg()) or error_log(common::dbLog($mapdb, $sql), 0));
  618. //RecentStatusList
  619. $RecentStatusList = array();
  620. foreach ($rss as $key => $value) {
  621. $serial_no = $value["serial_no"];
  622. $_schemas_bk = $value['_schemas'];
  623. $_schemas = $value['_schemas'];
  624. if($_schemas == "public"){
  625. $_schemas = "ocean";
  626. }
  627. //单独取查询milestone信息
  628. if ($value['transport_mode'] == "sea"){
  629. $milestone_sql = "select a.act_date,a.act_time,sn.description,a.timezone,
  630. a.code as dd_code
  631. from public.ocean_milestone a
  632. inner join public.customer_service_milestone_sno sn on sn.code=a.code and sn.type = 'sea'
  633. where a.serial_no='$serial_no'
  634. and a.code in (select regexp_split_to_table('IFFBCF,IFFCPU,IFFREC,IFFDEP,IFFARR,IFFDEL', ','))
  635. and a.act_date is not null
  636. order by sn.sno desc limit 1";
  637. } elseif ($value['transport_mode'] == "air"){
  638. //air milestone 的Departed实际描述要替换: IFFDEP =》 IFFONB
  639. $milestone_sql = "select a.act_date,a.act_time,sn.description,a.timezone,
  640. a.code as dd_code
  641. from $_schemas_bk.air_milestone a
  642. inner join public.customer_service_milestone_sno sn on sn.code=a.code and sn.type = 'air'
  643. where a.serial_no='$serial_no'
  644. and a.code in (select regexp_split_to_table('IFFBCF,IFFCPU,IFFREC,IFFONB,IFFARR,IFFDEL', ','))
  645. and a.act_date is not null
  646. order by sn.sno desc limit 1";
  647. }
  648. $milestone = common::excuteObjectSql($milestone_sql);
  649. $value["act_date"] = $milestone["act_date"];
  650. $value["act_time"] = $milestone["act_time"];
  651. $value["description"] = $milestone["description"];
  652. $value["timezone"] = $milestone["timezone"];
  653. $value["dd_code"] = $milestone["dd_code"];
  654. $timezone = "";
  655. //按照最新execl Timezone From 来自于origin
  656. if($value['dd_code'] == "IFFBCF" || $value['dd_code'] == "IFFCPU"){
  657. $sql = "SELECT (select time_zone from public.city_timezone where uncode = LEFT(c.country, 2) || COALESCE(c.city_code,'')) as timezone
  658. FROM $_schemas.contacts c WHERE c.contact_id = '".$value['origin']."'";
  659. $timezone = common::excuteOneSql($sql);
  660. }
  661. //按照最新execl Timezone From 来自于final_destination
  662. if($value['dd_code'] == "IFFDEL"){
  663. $sql = "select time_zone from public.city_timezone where uncode = '".$value['final_desination_uncode']."'";
  664. $timezone = common::excuteOneSql($sql);
  665. }
  666. if($value['dd_code'] == "IFFREC" || $value['dd_code'] == "IFFDEP" || $value['dd_code'] == "IFFARR"){
  667. $EDI315Time = array();
  668. if ($value['transport_mode'] == "sea"){
  669. //Timezone From 来自于EDI315
  670. $EDI315Time = common::getEDI315Time($serial_no,$value['_schemas']);
  671. }
  672. if($value['dd_code'] == "IFFREC" || $value['dd_code'] == "IFFDEP"){
  673. //先以EDI315 时区为准,如果没有这代表数据是手动输入,或者没有同步情况
  674. $timezone = $EDI315Time[$value['dd_code']]['timezone'];
  675. if(empty($timezone)){
  676. if($value['dd_code'] == "IFFREC"){
  677. $sql = "select time_zone from public.city_timezone where uncode = '".$value['place_of_receipt_un']."'";
  678. }else{
  679. $sql = "select time_zone from public.city_timezone where uncode = '".$value['fport_of_loading_un']."'";
  680. }
  681. $timezone = common::excuteOneSql($sql);
  682. }
  683. }
  684. if($value['dd_code'] == "IFFARR"){
  685. $timezone = $EDI315Time[$value['dd_code']]['timezone'];
  686. if(empty($timezone)){
  687. $sql = "select time_zone from public.city_timezone where uncode = '".$value['mport_of_discharge_un']."'";
  688. $timezone = common::excuteOneSql($sql);
  689. }
  690. }
  691. }
  692. $Arrived = $value['description'];
  693. $startStation=$value['fport_of_loading_un'];
  694. $endStation=$value['mport_of_discharge_un'];
  695. if ($value['transport_mode'] == "sea"){
  696. $startStation=$value['place_of_receipt_un'];
  697. $endStation=$value['place_of_delivery_un'];
  698. }
  699. if ($value['transport_mode'] == "air"){
  700. $startStation=!empty($ocean['place_of_receipt_un'])? $ocean['place_of_receipt_un'] : $ocean['fport_of_loading_un'];
  701. $endStation=!empty($ocean['place_of_delivery_un']) ? $ocean['place_of_delivery_un'] : $ocean['mport_of_discharge_un'];
  702. }
  703. $RecentStatusList[] = array("Title"=>$value['h_bol'],
  704. "name"=>utils::outDisplayForMerge($value['f_vessel'],$value['f_voyage']),
  705. "bookingNumber" =>$value['booking_no'],
  706. "IsSubscribe" =>false,
  707. "shipperName"=>$value['shipper'],
  708. "consigneeName" =>$value['consignee'],
  709. "startStation"=>$startStation,
  710. "endStation"=>$endStation,
  711. "ETD"=>$value['etd'],
  712. "ETA"=>$value['eta'],
  713. "type"=>$value['new_status'],
  714. "Arrived"=>$Arrived,
  715. "Time"=>$value["act_date"],
  716. "act_time" =>$value["act_time"],
  717. "timezone"=>$timezone,
  718. "_schemas"=>$value["_schemas"],
  719. "transport_mode"=>$value["transport_mode"],
  720. 'is_subscribe' =>common::checkedSubscribe($value['serial_no']),
  721. "a" =>common::deCode($value['serial_no'], 'E'));
  722. }
  723. $data = common::getManagement();
  724. $arrTmp = array('searchData' => $RecentStatusList,
  725. 'Management' => $data['Management'],
  726. 'dashboard_filter' => $data['dashboard_filter'],
  727. 'is_customer' =>_isCustomerLogin(),
  728. 'rc' => $rc,
  729. 'ps' => $ps,
  730. 'cp' => $cp,
  731. 'tp' => $tp);
  732. } else {
  733. $data = common::getManagement();
  734. $arrTmp = array('searchData' => array(),
  735. 'Management' => $data['Management'],
  736. 'dashboard_filter' => $data['dashboard_filter']);
  737. }
  738. common::echo_json_encode(200,$arrTmp);
  739. exit();
  740. break;
  741. case 'save_layout':
  742. $management = json_encode($_POST["management"]);
  743. $dashboard_filter = json_encode($_POST["dashboardObj"]);
  744. $_param = "";
  745. if(!empty($_POST["management"])){
  746. $_param .= " management = '$management' ";
  747. }
  748. if(isset($_POST["dashboardObj"]) && !empty($dashboard_filter)){
  749. $_param .= ",dashboard_filter = '$dashboard_filter' ";
  750. }
  751. if(!empty($_param)){
  752. common::excuteUpdateSql("update public.ra_online_user set $_param where lower(user_login) = '" . strtolower(_getLoginName()) . "'");
  753. }
  754. $returnData = array("msg" => "success");
  755. common::echo_json_encode(200, $returnData);
  756. exit();
  757. break;
  758. case 'password':
  759. tools::getInstance()->updatePassword();
  760. break;
  761. case 'tools':
  762. tools::getInstance()->markSystem();
  763. break;
  764. case 'robot':
  765. robot::getInstance()->robot_prompt_configuration();
  766. break;
  767. case 'robot_chat':
  768. robot::getInstance()->ai_chat();
  769. break;
  770. case 'robot_chat_log':
  771. robot::getInstance()->robot_chat_log();
  772. break;
  773. case 'robot_api_log':
  774. robot::getInstance()->robot_api_log();
  775. break;
  776. case 'system_setting':
  777. tools::getInstance()->user_system_setting();
  778. break;
  779. case 'monitoring_setting':
  780. tools::getInstance()->user_monitoring_setting();
  781. break;
  782. case 'notifications_rules':
  783. tools::getInstance()->notifications_rules();
  784. break;
  785. case 'destination_delivery_load':
  786. destination_delivery::getInstance()->destination_delivery_load();
  787. break;
  788. case 'destination_delivery_config':
  789. destination_delivery::getInstance()->destination_delivery_config();
  790. break;
  791. case 'destination_delivery_booking':
  792. destination_delivery::getInstance()->destination_delivery_booking();
  793. break;
  794. case 'user_guide':
  795. $rootPath = realpath(dirname(__FILE__)) . DS;
  796. //common::download_file($rootPath."images\ACE-M1_ISF_ACI_User_Guide\ACE-M1_ISF_ACI_User_Guide.pdf", "ACE-M1_ISF_ACI_User_Guide_V2.0.pdf");
  797. // PDF文件在服务器上的位置
  798. $filename = $rootPath."userFile". DS."KLN_Online_User_Guide_24.11.26.pdf";
  799. $display_name = "KLN_Online_User_Guide_24_11_26.pdf";
  800. // Header content type
  801. header("Content-type: application/pdf");
  802. header("Content-Length: " . filesize($filename));
  803. header("Content-Disposition:attachment;filename=\"" . $display_name . "\"");
  804. // 将文件发送到浏览器。
  805. readfile($filename);
  806. break;
  807. case 'feature_update':
  808. $id = $_REQUEST["id"];
  809. $rootPath = realpath(dirname(__FILE__)) . DS;
  810. //common::download_file($rootPath."images\ACE-M1_ISF_ACI_User_Guide\ACE-M1_ISF_ACI_User_Guide.pdf", "ACE-M1_ISF_ACI_User_Guide_V2.0.pdf");
  811. // PDF文件在服务器上的位置
  812. $filename = $rootPath."upload". DS."feature_update_".$id.".pdf";
  813. $display_name = "feature_update.pdf";
  814. // Header content type
  815. header("Content-type: application/pdf");
  816. header("Content-Length: " . filesize($filename));
  817. header("Content-Disposition:inline;filename=\"" . $display_name . "\"");
  818. // 将文件发送到浏览器。
  819. readfile($filename);
  820. break;
  821. default:
  822. $data = array(
  823. 'msg' => 'Page not found',
  824. );
  825. common::echo_json_encode(500, $data);
  826. }
  827. $db->Close();
  828. $db = null;
  829. if ($max_ec > 0)
  830. ini_set('max_execution_time', $max_ec); //recover old value
  831. if (!empty($memory_limit))
  832. ini_set('memory_limit', $memory_limit);
  833. ?>