<?php

// 更新用户会员状态
require_once ("../user_include.inc");

$unionId = ParamUtil::getRequestString("unionId", 0);
ErrorLogger::doOutput("Compass...ajax_update_user_member.php....Start.", 0);

ErrorLogger::doOutput("Compass...ajax_update_user_member.php....unionId=" . $unionId, 0);

//参数验证
if(empty($unionId)) {
	responseNG("参数错误！");
}

//检索用户是否存在
$param['unionid'] = $unionId;
$param['delete_flg'] = false;
$tmpUserMstList = UserMst::getList($param,'id','desc', 0, 1);
if(empty($tmpUserMstList)) {
	responseNG("参数错误！");
}

//调用支付


$user = $tmpUserMstList[0];
$user->is_member = true;
$user->save();

ErrorLogger::doOutput("Compass...ajax_update_user_member.php....End.", 0);

responseOK("更新成功！");

function responseNG($message) {
	$result = array("status"=>"NG", "message"=>$message);
	print json_encode($result);
	exit;
}
function responseOK($message) {
	$result = array("status"=>"OK", "message"=>$message);
	print json_encode($result);
	exit;
}
?>