| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- <?php
- namespace app\command;
- use app\model\star\StarTaskUser;
- use app\model\star\StarTaskVideo;
- use Symfony\Component\Console\Command\Command;
- use Symfony\Component\Console\Input\InputInterface;
- use Symfony\Component\Console\Output\OutputInterface;
- use yzh52521\EasyHttp\Http;
- class PushVideo extends Command
- {
- protected static string $defaultName = 'push:video';
- protected static string $defaultDescription = '星川任务';
- protected function execute(InputInterface $input, OutputInterface $output): int
- {
- try {
- $nextPage = 1;
- $done = 0;
- while (is_numeric($nextPage)) {
- $resp = (new StarTaskVideo)->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/69e07cb9d9016a4ba4737e880bb32ba47135f8c4f8799955",$val->toArray())->array();
- if ($resp['code'] <> 0) {
- $output->writeln("{$val['video_id']} == 推送数据失败==".getDateFull());
- } else {
- $output->writeln("{$val['video_id']} == 推送成功==".getDateFull());
- }
- }
- $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;
- }
- }
|