public function index()
 {
     $title = I('title');
     if (!empty($title)) {
         $map['telephone'] = array('like', '%' . $title . '%');
         $data['title'] = $title;
     }
     $map['status'] = array('gt', -1);
     $list = $this->page($this->table, $map, 'id desc,status desc');
     /*获取语言信息*/
     $language = get_language_cache();
     foreach ($language as $key => $val) {
         $language_arr[$val['id']] = $val['title'];
     }
     $list = int_to_string($list, array('status' => array(0 => '未处理', 1 => '已处理'), 'language_id' => $language_arr, 'to_language_id' => $language_arr, 'type' => array(1 => '个人译者', 2 => '商家译者', 3 => '商家或个人')));
     $data['list'] = $list;
     $this->assign($data);
     $this->display();
 }
 /**
  *
  **/
 public function index()
 {
     if (C('IS_MOBILE') == 1) {
         //表示是手机访问
     } else {
         if (C('IS_MOBILE') == 0) {
             //表示是pc访问
         }
     }
     $apptype = $this->appParam();
     if ($apptype == -1) {
         $apptype = false;
     } else {
         $apptype = true;
     }
     //$apptype = (!empty(I('post.apptype')) and I('post.apptype')==C('APP_KEY'))?true:false;//手机app接口密钥
     if ($apptype) {
         $language = get_language_cache();
         foreach ($this->info["shop_company"] as $k => $row) {
             $language_id_key = array_id_key($language);
             $good_at = json_decode($row['good_at'], true);
             $good_at_info = array();
             $i = 0;
             foreach ($good_at as $key => $val) {
                 if ($i < 2) {
                     if (!empty($language_id_key[$val]['title'])) {
                         $i++;
                         $good_at_info[] = $language_id_key[$val]['title'];
                     }
                 } else {
                     continue;
                 }
             }
             if (!empty($good_at_info)) {
                 $this->info["shop_company"][$k]["good_at_info"] = implode(" ", $good_at_info);
             }
         }
         $rec_language = get_language_recommend_cache();
         /*查询推荐的源语言*/
         $this->info['recommend_language'] = $rec_language;
         dump($info);
         $this->ajaxReturn($this->info);
     } else {
         //查询出banner数据
         $result = get_result($this->table, array('status' => 1));
         if (C('IS_MOBILE') == 1) {
             //表示是手机访问
             $this->ajaxReturn(array('result' => $result));
         } else {
             if (C('IS_MOBILE') == 0) {
                 //表示是pc访问
                 $this->display();
             }
         }
     }
 }
 public function index()
 {
     //接收用户筛选信息,具体的信息看,组织查询的条件
     $map['status'] = array('GT', -1);
     $keywords = I('keywords');
     $language_title = I('language_title');
     $to_language_title = I('to_language_title');
     //获取语言信息
     $temp_language = get_language_cache();
     $language = array();
     foreach ($temp_language as $val) {
         //让数组的Key值与当前数据的ID对应
         $language[$val['id']] = $val;
     }
     if ($keywords) {
         $keywords = trim($keywords);
         $map['shop_title'] = array('like', "%{$keywords}%");
         //这里还可以添加其他的关键词
         $data['keywords'] = $keywords;
         //将本次的关键词显示到页面中去
     }
     //将源语言存入过滤条件中
     if ($language_title) {
         $language_title = trim($language_title);
         foreach ($language as $key => $value) {
             if (is_numeric(strpos($value['title'], $language_title))) {
                 //$map['language_id']=array('in',$language_ids);
                 $language_ids[] = $key;
             }
             //				foreach ($value as $k=>$v){
             //					if ($language_title == $v){
             //							$map['language_id'] = $key;
             //					}
             //				}
         }
         if (!empty($language_ids)) {
             $map['language_id'] = array('in', $language_ids);
         } else {
             $map['to_language_id'] = 0;
         }
         $data['language_title'] = $language_title;
     }
     //将目标语言存入过滤条件中
     if ($to_language_title) {
         $to_language_title = trim($to_language_title);
         foreach ($language as $key => $value) {
             if (is_numeric(strpos($value['title'], $to_language_title))) {
                 //$map['language_id']=array('in',$language_ids);
                 $to_language_ids[] = $key;
             }
             //				foreach ($value as $k=>$v){
             //					if ($to_language_title == $v){
             //						$map['to_language_id'] = $key;
             //					}
             //				}
         }
         if (!empty($to_language_ids)) {
             $map['to_language_id'] = array('in', $to_language_ids);
         } else {
             $map['to_language_id'] = 0;
         }
         $data['to_language_title'] = $to_language_title;
     }
     //按照条件将信息显示出来
     $result = $this->page(D($this->model), $map, $order = 'id desc', $field = array(), $this->limit);
     //将信息中的int字段转化成文字信息
     $result = int_to_string($result, array("product_status" => array("0" => "下架", "1" => "上架"), "recommend" => array("0" => "推荐", "1" => "取消推荐"), 'assess' => array("0" => '审核', "1" => '取消审核')));
     $data['result'] = $result;
     $this->assign($data);
     $this->display();
 }
						</div>
					</div>
					<button class="pull-right search_btn" type="submit" >
						<i class="fa fa-search f_18" ></i>
					</button>
					<div class="search_input_box">
						<input type="text" name="search" placeholder="输入您想找的翻译公司,翻译人员,翻译语言" value='<?php 
