作者 赵彬吉
@@ -37,7 +37,7 @@ class Temp extends Command @@ -37,7 +37,7 @@ class Temp extends Command
37 * @author Akun 37 * @author Akun
38 * @date 2024/11/18 15:07 38 * @date 2024/11/18 15:07
39 */ 39 */
40 - public function handle() 40 + public function handle5()
41 { 41 {
42 $projects = Project::select(['id'])->orderBy('id', 'asc')->get(); 42 $projects = Project::select(['id'])->orderBy('id', 'asc')->get();
43 foreach ($projects as $project) { 43 foreach ($projects as $project) {
@@ -236,7 +236,7 @@ class Temp extends Command @@ -236,7 +236,7 @@ class Temp extends Command
236 * @author Akun 236 * @author Akun
237 * @date 2024/09/26 10:48 237 * @date 2024/09/26 10:48
238 */ 238 */
239 - public function handle1() 239 + public function handle()
240 { 240 {
241 $notify_model = new Notify(); 241 $notify_model = new Notify();
242 $project_model = new Project(); 242 $project_model = new Project();
@@ -254,10 +254,12 @@ class Temp extends Command @@ -254,10 +254,12 @@ class Temp extends Command
254 $project_info = $project_model->read(['id' => $project_id], ['serve_id']); 254 $project_info = $project_model->read(['id' => $project_id], ['serve_id']);
255 if (!$project_info) { 255 if (!$project_info) {
256 $this->output('未查询到项目数据'); 256 $this->output('未查询到项目数据');
  257 + continue;
257 } 258 }
258 $serve_ip_info = $serve_ip_model->read(['id' => $project_info['serve_id']], ['servers_id']); 259 $serve_ip_info = $serve_ip_model->read(['id' => $project_info['serve_id']], ['servers_id']);
259 if (!$serve_ip_info) { 260 if (!$serve_ip_info) {
260 $this->output('未查询到服务器数据'); 261 $this->output('未查询到服务器数据');
  262 + continue;
261 } 263 }
262 $servers_id = $serve_ip_info['servers_id']; 264 $servers_id = $serve_ip_info['servers_id'];
263 265
@@ -290,9 +292,17 @@ class Temp extends Command @@ -290,9 +292,17 @@ class Temp extends Command
290 } 292 }
291 } else { 293 } else {
292 //其他服务器:请求对应C端接口 294 //其他服务器:请求对应C端接口
293 - $c_url = $domain . '/api/update_page/?project_id=' . $project_id . '&type=3';  
294 - $re = http_get($c_url);  
295 - $this->output($re['message'] ?? ''); 295 + $c_url = $domain . '/api/update_page/';
  296 + $c_params = [
  297 + 'project_id' => $project_id,
  298 + 'type' => 3
  299 + ];
  300 + $re = http_post($c_url, json_encode($c_params), [], true);
  301 + if (isset($re['status']) && $re['status'] == 200) {
  302 + $this->output($c_url . ' | 请求成功');
  303 + } else {
  304 + $this->output($c_url . ' | ' . ($re['message'] ?? '未返回失败原因'));
  305 + }
296 } 306 }
297 $this->output('项目id:' . $project_id . ',end'); 307 $this->output('项目id:' . $project_id . ',end');
298 } 308 }
@@ -300,6 +310,6 @@ class Temp extends Command @@ -300,6 +310,6 @@ class Temp extends Command
300 310
301 public function output($msg) 311 public function output($msg)
302 { 312 {
303 - echo $msg . PHP_EOL; 313 + echo date('Y-m-d H:i:s') . ' | ' . $msg . PHP_EOL;
304 } 314 }
305 } 315 }
@@ -25,6 +25,9 @@ class OperationHeartbeatController extends BaseController @@ -25,6 +25,9 @@ class OperationHeartbeatController extends BaseController
25 * @time :2024/8/28 14:03 25 * @time :2024/8/28 14:03
26 */ 26 */
27 public function saveHeartbeat(){ 27 public function saveHeartbeat(){
  28 + if($this->user['project_id'] == 1){
  29 + $this->response('success');
  30 + }
28 $this->request->validate([ 31 $this->request->validate([
29 'source'=>'required', 32 'source'=>'required',
30 'source_id'=>'required', 33 'source_id'=>'required',
@@ -64,6 +67,10 @@ class OperationHeartbeatController extends BaseController @@ -64,6 +67,10 @@ class OperationHeartbeatController extends BaseController
64 * @time :2024/8/28 14:29 67 * @time :2024/8/28 14:29
65 */ 68 */
66 public function getInfo(){ 69 public function getInfo(){
  70 + if($this->user['project_id'] == 1){
  71 + $info['status'] = 0;
  72 + $this->response('success',Code::SUCCESS,$info);
  73 + }
67 $this->request->validate([ 74 $this->request->validate([
68 'source'=>'required', 75 'source'=>'required',
69 'source_id'=>'required', 76 'source_id'=>'required',
@@ -273,7 +273,7 @@ class KeywordController extends BaseController @@ -273,7 +273,7 @@ class KeywordController extends BaseController
273 'keyword_id.required' => '关键词id不能为空', 273 'keyword_id.required' => '关键词id不能为空',
274 'product_id.required' => '产品id不为空', 274 'product_id.required' => '产品id不为空',
275 ]); 275 ]);
276 - $logic->delRelated($this->param['keyword'],$this->param['product_id']); 276 + $logic->delRelated($this->param['keyword_id'],$this->param['product_id']);
277 $this->response('success'); 277 $this->response('success');
278 } 278 }
279 } 279 }