Commit d4569c1e authored by clone's avatar clone

kill

parent 968b1ed0
......@@ -606,6 +606,8 @@ Route::group('task', [
'updateForActivityBegins' => ['task/UpdateActivityTask/updateForActivityBegins', ['method' => 'get']],
'updateCouponExpired' => ['task/UpdateCouponTask/updateCouponExpired', ['method' => 'get']],//超过有效期的券改过期
'killOutTimeSql' => ['task/KillOutTimeSql/killOutTimeSql', ['method' => 'get']],//超过有效期的券改过期
]);
Route::group('broker', [
......
<?php
namespace app\task\controller;
use app\model\ASite;
use think\console\command\make\Model;
/**
* Created by PhpStorm.
* User: zw
* Date: 2019/3/25
* Time: 14:14
*/
class KillOutTimeSql{
public function killOutTimeSql(){
$model = new ASite();
$sql = "select concat('KILL ',id,';') from information_schema.processlist where user='tl_root' and time > 20 and db='db_tongliandichan' or db is null";
//$sql = "select concat('KILL ',id,';') as kill_sql from information_schema.processlist where user='tldc_online' and time > 20 and db='db_tongliandichan' or db is null";
$result = $model->query($sql);
if($result){
foreach ($result as $item){
$kill_sql = $item["kill_sql"];
$model->query($kill_sql);
}
}
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment