1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- <?php
- /**
- * Created by PhpStorm.
- * User: xiaofeng
- * Date: 2018/4/26
- * Time: 上午11:13
- */
- namespace frontend\controllers;
- use frontend\base\CommonController;
- use Yii;
- use frontend\base\Help;
- class VideoController extends CommonController
- {
- public function actionHome()
- {
- $mode = new \common\models\Video();
- $cityGroup = $mode->GroupCity();
- if(!empty($cityGroup))
- {
- $id = array_column($cityGroup,'city','city_name');
- $mode->city = $id;
- $list = $mode->homeList();
- $arr = [];
- foreach ($list as $key=>$val)
- {
- if(in_array($val['city'],$id))
- {
- $arr[$val['city']][] = $val;
- }
- }
- }
- return $this->render('home',['city'=>$id,'model'=>$arr]);
- }
- public function actionDetails()
- {
- $model = new \common\models\Video();
- $model->id = Yii::$app->request->get('vid');
- $row = $model->HomeFind();
- return $this->render('details',['model'=>$row]);
- }
- public function actionRandvideo()
- {
- $mode = new \common\models\Video();
- $rows = $mode->RandList(5);
- if(!empty($rows))
- {
- foreach ($rows as &$val)
- {
- $val['thumb'] = Yii::$app->params['httpImg']['host'].Yii::$app->params['httpImg']['video'].$val['thumb'];
- }
- return Help::JsonCode(Help::SUCCESS,'成功',$rows);
- }
- return Help::JsonCode(Help::ERROR,'失败');
- }
- public function actionTest()
- {
- p($_SERVER);
- }
- }
|