public function actionView()
 {
     $playlistId = Yii::app()->request->getParam('id');
     $playlist = WapPlaylistModel::model()->published()->findByPk($playlistId);
     $user_msisdn = $playlist->msisdn;
     if (!$playlist) {
         $this->forward("/site/error", true);
     }
     $songsOfPlaylist = WapPlaylistModel::model()->getSongs($playlistId);
     //samge user
     $countPlSameUser = WapPlaylistModel::model()->countPlaylistByPhone($this->userPhone);
     $playlistPages = new CPagination($countPlSameUser);
     $pageSize = Yii::app()->params['pageSize'];
     $playlistPages->setPageSize($pageSize);
     $currentPage = $playlistPages->getCurrentPage();
     $playlistsSameUser = WapPlaylistModel::model()->getSamePlaylistByPhone($playlist->id, $this->userPhone, $currentPage * $pageSize, $pageSize);
     $errorCode = 'success';
     $errorDescription = '';
     //for show price
     $checkPlay = WapUserTransactionModel::model()->checkCharging24h($this->userPhone, $this->userPhone, $playlistId, 'play_album');
     $userSub = $this->userSub;
     //WapUserSubscribeModel::model()->getUserSubscribe($phone);
     if ($checkPlay) {
         $playPrice = 0;
     } else {
         if ($userSub) {
             $playPrice = 0;
         }
     }
     if ($checkPlay) {
         $playPrice = 0;
     }
     // 		$registerText = WapAlbumModel::model()->getCustomMetaData('REG_TEXT');
     $this->itemName = $playlist->name;
     $this->artist = "Chacha";
     //$playlist->username;
     $this->thumb = UserModel::model()->getThumbnailUrl('s1', $playlist->user_id);
     $this->url = URLHelper::buildFriendlyURL("playlist", $playlist->id, Common::makeFriendlyUrl($playlist->name));
     $this->description = $playlist->name;
     $this->render('view', array('playlist' => $playlist, 'songsOfPlaylist' => $songsOfPlaylist, 'playlistsSameUser' => $playlistsSameUser, 'playlistPages' => $playlistPages, 'errorCode' => $errorCode, 'errorDescription' => $errorDescription, 'userSub' => $userSub, 'user_msisdn' => $user_msisdn));
 }
Example #2
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();
 }