Your Name 6 months ago
parent
commit
16d2dc98a6
1 changed files with 32 additions and 0 deletions
  1. 32
    0
      application/api/controller/Ai.php

+ 32
- 0
application/api/controller/Ai.php View File

@@ -171,10 +171,23 @@ class Ai extends MemberApi
171 171
                             //写入日志
172 172
                             $log_content .= '指令id-' . $doc_id . '-' . json_encode($line, JSON_UNESCAPED_UNICODE) . '<br/>';
173 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 181
                         } else {
175 182
                             //写日志
176 183
                             $log_content_error .= '<p>短标题-' . $line[0] . '-已存在-指令短标题id:' . $one['id'] . '</p>';
177 184
                             $f_num++;
185
+
186
+                            //通知前端
187
+                            $msg = [
188
+                                'info' => '相同规则与相同主词下,['.$line[0].']已存在-不可重复导入!'
189
+                            ];
190
+                            $this->curlPost($msg);
178 191
                         }
179 192
                     }
180 193
                 }
@@ -453,5 +466,24 @@ class Ai extends MemberApi
453 466
             fputcsv($file, $row);
454 467
         }
455 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
 }

Loading…
Cancel
Save