</div> <div class="search_input clearfix"> <div class="pull-left search_select"> <div class="sim-select-box"> <div class="sim-select-checked"> <?php if (!isset($param['ability_id']) or $param['ability_id'] == 0) { ?> <input type="hidden" name="ability_id" value='0'><span>全部</span><i class="fa fa-caret-down f_18"></i> <?php } else { ?> <?php $serve_type = get_serve_cache(); $ability1 = array_id_key(get_ability_cache()); foreach ($serve_type as $k => $v) { if (isset($param['ability_id'])) { if ($param['ability_id'] == $v['id']) { ?> <input type="hidden" name="ability_id" value='<?php echo $v['id']; ?> '><span><?php echo $v['title']; ?> </span><i class="fa fa-caret-down f_18"></i> <?php } else { if ($param['ability_id'] == $ability1[$param['ability_id']]['id']) {
private function get_shop_comments() { $post = I('post.'); $sort = 'comment.add_time desc'; //$this->ajaxReturn($post['shop_id']); $maps["type"] = array('in', array(1, 2, 3)); 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; } } //获取筛选数据 $maps['shop_id'] = $this->shop_id; //$maps['status'] = 2;---- $maps['pid'] = 0; //表示正常的回复 //$maps = array_merge($maps,$map); //计算店铺的星级?????? /*if(I('get.type')){ $maps=array( 'type'=>I('get.type'), 'status'=>2, ); } else{ $maps=array( 'type'=>array(in,array(1,2,3)), 'status'=>2, ); }*/ $maps["status"] = 2; //审核通过并被启用的评论 //dump($maps); //exit; //统计店铺的好评数,中评数,差评数 $shop_good_comments = get_result($this->comment, array('shop_id' => $this->shop_id, 'status' => 2, 'type' => 1, 'pid' => 0)); $good_comments_num = count($shop_good_comments); $shop_mid_comments = get_result($this->comment, array('shop_id' => $this->shop_id, 'status' => 2, 'type' => 2, 'pid' => 0)); $mid_comments_num = count($shop_mid_comments); $shop_bad_comments = get_result($this->comment, array('shop_id' => $this->shop_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($this->comment_product), $maps, $sort, '', $this->limit); //dump($shop_comments);//die; //$this->ajaxReturn(session('sql')); //将语言和评论关联起来 $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('shop_id' => $shop_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; }
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; }
/** *我的评价 * 查询显示用户的评价 *流程分析 * 就是比店铺评价多了一个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'); } }