main_new_version.php 47 KB

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