echo $param['search'];
?>
'>
					</div>
				</div>
				</form>
				<div class="tag">
					<?php 
$language = get_language_cache();
$i = 0;
foreach ($recommend_language as $k => $v) {
    if ($v['pid'] == 1 && $v['recommend'] == 1 && $i <= 8) {
        ?>
					<a href="<?php 
        echo U('Home/Classes/index', array('language_id' => $v['id']));
        ?>
"><?php 
        echo $v['title'];
        ?>
</a>
					<?php 
        $i++;
    }
}
 function get_shop_comments()
 {
     $get = I('get.');
     $sort = 'comment.add_time desc';
     $maps["type"] = array('in', array(1, 2, 3));
     if (!empty($get)) {
         if ($get['type'] != 0) {
             //0表示全部
             $maps['type'] = $get['type'];
         }
     }
     //获取筛选数据
     $maps['pid'] = 0;
     //表示正常的回复
     $maps["status"] = 2;
     //审核通过并被启用的评论
     //查询当前订单信息
     $order_id = intval(I("get.order_id"));
     $order_info = get_info("orders", array("id" => $order_id));
     //dump($order_info);
     $maps["product_id"] = $order_info["product_id"];
     //统计店铺的好评数,中评数,差评数
     $shop_good_comments = get_result($this->comment, array('product_id' => $order_info['product_id'], 'status' => 2, 'type' => 1, 'pid' => 0));
     $good_comments_num = count($shop_good_comments);
     $shop_mid_comments = get_result($this->comment, array('product_id' => $order_info['product_id'], 'status' => 2, 'type' => 2, 'pid' => 0));
     $mid_comments_num = count($shop_mid_comments);
     $shop_bad_comments = get_result($this->comment, array('product_id' => $order_info['product_id'], 'status' => 2, 'type' => 3, 'pid' => 0));
     $bad_comments_num = count($shop_bad_comments);
     $all_comments_num = $good_comments_num + $mid_comments_num + $bad_comments_num;
     //所有评价的次数
     $shop_comments = $this->page(D('CommentProductView'), $maps, $sort);
     //dump($shop_comments);
     //将语言和评论关联起来
     $language_data = get_language_cache();
     $language_data = array_id_key($language_data);
     //将所属技能与评价关联
     $get_serve_cache = get_serve_cache();
     $get_serve_cache = array_id_key($get_serve_cache);
     foreach ($shop_comments as $k => $v) {
         $shop_comments[$k]['language_text'] = $language_data[$v['language_id']]['title'];
         $shop_comments[$k]['to_language_text'] = $language_data[$v['to_language_id']]['title'];
         $shop_comments[$k]['serve_text'] = $get_serve_cache[$v['product_type']]['title'];
         //查询当前评论的图片
         $image = get_result("comment_image", array("comment_id" => $v["id"]));
         $comments_image[$v["id"]] = $image;
     }
     //将评价和回复结合起来
     //当前页面的回复的id
     foreach ($shop_comments as $v) {
         $ids .= $v['id'] . ',';
     }
     if ($ids) {
         $shop_comments_s = get_result($this->comment, array('product_id' => $order_info['product_id'], 'status' => 2, 'pid' => array('in', trim($ids, ','))));
         $shop_comments_s = int_to_string($shop_comments_s, array('type' => array(1 => '好评', 2 => '中评', 3 => '差评')));
         if ($shop_comments_s) {
             foreach ($shop_comments_s as $v) {
                 $shop_comments[] = $v;
             }
             $shop_comments = list_to_tree($shop_comments, 'id', 'pid', '_child', 0, 'id');
         }
     }
     $comments = array('good_comments_num' => $good_comments_num, 'mid_comments_num' => $mid_comments_num, 'bad_comments_num' => $bad_comments_num, 'all_comments_num' => $all_comments_num, 'shop_comments' => $shop_comments, 'comments_image' => $comments_image);
     return $comments;
 }
 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']);
     }
 }
 /**
  *鐩稿唽/瑙嗛绠$悊
  *	鏄剧ず搴楅摵鐨勮棰戝拰鐓х墖
  *@author 鍒樻旦  <*****@*****.**>
  *@time 2015-07-07
  **/
 public function index()
 {
     $laguage = get_language_cache();
     $laguage2 = array_id_key($laguage);
     $this->display();
 }
