public function index() { if (empty($this->user_session)) { } $index_right_adver = D("Adver")->get_adver_by_key("index_right", 3); $this->assign("index_right_adver", $index_right_adver); $web_index_slider = D("Slider")->get_slider_by_key("web_slider"); $this->assign("web_index_slider", $web_index_slider); $all_category_list = D("Group_category")->get_category(); $this->assign("all_category_list", $all_category_list); $store_id = intval($_GET["store_id"]); $store = D("Merchant_store")->where(array("store_id" => $store_id))->find(); if (empty($store)) { $this->group_noexit_tips(); } $store["office_time"] = unserialize($store["office_time"]); $pre = $str = ""; foreach ($store["office_time"] as $time) { $str = $pre . $time["open"] . "-" . $time["close"]; $pre = ","; } $store["office_time"] = $str; $store_image_class = new store_image(); $store["images"] = $store_image_class->get_allImage_by_path($store["pic_info"]); $store_meal = D("Merchant_store_meal")->where(array("store_id" => $store_id))->find(); $store_meal["deliver_time"] = unserialize($store["deliver_time"]); $store_meal["width"] = 72 / 5 * $store_meal["score_mean"]; $store = array_merge($store, $store_meal); $merchant = M("Merchant")->where(array("mer_id" => $store["mer_id"]))->find(); $merchant_image = new merchant_image(); $merchant["merchant_pic"] = $merchant_image->get_allImage_by_path($merchant["pic_info"]); $collect_count = D("User_collect")->where(array("type" => "meal_detail", "id" => $store_id))->count(); $is_collect = 0; if ($collect = D("User_collect")->where(array("type" => "meal_detail", "id" => $store_id, "uid" => $this->user_session["uid"]))->find()) { $is_collect = 1; } $this->assign("collect_count", $collect_count); $this->assign("is_collect", $is_collect); $area = M("Area")->where(array("area_id" => $store["circle_id"]))->find(); $this->assign("area", $area); $this->assign("merchant", $merchant); $this->assign("store", $store); $this->display(); }
public function index() { //右侧广告 // $index_right_adver = D('Adver')->get_adver_by_key('index_right',3); // $this->assign('index_right_adver',$index_right_adver); //导航条 $web_index_slider = D('Slider')->get_slider_by_key('web_slider'); $this->assign('web_index_slider', $web_index_slider); //所有分类 包含2级分类 $all_category_list = D('Group_category')->get_category(); $this->assign('all_category_list', $all_category_list); //热门搜索词 $search_hot_list = D('Search_hot')->get_list(12, 0); $this->assign('search_hot_list', $search_hot_list); $now_group = D('Group')->get_group_by_groupId($_GET['group_id'], 'hits-setInc'); if (empty($now_group)) { $this->group_noexit_tips($this->config['group_alias_name'] . '不存在。'); } //商家的活动 $lotterys = D("Lottery")->field(true)->where(array('token' => $now_group['mer_id'], 'statdate' => array('lt', time()), 'enddate' => array('gt', time())))->select(); foreach ($lotterys as $lottery) { $index_right_adver[] = array('name' => $lottery['title'], 'pic' => $lottery['starpicurl'], 'url' => 'javascript:void(0);', 'id' => $lottery['id']); } $this->assign('index_right_adver', $index_right_adver); if ($now_group['cue']) { $now_group['cue_arr'] = unserialize($now_group['cue']); } if (!empty($now_group['pic_info'])) { $merchant_image_class = new merchant_image(); $now_group['merchant_pic'] = $merchant_image_class->get_allImage_by_path($now_group['pic_info']); } if (!empty($this->user_session)) { $database_user_collect = D('User_collect'); $condition_user_collect['type'] = 'group_detail'; $condition_user_collect['id'] = $now_group['group_id']; $condition_user_collect['uid'] = $this->user_session['uid']; if ($database_user_collect->where($condition_user_collect)->find()) { $now_group['is_collect'] = true; } } $this->assign('now_group', $now_group); $f_category = D('Group_category')->get_category_by_id($now_group['cat_fid']); if (empty($f_category)) { $this->group_noexit_tips($this->config['group_alias_name'] . '上级分类不存在。'); } $this->assign('f_category', $f_category); $s_category = D('Group_category')->get_category_by_id($now_group['cat_id']); if (empty($s_category)) { $this->group_noexit_tips($this->config['group_alias_name'] . '分类不存在。'); } $this->assign('s_category', $s_category); if ($now_group['packageid'] > 0) { $packages = M('Group_packages')->where(array('id' => $now_group['packageid'], 'mer_id' => $now_group['mer_id']))->find(); if (!empty($packages['groupidtext'])) { $mpackages = unserialize($packages['groupidtext']); } else { $mpackages = false; } $this->assign('mpackages', $mpackages); } //商家团购列表 $merchant_group_list = D('Group')->get_grouplist_by_MerchantId($now_group['mer_id'], 0, false, $now_group['group_id']); $this->assign('merchant_group_list', $merchant_group_list); //猜您喜欢 $like_group_list = D('Group')->get_grouplist_by_catId($now_group['cat_id'], $now_group['cat_fid'], 5); foreach ($like_group_list as $key => $value) { if ($value['group_id'] == $now_group['group_id']) { unset($like_group_list[$key]); } } $this->assign('like_group_list', $like_group_list); //分类下最热门团购,销售量 $category_hot_group_list = D('Group')->get_grouplist_by_catId($now_group['cat_id'], $now_group['cat_fid'], 4, false, '`sale_count` DESC'); foreach ($category_hot_group_list as $key => $value) { if ($value['group_id'] == $now_group['group_id']) { unset($category_hot_group_list[$key]); } } $this->assign('category_hot_group_list', $category_hot_group_list); $this->display(); }
public function set() { $now_group = D('Group')->get_group_by_groupId($_GET['group_id'], 'hits-setInc'); if (empty($now_group)) { $this->error_tips('当前' . $this->config['group_alias_name'] . '不存在!'); } if ($now_group['cue']) { $now_group['cue_arr'] = unserialize($now_group['cue']); } if (!empty($now_group['pic_info'])) { $merchant_image_class = new merchant_image(); $now_group['merchant_pic'] = $merchant_image_class->get_allImage_by_path($now_group['pic_info']); } if (!empty($this->user_session)) { $database_user_collect = D('User_collect'); $condition_user_collect['type'] = 'group_detail'; $condition_user_collect['id'] = $now_group['group_id']; $condition_user_collect['uid'] = $this->user_session['uid']; if ($database_user_collect->where($condition_user_collect)->find()) { $now_group['is_collect'] = true; } } $this->assign('now_group', $now_group); if ($now_group['reply_count']) { $reply_list = D('Reply')->get_reply_list($now_group['group_id'], 0, count($now_group['store_list']), 3); $this->assign('reply_list', $reply_list); } $merchant_group_list = D('Group')->get_grouplist_by_MerchantId($now_group['mer_id'], 3, true, $now_group['group_id']); $this->assign('merchant_group_list', $merchant_group_list); //分类下其他团购 $category_group_list = D('Group')->get_grouplist_by_catId($now_group['cat_id'], $now_group['cat_fid'], 3, true); foreach ($category_group_list as $key => $value) { if ($value['group_id'] == $now_group['group_id']) { unset($category_group_list[$key]); } } $this->assign('category_group_list', $category_group_list); /* 粉丝行为分析 */ D('Merchant_request')->add_request($now_group['mer_id'], array('group_hits' => 1)); /* 粉丝行为分析 */ $this->behavior(array('mer_id' => $now_group['mer_id'], 'biz_id' => $now_group['group_id'], 'keyword' => strval($_GET['keywords']))); $this->display(); }
public function index() { //判断登录 if (empty($this->user_session)) { // $this->assign('jumpUrl',U('Index/Login/index')); // $this->error('请先登录!'); } //右侧广告 $index_right_adver = D('Adver')->get_adver_by_key('index_right', 3); $this->assign('index_right_adver', $index_right_adver); //导航条 $web_index_slider = D('Slider')->get_slider_by_key('web_slider'); $this->assign('web_index_slider', $web_index_slider); $all_category_list = D('Group_category')->get_category(); $this->assign('all_category_list', $all_category_list); $store_id = intval($_GET['store_id']); //店铺信息 $store = D('Merchant_store')->where(array('store_id' => $store_id))->find(); if (empty($store)) { $this->group_noexit_tips(); } $store['office_time'] = unserialize($store['office_time']); $pre = $str = ''; $store['state'] = 0; $now_time = time(); foreach ($store['office_time'] as $time) { $str = $pre . $time['open'] . '-' . $time['close']; $pre = ','; $open = strtotime(date("Y-m-d ") . $time['open'] . ':00'); $close = strtotime(date("Y-m-d ") . $time['close'] . ':00'); if ($open < $now_time && $now_time < $close) { $store['state'] = 1; //根据营业时间判断 } } $store['office_time'] = $str; $store_image_class = new store_image(); $store['images'] = $store_image_class->get_allImage_by_path($store['pic_info']); $store_meal = D('Merchant_store_meal')->where(array('store_id' => $store_id))->find(); $store_meal['deliver_time'] = unserialize($store['deliver_time']); $store_meal['width'] = 72 / 5 * $store_meal['score_mean']; $store = array_merge($store, $store_meal); //商家信息 $merchant = M("Merchant")->where(array('mer_id' => $store['mer_id']))->find(); $merchant_image = new merchant_image(); $merchant['merchant_pic'] = $merchant_image->get_allImage_by_path($merchant['pic_info']); $sorts = M("Meal_sort")->where(array('store_id' => $store_id))->order('sort ASC')->select(); $list = $temp = array(); $id = 0; $sids = array(); foreach ($sorts as $sort) { if ($sort['is_weekshow']) { $week = explode(",", $sort['week']); if (in_array(date("w"), $week)) { $sids[] = $sort['sort_id']; } } else { $sids[] = $sort['sort_id']; } } $sort_type = isset($_GET['sort_type']) ? intval($_GET['sort_type']) : 0; $this->assign('sort_type', $sort_type); switch ($sort_type) { case 0: $order = 'meal_id DESC'; break; case 1: $order = 'price DESC'; break; case 2: $order = 'price ASC'; break; } //菜单信息 $meals = M('Meal')->field(true)->where(array('store_id' => $store_id, 'sort_id' => array('in', $sids), 'status' => 1))->order($order)->select(); $meal_image_class = new meal_image(); $txt = $pic = array(); foreach ($meals as &$m) { $m['image'] = $meal_image_class->get_image_by_path($m['image'], $this->config['site_url'], 's'); // $temp[$m['sort_id']] = isset($temp[$m['sort_id']]) ? $temp[$m['sort_id']] : array(); // if ($m['image']) { // array // } $pic[$m['sort_id']] = isset($pic[$m['sort_id']]) ? $pic[$m['sort_id']] : array(); $txt[$m['sort_id']] = isset($txt[$m['sort_id']]) ? $txt[$m['sort_id']] : array(); $lst[$m['sort_id']] = isset($lst[$m['sort_id']]) ? $lst[$m['sort_id']] : array(); if ($m['image']) { $pic[$m['sort_id']][] = $m; } else { $txt[$m['sort_id']][] = $m; } $lst[$m['sort_id']][] = $m; } $list = array(); foreach ($sorts as &$s) { $s['meals']['pic'] = isset($pic[$s['sort_id']]) ? $pic[$s['sort_id']] : ''; $s['meals']['txt'] = isset($txt[$s['sort_id']]) ? $txt[$s['sort_id']] : ''; $s['meals']['list'] = isset($lst[$s['sort_id']]) ? $lst[$s['sort_id']] : ''; } //被收藏的次数 $collect_count = D('User_collect')->where(array('type' => 'meal_detail', 'id' => $store_id))->count(); $is_collect = 0; if ($collect = D('User_collect')->where(array('type' => 'meal_detail', 'id' => $store_id, 'uid' => $this->user_session['uid']))->find()) { $is_collect = 1; } $this->assign('collect_count', $collect_count); $this->assign('is_collect', $is_collect); //菜品分类信息 // $sorts = M('Meal_sort')->where(array('store_id' => $store_id))->select(); $area = M("Area")->where(array('area_id' => $store['circle_id']))->find(); $this->assign('area', $area); $this->assign('merchant', $merchant); $this->assign('store', $store); $this->assign('sorts', $sorts); $this->display(); }