ManageAction::verify PHP Method

verify() public method

处理用户申请圈主或小主
public verify ( )
    public function verify()
    {
        $map['weiba_id'] = intval($_POST['weiba_id']);
        $map['follower_uid'] = $_POST['uid'];
        $value = intval($_POST['value']);
        $weiba = D('weiba')->where('weiba_id=' . $map['weiba_id'])->find();
        $actor = model('User')->getUserInfo($this->mid);
        $config['name'] = $actor['space_link'];
        $config['weiba_name'] = $weiba['weiba_name'];
        $config['source_url'] = U('weiba/Index/detail', array('weiba_id' => $map['weiba_id']));
        if ($value != -1) {
            if ($value == 3) {
                if (D('weiba_follow')->where('level=3 AND weiba_id=' . $map['weiba_id'])->find()) {
                    $return['status'] = 0;
                    $return['data'] = '只能设置一个圈主';
                    echo json_encode($return);
                    exit;
                }
            }
            $res = D('weiba_follow')->where($map)->setField('level', $value);
            if ($res) {
                if ($value == 3) {
                    D('weiba')->where('weiba_id=' . $map['weiba_id'])->setField('admin_uid', $_POST['uid']);
                }
                D('weiba_apply')->where($map)->delete();
                model('Notify')->sendNotify($_POST['uid'], 'weiba_apply_ok', $config);
                $return['status'] = 1;
                $return['data'] = '操作成功';
            } else {
                $return['status'] = 0;
                $return['data'] = '操作失败';
            }
        } else {
            D('weiba_apply')->where($map)->delete();
            model('Notify')->sendNotify($_POST['uid'], 'weiba_apply_reject', $config);
            $return['status'] = 1;
            $return['data'] = '驳回成功';
        }
        echo json_encode($return);
        exit;
    }