<?php
require('path.inc.php');

$member_id = $member->getAuthInfo('id');

$identity = new Identity($query);
if($page->action == 'save'){
	try{
		$_POST['broker_id'] = $member_id;
		$identity->save($_POST);
		$page->goto('brokerIdentity.php','申请已提交，请等待审核通过');
	}catch (Exception $e){
		$page->back("申请保存失败，请重试");
	}
	exit;
}else{
	$page->name = 'brokerIdentity';
	$page->addJs('FormValid.js');
	
	$memberInfo = $member->getInfo($member_id,'*',true);
	$memberInfo['idcard'] = trim($memberInfo['idcard']);
	$memberInfo['mobile'] = trim($memberInfo['mobile']);
	$page->tpl->assign('memberInfo',$memberInfo);
}

$page->show();
?>