Ejemplo n.º 1
0
 public function actionUnfavorite()
 {
     $appID = $_POST['id'];
     if (empty($appID)) {
         throw new THttpException('操作失败');
     }
     $app = AppInfoList::model()->findByPk($appID);
     if (empty($app) || $app->Status > 0) {
         throw new THttpException('操作失败');
     }
     $userID = Yii::app()->user->id;
     $user = User::model()->findByPk($userID);
     if (empty($user)) {
         throw new THttpException('操作失败');
     }
     try {
         if (Favorite::favoriteBoolean($appID, $userID, false)) {
             echo new ReturnInfo(RET_SUC, 'success');
         }
     } catch (Exception $e) {
         throw new THttpException('操作失败');
     }
 }
Ejemplo n.º 2
0
 public function actionUnfavorite()
 {
     $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();
     }
     $app = AppInfoList::model()->findByPk($appID);
     if (empty($app)) {
         echo new ReturnInfo(RET_ERROR, 'Argument appid passed to ' . __CLASS__ . '::' . __FUNCTION__ . '() that can not find a record.');
         Yii::app()->end();
     }
     try {
         Favorite::favoriteBoolean($appID, $this->apiUser->ID, false);
         echo new ReturnInfo(RET_SUC, 1);
     } catch (Exception $e) {
         echo new ReturnInfo(RET_ERROR, $e->getMessage());
     }
 }