Ejemplo n.º 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'));
 }
Ejemplo n.º 2
0
 /**
  * 查看订单详情
  * @author						李东
  * @date						2015-06-30
  */
 public function detail()
 {
     $order_id = I('get.id');
     if (!$order_id) {
         $this->error('错误操作');
     }
     $map['order_id'] = $order_id;
     $order_info = get_info(D($this->model), $map);
     if ($order_info['order_status'] == 1) {
         redirect(U('/Home/Buy/confirm_quote/', array('order_id' => $order_id)));
     }
     $files = get_result($this->files_complete, array('order_id' => $order_id));
     //     	print_r($files);exit;
     $order_info['files'] = $files;
     /*获取格式为 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=>title 的产品分类数组*/
     $product_type = id_and_text($this->product_type);
     /*暂时将一维数组转化为二维数组*/
     $temp[] = $order_info;
     $temp = int_to_string($temp, array("order_status" => $this->order_status, 'is_need_invoice' => array('0' => '否', '1' => '是'), 'product_type' => $product_type, 'pay_type' => array('0' => '余额支付', '1' => '支付宝支付'), "product_language_id" => $language_text, "product_to_language_id" => $language_text));
     /*将Json中所有ID转换成文字字符串*/
     $temp = json_to_chars($temp, array('product_industry_id' => $industry_text, 'product_ability_id' => $ability_text));
     $order_info = $temp[0];
     /*将二维数组还原成一维数组*/
     /*获取买家信息*/
     $buyer_info = get_info('member', array('id' => $order_info['member_id']));
     /*获取下单地址信息*/
     $user_address = get_area_pid($order_info['address_path'] . $order_info['address_id']);
     /*获取发票信息*/
     if ($order_info['is_need_invoice'] == 1) {
         $invoice = get_address_detail($order_info['address_id']);
     }
     $address_text = '';
     foreach ($user_address as $row) {
         $address_text .= $row['title'] . ' ';
     }
     $buyer_info['address_text'] = $address_text;
     $map = array();
     $map['order_id'] = $order_id;
     $order_result = get_result('order_history', $map);
     $order_result = int_to_string($order_result, array('order_status' => $this->order_status));
     if ($order_info['order_status'] == 4) {
         /*如果订单状态为待退款状态,查询退款原因描述*/
         $map['order_id'] = $order_id;
         $refund_result = get_result(D($this->refund_model), $map);
         //     		print_r($refund_result);exit;
         foreach ($refund_result as $k => $row) {
             if ($row['type'] == 1) {
                 /*如果是下单用户的信息,查询是否上传凭证文件*/
                 $refund_result[$k]['ask_name'] = $row['username'];
                 $files = get_result($this->refund_files, array('refund_id' => $row['id']));
                 $files = get_file_type($files);
                 $refund_result[$k]['files'] = $files;
             } elseif ($row['type']) {
                 $refund_result[$k]['ask_name'] = $row['shop_title'];
             }
         }
     }
     $data['invoice'] = $invoice;
     $data['info'] = $order_info;
     $data['result'] = $order_result;
     $data['buyer_info'] = $buyer_info;
     $data['refund_result'] = $refund_result;
     $this->assign($data);
     $this->display();
 }
