ShuanghongS 1 месяц назад
Родитель
Сommit
cea56aecc2
2 измененных файлов с 26 добавлено и 1 удалено
  1. 25 0
      service/destination_delivery.class.php
  2. 1 1
      service/tools.class.php

+ 25 - 0
service/destination_delivery.class.php

@@ -763,6 +763,31 @@ class destination_delivery {
             }
         }
 
+         if ($operate == "search_calendar"){ 
+
+            $month = common::check_input($_POST ['month']); //current_page
+            $sqlWhere = ' where ' . common::searchExtendHand_KLN("ocean", $_SESSION["ONLINE_USER"]);
+            //兜底规则
+            $sqlWhere .= " and eta >= now() - INTERVAL '6 months' and eta <= now() + INTERVAL '6 months'";
+            
+            $search_calendar_sql = common::excuteOneSql("select item_value from public.config where item = 'Destination_Bookings_Calendar_Sql'");
+
+            //日期计算
+            $month = common::excuteObjectSql("SELECT CURRENT_DATE AS access_date,  
+                                        (to_date('".$month."', 'MM/YYYY'))::date AS month_start,
+                                (date_trunc('month', to_date('".$month."', 'MM/YYYY')) + interval '1 month - 1 day')::date AS month_end");
+
+            $search_calendar_sql = str_replace('<{access_date}>', $month['access_date'], $search_calendar_sql);
+            $search_calendar_sql = str_replace('<{month_start}>', $month['month_start'], $search_calendar_sql);
+            $search_calendar_sql = str_replace('<{month_end}>', $month['month_end'], $search_calendar_sql);
+            $search_calendar_sql = str_replace('<{sqlWhere}>', $sqlWhere, $search_calendar_sql);
+            
+            $result = common::excuteOneSql($search_calendar_sql);
+            $result = json_decode($result,true);
+            common::echo_json_encode(200,$result);
+            exit();
+        }
+
         if ($operate == "search_shipment"){
             $data = $this->search_shipment();
             if(!empty($data['msg'])){

+ 1 - 1
service/tools.class.php

@@ -326,7 +326,7 @@ class tools {
                 }
     
                 $sql = "INSERT INTO public.kln_user_subscribed(user_login, subscribed_serial_no, create_user, create_time)
-                    VALUES ('"._getLoginName()."', '$serial_no', '"._getLoginName()."', now());";
+                    VALUES ('".strtolower(_getLoginName())."', '$serial_no', '"._getLoginName()."', now());";
                 common::excuteUpdateSql($sql);
                 $data = array("msg" => "Subscribe Successful");
                 common::echo_json_encode(200,$data);