Your Name 11 miesięcy temu
rodzic
commit
16d2dc98a6
1 zmienionych plików z 32 dodań i 0 usunięć
  1. 32
    0
      application/api/controller/Ai.php

+ 32
- 0
application/api/controller/Ai.php Wyświetl plik

171
                             //写入日志
171
                             //写入日志
172
                             $log_content .= '指令id-' . $doc_id . '-' . json_encode($line, JSON_UNESCAPED_UNICODE) . '<br/>';
172
                             $log_content .= '指令id-' . $doc_id . '-' . json_encode($line, JSON_UNESCAPED_UNICODE) . '<br/>';
173
                             $s_num++;
173
                             $s_num++;
174
+
175
+                            //通知前端
176
+                            $is_use_desc = $is_use === 1?'合法':'不匹配';
177
+                            $msg = [
178
+                                'info' => '['.$line[0].']成功新增记录!匹配结果:'.$is_use_desc
179
+                            ];
180
+                            $this->curlPost($msg);
174
                         } else {
181
                         } else {
175
                             //写日志
182
                             //写日志
176
                             $log_content_error .= '<p>短标题-' . $line[0] . '-已存在-指令短标题id:' . $one['id'] . '</p>';
183
                             $log_content_error .= '<p>短标题-' . $line[0] . '-已存在-指令短标题id:' . $one['id'] . '</p>';
177
                             $f_num++;
184
                             $f_num++;
185
+
186
+                            //通知前端
187
+                            $msg = [
188
+                                'info' => '相同规则与相同主词下,['.$line[0].']已存在-不可重复导入!'
189
+                            ];
190
+                            $this->curlPost($msg);
178
                         }
191
                         }
179
                     }
192
                     }
180
                 }
193
                 }
453
             fputcsv($file, $row);
466
             fputcsv($file, $row);
454
         }
467
         }
455
         fclose($file);
468
         fclose($file);
469
+
470
+        //执行下载
471
+
472
+    }
473
+
474
+    /*
475
+     * curl - post 通知
476
+     */
477
+    public function curlPost($data){
478
+        $ch = curl_init();
479
+        curl_setopt($ch, CURLOPT_URL, "http://workerman.dev.zx2049.com/work/push/test");
480
+        curl_setopt($ch, CURLOPT_POST, 1);
481
+        //The number of seconds to wait while trying to connect. Use 0 to wait indefinitely.
482
+        curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 60);
483
+        curl_setopt($ch, CURLOPT_POSTFIELDS , http_build_query($data));
484
+        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
485
+        $output = curl_exec($ch);
486
+        curl_close($ch);
487
+        return $output;
456
     }
488
     }
457
 }
489
 }

Ładowanie…
Anuluj
Zapisz