Author: jason (yangjs17@yeah.net)
Inheritance: extends Model
Esempio n. 1
0
 function chartByType()
 {
     $type = Yii::app()->request->getParam('_type', 'song');
     $district = Yii::app()->request->getParam('_district', 'VN');
     $collection = CollectionModel::model()->getCollectionByType($type, "bxh", $district, 0);
     $collection = $collection ? $collection[0] : null;
     switch ($type) {
         case "video":
             $view = "_videoChart";
             $collectionCode = $collection ? $collection->code : 'BXH_VIDEO';
             $data = MainContentModel::getListByCollection($collectionCode, 1, 10);
             break;
         case "album":
             $view = "_albumChartForAlbumPage";
             $collectionCode = $collection ? $collection->code : 'ALBUM_HOT';
             $data = MainContentModel::getListByCollection($collectionCode, 1, 10);
             break;
         case "song":
         default:
             $view = "_songChartForSongPage";
             $collectionCode = $collection ? $collection->code : 'BXH_SONG_VN';
             $data = MainContentModel::getListByCollection($collectionCode, 1, 10);
             break;
     }
     $this->renderPartial($view, compact("data", "collection"));
 }
Esempio n. 2
0
 public function actionCollection()
 {
     $arr_item = array('song' => array('widget' => 'song.SongList'), 'video' => array('widget' => 'video.VideoList'), 'album' => array('widget' => 'album.AlbumList'), 'videoPlaylist' => array('widget' => 'video_playlist.Video_playlistList'));
     $callBack = (int) Yii::app()->request->getParam('call_back', 0);
     $page = (int) Yii::app()->request->getParam('page', 1);
     $limit = Yii::app()->params['numberPerPage'];
     $id = Yii::app()->request->getParam('id', '');
     $collection = CollectionModel::model()->findByPk($id);
     $callBackLink = Yii::app()->createUrl("genre/collection", array('id' => $id));
     $colection_code = $collection->code;
     $count = WapSongModel::countListByCollection($colection_code, $page, $limit);
     $videos = WapSongModel::getListByCollection($colection_code, $page, $limit);
     $pager = new CPagination($count);
     $pager->setPageSize($limit);
     if ($callBack) {
         $this->layout = false;
         $this->render("_ajaxList", compact('videos', 'pager', 'callBackLink'));
     } else {
         $this->render('collection', array('videos' => $videos, 'pager' => $pager, 'callBackLink' => $callBackLink, 'collection' => $collection, 'arr_item' => $arr_item, 'options' => array('col' => $collection->id, 'display_type' => $collection->code == 'VIDEO_COLLECTION' ? 'VIDEO_COLLECTION' : '')));
     }
 }
Esempio n. 3
0
 public function actionIndex()
 {
     $callBack = (int) Yii::app()->request->getParam('call_back', 0);
     $page = (int) Yii::app()->request->getParam('page', 1);
     $limit = Yii::app()->params['numberPerPage'];
     $pageSize = Yii::app()->params['pageSize'];
     $c = CHtml::encode(Yii::app()->request->getParam('genre', 'VN'));
     $s = CHtml::encode(Yii::app()->request->getParam('type', 'SONG'));
     $s = strtoupper($s);
     $callBackLink = Yii::app()->createUrl("bxh/index", array('type' => $c, 's' => $s));
     if ($c == 'VN' || $c == 0) {
         $cTitle = Yii::t("wap", "Việt Nam");
     }
     if ($c == 'EUR') {
         $cTitle = Yii::t("wap", "Âu Mỹ");
     }
     if ($c == 'KOR') {
         $cTitle = Yii::t("wap", "Châu Á");
     }
     $sTitle = $s == 'SONG' ? Yii::t("wap", "Song") : $s;
     $options = array();
     $ccType = 'bxh';
     $collection = CollectionModel::model()->getCollectionByType($s, $ccType, $c, 0);
     $contentCode = $collection[0]->code;
     $count = WapSongModel::countListByCollection($contentCode);
     $topWeek = MainContentModel::getListByCollection($contentCode, $page, $limit);
     $options['col'] = $contentCode;
     $pager = new CPagination($count);
     $pager->setPageSize($limit);
     $type_name = strtolower($s);
     $ajaxview = "_ajax" . $type_name . "List";
     if ($callBack) {
         $this->layout = false;
         $this->render($ajaxview, compact('topWeek', 'pager', 'callBackLink', 'limit', 'options'));
     } else {
         $this->render('index', array('topWeek' => $topWeek, 's' => $s, 'c' => $c, 'cTitle' => $cTitle, 'sTitle' => $sTitle, 'pager' => $pager, 'callBackLink' => $callBackLink, 'options' => $options));
     }
 }
 protected function getCollections()
 {
     $c_model = new CollectionModel('debuglogs');
     return $c_model->getCollections();
 }