Ejemplo n.º 3
0
 public function servece()
 {
     $this->header();
     //店铺内页主要模块信息
     // 		//获取用户的评价等信息
     $comments = $this->get_shop_comments();
     //店铺的评价信息
     // 		//店铺的服务信息
     // 		$shop_servece = $this->get_servece_language(10);//店铺的服务,2表示查询两个
     // 		$data['shop_servece'] = $shop_servece;
     $shop_id = I('get.shop_id');
     $status = true;
     if (intval($shop_id) <= 0 and empty(I("post."))) {
         /*判断参数是否符合规则*/
         $result = array('status' => '0', 'msg' => '错误请求');
         $status = false;
     }
     if ($status) {
         //获取用户的评价等信息
         $comments = $this->get_shop_comments();
         //店铺的评价信息
         /*如果前置条件符合,执行以下操作*/
         /*查询店铺信息*/
         $shop_info = get_info($this->table, array('id' => $shop_id));
         /*获取语言信息*/
         $language = get_language_cache();
         /*获取技能信息*/
         $ability = list_to_tree(get_ability_cache());
         /*获取行业信息*/
         $industry = get_industry_cache();
         /*获取数组键值为语言ID的新数组*/
         foreach ($language as $val) {
             $language_id_key[$val['id']] = $val;
         }
         /*处理擅长语言*/
         $good_at = json_decode($shop_info['good_at'], true);
         foreach ($good_at as $k => $v) {
             $good_at_new[$k]['id'] = $v;
             $good_at_new[$k]['title'] = $language_id_key[$v]['title'];
         }
         $shop_info['good_at_arr'] = $good_at_new;
         /*处理店铺logo*/
         if (is_file($shop_info['logo'])) {
             $shop_info['logo'] = __ROOT__ . '/' . $shop_info['logo'];
         } else {
             $shop_info['logo'] = __ROOT__ . '/Public/Home/img/company_img.jpg';
         }
         /*处理数字值,将数字转化为文字*/
         $temp[0] = $shop_info;
         $temp = int_to_string($temp, array('type' => $this->seller_type));
         $shop_info = $temp[0];
         /*查询店铺所属商品*/
         $map['status'] = 1;
         $map['shop_id'] = $shop_id;
         $map['assess'] = 1;
         /*默认排序条件*/
         $order = ' recommend desc,sort desc,id desc';
         $product_result = get_result(D($this->product_model), $map, '', $order);
         /*获取格式为 id=>title 的语言分类数组*/
         $language_text = id_and_text(get_language_cache());
         /*获取格式为 id=>title 的等级分类数组*/
         $level_text = id_and_text(get_product_level_cache());
         /*获取格式为 id=>title 的产品分类数组*/
         $product_type = id_and_text($this->product_type);
         $product_result = int_to_string($product_result, array('level_id' => $level_text, "type" => $product_type, "language_id" => $language_text, "to_language_id" => $language_text));
         /*将json格式ID转为逗号分隔的Title*/
         /*获取格式为 id=>title 的领域分类数组*/
         $industry_text = id_and_text(get_industry_cache());
         /*获取格式为 id=>title 的属性分类数组*/
         $ability_text = id_and_text(get_ability_cache());
         /*将Json中所有ID转换成文字字符串*/
         $product_result = json_to_chars($product_result, array('industry_id' => $industry_text, 'ability_id' => $ability_text));
         //print_r($product_result);
         $data['shop_info'] = $shop_info;
         $data['product_result'] = $product_result;
         /*查询店铺所属商品*/
         $shop_id = I('get.shop_id');
         $map['status'] = 1;
         $map['shop_id'] = $shop_id;
         /*默认排序条件*/
         $all_product = get_result(D($this->product_model), $map);
         /*获取格式为 id=>title 的语言分类数组*/
         $language_text = id_and_text(get_language_cache());
         /*获取格式为 id=>title 的等级分类数组*/
         $level_text = id_and_text(get_product_level_cache());
         /*获取格式为 id=>title 的产品分类数组*/
         $product_type = id_and_text($this->product_type);
         $all_product = int_to_string($all_product, array('level_id' => $level_text, "type" => $product_type, "language_id" => $language_text, "to_language_id" => $language_text));
         /*将json格式ID转为逗号分隔的Title*/
         /*获取格式为 id=>title 的领域分类数组*/
         $industry_text = id_and_text(get_industry_cache());
         /*获取格式为 id=>title 的属性分类数组*/
         $ability_text = id_and_text(get_ability_cache());
         /*将Json中所有ID转换成文字字符串*/
         $all_product = json_to_chars($all_product, array('industry_id' => $industry_text, 'ability_id' => $ability_text));
         $data['all_product'] = json_encode($all_product);
         //店铺的过往经历
         /********************************TODO:最近浏览**************************************************/
         $view_shops = cookie('view_shops');
         // 	    	print_r($view_shops);
         // 	    	echo '<br/>';
         // 	    	cookie('view_shops',$view_shops);
         $view_shops[$shop_info['id']] = json_encode($shop_info);
         cookie('view_shops', $view_shops);
         // 	    	echo '<pre />';
         // 	    	print_r(cookie('view_shops'));
         /*************************************************************************************/
         $this->assign($data);
         $this->assign($comments);
         if (IS_AJAX) {
             $this->display('comments_ajax');
         } else {
             $this->display('list');
         }
     } else {
         /*如果前置条件不符合,执行以下操作*/
         $this->error($result['msg']);
     }
 }
Ejemplo n.º 4
0
 /**
  * 商品编辑
  * 如果是表单提交更新数据
  * 否则查询出要编辑的商品,在页面中展示高商品的信息
  *
  * @author					李东
  * @date					2015-07-03
  */
 public function edit()
 {
     if (IS_POST) {
         $shop_id = session('home_shop_id');
         $result = $this->update($shop_id);
         $this->appOut($result, $this->apptype, 0);
         //    		if($result['status'] == 1){
         //    			$this->success($result['msg'],$result['url']);
         //    		}else{
         //    			$this->error($result['msg'],$result['url']);
         //    		}
     } else {
         $gets = I('get.');
         $id = $gets['id'];
         $map['id'] = $id;
         $info = get_info(D($this->model), $map);
         /*获取格式为 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=>title 的产品分类数组*/
         $product_type = id_and_text($this->product_type);
         /*暂时将一维数组转化为二维数组*/
         $temp[] = $info;
         $temp = int_to_string($temp, array("language_id" => $language_text, "to_language_id" => $language_text));
         /*将Json中所有ID转换成文字字符串*/
         $temp = json_to_chars($temp, array('industry_id' => $industry_text, 'ability_id' => $ability_text));
         $info = $temp[0];
         /*将二维数组还原成一维数组*/
         $ability_ids = json_decode($info['ability_id'], true);
         $industry_ids = json_decode($info['industry_id'], true);
         //     		print_r($info);exit;
         $data['info'] = $info;
         $data['ability_ids'] = $ability_ids;
         $data['industry_ids'] = $industry_ids;
         $data['product_level'] = get_product_level_cache();
         $data['product_type'] = $this->product_type;
         $data['ability'] = list_to_tree(get_ability_cache());
         $data['industry'] = list_to_tree(get_industry_cache());
         $data['language'] = get_language_cache();
         $tips_msg = array('status' => 1, 'info' => $data);
         $this->appOut($tips_msg, $this->apptype, 1, 'operate');
         //    		$this->assign($data);
         //    		$this->display('operate');
     }
 }
