...
|
...
|
@@ -9,6 +9,8 @@ use backend\widgets\Filter; |
|
|
use backend\widgets\YHGImage\Common\Images as CommonImages;
|
|
|
use app\models\Video;
|
|
|
use yii\helpers\ArrayHelper;
|
|
|
use app\models\Share;
|
|
|
use common\config\Params;
|
|
|
|
|
|
/**
|
|
|
* Live controller
|
...
|
...
|
@@ -123,13 +125,12 @@ class LiveController extends BaseController |
|
|
$model = Video::findOne($posts['id']);
|
|
|
if(!empty($model))
|
|
|
{
|
|
|
$model->pic = $posts['pic'];
|
|
|
$model->url = $posts['url'];
|
|
|
$model->title = $posts['title'];
|
|
|
if($model->save())
|
|
|
if($model->edit($posts))
|
|
|
{
|
|
|
Yii::$app->session->setFlash('success', '编辑成功。');
|
|
|
}
|
|
|
}else{
|
|
|
Yii::$app->session->setFlash('error', '编辑失败。');
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
...
|
...
|
@@ -139,20 +140,56 @@ class LiveController extends BaseController |
|
|
}
|
|
|
else
|
|
|
{
|
|
|
$id = Yii::$app->request->get('id', 0);
|
|
|
$video = Video::findOne(['id'=> $id]);
|
|
|
if(empty($video))
|
|
|
{
|
|
|
Yii::$app->session->setFlash('error', '找不到该视频');
|
|
|
return $this->redirect($this->_refer);
|
|
|
}
|
|
|
//图片上传组件
|
|
|
$uploader = \backend\widgets\UploadImage::self()->logo('pic', $video->pic);
|
|
|
return $this->render('videoedit', ['video' => $video, 'uploader' => $uploader]);
|
|
|
$id = Yii::$app->request->get('id', 0);
|
|
|
$video = Video::findOne(['id' => $id]);
|
|
|
if (empty($video)) {
|
|
|
Yii::$app->session->setFlash('error', '找不到该视频');
|
|
|
return $this->redirect($this->_refer);
|
|
|
}
|
|
|
$videoShare = [];
|
|
|
if ($shareModel = Share::findOne(['obj_id' => $video->id, 'type' => Params::VIDEO_SHARE_TYPE])) {
|
|
|
$videoShare = $shareModel->toArray();
|
|
|
}
|
|
|
//图片上传组件
|
|
|
$uploader = \backend\widgets\UploadImage::self()->single('pic', $video->pic);
|
|
|
$sharePicUploader = \backend\widgets\UploadImage::self()->single('share_pic', $videoShare['pic']);
|
|
|
|
|
|
return $this->render('videoedit', [
|
|
|
'video' => $video,
|
|
|
'uploader' => $uploader,
|
|
|
'sharePicUploader' => $sharePicUploader,
|
|
|
'videoShare' => $videoShare
|
|
|
]);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 删除视频记录
|
|
|
* @author yaoxiaofeng
|
|
|
*/
|
|
|
public function actionVideodel()
|
|
|
{
|
|
|
if (!$id = Yii::$app->getRequest()->getQueryParam('id')) {
|
|
|
return $this->redirect($this->_refer);
|
|
|
}
|
|
|
do {
|
|
|
$model = Video::findOne($id);
|
|
|
if (empty($model)) {
|
|
|
Yii::$app->session->setFlash('error', '找不到该视频信息。');
|
|
|
break;
|
|
|
}
|
|
|
if ($model->delete()) {
|
|
|
Yii::$app->session->setFlash('success', '删除成功。');
|
|
|
} else {
|
|
|
Yii::$app->session->setFlash('error', '删除失败。');
|
|
|
}
|
|
|
break;
|
|
|
} while (false);
|
|
|
|
|
|
return $this->redirect($this->_refer);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 视频状态设置
|
|
|
* @return
|
|
|
*/
|
...
|
...
|
@@ -307,11 +344,13 @@ class LiveController extends BaseController |
|
|
//图片上传组件
|
|
|
$picUploader = \backend\widgets\UploadImage::self()->single('pic',$model->pic);
|
|
|
$backgroundUploader = \backend\widgets\UploadImage::self()->single('background_pic',$model->background_pic);
|
|
|
$sharePicUploader = \backend\widgets\UploadImage::self()->single('share_pic',$post['share_pic'] ? :'');
|
|
|
|
|
|
return $this->render('roomedit',[
|
|
|
'model'=> $model,
|
|
|
'picUploader'=>$picUploader,
|
|
|
'backgroundUploader'=>$backgroundUploader,
|
|
|
'sharePicUploader'=>$sharePicUploader,
|
|
|
'masters'=>$masters,
|
|
|
]);
|
|
|
}
|
...
|
...
|
@@ -351,12 +390,19 @@ class LiveController extends BaseController |
|
|
//图片上传组件
|
|
|
$picUploader = \backend\widgets\UploadImage::self()->single('pic',$model->pic);
|
|
|
$backgroundUploader = \backend\widgets\UploadImage::self()->single('background_pic',$model->background_pic);
|
|
|
$sharePicUploader = \backend\widgets\UploadImage::self()->single('share_pic',$post['share_pic'] ? :'');
|
|
|
|
|
|
$roomShare = [];
|
|
|
if($shareModel = Share::findOne(['obj_id'=>$model->room_id,'type'=>Params::LIVE_SHARE_TYPE])) {
|
|
|
$roomShare = $shareModel->toArray();
|
|
|
}
|
|
|
return $this->render('roomedit',[
|
|
|
'model'=> $model,
|
|
|
'picUploader'=>$picUploader,
|
|
|
'backgroundUploader'=>$backgroundUploader,
|
|
|
'sharePicUploader'=>$sharePicUploader,
|
|
|
'masters'=>$masters,
|
|
|
'roomShare' => $roomShare
|
|
|
]);
|
|
|
}
|
|
|
|
...
|
...
|
|