| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- <?php
- namespace app\command;
- use app\model\star\StarTaskUser;
- use Symfony\Component\Console\Command\Command;
- use Symfony\Component\Console\Input\InputInterface;
- use Symfony\Component\Console\Output\OutputInterface;
- use yzh52521\EasyHttp\Http;
- class PushAuthor extends Command
- {
- protected static string $defaultName = 'push:author';
- protected static string $defaultDescription = '星川任务';
- protected function execute(InputInterface $input, OutputInterface $output): int
- {
- try {
- $nextPage = 1;
- $done = 0;
- while (is_numeric($nextPage)) {
- $resp = (new StarTaskUser)->page($nextPage,10)->select();
- if ($resp->isEmpty()) {
- $output->writeln("没有任务啦==".getDateFull());
- $nextPage = null;
- return true;
- }
- foreach ($resp as $key=>$val) {
- $resp = Http::asJson()->post("https://api.jiandaoyun.com/api/v1/automation/tenant/69dc899f71c9656940c3db33/hooks/69e07cb9d9016a4b9d9e4b140bb32ba471357f09758bdc49",$val->toArray())->array();
- print_r($resp);
- }
- $nextPage = $nextPage+1;
- $output->writeln("进入下一页=={$nextPage}==".getDateFull());
- }
- } catch (\Throwable $throwable) {
- echo getDateFull()."==报错啦===".$throwable->getFile()."\n";
- echo getDateFull()."==报错啦===".$throwable->getLine()."\n";
- echo getDateFull()."==报错啦===".$throwable->getMessage()."\n";
- }
- return true;
- }
- }
|