123456789101112131415161718192021222324252627282930313233343536373839 |
- <?php
- /**
- * Created by PhpStorm.
- * User: xiaofeng
- * Date: 2018/4/13
- * Time: 下午3:23
- */
- namespace backend\server;
- use Yii;
- use common\models\Video;
- class RoutineVideo
- {
- public function StateAndDel($type)
- {
- $model = new Video();
- $input = Yii::$app->request->post();
- $row = $model->FindById($input['id']);
- switch ($type)
- {
- case 1:
- if($row->state == 1)
- {
- $row->state = 2;
- }
- else if($row->state == 2)
- {
- $row->state = 1;
- }
- break;
- case 2:
- $row->del = 2;
- break;
- }
- if($row->save() == true) return true;
- }
- }
|