Esempio n. 5
0
 public function actionList()
 {
     $callBack = (int) Yii::app()->request->getParam('call_back', 0);
     $page = (int) Yii::app()->request->getParam('page', 1);
     $limit = Yii::app()->params['numberSongPerPage'];
     $c = CHtml::encode(Yii::app()->request->getParam('id', '0'));
     $s = CHtml::encode(Yii::app()->request->getParam('type', 'NEW'));
     $s = strtoupper($s);
     $cTitle = $c == 0 ? 'Tất cả thể loại' : WapGenreModel::model()->findByPk($c)->name;
     $sTitle = $s == 'NEW' ? "Mới" : $s;
     $count = WapSongModel::countListByCollection('SONG_HOT');
     $songs = WapSongModel::getListByCollection('SONG_HOT', $page, $limit);
     $pager = new CPagination($count);
     $pager->setPageSize($limit);
     $offset = $pager->getOffset();
     $callBackLink = Yii::app()->createUrl("song/list", array('c' => $c, 's' => $s));
     $options = array();
     if ($c == 0) {
         // danh sach song
         if ($s == 'NEW') {
             $count = WapSongModel::countListByCollection('SONG_NEW');
             $songs = WapSongModel::getListByCollection('SONG_NEW', $page, $limit);
             $options['col'] = 'BÀI HÁT MỚI';
         } else {
             $count = WapSongModel::countListByCollection('SONG_HOT');
             $songs = WapSongModel::getListByCollection('SONG_HOT', $page, $limit);
             $options['col'] = 'BÀI HÁT HOT';
         }
         $pager = new CPagination($count);
         $pager->setPageSize($limit);
     } else {
         $arrPattern = array('-', '_', '\'', ' ');
         $cKey = strtoupper(str_replace($arrPattern, '', Common::strNormal($cTitle)));
         $colection_code = 'SONG_' . $s . '_' . $cKey;
         $check_key = CollectionModel::model()->findByAttributes(array('code' => $colection_code));
         if (isset($check_key)) {
             $count = WapSongModel::countListByCollection($colection_code, $page, $limit);
             $songs = WapSongModel::getListByCollection($colection_code, $page, $limit);
             $pager = new CPagination($count);
             $pager->setPageSize($limit);
         } else {
             if ($s == 'NEW') {
                 $count = WapSongModel::model()->countSongsByGenre($c);
                 $pager = new CPagination($count);
                 $pager->setPageSize($limit);
                 $songs = WapSongModel::model()->getSongsByGenre($c, $pager->getOffset(), $pager->getLimit());
                 $options['col'] = 'BÀI HÁT MỚI';
             } else {
                 //$count = WapSongModel::model()->countSongsByGenre($c);
                 $count = WapGenreModel::getCountSongsByGenreCollection($c, 1);
                 $pager = new CPagination($count);
                 $pager->setPageSize($limit);
                 $songs = WapGenreModel::getSongsByGenreCollection($c, 1, $pager->getOffset(), $pager->getLimit());
                 $options['col'] = 'BÀI HÁT HOT';
             }
         }
     }
     if ($callBack) {
         $this->layout = false;
         $this->render("_ajaxList", compact('songs', 'pager', 'callBackLink', 'options'));
     } else {
         $this->render('list', array('songs' => $songs, 's' => $s, 'c' => $c, 'cTitle' => $cTitle, 'sTitle' => $sTitle, 'pager' => $pager, 'callBackLink' => $callBackLink, 'options' => $options, 'type' => ''));
     }
 }
Esempio n. 6
0
 public function delCollect()
 {
     //验证是否登录
     $this->getLoginInfo();
     //验证token
     $this->checkToken(Utils::GetValue("tokenkey"), $this->uin);
     //检查请求来源
     $this->checkRefer();
     $collectionModel = new CollectionModel();
     if ($collectionModel->delCollection($this->uin, $this->comicId)) {
         ActionHelper::UpdateUserStat($this->uin, COLL, '-');
         ActionHelper::UpdateComicStat($this->comicId, 'coll_count', '-');
         ActionHelper::RecordUserAction($this->uin, DEL_COLL_ACT, $this->comicId);
         echo '{"status":10}';
     } else {
         echo '{"status":-10}';
     }
     exit;
 }