<?php
// +----------------------------------------------------------------------
// | Sunnyi 多语商城建站系统 (Build on ThinkPHP)
// +----------------------------------------------------------------------
// | Copyright (c) 2009 http://www.sunnyi.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: 商易网络(admin@sunnyi.cn)
// +----------------------------------------------------------------------

//会员配送
class UserConsigneeModel extends MultiLangModel  {
	
	//查询配送列表分页
	public function getConsigneeList($user_id, $page=1)
	{
		$limit = ($page-1)*C("PAGE_LISTROWS").",".C("PAGE_LISTROWS");
		$list = $this->where("user_id=".$user_id)->limit($limit)->findAll();
		foreach($list as $k=>$v)
		{
			$list[$k]['region_lv1_info'] = D("RegionConf")->getById($v['region_lv1']);
			$list[$k]['region_lv2_info'] = D("RegionConf")->getById($v['region_lv2']);
			$list[$k]['region_lv3_info'] = D("RegionConf")->getById($v['region_lv3']);
			$list[$k]['region_lv4_info'] = D("RegionConf")->getById($v['region_lv4']);
		}
		$result['list'] = $list;
		$result['total'] = $this->where("user_id=".$user_id)->count();
		return $result;
	}
	
	//查询配送
	public function getConsigneeItem($consignee_id)
	{
		$item = $this->getById($consignee_id);
		if($item)
		{
			$item['region_lv1_info'] = D("RegionConf")->getById($item['region_lv1']);
			$item['region_lv2_info'] = D("RegionConf")->getById($item['region_lv2']);
			$item['region_lv3_info'] = D("RegionConf")->getById($item['region_lv3']);
			$item['region_lv4_info'] = D("RegionConf")->getById($item['region_lv4']);
		}

		return $item;
	}
}
?>