MsgStatus.php 802 B

12345678910111213141516171819202122232425
  1. <?php
  2. namespace app\command;
  3. use app\model\saas\SaasChatMsg;
  4. use Symfony\Component\Console\Command\Command;
  5. use Symfony\Component\Console\Input\InputInterface;
  6. use Symfony\Component\Console\Output\OutputInterface;
  7. class MsgStatus extends Command
  8. {
  9. protected static string $defaultName = 'msg:status';
  10. protected static string $defaultDescription = '统一生成Model';
  11. protected function execute(InputInterface $input, OutputInterface $output): int
  12. {
  13. $output->writeln("开始更新聊天记录====>" . getDateFull());
  14. $total = (new SaasChatMsg)->where("is_user",0)->count();
  15. $output->writeln("共计{$total}条记录更新====>" . getDateFull());
  16. (new SaasChatMsg)->where("is_user",0)->update(["is_user" =>1 ]);
  17. return self::SUCCESS;
  18. }
  19. }