示例#1
0
 public function index()
 {
     $gets = I('get.');
     $product_id = $gets['product_id'];
     $member_id = session('home_member_id');
     /* 获取所选商品信息 */
     $map['id'] = $product_id;
     $product_info = get_info($this->product_table, $map);
     $product_type = $product_info['type'];
     if (!$product_type) {
         $this->error('产品类型错误');
     }
     if (intval($product_type)) {
         // 文件上传插件第二次加载页面时的报错
         /* 确定要加载的第一步的页面 */
         session('buy_first_view', $this->first_step_view[$product_type]);
     }
     $temp['0'] = $product_info;
     /* 获取格式为 id=>title 的语言分类数组 */
     $language_text = id_and_text(get_language_cache());
     /* 获取格式为 id=>title 的领域分类数组 */
     $industry_text = id_and_text(get_industry_cache());
     /* 获取格式为 id=>title 的属性分类数组 */
     $ability_text = id_and_text(get_ability_cache());
     /* 获取所有属性,并将键值转换为子数组的ID */
     $ability_all = array_id_key(get_ability_cache());
     /* 获取所有行业,并将键值转换为子数组的ID */
     $industry_all = array_id_key(get_industry_cache());
     $temp = int_to_string($temp, array("language_id" => $language_text, "to_language_id" => $language_text));
     /* 将二维数组还原成一维数组 */
     $product_info = $temp[0];
     /* 将行业ID转换为包含title的数组 */
     $product_info['industry_id_arr'] = int_to_arr(json_decode($product_info['industry_id'], true), $industry_all);
     /* 将属性ID转换为包含title的数组 */
     $product_info['ability_id_arr'] = int_to_arr(json_decode($product_info['ability_id'], true), $ability_all);
     // print_r($product_info);
     $address_result = get_address_info($member_id);
     $data['address_result'] = $address_result;
     $data['product_info'] = $product_info;
     $this->assign($data);
     // 根据数据表中的字段获取地址信息
     $area = get_area_cache();
     $data['area'] = $area;
     // 		dump($data['product_info']);die;
     $this->assign('data', $data);
     /* 按照所传产品类型确定第一步加载的页面 */
     $this->display(session('buy_first_view'));
 }
示例#2
0
	public function get_address_info () {
		global $ecs,$db;
		checkLogin();
		$address_id = isset($_GET['address_id'])? intval($_GET['address_id']) :0;
		if(empty($address_id))
		{
			$msg = rpcLang('user.php', 'address_id_is_empty');
			jsonExit("{\"status\":\"$msg\"}");
		}else
		{
			include_once('includes/lib_transaction.php');
			$address = get_address_info($address_id);
			$country_id = $address['country'];
			$province_id = $address['province'];
			$city_id = $address['city'];
			$district_id = $address['district'];
			$arr = array($country_id,$province_id,$city_id,$district_id);
			$result = array (); 
			foreach ($arr as $key => $val) {
				$sql = "select `region_name` from".$ecs->table('region')."where `region_id`= {$val}";
				$region_name = $db->getOne($sql);
				array_push($result,$region_name);
			}
			$address['country_name'] = $result[0];
			$address['province_name'] = $result[1];
			$address['city_name'] = $result[2];
			$address['district_name'] = $result[3];
			$sql = "select `user_name` from".$ecs->table('users')."where `user_id`= {$address['user_id']}";
		    $user_name = $db->getOne($sql); 
		    if(!$user_name){
		    	$msg = rpcLang('user.php', 'get_user_name_failure');
		    	jsonExit("{\"status\":\"$msg\"}");
		    }
		    $address['user_name'] = $user_name ;
			//var_dump($address);exit;
			jsonExit($address);
		}
	}
示例#3
0
    $smarty->assign('page_count', $shop_list['page_count']);
    $page = isset($_REQUEST['page']) ? intval($_REQUEST['page']) : 1;
    $start_array = range(1, $page);
    $end_array = range($page, $shop_list['page_count']);
    if ($page - 5 > 0) {
        $smarty->assign('start', $page - 3);
        $start_array = range($page, $page - 2);
    }
    if ($shop_list['page_count'] - $page > 5) {
        $smarty->assign('end', $page + 3);
        $end_array = range($page, $page + 2);
    }
    $page_array = array_merge($start_array, $end_array);
    sort($page_array);
    $smarty->assign('page_array', array_unique($page_array));
    $address_info = get_address_info();
    $child_info = get_child_address_info();
    $smarty->assign('child_info', $child_info);
    $smarty->assign('address_info', $address_info);
    assign_dynamic('stores');
}
/* 显示模板 */
$smarty->display($tpl, $cache_id);
/**
 * 获取所有店铺分类
 */
function get_all_category()
{
    $sql = "select * from " . $GLOBALS['ecs']->table('street_category') . " where is_show=1 order by sort_order";
    $all = $GLOBALS['db']->getAll($sql);
    $ret1 = $ret = array();
示例#4
0
文件: user.php 项目: noikiy/mdwp
		$region['region_name'] = $region_name;
		jsonExit($region);
	}

}else if($act == 'get_address_info')//得到单条收货信息
{
	checkLogin();
	$address_id = isset($_GET['address_id'])? intval($_GET['address_id']) :0;
	if(empty($address_id))
	{
		$msg = rpcLang('user.php', 'address_id_is_empty');
		jsonExit("{\"status\":\"$msg\"}");
	}else
	{
		include_once('includes/lib_transaction.php');
		$address = get_address_info($address_id);
		//var_dump($address);exit;
		
		$country_id = $address['country'];
		$province_id = $address['province'];
		$city_id = $address['city'];
		$district_id = $address['district'];
		$arr = array($country_id,$province_id,$city_id,$district_id);
		$result = array (); 
		foreach ($arr as $key => $val) {
			$sql = "select `region_name` from".$ecs->table('region')."where `region_id`= {$val}";
			$region_name = $db->getOne($sql);
			array_push($result,$region_name);
		}
		$address['country_name'] = $result[0];
		$address['province_name'] = $result[1];