Exemplo n.º 1
0
 public function actionMyApp()
 {
     $memberID = Yii::app()->getRequest()->getQuery('userid');
     $condition = 'CommitUserId = :CommitUserId';
     if (empty($memberID)) {
         $memberID = Yii::app()->user->id;
     }
     if ($memberID != Yii::app()->user->id) {
         $condition .= ' and Status = 0';
     }
     $member = User::model()->findByPk($memberID);
     if (!$member instanceof User) {
         echo new ReturnInfo(RET_ERROR, '操作错误');
         Yii::app()->end();
     }
     echo new ReturnInfo(RET_SUC, array('data' => AppInfoList::parseData(AppInfoList::model()->findAll(array('condition' => $condition, 'order' => 'Id desc', 'params' => array(':CommitUserId' => $memberID))), $memberID)));
 }
Exemplo n.º 2
0
 public function actionMyAppList()
 {
     $memberID = Yii::app()->getRequest()->getQuery('memberid');
     $condition = 'CommitUserId = :CommitUserId';
     if (empty($memberID)) {
         $memberID = Yii::app()->user->id;
     }
     if ($memberID != Yii::app()->user->id) {
         $condition .= ' and Status = 0';
     }
     $member = User::model()->findByPk($memberID);
     if (!$member instanceof User) {
         throw new THttpException("操作错误");
     }
     $this->render('myapplist', array('data' => AppInfoList::parseData(AppInfoList::model()->findAll(array('condition' => $condition, 'order' => 'Id desc', 'params' => array(':CommitUserId' => $memberID))), $memberID)));
 }
Exemplo n.º 3
0
 static function getInteractionApp($memberID, $appIds)
 {
     $apps = array();
     if (!empty($appIds)) {
         $appsModel = self::getAppsByIds($appIds);
         $publicApps = array();
         foreach ($appsModel as $app) {
             if ($app->Status == 0) {
                 $publicApps[$app->Id] = $app;
             }
         }
         $interactionApps = array();
         $interactionOrder = array_reverse($appIds);
         foreach ($interactionOrder as $interactionAppId => $id) {
             if (isset($publicApps[$id])) {
                 $interactionApps[] = $publicApps[$id];
             }
         }
         $apps = AppInfoList::parseData($interactionApps, $memberID);
     }
     return $apps;
 }
Exemplo n.º 4
0
 public function actionInteractionApp()
 {
     $memberID = Yii::app()->getRequest()->getQuery('memberid');
     if (empty($memberID)) {
         $memberID = $this->apiUser->ID;
     }
     $member = User::model()->findByPk($memberID);
     if (!$member instanceof User) {
         throw new THttpException("操作错误");
     }
     $userKey = 'user_' . $memberID;
     $userArray = Yii::app()->cache->get($userKey);
     $memberArray = empty($userArray) ? array() : unserialize($userArray);
     $apps = array();
     if (!empty($memberArray)) {
         $type = 1;
         if (isset($_GET['type'])) {
             $type = $_GET['type'];
         }
         if ($type == 1) {
             if (isset($memberArray['like']) && !empty($memberArray['like'])) {
                 $apps = AppInfoList::parseData(AppInfoList::model()->findAll(array('condition' => "Id in (" . implode(',', $memberArray['like']) . ")")), $memberID);
             }
         } else {
             if ($type == 2) {
                 if (isset($memberArray['comment']) && !empty($memberArray['comment'])) {
                     $apps = AppInfoList::parseData(AppInfoList::model()->findAll(array('condition' => "Id in (" . implode(',', $memberArray['comment']) . ")")), $memberID);
                 }
             }
         }
     }
     echo new ReturnInfo(RET_SUC, $apps);
 }