LiveController.php 716 B

123456789101112131415161718192021222324252627282930313233
  1. <?php
  2. namespace console\controllers;
  3. use bizGhs\live\classes\LiveSeatClass;
  4. use common\components\util;
  5. use yii\console\Controller;
  6. use Yii;
  7. class LiveController extends Controller
  8. {
  9. public function actionSeat()
  10. {
  11. if (getenv('YII_ENV') == 'production') {
  12. $mainId = 33852;
  13. } else {
  14. $mainId = 644;
  15. }
  16. $has = LiveSeatClass::getByCondition(['mainId' => $mainId], true);
  17. if (!empty($has)) {
  18. util::stop('已经有了');
  19. }
  20. for ($i = 1; $i <= 66; $i++) {
  21. $data = [
  22. 'mainId' => $mainId,
  23. 'no' => $i,
  24. ];
  25. LiveSeatClass::add($data, true);
  26. }
  27. }
  28. }