DelController.class.php 1.23 KB
<?php
/**
 * 【业绩比拼-手机端】删除我的回帖或回复接口
 *
 * User: daijun
 * Date: 2017-11-02
 */

namespace Api\Controller\Common;

use Common\Service\CommentService;
use Common\Service\ReplyService;

class DelController extends \Api\Controller\AbstractController
{

    public function Index_post()
    {

        // 获取参数
        $obj_id = I('post.obj_id', 0, 'intval');
        $type = I('post.type', 0, 'intval');

        // 判断是否外部人员
        if (empty($this->uid)) {

            E('_EMPTY_USER_ID');
        }

        if (empty($obj_id)) {
            // 验证数据ID
            E('_EMPTY_DEL_ID');
        }

        if (empty($type)) {
            // 验证数据类型
            E('_EMPTY_DEL_TYPE');
        }

        if (CommentService::DEL_COMMENT_TYPE == $type) {
            // 回帖信息表
            $comment_serv = new CommentService();

            // 删除回帖
            $comment_serv->del_comment($obj_id, $this->uid);

        } elseif (ReplyService::DEL_REPLY_TYPE == $type) {
            // 回复信息表
            $reply_serv = new ReplyService();

            // 删除回复
            $reply_serv->del_reply($obj_id, $this->uid);
        }

        return true;
    }
}