Example #8
0
 /**
  * 商品更新
  * 添加商品/修改商品的方法
  * 
  * @author						李东
  * @date						2015-07-01
  */
 public function update($shop_id)
 {
     if (IS_POST) {
         $posts = I('post.');
         if (intval($posts['id']) > 0) {
             $map['id'] = $posts['id'];
             $map['shop_id'] = session('home_shop_id');
             //按照登录店铺的ID来查看
             $info = get_info($this->table, $map);
             if (!$info) {
                 return array('status' => 0, 'msg' => '操作失败');
             }
         }
         /* 定义添加验证规则 */
         $rules = array(array('title', 'require', '名称不能为空'), array('type', 'require', '请选择类型'), array('language_id', 'require', '请选择源语言'), array('to_language_id', 'require', '请选择目标语言'), array('short_description', 'require', '简介不能为空'), array('price', 'require', '请填写价格'), array('level_id', 'require', '请选择等级'));
         if (empty($posts['industry_id'])) {
             return array('status' => '0', 'msg' => '请设置行业');
         }
         if ($posts['language_id'] == $posts['to_language_id']) {
             return array('status' => '0', 'msg' => '源语言不能与目标语言相同');
         }
         if (is_numeric($posts['price'])) {
             if (floatval($posts['price']) <= 0) {
                 return array('status' => '0', 'msg' => '价额应大于0');
             }
         }
         if (empty($posts['start_time']) || $posts['start_time'] == '0000-00-00 00:00:00') {
             return array('status' => '0', 'msg' => '请填写开始时间');
         }
         if (empty($posts['expired_time']) || $posts['expired_time'] == '0000-00-00 00:00:00') {
             return array('status' => '0', 'msg' => '请填写结束时间');
         }
         /*判断添加的产品是否在服务范围内*/
         $status = $this->check_type($shop_id, $posts['language_id'], $posts['to_language_id']);
         if (!empty($status)) {
             return $status;
         }
         if ($posts['start_time'] > $posts['expired_time']) {
             return array('status' => 0, 'msg' => '结束时间必须大于开始时间');
         }
         $industry_id = json_encode($posts['industry_id']);
         $language = id_and_text(get_language_cache());
         $title = $language[$posts['language_id']] . '翻译成' . $language[$posts['to_language_id']];
         $_POST = array('id' => $posts['id'], 'title' => $title, 'language_id' => $posts['language_id'], 'to_language_id' => $posts['to_language_id'], 'short_description' => $posts['short_description'], 'description' => $posts['description'], 'price' => $posts['price'], 'keywords' => $posts['keywords'], 'industry_id' => $industry_id, 'type' => $posts['type'], 'ability_id' => json_encode($posts['ability_3']), 'level_id' => $posts['level_id'], 'start_time' => $posts['start_time'], 'expired_time' => $posts['expired_time'], 'description' => $posts['description'], 'shop_id' => session("home_shop_id"), 'invoice' => $posts['invoice'], 'status' => 1, 'assess' => 1);
         $result = update_data($this->table, $rules);
         /* 判断执行操作是否成功 */
         if (is_numeric($result)) {
             // 				$price=$this->get_min_price();
             // 				if($posts['price']<=$price){
             // 					$_POST=null;
             // 					$_POST['id']=session('home_shop_id');
             // 					$_POST['min_price']=$posts['price'];
             // 				}
             //当用户添加商品成功时,更新店铺表
             $sql .= "UPDATE sr_shop SET have_product=1 WHERE id=" . session('home_shop_id');
             $Model = M();
             $result2 = $Model->execute($sql);
             $price = $this->get_min_price();
             if ($posts['price'] <= $price) {
                 $_POST = null;
                 $_POST['id'] = session('home_shop_id');
                 $_POST['min_price'] = $posts['price'];
             } else {
                 $_POST = null;
                 $_POST['id'] = session('home_shop_id');
                 $_POST['min_price'] = $price;
             }
             /*更新店铺最低价*/
             update_data($this->shop_table);
             F($this->category_cache, null);
             /* 操作成功清除缓存 */
             return array('status' => '1', 'msg' => '操作成功', 'url' => U('index'));
             // 				$this->success('操作成功',U('index',array('pid'=>intval(I('post.pid')))));
         } else {
             return array('status' => '0', 'msg' => $result);
             // 				$this->error($result);
         }
     } else {
         return array('status' => '0', 'msg' => '违法操作', 'url' => U('index'));
         // 			$this->error('违法操作',U('index'));
     }
 }
 /**
  *我的评价
  *	查询显示用户的评价
  *流程分析
  *	就是比店铺评价多了一个member_id筛选
  **/
 public function member_evaluate()
 {
     $post = I('post.');
     $sort = 'comment.add_time desc';
     $member_id = session('home_member_id');
     if (!empty($post)) {
         if ($post['radio'] != 0) {
             //0表示全部
             $maps['type'] = $post['radio'];
         }
         switch ($post['select']) {
             case 1:
                 $sort = 'comment.add_time desc';
                 break;
             case 2:
                 $sort = 'comment.add_time asc';
                 break;
         }
     }
     $shop_id = session('home_shop_id');
     //获取筛选数据
     //$maps['shop_id'] = $shop_id;
     //$maps['status'] = 2;
     $maps['member_id'] = $member_id;
     $maps['pid'] = 0;
     //$maps = array_merge($maps,$map);
     //计算店铺的星级??????
     //统计店铺的好评数,中评数,差评数
     $shop_good_comments = get_result($this->comment, array('member_id' => $member_id, 'type' => 1, 'pid' => 0));
     $good_comments_num = count($shop_good_comments);
     $shop_mid_comments = get_result($this->comment, array('member_id' => $member_id, 'type' => 2, 'pid' => 0));
     $mid_comments_num = count($shop_mid_comments);
     $shop_bad_comments = get_result($this->comment, array('member_id' => $member_id, 'type' => 3, 'pid' => 0));
     $bad_comments_num = count($shop_bad_comments);
     $total_comments_num = $good_comments_num + $mid_comments_num + $bad_comments_num;
     $shop_comments = $this->page(D($this->comment_product), $maps, $sort, '', $this->limit);
     //关联查询商品和评论表
     $shop_comments = int_to_string($shop_comments, array('type' => array(1 => '好评', 2 => '中评', 3 => '差评')));
     //将语言和评论关联起来
     $language_data = get_language_cache();
     $language_data = array_id_key($language_data);
     //将所属技能与评价关联
     $get_serve_cache = get_serve_cache();
     $get_serve_cache = array_id_key($get_serve_cache);
     foreach ($shop_comments as $k => $v) {
         $shop_comments[$k]['language_text'] = $language_data[$v['language_id']]['title'];
         $shop_comments[$k]['to_language_text'] = $language_data[$v['to_language_id']]['title'];
         $shop_comments[$k]['serve_text'] = $get_serve_cache[$v['product_type']]['title'];
         //查询当前评论的图片
         $image = get_result("comment_image", array("comment_id" => $v["id"]));
         $comments_image[$v["id"]] = $image;
     }
     //将评价和回复结合起来
     //当前页面的回复的id
     foreach ($shop_comments as $v) {
         $ids .= $v['id'] . ',';
     }
     if ($ids) {
         $shop_comments_s = get_result($this->comment, array('pid' => array('in', trim($ids, ','))));
         $shop_comments_s = int_to_string($shop_comments_s, array('type' => array(1 => '好评', 2 => '中评', 3 => '差评')));
         if ($shop_comments_s) {
             foreach ($shop_comments_s as $v) {
                 $shop_comments[] = $v;
             }
             $shop_comments = list_to_tree($shop_comments, 'id', 'pid', '_child', 0);
         }
     }
     $comments = array('total_comments_num' => $total_comments_num, 'good_comments_num' => $good_comments_num, 'mid_comments_num' => $mid_comments_num, 'bad_comments_num' => $bad_comments_num, 'shop_comments' => $shop_comments, 'comments_image' => $comments_image);
     $this->assign($comments);
     if (!empty($post)) {
         $this->display('order_evaluate_ajax');
     } else {
         $this->display('order_evaluate');
     }
 }
 public function companyinfo()
 {
     if (session('home_shop_id')) {
         $shop_id = session('home_shop_id');
         //查询用户店铺的信息
         $shop_info = get_info(D('MemberShopView'), array('id' => $shop_id));
         //print_r($shop_info);exit;
         //查询地理信息
         $area_data = get_area_cache();
         $area_list = list_to_tree($area_data);
         //查询店铺的地理信息
         $shop_area_id = $shop_info['area_id'];
         foreach ($area_list as $val) {
             foreach ($val['_child'] as $v) {
                 foreach ($v['_child'] as $vv) {
                     if ($vv['id'] == $shop_area_id) {
                         $shop_info['city'] = $v['id'];
                         $shop_info['province'] = $val['id'];
                         $city_data = $val['_child'];
                         $area_k = $v['_child'];
                     }
                 }
             }
         }
         //查询语种分类
         $language_data = list_to_tree(get_language_cache());
         //查询擅长的领域
         $good_at = json_decode($shop_info['good_at']);
         $data['shop_info'] = $shop_info;
         $data['area_data'] = $area_data;
         $data['city_data'] = $city_data;
         $data['area_k'] = $area_k;
         $data['good_at'] = $good_at;
         $data['language_data'] = $language_data;
         // 			$time_data_s = explode("~", $shop_info['work_time_s']);
         // 			$time_data_e = explode("~", $shop_info['work_time_e']);
         $time_data_s = json_decode($shop_info['work_time_s']);
         $time_data_e = json_decode($shop_info['work_time_e']);
         $this->assign('time_data_s', $time_data_s)->assign('time_data_e', $time_data_e);
         $tips_msg = array('status' => 1, 'info' => $data);
         $this->appOut($tips_msg, $this->apptype, 1);
         //			if ($apptype){
         //				$appinfo['shop_info'] = $shop_info;//用户店铺信息
         //				$appinfo['area_data'] = $area_data;//地理信息
         //				$appinfo['good_at'] = $good_at;//擅长领域
         //				$appinfo['language_data'] = $language_data;//语种分类
         //				$this->ajaxReturn($data['address']);
         //			}
         //			$this->assign($data);
         //			$this->display();
     } else {
         $tips_msg = array('status' => 1, 'info' => '您的店铺尚未开通!', 'url' => U('Home/Index/index'));
         $this->appOut($tips_msg, $this->apptype, 0);
     }
 }
