RoutineVideo.php 876 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: xiaofeng
  5. * Date: 2018/4/13
  6. * Time: 下午3:23
  7. */
  8. namespace backend\server;
  9. use Yii;
  10. use common\models\Video;
  11. class RoutineVideo
  12. {
  13. public function StateAndDel($type)
  14. {
  15. $model = new Video();
  16. $input = Yii::$app->request->post();
  17. $row = $model->FindById($input['id']);
  18. switch ($type)
  19. {
  20. case 1:
  21. if($row->state == 1)
  22. {
  23. $row->state = 2;
  24. }
  25. else if($row->state == 2)
  26. {
  27. $row->state = 1;
  28. }
  29. break;
  30. case 2:
  31. $row->del = 2;
  32. break;
  33. }
  34. if($row->save() == true) return true;
  35. }
  36. }