ShuanghongS преди 6 месеца
родител
ревизия
643359fb40
променени са 3 файла, в които са добавени 79 реда и са изтрити 20 реда
  1. 45 1
      service/ocean_order.class.php
  2. 7 19
      service/robot.class.php
  3. 27 0
      utils/common.class.php

+ 45 - 1
service/ocean_order.class.php

@@ -623,7 +623,7 @@ class ocean_order {
                 "Vessel"=>$ocean_info["m_vessel"],"Voyage"=>$ocean_info["m_voyage"],
                 "ETD"=>$ocean_info["f_etd"],"ETA"=>$ocean_info["m_eta"],
                 "Last updated User"=>$ocean_info["modify_user"],"Last updated Time"=>$ocean_info["modify_time"],
-                "Submitter" =>$Submitter,"signature" =>$signature,"authorized_email" =>$authorized_email,"authorized_tel" =>$authorized_tel,"is_send" =>$ocean_info['is_send']);
+                "submitter" =>$Submitter,"signature" =>$signature,"authorized_email" =>$authorized_email,"authorized_tel" =>$authorized_tel,"is_send" =>$ocean_info['is_send']);
 
             $data["detail_information"] = $detail_information;
             $data["schemas"] = $schemas;
@@ -649,7 +649,51 @@ class ocean_order {
             }
             exit();
         }
+
+        if ($operate == "default_vgm"){
+            $vgm = array();
+            $isvgm = false;
+            if (_canEdiVgm()) {
+                $isvgm = true;
+            }
+            if ($isvgm) {
+                $vgm = common::excuteObjectSql("select * from ocean_vgm_setting where login_name ilike '" . _getLoginName() . "'");
+            }
+
+            $data = array("isvgm" =>$isvgm,"vgm" => $vgm);
+            common::echo_json_encode(200,$data);
+            exit();
+        }
         
+        if ($operate == "default_vgm_update"){
+            $vgm = array();
+            if (_canEdiVgm()) {
+                $submitter = $_POST['submitter'];
+                $signature = $_POST['signature'];
+                $authorized_email = $_POST['authorized_email'];
+                $authorized_tel = $_POST['authorized_tel'];
+                $count = common::excuteOneSql("select count(*) from ocean_vgm_setting where  login_name ilike '" . _getLoginName() . "'");
+
+                if($count > 0){
+                    $rs = common::excuteUpdateSql("update ocean_vgm_setting set submitter = '" . common::check_input($submitter) . "', "
+                        . "signature = '" . common::check_input($signature) . "', authorized_email = '" . common::check_input($authorized_email) . "', "
+                        . "authorized_tel = '" . common::check_input($authorized_tel) . "' where login_name ilike '" . _getLoginName() . "'");
+                }else{
+                    $rs =common::excuteUpdateSql("INSERT INTO ocean_vgm_setting(login_name, submitter, signature, authorized_email, authorized_tel) "
+                        . "VALUES ('" . _getLoginName() . "', '" . common::check_input($submitter) . "', "
+                        . "'" . common::check_input($signature) . "', '" . common::check_input($authorized_email) . "', "
+                        . "'" . common::check_input($authorized_tel) . "');");
+                }
+                $vgm["submitter"] = $submitter;
+                $vgm["signature"] = $signature;
+                $vgm["authorized_email"] = $authorized_email;
+                $vgm["authorized_tel"] = $authorized_tel;
+            }
+
+            $data = array("msg" =>"Save Successful","vgm" => $vgm);
+            common::echo_json_encode(200,$data);
+            exit();
+        }
         /*
          * share_shipment 这个提交的意义,是为了留下记录用户信息
         */

+ 7 - 19
service/robot.class.php

@@ -630,26 +630,14 @@ class robot{
         $answer ="";
         $fixedChat = common::excuteObjectSql("select * from public.kln_robot_chat_fixed where fixed_faq = '$fixed_faq'");
 
-        if (empty($fixedChat['secondary_interaction_content']) || $question_content != $fixedChat['fixed_faq'] ){          
-            $reference = $fixedChat["answer_style"];
+        if (empty($fixedChat['secondary_interaction_content']) || $question_content != $fixedChat['fixed_faq'] ){
+
             $answer_template = common::check_input($fixedChat["answer_style"]);
-            //执行sql 语句
-            $sql = $fixedChat["fixed_sql"];
-            //拆分sql 存在多条的情况
-            $sqlArr = explode(";", $sql);
-            //给所有sql 拼接用户权限
-            $sqlWhere = '  ' . common::searchExtendHand_KLN("ocean", $_SESSION["ONLINE_USER"]);
-            //先不考虑总数,处理有难度
-            foreach($sqlArr as $_sql){
-                if(empty($_sql)){
-                    continue;
-                }
-                //根据public.kln_ocean 和 WHERE 的位置关系,带入权限
-                $new_sql = utils::modifyString($_sql,$sqlWhere);
-                //处理limit 超过10 先限制10
-                //$new_sql = utils::processLimitClause($new_sql);
-                $rs = common::excuteListSql($new_sql);
-                $reference = utils::replacementsMultiline($rs,$reference,$new_sql);
+            $reference = $fixedChat["answer_style"];
+          
+            $dataArr = common::FixedAnswerAndLogData($fixedChat);
+            foreach($dataArr as $data){
+                $reference = utils::replacementsMultiline($data,$reference,'');
             }
             //有就去掉{{#each hbol_list}}\n  {{/each}}
             $reference = preg_replace([

+ 27 - 0
utils/common.class.php

@@ -2556,5 +2556,32 @@ class common {
         // }
         // return $model;
     }
+
+    public static function FixedAnswerAndLogData($fixedChat){
+        $data = array();
+        //单个处理:Shipments arriving in the next 7 days.
+        if($fixedChat["fixed_faq"] == "Shipments arriving in the next 7 days."){
+            $reference = $fixedChat["answer_style"];
+            //执行sql 语句
+            $sql = $fixedChat["fixed_sql"];
+            //拆分sql 存在多条的情况
+            $sqlArr = explode(";", $sql);
+            //给所有sql 拼接用户权限
+            $sqlWhere = '  ' . common::searchExtendHand_KLN("ocean", $_SESSION["ONLINE_USER"]);
+            //先不考虑总数,处理有难度
+            foreach($sqlArr as $_sql){
+                if(empty($_sql)){
+                    continue;
+                }
+                //根据public.kln_ocean 和 WHERE 的位置关系,带入权限
+                $new_sql = utils::modifyString($_sql,$sqlWhere);
+                //处理limit 超过10 先限制10
+                //$new_sql = utils::processLimitClause($new_sql);
+                $rs = common::excuteListSql($new_sql);
+                $reference = utils::replacementsMultiline($rs,$reference,$new_sql);
+            }
+        }
+        return $data; 
+    }
 }
 ?>