Ejemplo n.º 5
0
/**
 * 获取热销商品
 * @param int $shop_id						店铺ID
 * @return array 							查询处理后的结果集
 * @author									李东
 * @date									2015-07-25
 */
function get_hot_product($shop_id)
{
    $map['shop_id'] = $shop_id;
    $map['status'] = 1;
    $limit = 9;
    $order = ' id desc ';
    $result = get_result('products', $map, '', $order, $limit);
    /*获取格式为 id=>title 的语言分类数组*/
    $language_text = id_and_text(get_language_cache());
    /*获取格式为 id=>title 的等级分类数组*/
    $level_text = id_and_text(get_product_level_cache());
    /*获取格式为 id=>title 的产品分类数组*/
    $product_type = id_and_text(list_to_tree(get_ability_cache()));
    /*获取缓存的分类属性转换为树状*/
    $result = int_to_string($result, array('level_id' => $level_text, "type" => $product_type, "language_id" => $language_text, "to_language_id" => $language_text));
    /*将json格式ID转为逗号分隔的Title*/
    /*获取格式为 id=>title 的领域分类数组*/
    $industry_text = id_and_text(get_industry_cache());
    /*获取格式为 id=>title 的属性分类数组*/
    $ability_text = id_and_text(get_ability_cache());
    /*将Json中所有ID转换成文字字符串*/
    $result = json_to_chars($result, array('industry_id' => $industry_text, 'ability_id' => $ability_text));
    return $result;
}
Ejemplo n.º 6
0
 public function index()
 {
     $member_id = session('home_member_id');
     if ($member_id) {
         $result_collect = get_result($this->table_collect, array('member_id' => $member_id, 'status' => 1));
         $result = array();
         foreach ($result_collect as $key => $value) {
             $result[] = get_info(D($this->member_model), array('id' => $value['collect_id']));
             $result[$key]['collect_id'] = $value['id'];
         }
         /*计算查询出的店铺数量*/
         $seller_count = count($result);
         /*获取语言信息*/
         $language = get_language_cache();
         /*获取技能信息*/
         $ability = list_to_tree(get_ability_cache());
         /*获取行业信息*/
         $industry = get_industry_cache();
         /*获取数组键值为语言ID的新数组*/
         foreach ($language as $val) {
             $language_id_key[$val['id']] = $val;
         }
         foreach ($result as $key => $row) {
             /*处理擅长语言*/
             $good_at = json_decode($row['good_at'], true);
             $good_at_new = array();
             //必须设置为空,不然会影响循环之后的数据
             foreach ($good_at as $k => $v) {
                 $good_at_new[$k]['id'] = $v;
                 $good_at_new[$k]['title'] = $language_id_key[$v]['title'];
             }
             $result[$key]['good_at_arr'] = $good_at_new;
             /*处理店铺logo*/
             if (is_file($row['logo'])) {
                 $result[$key]['logo'] = __ROOT__ . '/' . $row['logo'];
             } else {
                 $result[$key]['logo'] = __ROOT__ . '/Public/Home/img/company_img.jpg';
             }
         }
         /*常见问题*/
         $common_problem = get_common_problem();
         $data['common_problem'] = $common_problem;
         $data['seller_count'] = $seller_count;
         $data['result'] = $result;
         $data['language'] = $language;
         $data['ability'] = $ability;
         $data['industry'] = $industry;
         $data['seller_type'] = $this->seller_type;
         $data['param'] = $this->search;
         if ($apptype) {
             $this->ajaxReturn($data);
             //返回给手机app的json数据
         }
         $buy_shop = array();
         if (!empty($this->member_info)) {
             $buy_shop = json_decode($this->member_info['has_buy'], true);
         }
         $data['buy_shop'] = $buy_shop;
         //@赵群@查询地理信息
         $area = get_area_cache();
         $area_id_key = array_id_key($area);
         $address_data = array();
         foreach ($result as $key => $value) {
             $address_data[] = get_info('address', array('member_id' => $value['member_id']), $field = array('member_id', 'area_path'));
         }
         foreach ($address_data as $key => $value) {
             $address_arr = $value['area_path'];
             $path = explode('-', $address_arr);
             $new_address = $area_id_key[$path['2']]['title'] . $area_id_key[$path['3']]['title'] . $area_id_key[$path['4']]['title'];
             $address_data[$key]['path'] = $new_address;
         }
         // 			dump($data['result']);die;
         $this->assign($data)->assign('address_data', $address_data);
         $this->display();
     } else {
         $this->error('请先登录!');
     }
 }