ShuanghongS 6 miesięcy temu
rodzic
commit
d08a38c706
2 zmienionych plików z 50 dodań i 5 usunięć
  1. 2 2
      service/ocean_order.class.php
  2. 48 3
      service/robot.class.php

+ 2 - 2
service/ocean_order.class.php

@@ -845,8 +845,8 @@ class ocean_order {
                 $filterTag_param .= " or ((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)";
             }
             if (stripos($filterTag, "Departure") !== FALSE) {
-                $_sqlwhere .= "or (m_iffdep is not null and m_iffarr is null and m_iffdel is null)";
-                $filterTag_param .= "or (m_iffdep is not null and m_iffarr is null and m_iffdel is null)";
+                $_sqlwhere .= " or (m_iffdep is not null and m_iffarr is null and m_iffdel is null)";
+                $filterTag_param .= " or (m_iffdep is not null and m_iffarr is null and m_iffdel is null)";
             }
             if (stripos($filterTag, "Arrived") !== FALSE) {
                 $_sqlwhere .= " or (m_iffarr is not null and m_iffdel is null)";

+ 48 - 3
service/robot.class.php

@@ -27,6 +27,42 @@ class robot{
         }
         return self::$_robot;
     }
+    public function robot_chat() {
+        $operate = utils::_get('operate');
+        $operate = strtolower($operate);
+
+        /*
+         * index page
+         */
+        if (empty($operate)) {
+            $column = column::getInstance()->getDisplayColumn('Robot_Chat_Search');
+            $OperationTableColumns = column::getInstance()->tableColumns('Operation_Search',$column);
+            $data['OperationTableColumns'] = $OperationTableColumns;
+            common::echo_json_encode(200,$data);
+            exit();
+        }
+        /*
+         * operation_search search
+         */
+        if ($operate == "search") {
+            //$this->_operation_search();
+        }
+
+        if ($operate == "excel") {
+            $sql = common::deCode($_POST ['tmp_search'], 'D');
+            $sql = substr($sql, 0, strripos($sql, " limit"));
+            if(!empty($sql)){
+                $rss = common::excuteListSql($sql);
+            }
+            foreach($rss as $key =>$val){
+                $rss[$key]['Operation Time'] = $rss[$key]['_operation_time'];
+            }
+            common::echo_json_encode(200,array("msg"=>"success","Data" => $rss));
+            exit;
+        }
+        
+    }
+
     public function robot_prompt_configuration() {
         $operate = utils::_get('operate');
         $operate = strtolower($operate);
@@ -230,8 +266,8 @@ class robot{
 
             $ai_model = common::check_input($model);
             $input_token = common::check_input($input_token);
-            $request_content = common::check_input($response['data']);
-            $ai_response_content = common::check_input($response['full_response']);
+            $request_content = common::check_input(json_encode($response['data']));
+            $ai_response_content = common::check_input(json_encode($response['full_response']));
             $output_token = common::check_input($output_token);
   
             $sql = "INSERT INTO public.kln_robot_chat_log( question_id, user_name, user_type, question_type, question_content, 
@@ -241,7 +277,7 @@ class robot{
                         response_duration)
                 VALUES ('$question_id', '$user_name', '$user_type', '$question_type', '$question_content', 
                         '$answer_type', '$answer', '', '$response_duration', '$request_question_time', 
-                        '$question_time', '$request_id', '$ai_model', '$input_token', '$request_content', 
+                        '$question_time', '$request_id', '$ai_model','$request_content',  '$input_token', 
                         '$ai_response_content', '$output_token', '$request_question_time', '$response_time', 
                         '$response_duration');";
             $rs = common::excuteUpdateSql($sql);
@@ -261,6 +297,15 @@ class robot{
             common::echo_json_encode(200,$rs);            
             exit(); 
         }
+
+        if ($operate == "download"){
+            $sql = common::deCode($_POST ['tmp_search'], 'D');
+            if(!empty($sql)){
+                $rs = common::excuteListSql($sql);
+            }
+            common::echo_json_encode(200,array("msg"=>"success","Data" => $rs));
+            exit;
+        }
     }
 
     public function dealPromptFormatAndVue($configuration){