CancelLikeController.class.php 903 Bytes
<?php
/**
 * 【考试中心-手机端】考试排名取消点赞接口
 * CancelLikeController.class.php
 * @author: 蔡建华
 * @date: 2017-05-23
 */

namespace Api\Controller\Rank;

use Common\Common\DataCenter;
use Common\Service\LikeService;

class CancelLikeController extends AbstractController
{

    public function Index_post()
    {
        // 答卷id
        $ea_id = I('post.ea_id');

        // 实例化考试-点赞表service
        $like_s = New LikeService();
        // 取消点赞
        $data = $like_s->del_like_data($ea_id, $this->uid);
        // 操作失败,返回提示"取消点赞失败"
        if (!$data) {

            E('_ERR_UNLIKE_FALSE');
        }

        // 数据中心:取消点赞埋点
        $datacenter =& DataCenter::instance();
        $datacenter->delUserLike($this->uid, $ea_id);

        // 返回结果
        $this->_result = $data;
    }
}