<?php
namespace app\cmd;
use app\model\Sign;
use app\service\AgreementService;
use think\Collection;
use think\console\Command;
use think\console\Input;
use think\console\Output;

class QueryAgreeStatus extends Command
{
    protected function configure()
    {
        $this->setName('queryAgreeStatus')->setDescription('主动拉取签约状态');
    }
    protected function execute(Input $input, Output $output)
    {
         Sign::whereIn('sign_status', [Sign::SIGN_STATUS_DEFAULT, Sign::SIGN_STATUS_SUCCESS])->field('*')->chunk(100, function (Collection $signCollection) use (&$output) {
             foreach ($signCollection as $collection) {
                 AgreementService::queryAgreementStatus($collection);
             }
         });
        $output->writeln("主动拉取签约状态完成");
    }
}