/** * 验证token */ protected function checkToken($tokenKey, $uin) { if (empty($tokenKey) || $uin != ActionHelper::CheckToken($tokenKey)) { echo '{"status": -97, "msg":"token验证错误!"}'; exit; } }
public function delCollect() { //验证是否登录 $this->getLoginInfo(); //验证token $this->checkToken(Utils::GetValue("tokenkey"), $this->uin); //检查请求来源 $this->checkRefer(); $collectionModel = new CollectionModel(); if ($collectionModel->delCollection($this->uin, $this->comicId)) { ActionHelper::UpdateUserStat($this->uin, COLL, '-'); ActionHelper::UpdateComicStat($this->comicId, 'coll_count', '-'); ActionHelper::RecordUserAction($this->uin, DEL_COLL_ACT, $this->comicId); echo '{"status":10}'; } else { echo '{"status":-10}'; } exit; }