Example #11
0
 /**
  * 加载支付页面
  * 用于选择支付方式	
  * @author						李东
  * @date						2015-07-10
  */
 public function pop_pay()
 {
     $gets = I('get.');
     $member_id = session("home_member_id");
     $order_id = $gets['order_id'];
     if ($member_id && $order_id) {
         /*判断用户是否登录*/
         $map['member_id'] = $member_id;
         $map['id'] = $order_id;
         /*如果是商家查看订单*/
         $order_info = get_info(D($this->model), $map);
         $member_info = get_info($this->member_table, array('id' => $member_id));
         if (!$order_info) {
             /*如果没有获取到订单信息*/
             $tips_msg = array('status' => '0', 'msg' => '请登录后再操作');
             //跳出该if判断,跳转到输出位置
             goto export;
         } elseif ($order_info['order_status'] > 1) {
             $tips_msg = array('status' => '0', 'msg' => '该订单无法支付');
             goto export;
         } else {
             $order_info['step'] = 2;
             /*将用户操作步骤暂时设置为2,当客户完成付款直接到3*/
         }
         /*获取语言列表*/
         $language = array_id_key(get_language_cache());
         //     			print_r($order_info['to_language_id']);exit;
         $order_info['product_to_language_id_text'] = $language[$order_info['product_to_language_id']]['title'];
         $order_info['product_language_id_text'] = $language[$order_info['product_language_id']]['title'];
         //     			print_r($order_info);
         $tips_msg = array('status' => '1', 'msg' => '加载成功', 'order_info' => $order_info);
     } elseif (!$member_id) {
         $tips_msg = array('status' => '0', 'msg' => '请登录后再操作');
     } else {
         $tips_msg = array('status' => '0', 'msg' => '错误请求');
     }
     /*输出位置*/
     export:
     if ($tips_msg['status'] != 0) {
         $data['order_info'] = $tips_msg['order_info'];
         $data['member_info'] = $member_info;
         $this->assign($data);
         $this->display('step_3_payorder');
     } else {
         $this->error($tips_msg['msg']);
     }
 }
Example #12
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;
}
 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('请先登录!');
     }
 }