12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576 |
- <?php
- namespace pp\Console\Commands\ToolA;
- use Illuminate\Console\Command;
- class ContinueReadTool extends Command
- {
-
- protected $signature = 'Tool:ContinueReadTool';
-
- protected $description = '继续阅读推送表迁移';
-
- public function __construct()
- {
- parent::__construct();
- }
-
- public function handle()
- {
- }
-
- private function findId(){
- $id = 0;
- while (true){
- if($id){
- $result = DB::connection('api_mysql')
- ->table('custom_push_keep_continue')
- ->where('id','<',$id)
- ->select('id','created_at')->orderBy('id','desc')->first();
- }else{
- $result = DB::connection('api_mysql')->table('custom_push_keep_continue')->select('id','created_at')->orderBy('id','desc')->first();
- }
- if($result){
- foreach ($result as $item){
- $id = $item->id;
- if(strtotime($item->created_at) <= time()-86400*1.5){
- return $item->id;
- }
- }
- }else{
- break;
- }
- }
- return $id;
- }
- }
|