/** * 节的详细页(视频学习页) * */ function infoAction() { $videoId = (int) $this->get("video_id", 0); $videoId = $videoId ? $videoId : $this->section['video_id']; $videoModel = new VideoModel(); $video = $videoModel->getVideo($videoId); $video['is_user_like'] = $videoModel->isUserLikeOrDislike($this->uid, $videoId); $data = array('course_id' => $this->course['id'], 'course_name' => $this->course['name'], 'chapter_id' => $this->chapter['id'], 'chapter_name' => $this->chapter['name'], 'chatper_seq' => $this->chapter['seq'], 'section_id' => $this->section['id'], 'section_name' => $this->section['name'], 'section_seq' => $this->section['seq'], 'video_id' => $video['id'], 'video_url' => $video['url'], 'video_duration' => $video['duration'], 'duration' => $video['duration'], 'video_image' => $video['image'], 'video_like_num' => $video['like_num'], 'video_dislike_num' => $video['dislike_num'], 'video_view_num' => $video['view_num'], 'is_user_like' => $video['is_user_like']); if (!$this->teacher || $this->teacher['id'] != $video['user_id']) { $userModel = new UserModel(); $this->teacher = $userModel->getTeacher($video['user_id']); } $data['teacher'] = array('id' => $this->teacher['id'], 'name' => $this->teacher['name'], 'job_title' => $this->teacher['job_title'], 'avator' => $this->teacher['avator']); if ($this->isMobile) { $this->displayJson(Common_Error::ERROR_SUCCESS, $data); } if ($this->course['type'] == 1) { $practiseModel = new PractiseModel(); $practise = $practiseModel->getVideoBelongPractise($videoId, $this->course['id']); $this->assign("practise", $practise); } $this->assign("course", $this->course); $this->assign("chapter", $this->chapter); $this->assign("section", $this->section); $this->assign("teacher", $this->teacher); $this->assign("video", $video); }
function index() { $video_model = new VideoModel(); $video = $video_model->get_video(); // var_dump($video);die; $view = new View(); $view->set_file_name('video'); $params = array('video' => $video); $view->show($params); }
function playAction() { //视频观看次数++ $videoId = (int) $this->get("video_id", 0); $videoModel = new VideoModel(); $videoModel->incrViewNum($videoId); $videoModel->insert($this->uid, $videoId); //用户人数 $section = $videoModel->getVideoBelongSection($videoId); if ($section) { $courseModel = new CourseModel(); $courseModel->incrViewNum($section['course_id']); } $this->displayJson(Common_Error::ERROR_SUCCESS); }
function userDetails($uid) { $slam = new SlamModel($uid); $user["count"]["slams"] = $slam->Count(); $user["slams"]["request"] = $slam->GetRequests(); $scrap = new ScrapModel($uid); $user["count"]["scrap"] = $scrap->Count($this->view->user['id']); $tweet = new TweetModel($uid); $user["count"]["tweet"] = $tweet->Count(); $user["count"]["friends"] = count($this->view->userExt ? $this->view->userExt["friends"] : $this->view->user["friends"]); $photos = new PicsModel($uid); $user["count"]["photos"] = $photos->Count(); $videos = new VideoModel($uid); $user["count"]["videos"] = $videos->Count(); $community = new CommunityModel($uid); $user["count"]["community"] = $community->Count(); $this->view->stuff = $user; }
/** * 发表评论 * curl -d "course_id=1&comment_id=1&video_id=0&content=helloaaaaaaaaaa" http://182.92.110.119/comment/publish */ function publishAction() { $courseId = (int) $this->post("course_id", 0); $commentId = (int) $this->post("comment_id", 0); $videoId = (int) $this->post("video_id", 0); $content = $this->post("content", ""); $time = time(); $comment = array("uid" => $this->uid, "comment_id" => $commentId, "course_id" => $courseId, "video_id" => $videoId, "content" => $content, "create_time" => $time); $commentModel = new CommentModel(); $id = $commentModel->insertComment($comment); if ($id) { $userModel = new UserModel(); $videoModel = new VideoModel(); $courseModel = new CourseModel(); $author = $userModel->getUser($comment['uid']); $comment['create_time_fmt'] = Common_Time::flow($comment['create_time']); $comment['author_uid'] = $author['stuff_id']; $comment['author_name'] = $author['stuff_name']; $comment['author_avator'] = $author['avator']; if ($comment['comment_id']) { $parentComment = $commentModel->getComment($comment['comment_id']); $beReplyAuthor = $userModel->getUser($parentComment['uid']); $parentComment['author_uid'] = $beReplyAuthor['stuff_id']; $parentComment['author_name'] = $beReplyAuthor['stuff_name']; $parentComment['author_avator'] = $beReplyAuthor['avator']; $parentComment['create_time_fmt'] = Common_Time::flow($parentComment['create_time']); $comment['parent_comment'] = $parentComment; } if ($comment['video_id']) { $section = $videoModel->getVideoBelongSection($comment['video_id']); if (!$section) { $practiseModel = new PractiseModel(); $practise = $practiseModel->getVideoBelongPractise($comment['video_id'], $courseId); $comment['practise_seq'] = $practise['seq']; $section = $courseModel->getSection($practise['section_id']); } $chapter = $courseModel->getSection($section["parent_id"]); $comment["chapter_id"] = $chapter["id"]; $comment["chapter_name"] = $chapter["name"]; $comment["chapter_seq"] = $chapter["seq"]; $comment["section_id"] = $section["id"]; $comment["section_name"] = $section["name"]; $comment["section_seq"] = $section["seq"]; $userVideo = $videoModel->getUserVideoVote($comment['uid'], $comment['video_id']); $comment["video_like"] = isset($userVideo['like_type']) ? $userVideo['like_type'] : 0; } $this->displayJson(Common_Error::ERROR_SUCCESS, array($comment)); } $this->displayJson(Common_Error::ERROR_MYSQL_EXECUTE); }
public function init() { $assets = dirname(__FILE__) . '/assets'; $this->assetsPath = Yii::app()->assetManager->publish($assets, false, 1, YII_DEBUG); if (empty($this->imageAds)) { $this->imageAds = '/web/images/bg_default.png'; } if (empty($this->data)) { $data[] = array('file' => 'https://s3.amazonaws.com/jomedia-jwplayer/samples/tears-of-steel.mp4', 'label' => '128K'); $data[] = array('file' => 'https://s3.amazonaws.com/jomedia-jwplayer/samples/tears-of-steel.mp4', 'label' => '320K VIP'); $source = json_encode($data); } $video = VideoModel::model()->findByPk($this->videoId); //check xem co phai iphone 3G khong $device = Yii::app()->session['device']; /*if(!empty($device) && $device['os'] == 'iOS' && (int) Yii::app()->session['deviceOS'] <= 6 ){ $source = VideoModel::model()->builDataPlayerVideo($this->videoId,null, Yii::app()->params['video.profile.default']['iphone'][0]); }else { $source = VideoModel::model()->builDataPlayerVideo($this->videoId); }*/ $source = VideoModel::model()->builDataPlayerVideo($this->videoId); $image = AvatarHelper::getAvatar("video", $this->videoId, 640); $cs = Yii::app()->clientScript; $cs->registerScriptFile($this->assetsPath . '/jwplayer.js', CClientScript::POS_END); $cs->registerScript('play_video' . $this->id, "\n jwplayer('" . $this->id . "').setup({\n width: '" . $this->width . "',\n height: " . $this->height . ",\n image: '" . $image . "',\n sources: {$source},\n autostart: " . $this->autostart . ",\n expand: '" . $this->expand . "',\n primary: '" . $this->primary . "',\n /*plugins: {\n '" . $this->assetsPath . "/vast.js': {\n client:'vast',\n schedule:{\n overlay: { offset: " . $this->offset . ", tag: '" . Yii::app()->createUrl('/player/banner') . "', type:'nonlinear' }\n }\n }\n }*/\n });\n ", CClientScript::POS_END); if ($this->expand) { $cs->registerScript('play_video_expand' . $this->id, "\n function onPlayerExpandCollapse() {\n\n if(jwplayer('" . $this->id . "').getFullscreen) {\n jwplayer('" . $this->id . "').setFullscreen(false);\n }\n if(\$('.video_player').width() <= 745){\n \$('.colum2').css({'margin-top':'20px'});\n \$('.video_player').css({'height':'540px'});\n \$('.video_player').css({'width':'960px'});\n \$('#player-holder').removeClass('watch-normal-mode');\n \$('#player-holder').addClass('watch-large-mode');\n \$('.video_player .colum2').css({'margin-top':'-370px'});\n onPlayerExpand();\n }else{\n onPlayerCollapse();\n \$('.colum2').css({'margin-top':''});\n \$('.video_player').css({'height':'390px'});\n \$('.video_player').css({'width':'745px'});\n \$('#player-holder').removeClass('watch-large-mode');\n \$('#player-holder').addClass('watch-normal-mode');\n }\n }\n\n function onPlayerExpand() {\n jwplayer('" . $this->id . "').resize(960,540);\n }\n\n function onPlayerCollapse() {\n jwplayer('" . $this->id . "').resize(745,390);\n }\n ;\n ", CClientScript::POS_END); } //track and log $deviceType = 'mobile'; $isUserLogin = Yii::app()->user->isGuest ? 'false' : 'true'; $cs->registerScript('play_video_current' . $this->id, "\n var device_type = '" . $deviceType . "';\n var listPlayed =Array();\n var playVideoFlag = true;\n var logedin = " . $isUserLogin . ";\n jwplayer().onPlay(function(){\n console.log(JSON.stringify(check_video_quality()));\n if(!check_video_quality()){\n jwplayer('" . $this->id . "').pause();\n }\n\n });\n jwplayer().onBeforePlay(function() {\n\n playVideoFlag = false;\n });\n jwplayer().onTime(function(event) {\n if(Math.round(event.position) >=5){\n if(playVideoFlag) {\n playVideoFlag = false;\n var action = 'Play Video';\n if(in_array_item(listPlayed,'video_" . $video->id . "')){\n var action = 'Replay Video';\n }\n var item = 'video_" . $video->id . "';\n if(!in_array_item(listPlayed,item)){\n listPlayed.push(item);\n }\n console.log(device_type+'-'+action);\n ga('send', 'event', device_type, action,'" . CHtml::encode($video->name . "-" . $video->artist_name . "-" . $video->id) . "');\n ajax_load('/player/logVideo',{'id':" . $video->id . "});\n }\n }\n });\n ", CClientScript::POS_END); //check login 720p $obj = array("obj_type" => 'video', 'name' => $video->name, 'id' => $video->id, 'artist' => $video->artist_name); $urlDetail = URLHelper::makeUrl($obj); $lac = Yii::app()->user->getState('last_action'); $lurl = Yii::app()->user->getState('last_url'); Yii::app()->user->setState('last_url', null); $register_url = Yii::app()->createUrl("account/package"); $login_url = Yii::app()->createUrl("account/login"); $js = ''; if ($lac == '720p' && $lurl == $urlDetail && !Yii::app()->user->isGuest) { $js = 'jwplayer().setCurrentQuality(0);'; } $js = 'jwplayer().setCurrentQuality(0);'; $cs->registerScript('play_video_current_changeQ' . $this->id, "\n\n jwplayer().onQualityLevels(function(event){\n var currQIndex = jwplayer().getCurrentQuality();\n var currQL = jwplayer().getQualityLevels();\n var bitrate = currQL[currQIndex].label;\n if(logedin==false && bitrate=='720p'){\n jwplayer().setCurrentQuality(currQIndex+1);\n }\n jwplayer().setCurrentQuality(currQIndex+1);\n });\n jwplayer().onQualityChange(function(event){\n var logedin = false;\n\n \$.ajax({\n url: '/ajax/isAuthenticate',\n type: 'post',\n data: {fa:'720p',url_return:'" . $urlDetail . "'},\n async: false,\n dataType: 'json',\n success: function(data){\n if(data.errorCode==0){\n logedin = true;\n }\n }\n })\n var currEQIndex = jwplayer().getCurrentQuality();\n var currQL = jwplayer().getQualityLevels();\n var bitrate = currQL[currEQIndex].label;\n\n if(logedin==false && bitrate=='720p'){\n var html = 'Quý khách vui lòng đăng ký để nghe miễn phí nội dung chất lượng cao.';\n html += '<div class=\"clb ovh\">';\n html += '<div class=\"btn-popup btn-popup-green\" style=\"width: 45%; float: left;\">';\n html += '<a href=\" {$register_url} \" class=\"show\" style=\"color: #FFF\">Đăng ký</a>';\n html += '</div>';\n html += '<div class=\"btn-popup btn-popup-green\" style=\"width: 45%; float: right;\">';\n html += '<a href=\"javascript::void();\" onclick=\"Popup.close()\" class=\"show\" style=\"color: #FFF\">Hủy</a>';\n html += '</div>';\n html += '</div>';\n html += '</div>';\n Popup.alert(html);\n\n\n }\n });\n ", CClientScript::POS_END); $cs->registerScript('check_current_video' . $this->id, "\n function check_video_quality(){\n var anable_play = true;\n var currEQIndex = jwplayer().getCurrentQuality();\n var currQL = jwplayer().getQualityLevels();\n var bitrate = currQL[currEQIndex].label;\n if(!userSubs){\n console.log(JSON.stringify(bitrate));\n if(userPhone && bitrate == '720p'){\n return false;\n }else{\n }\n }\n }\n ", CClientScript::POS_END); parent::init(); }
public function __construct() { parent::__construct(); $this->_videosearchQuery = filter_input(INPUT_POST, 'videosearchQuery'); $this->_addnewVideo = filter_input(INPUT_POST, 'add_video'); $this->_status = filter_input(INPUT_GET, 'status'); $this->_searchBtn = filter_input(INPUT_POST, 'videosearchbtn'); $this->_update = filter_input(INPUT_GET, 'update'); $this->_add = filter_input(INPUT_GET, 'add'); $this->_del = filter_input(INPUT_GET, 'del'); $this->_featured = filter_input(INPUT_GET, 'featured'); $this->_orderDirection = filter_input(INPUT_GET, 'order'); $this->_adminorder_direction = $this->get_order_details(); $this->_orderBy = filter_input(INPUT_GET, 'orderby'); $this->_settingsData = $this->get_settingsdata(); }
/** * Constructor function used to get parameters from request URL */ public function __construct() { parent::__construct(); global $wpdb; $this->_wpdb = $wpdb; /** Get videosearchQuery param for videos */ $this->_videosearchQuery = filter_input(INPUT_POST, 'videosearchQuery'); /** Get add_video param for videos */ $this->_addnewVideo = filter_input(INPUT_POST, 'add_video'); /** Get status param for videos */ $this->_status = filter_input(INPUT_GET, 'status'); /** Get videosearchbtn param for videos */ $this->_searchBtn = filter_input(INPUT_POST, 'videosearchbtn'); /** Get update param for videos */ $this->_update = filter_input(INPUT_GET, 'update'); /** Get add param for videos */ $this->_add = filter_input(INPUT_GET, 'add'); /** Get del param for videos */ $this->_del = filter_input(INPUT_GET, 'del'); /** Get featured param for videos */ $this->_featured = filter_input(INPUT_GET, 'featured'); /** Get order param for videos */ $this->_orderDirection = filter_input(INPUT_GET, 'order'); /** Get orderby param for videos*/ $this->_orderBy = filter_input(INPUT_GET, 'orderby'); /** Set order by fields as array */ $orderBy = array('id', 'title', 'author', 'category', 'fea', 'publish', 'date', 'ordering'); $this->_order = ''; /** Get order by fields nad direction for videos */ if (isset($this->_orderBy) && in_array($this->_orderBy, $orderBy)) { $this->_order = $this->_orderBy; } else { $this->_orderDirection = 'DESC'; } /** Get plugin settings date */ $this->_settingsData = getPluginSettings(); $this->_player_colors = unserialize($this->_settingsData->player_colors); /** Get upload directory path */ $this->_srt_path = getUploadDirPath(); $this->_adminorder_direction = $this->_player_colors['recentvideo_order']; }
public function actionDownload() { $this->layout = false; $contentId = (int) Yii::app()->request->getParam('id'); $type = Yii::app()->request->getParam('type', 'downloadSong'); $deviceId = yii::app()->session['deviceId']; $downloadUrl = ''; if ($type == 'downloadVideo') { $video = WapVideoModel::model()->findByPk($contentId); $downloadUrl = VideoModel::model()->getDownloadUrl($contentId, $deviceId, 'http', true); $contentType = 'video/mp4'; $fileName = $video->name; $fileName = Common::makeFriendlyUrl($fileName) . ".mp4"; } elseif ($type == 'downloadSong') { $song = WapSongModel::model()->findByPk($contentId); //$downloadUrl = WapSongModel::model()->getNiceDownloadUrl($song->id, $deviceId, 'http', $song->profile_ids, $song->url_key, $song->artist_name); //$downloadUrl = WapSongModel::model()->getAudioFileUrl($song->id, $deviceId, 'http', $song->profile_ids); $downloadUrl = WapSongModel::model()->getNiceDownloadUrl($song->id, $deviceId, 'http', $song->profile_ids, $song->url_key, $song->artist_name); echo '<meta http-equiv="refresh" content="0;url=' . $downloadUrl . '" />'; exit; $contentType = 'audio/mpeg'; $fileName = $song->name; $fileName = Common::makeFriendlyUrl($fileName) . ".mp3"; } echo '<meta http-equiv="refresh" content="0;url=' . $downloadUrl . '" />'; exit; //$this->redirect($downloadUrl); //Yii::app()->end(); //echo '<meta http-equiv="refresh" content="0;url='.$downloadUrl.'" />'; header("Cache-Control: public"); header("Content-Description: File Transfer"); header("Content-Disposition: attachment; filename=" . $fileName); header("Content-Type: {$contentType}"); header("Content-Transfer-Encoding: binary"); readfile($downloadUrl); //Yii::app()->end(); //Common::DownloadWithName($this->userPhone, $contentId, $type); exit; }
<?php foreach ($list_video as $item) { ?> <li class="item-video-playlist <?php echo $video->id == $item->id ? 'selected' : ''; ?> " id="video-item-<?php echo $i; ?> " rel="<?php echo $item->id; ?> "> <?php $playUrl = VideoModel::model()->getVideoFileUrl($item->id, $deviceId, 'rtsp', true); $videoPlaylistLink = Yii::app()->createUrl('videoPlaylist/view', array('id' => $content->id, 'url_key' => Common::makeFriendlyUrl($item['name']), 'video_id' => $item->id)); ?> <a data-toggle="modal" data-freeview="1" data-allowview="3" data-pricev="0" data-priced="0" data-id="39618" data-3g="0" data-hp="0" href="javascript:void(0)" class="thumb-link popup-modal"> <?php $avatarImage = CHtml::image(WapVideoModel::model()->getThumbnailUrl(100, $item['id']), 'avatar', array('class' => 'video-avatar', 'align' => 'left')); ?> <div class="thumb"> <?php echo $avatarImage; ?> </div> <h2><?php echo Formatter::smartCut(CHtml::encode($item['name']), Yii::app()->params['limit_substring_title'], 0);
public function actionGetContentPrice() { $id = Yii::app()->request->getParam('id'); $action = Yii::app()->request->getParam('action', 'play_song'); $phone = Yii::app()->user->getState('msisdn'); $phone = Formatter::formatPhone($phone); $checkCharg24h = WapUserTransactionModel::model()->checkCharging24h($phone, $phone, $id, $action); $error = 99; $chargPrice = -1; if ($checkCharg24h) { $chargPrice = 0; $error = 0; } else { switch ($action) { case "play_song": $obj = SongModel::model()->findByPk($id); if (!empty($obj)) { $chargPrice = Yii::app()->params['promotion.song.play.unsub']; //$chargPrice = $obj->listen_price; $error = 0; } break; case "download_song": $obj = SongModel::model()->findByPk($id); if (!empty($obj)) { $chargPrice = Yii::app()->params['promotion.song.download.unsub']; $error = 0; } break; case "play_video": $obj = VideoModel::model()->findByPk($id); if (!empty($obj)) { $chargPrice = Yii::app()->params['promotion.video.play.unsub']; $error = 0; } break; case "download_video": $obj = VideoModel::model()->findByPk($id); if (!empty($obj)) { $chargPrice = Yii::app()->params['promotion.video.download.unsub']; $error = 0; } break; } } $return = new stdClass(); $return->errorCode = $error; $return->message = ""; $return->data = array("price" => $chargPrice); header("Content-type: application/json"); echo json_encode($return); Yii::app()->end(); }
public function actionAjaxMap() { Yii::import("application.models.web.*"); $fileId = Yii::app()->request->getParam('fileId'); $offset = Yii::app()->request->getParam('offset', 0); $return = new stdClass(); $return->error = 0; $return->errorMessage = ""; $return->success = 0; $return->data = array(); try { $c = new CDbCriteria(); $c->condition = "id=:FID"; $c->params = array(":FID" => $fileId); $fileInfo = CopyrightInputFileModel::model()->find($c); if (isset($fileInfo)) { $content_type = $fileInfo->content_type; $c = new CDbCriteria(); $c->condition = "input_file=:FID"; $c->params = array(":FID" => $fileId); $c->order = "id ASC"; $c->limit = 1; $c->offset = $offset; $item = CopyrightInputContentModel::model()->find($c); $Log = new KLogger("log_map", KLogger::INFO); if (empty($item)) { $return->success = 1; } else { $inputId = $item->id; $countMapSong = $countMapVideo = 0; if ($content_type == 'song') { $cr = new CDbCriteria(); $cr->condition = "LOWER(TRIM(name)) LIKE :NAME AND cp_id=1"; $cr->params = array(":NAME" => strtolower(trim($item->name)) . "%"); $items = SongModel::model()->findAll($cr); foreach ($items as $song) { if (isset($song['cp_id']) && $song['cp_id'] == 1) { $songName = strtoupper(trim($song['name'])); $songArtist = strtoupper(trim($song['artist_name'])); $songArtist = Common::strNormal($songArtist); $itemName = strtoupper(trim($item->name)); $itemArtist = strtoupper(trim($item->artist)); $itemArtist = Common::strNormal($itemArtist); if ($item->id == 574692) { $s = strlen($songName) - strlen($itemName); $d = strrpos($songArtist, $itemArtist); $Log->LogInfo("songName: {$songName} | itemName:{$itemName} |{$s}|| songArtist:{$songArtist} | itemArtist:{$itemArtist} " . json_encode($d), false); } if (strlen($songName) - strlen($itemName) > 3) { continue; } if (strrpos($songArtist, $itemArtist) === false) { continue; } $sql = "\n INSERT INTO copyright_content_map(input_id,content_id,content_name,content_artist,content_type)\n VALUES(:INPUT_ID,:CONTENT_ID,:CONTENT_NAME,:CONTENT_ARTIST,'song')\n ON DUPLICATE KEY UPDATE content_name=:CONTENT_NAME_2, content_artist=:CONTENT_ARTIST_2\n "; $contentId = $song['id']; $contentName = $song['name']; $contentArtist = $song['artist_name']; $dataCmd = Yii::app()->db->createCommand($sql); $dataCmd->bindParam(":INPUT_ID", $inputId, PDO::PARAM_INT); $dataCmd->bindParam(":CONTENT_ID", $contentId, PDO::PARAM_INT); $dataCmd->bindParam(":CONTENT_NAME", $contentName, PDO::PARAM_STR); $dataCmd->bindParam(":CONTENT_ARTIST", $contentArtist, PDO::PARAM_STR); $dataCmd->bindParam(":CONTENT_NAME_2", $contentName, PDO::PARAM_STR); $dataCmd->bindParam(":CONTENT_ARTIST_2", $contentArtist, PDO::PARAM_STR); $dataCmd->execute(); $countMapSong++; } } $return->error = 0; $return->errorMessage = $item->name . ">> Bài hát ({$countMapSong})"; } if ($content_type == 'video') { $cr = new CDbCriteria(); $cr->condition = "LOWER(TRIM(name)) LIKE :NAME AND cp_id=1"; $cr->params = array(":NAME" => strtolower(trim($item->name)) . "%"); $items = VideoModel::model()->findAll($cr); foreach ($items as $video) { if (isset($video['cp_id']) && $video['cp_id'] == 1) { $videoName = strtoupper(trim($video['name'])); $videoArtist = strtoupper(trim($video['artist_name'])); $videoArtist = Common::strNormal($videoArtist); $itemName = strtoupper(trim($item->name)); $itemArtist = strtoupper(trim($item->artist)); $itemArtist = Common::strNormal($itemArtist); if (strlen($videoName) - strlen($itemName) > 3) { continue; } if (strrpos($videoArtist, $itemArtist) === false) { continue; } $sql = "\n INSERT INTO copyright_content_map(input_id,content_id,content_name,content_artist,content_type)\n VALUES(:INPUT_ID,:CONTENT_ID,:CONTENT_NAME,:CONTENT_ARTIST,'video')\n ON DUPLICATE KEY UPDATE content_name=:CONTENT_NAME_2, content_artist=:CONTENT_ARTIST_2\n "; $contentId = $video['id']; $contentName = $video['name']; $contentArtist = $video['artist_name']; $dataCmd = Yii::app()->db->createCommand($sql); $dataCmd->bindParam(":INPUT_ID", $inputId, PDO::PARAM_INT); $dataCmd->bindParam(":CONTENT_ID", $contentId, PDO::PARAM_INT); $dataCmd->bindParam(":CONTENT_NAME", $contentName, PDO::PARAM_STR); $dataCmd->bindParam(":CONTENT_ARTIST", $contentArtist, PDO::PARAM_STR); $dataCmd->bindParam(":CONTENT_NAME_2", $contentName, PDO::PARAM_STR); $dataCmd->bindParam(":CONTENT_ARTIST_2", $contentArtist, PDO::PARAM_STR); $dataCmd->execute(); $countMapVideo++; } } $return->error = 0; $return->errorMessage = $item->name . ">> Video ({$countMapVideo})"; } } } } catch (Exception $e) { $return->error = 500; $return->errorMessage = $e->getMessage(); } echo json_encode($return); Yii::app()->end(); }
<?php } elseif ($deactive) { $msg = Yii::app()->params['alert_content_limited']; $this->widget('application.widgets.touch.common.NotifyMessageWidget', array('msg' => $msg, 'type' => 'video')); } else { ?> <div class="poster" id="video-poster" style="background: #000 url(<?php echo str_replace('imuzik2013/imuzik2013', 'imuzik2013', WapVideoModel::model()->getThumbnailUrl(320, $video->id)); ?> ) no-repeat center center; width: 320px;height: 240px; margin: 0 auto"> <?php if (VideoModel::model()->isHD($video['profile_ids'])) { ?> <?php $playUrlHD = VideoModel::model()->getVideoFileUrl($video->id, $deviceId, 'http', true, 9); ?> <div class="_mbx"> <div><a class="playHd" href="javascript: void(0)"><span class="vhd">HD</span></a></div> </div> <script> $(function () { $(".playHd").live("click", function () { $(this).find("span").toggleClass("nhd"); var video = document.getElementsByTagName('video')[0]; var sources = video.getElementsByTagName('source'); if ($(this).find("span").hasClass("nhd")) { sources[0].src = '<?php echo $playUrlHD; ?> ';
public function actionCharge() { $id = Yii::app()->request->getParam('id'); $video = VideoModel::model()->findByPk($id); $action = Yii::app()->request->getParam('action', 'playVideo'); $deviceId = yii::app()->session['deviceId']; $msg = ""; $playUrl = ''; if (!$video) { $this->redirect($this->createUrl("site/error404")); } $back_url = Yii::app()->params['base_url'] . Yii::app()->createUrl('video/view', array('id' => $video->id, 'url_key' => Common::makeFriendlyUrl($video->name))); if (Yii::app()->user->isGuest) { if ($action == 'downloadVideo') { $this->redirect($this->createUrl("/account/login", array('back_url' => $back_url))); Yii::app()->end(); } else { //cho nghe 5 lan free $limit = isset(Yii::app()->session["limit_play"]) ? Yii::app()->session["limit_play"] : 0; if ($limit >= 5) { $msg = Yii::app()->params['message']['limit_content']; } else { Yii::app()->session["limit_play"] = Yii::app()->session["limit_play"] + 1; $playUrl = VideoModel::model()->getVideoFileUrl($video->id, $deviceId, 'rtsp', true); $this->redirect($this->createUrl("video/view", array('url' => $playUrl, "id" => $id, 'url_key' => $video->url_key))); } $this->render('play', compact('msg', 'back_url', 'playUrl')); exit; } } if ($action == 'downloadVideo' && empty($this->isSub)) { $msg = "Quý khách vui lòng đăng ký dịch vụ để tải miễn phí nội dung"; $this->render('download', compact('msg', 'back_url')); exit; } $bmUrl = Yii::app()->params['bmConfig']['remote_wsdl']; $client = new SoapClient($bmUrl, array('trace' => 1)); if ($action == 'playVideo') { $params = array('code' => $video->code, 'from_phone' => Yii::app()->user->getState('msisdn'), 'source_type' => 'wap', 'promotion' => 0); $result = $client->__soapCall('playVideo', $params); } elseif ($action == 'downloadVideo') { $params = array('code' => $video->code, 'from_phone' => yii::app()->user->getState('msisdn'), 'to_phone' => yii::app()->user->getState('msisdn'), 'source_type' => 'wap', 'promotion' => 0, 'smsId' => '', 'noteOptions' => array()); $result = $client->__soapCall('downloadVideo', $params); } $errorCode = $result->message; // Log url trả về cho user if ($errorCode == "success") { if ($action == 'playVideo') { $playUrl = VideoModel::model()->getVideoFileUrl($video->id, $deviceId, 'rtsp', true); } else { $playUrl = VideoModel::model()->getDownloadUrl($video->id, $deviceId, 'http', true); } $this->redirect($this->createUrl("video/view", array('url' => $playUrl, "id" => $id, 'url_key' => $video->url_key))); } else { $msg = Yii::app()->params['subscribe'][$errorCode]; } $this->render('play', compact('msg', 'back_url', 'playUrl')); }