作者 赵彬吉
... ... @@ -37,7 +37,7 @@ class Temp extends Command
* @author Akun
* @date 2024/11/18 15:07
*/
public function handle()
public function handle5()
{
$projects = Project::select(['id'])->orderBy('id', 'asc')->get();
foreach ($projects as $project) {
... ... @@ -236,7 +236,7 @@ class Temp extends Command
* @author Akun
* @date 2024/09/26 10:48
*/
public function handle1()
public function handle()
{
$notify_model = new Notify();
$project_model = new Project();
... ... @@ -254,10 +254,12 @@ class Temp extends Command
$project_info = $project_model->read(['id' => $project_id], ['serve_id']);
if (!$project_info) {
$this->output('未查询到项目数据');
continue;
}
$serve_ip_info = $serve_ip_model->read(['id' => $project_info['serve_id']], ['servers_id']);
if (!$serve_ip_info) {
$this->output('未查询到服务器数据');
continue;
}
$servers_id = $serve_ip_info['servers_id'];
... ... @@ -290,9 +292,17 @@ class Temp extends Command
}
} else {
//其他服务器:请求对应C端接口
$c_url = $domain . '/api/update_page/?project_id=' . $project_id . '&type=3';
$re = http_get($c_url);
$this->output($re['message'] ?? '');
$c_url = $domain . '/api/update_page/';
$c_params = [
'project_id' => $project_id,
'type' => 3
];
$re = http_post($c_url, json_encode($c_params), [], true);
if (isset($re['status']) && $re['status'] == 200) {
$this->output($c_url . ' | 请求成功');
} else {
$this->output($c_url . ' | ' . ($re['message'] ?? '未返回失败原因'));
}
}
$this->output('项目id:' . $project_id . ',end');
}
... ... @@ -300,6 +310,6 @@ class Temp extends Command
public function output($msg)
{
echo $msg . PHP_EOL;
echo date('Y-m-d H:i:s') . ' | ' . $msg . PHP_EOL;
}
}
... ...
... ... @@ -25,6 +25,9 @@ class OperationHeartbeatController extends BaseController
* @time :2024/8/28 14:03
*/
public function saveHeartbeat(){
if($this->user['project_id'] == 1){
$this->response('success');
}
$this->request->validate([
'source'=>'required',
'source_id'=>'required',
... ... @@ -64,6 +67,10 @@ class OperationHeartbeatController extends BaseController
* @time :2024/8/28 14:29
*/
public function getInfo(){
if($this->user['project_id'] == 1){
$info['status'] = 0;
$this->response('success',Code::SUCCESS,$info);
}
$this->request->validate([
'source'=>'required',
'source_id'=>'required',
... ...
... ... @@ -273,7 +273,7 @@ class KeywordController extends BaseController
'keyword_id.required' => '关键词id不能为空',
'product_id.required' => '产品id不为空',
]);
$logic->delRelated($this->param['keyword'],$this->param['product_id']);
$logic->delRelated($this->param['keyword_id'],$this->param['product_id']);
$this->response('success');
}
}
... ...