示例#1
0
 public function actionGetLikedPeople()
 {
     if (isset($_POST['appID']) && isset($_POST['start'])) {
         $userArray = CommonFunc::getRedis('link_' . $_POST['appID'], 'user');
         if (!empty($userArray)) {
             echo new ReturnInfo(RET_SUC, AppInfoList::getLikedPeople($userArray, $_POST['start']));
             return;
         }
     }
     echo new ReturnInfo(-1, '网络连接超时,请稍后重试!');
     return;
 }
示例#2
0
 public function actionAppDetail()
 {
     $appID = Yii::app()->getRequest()->getQuery('appid');
     if (empty($appID)) {
         echo new ReturnInfo(RET_ERROR, 'Argument appid passed to ' . __CLASS__ . '::' . __FUNCTION__ . '() that can not be empty.');
         Yii::app()->end();
     }
     $appInfoObj = AppInfoList::model()->findByPk($appID);
     if (empty($appInfoObj)) {
         echo new ReturnInfo(RET_ERROR, 'Argument appid passed to ' . __CLASS__ . '::' . __FUNCTION__ . '() that can not find a record.');
         Yii::app()->end();
     }
     $appInfoArray = array('id' => $appInfoObj->Id, 'appName' => $appInfoObj->AppName, 'remarks' => $appInfoObj->Remarks, 'commentCount' => $appInfoObj->reply_count, 'commitUserId' => $appInfoObj->CommitUserId, 'CommitTime' => AppInfoList::getPeriod($appInfoObj->CommitTime), 'markName' => Source::getSourceName($appInfoObj->SourceId), 'pushListObj' => isset($appInfoObj->pushListObj) && $appInfoObj->pushListObj->FileSize ? $appInfoObj->pushListObj->FileSize : "0MB", 'iconUrl' => $appInfoObj->IconUrl, 'appSource' => $appInfoObj->SourceId, 'appUrl' => $appInfoObj->AppUrl, 'appInfo' => $appInfoObj->AppInfo, 'up' => $appInfoObj->Up);
     $appID = $appInfoObj->Id;
     $count_key = 'link_' . $appID;
     $memberArray = CommonFunc::getRedis('user_' . Yii::app()->user->id);
     $appInfoArray['hasFavorited'] = false;
     $appInfoArray['isUpped'] = false;
     if (!empty($memberArray)) {
         $appInfoArray['hasFavorited'] = isset($memberArray['favorite'][$appID]) ? 1 : 0;
         if (!isset($memberArray['like'])) {
             $memberArray['like'] = array();
         }
         $appInfoArray['isUpped'] = in_array($appInfoObj->Id, $memberArray['like']) ? true : false;
     }
     $countArray = CommonFunc::getRedis($count_key);
     if (!empty($countArray)) {
         if (!isset($countArray['count'])) {
             $countArray['count'] = 0;
         }
         if (!isset($countArray['user'])) {
             $countArray['user'] = array();
         }
         $appInfoArray['count'] = $countArray['count'];
         $appInfoArray['p_user'] = AppInfoList::getLikedPeople($countArray['user'], 0);
     } else {
         $appInfoArray['count'] = 0;
         $appInfoArray['p_user'] = array();
     }
     //发信息的人
     $user = $appInfoObj->link_user;
     if (!empty($user)) {
         $appInfoArray['username'] = htmlspecialchars($user->UserName);
         if (!empty($user['Icon'])) {
             $appInfoArray['userurl'] = $user->Icon;
         } else {
             $appInfoArray['userurl'] = '';
         }
     } else {
         $appInfoArray['username'] = '';
         $appInfoArray['userurl'] = '';
     }
     //信息的轮播图片(link_info表)
     $appInfoArray['imgurl'] = array();
     if (!empty($appInfoObj->VideoUrl)) {
         $appInfoArray['videoUrl'] = $appInfoObj->VideoUrl;
     }
     if (!empty($appInfoObj->ScreenShoot)) {
         $appInfoArray['imgurl'] = explode(',', $appInfoObj->ScreenShoot);
     }
     echo new ReturnInfo(RET_SUC, $appInfoArray);
 }