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


$shop_viewog = new ShopViewLog($query);

if ($page->action =='delete'){
	//删除
	$ids = intval($_GET['friend_id']);
	try{
		$shop_viewog->delete($ids);
		$page->goto('snsLinkIn.php','删除成功');
	}catch (Exception $e){
		$page->back("删除失败，请重试");
	}
}else{
	$page->name = 'snsLinkIn';

	$cityarea_option = Dd::getArray('cityarea');
	$broker_type_option = Dd::getArray('broker_type');
	
	$member_id = $member->getAuthInfo('id');
	$where = ' broker_id ='.$member_id;
	require($cfg['path']['lib'] . 'classes/Pages.class.php');
	$pages = new Pages($shop_viewog->getCount($where),45,'pages_g.tpl');
	$pageLimit = $pages->getLimit();
	$dataList = $shop_viewog->getList($pageLimit,'*',$where,' order by id desc ');
	foreach ($dataList as $key => $item){
		$friend_info = $member->getInfo($item['friend_id'],'*',true);
		$dataList[$key]=$friend_info;
		$dataList[$key]['id'] = $item['id'];
		$dataList[$key]['friend_id'] = $item['friend_id'];
		$dataList[$key]['add_time'] = $item['add_time'];
	}
	$page->tpl->assign('to_url', $_SERVER['REQUEST_URI']);
	$page->tpl->assign('dataList', $dataList);
	$page->tpl->assign('pagePanel', $pages->showCtrlPanel_g(5));//分页条
}

$page->show();
?>