ChannelApi::channel_follow PHP Method

channel_follow() public method

频道关注或取消关注 --using
public channel_follow ( ) : 状态+提示
return 状态+提示
    public function channel_follow()
    {
        $cids = t($this->data['channel_category_id']);
        $cids = explode(',', $cids);
        $type = intval($this->data['type']);
        if ($type == 1) {
            // 加关注
            $action = 'add';
            $info = '关注';
        } else {
            $action = 'del';
            $info = '取消关注';
        }
        foreach ($cids as $cid) {
            $res = D('ChannelFollow', 'channel')->upFollow($this->mid, $cid, $action);
        }
        if ($res) {
            $data['status'] = 1;
            $data['msg'] = $info . '成功';
        } else {
            $data['status'] = 0;
            $data['msg'] = $info . '失败';
        }
        return $data;
    }