コード例 #1
0
ファイル: action.php プロジェクト: Resolut1on/My-Project
 protected function addCollect()
 {
     //验证是否登录
     $this->getLoginInfo();
     //验证token
     $this->checkToken(Utils::GetValue("tokenkey"), $this->uin);
     //检查请求来源
     $this->checkRefer();
     $collectionModel = new CollectionModel();
     $collectionList = $collectionModel->getUserCollectionList($this->uin);
     if ($collectionList === false) {
         echo '{"status":0}';
         exit;
     }
     $result = $collectionModel->addCollection($this->uin, $this->comicId);
     if ($result['ret'] == 2) {
         $statModel = new StatModel();
         $statModel->updStatByUinType($this->uin, COLL, count($collectionList) + 1);
         ActionHelper::UpdateComicStat($this->comicId, 'coll_count', '+');
         ActionHelper::RecordUserAction($this->uin, COLL_ACT, $this->comicId);
         ActionHelper::UpdateUserPoint($this->uin, COLL_ACT);
         echo '{"status":1}';
     } else {
         if ($result['code'] == -1) {
             echo '{"status":2}';
             exit;
         } else {
             if ($result['code'] == -2) {
                 echo '{"status":3}';
                 exit;
             } else {
                 echo '{"status":0}';
             }
         }
     }
 }