Exemple #1
0
 public function get_group_by_groupId($group_id, $other = '')
 {
     $condition_where = "`g`.`mer_id`=`m`.`mer_id` AND `m`.`status`='1' AND `g`.`status`='1' AND `g`.`group_id`='{$group_id}'";
     $condition_table = array(C('DB_PREFIX') . 'group' => 'g', C('DB_PREFIX') . 'merchant' => 'm');
     $condition_field = '`g`.`name` AS `group_name`,`m`.`name` AS `merchant_name`,`g`.*,`m`.*';
     $database = D('');
     $now_group = D('')->field($condition_field)->table($condition_table)->where($condition_where)->find();
     if (!empty($now_group)) {
         $now_group['price'] = floatval($now_group['price']);
         $now_group['old_price'] = floatval($now_group['old_price']);
         $now_group['wx_cheap'] = floatval($now_group['wx_cheap']);
         $now_group['url'] = C('config.site_url') . '/group/' . $now_group['group_id'] . '.html';
         $now_group['buy_url'] = C('config.site_url') . '/group/buy/' . $now_group['group_id'] . '.html';
         $group_image_class = new group_image();
         $now_group['all_pic'] = $group_image_class->get_allImage_by_path($now_group['pic']);
         $now_group['store_list'] = D('Group_store')->get_storelist_by_groupId($now_group['group_id']);
         if (count($now_group['store_list']) == 1) {
             $now_group['store_list'][0]['area'] = D('Area')->get_area_by_areaId($now_group['store_list'][0]['area_id']);
             $now_group['store_list'][0]['circle'] = D('Area')->get_area_by_areaId($now_group['store_list'][0]['circle_id']);
         }
         if ($other) {
             $condition_group['group_id'] = $group_id;
             switch ($other) {
                 case 'hits-setInc':
                     $this->where($condition_group)->setInc('hits');
                     break;
             }
         }
     }
     return $now_group;
 }