コード例 #1
0
ファイル: _popupRbt.php プロジェクト: giangnh264/mobileplus
        ?>
','gift')">Tặng</a>
				</div>

			</li>
		<?php 
        $i++;
    }
    ?>
		</ul>

	</div>
	<div id="rbt-download" style="display: none;">
		<div class="rbt_head">
			<?php 
    if (Yii::app()->user->isGuest || !Formatter::isMobiPhoneNumber($userPhone)) {
        ?>
			<div class="popup-message">
			<?php 
        echo Yii::t('web', 'Chức năng nhạc chờ chỉ áp dụng cho các tài khoản là thuê bao Mobifone');
        ?>
			</div>
			<?php 
    } else {
        ?>
			<div class="row"><h3 id="down_rbt_name"></h3></div>
			<div class="row color-989898"><?php 
        echo Yii::t('web', 'Ca sỹ');
        ?>
: <span id="down_rbt_artist"></span></div>
			<div class="row color-989898"><?php 
コード例 #2
0
 public function actionDownloadRbt()
 {
     $flag = true;
     $userPhone = false;
     if (!Yii::app()->user->isGuest) {
         $userPhone = Yii::app()->user->getState('msisdn');
     }
     if (Yii::app()->getRequest()->ispostRequest && isset($_POST['rbt_code'])) {
         $flag = false;
         $toPhone = Yii::app()->request->getParam('to_phone');
         $code = Yii::app()->request->getParam('rbt_code');
         $result = new stdClass();
         if (!Formatter::isMobiPhoneNumber($userPhone)) {
             $result->errorCode = 1;
             $result->message = "Chức năng nhạc chờ chỉ áp dụng cho các tài khoản là thuê bao Mobifone";
             echo json_encode($result);
             Yii::app()->end();
         }
         if (!Formatter::isMobiPhoneNumber($toPhone)) {
             $result->errorCode = 1;
             $result->message = "Số điện thoại người nhận không phải là thuê bao Mobifone";
             echo json_encode($result);
             Yii::app()->end();
         }
         $flagCRBT = false;
         $msisdn = Formatter::removePrefixPhone($userPhone);
         $msisdn = substr($msisdn, 1);
         $funringStatus = FunringHelper::getInstance()->checkStatus($msisdn);
         if ($funringStatus == -1) {
             $result->errorCode = -1;
             $result->message = "Không kết nối được đến hệ thống CRBT";
             echo json_encode($result);
             Yii::app()->end();
         }
         if ($funringStatus == 4) {
             // Chua dang ky => thuc hien dang ky cho TB
             $retRegister = FunringHelper::getInstance()->register($msisdn);
             if ($retRegister != 0) {
                 $result->errorCode = -1;
                 $result->message = "Không kết nối được đến hệ thống CRBT";
                 echo json_encode($result);
                 Yii::app()->end();
             }
         }
         if ($userPhone == $toPhone) {
             $ret = FunringHelper::getInstance()->orderTone($msisdn, $code);
             if ($ret == 0) {
                 $error = "Bạn đã tải nhạc chờ thành công!";
             } else {
                 $error = "Bạn tải nhạc chờ chưa thành công. Vui lòng kiểm tra và thao tác lại.";
             }
         } else {
             $toPhone = Formatter::removePrefixPhone($toPhone);
             $toPhone = substr($toPhone, 1);
             $ret = FunringHelper::getInstance()->giftTone($msisdn, $code, $toPhone);
             if ($ret == 0) {
                 $error = "Bạn đã tặng nhạc chờ thành công cho số thuê bao 0{$toPhone}.";
             } else {
                 $error = "Bạn tặng nhạc chờ cho số thuê bao 0{$toPhone} chưa thành công. Vui lòng kiểm tra và thao tác lại.";
             }
         }
         $result->errorCode = $ret;
         $result->message = $error;
         echo json_encode($result);
     }
     if ($flag) {
         $rbts = array();
         $id = Yii::app()->request->getParam('id');
         $song = SongModel::model()->findByPk($id);
         if ($song->rbt_codes != "") {
             $code = explode(",", trim($song->rbt_codes));
             $rbts = RbtModel::model()->getByCodes($code);
         }
         $this->renderPartial('_popupRbt', compact("song", "rbts", "userPhone"), false, true);
     }
 }