Maafkan saya, Tianjin dalam bulatan merah, bagaimana untuk menentukan Tianjin, Tianjin, Nankai, Tianjin, Tianjin dan Hexi dengan tepat, atau 3 kotak lungsur, Nankai, Hexi di bawah Tianjin, tetapi hanya memaparkan kawasan di bawah? rantau ini, bagaimana untuk mencapainya
Antara muka hadapan![1595830203701127.png 微信图片_20200727140840.png](https://img.php.cn/upload/image/130/762/659/1595830203701127.png)
Kod HTML
Kod PHP
// 我的地区 function action_my_region() { $user = $GLOBALS['user']; $_CFG = $GLOBALS['_CFG']; $_LANG = $GLOBALS['_LANG']; $smarty = $GLOBALS['smarty']; $db = $GLOBALS['db']; $ecs = $GLOBALS['ecs']; $user_id = $GLOBALS['user_id']; $action = $GLOBALS['action']; $day = $_GET['day'] ? $_GET['day'] : 30; $user_name = $_REQUEST['user_name'] ? $_REQUEST['user_name'] : ''; $mobile = $_REQUEST['mobile'] ? $_REQUEST['mobile'] : ''; $user_area_id = $_REQUEST['user_area_id'] ? $_REQUEST['user_area_id'] : 0; $user_rank_id= $_REQUEST['user_rank_id'] ? $_REQUEST['user_rank_id'] : 0; $time= $_REQUEST['time'] ? $_REQUEST['time'] : ''; $where = ' '; if ($user_name){ $where .= " AND user_name like '%".$user_name."%'"; } if ($mobile){ $where .= ' AND mobile_phone = '.$mobile; } if($user_area_id){ $where .= ' AND province = '.$user_area_id; } if($user_rank_id){ $where .= ' AND user_rank = '.$user_rank_id; } if($time){ $date = explode(" ",$time); $data1 = strtotime(str_replace("/","-",$date[0])); $data2 = strtotime(str_replace("/","-",$date[2]))+86399; }else{ $data1 =strtotime(date('Y/m/d',strtotime('-30 day'))); $data2 = strtotime(date('Y/m/d'))+86399; $time = date('Y/m/d',strtotime('-30 day')).'-'.date('Y/m/d'); } $page = isset($_REQUEST['page']) ? intval($_REQUEST['page']) : 1; $data = $GLOBALS['db']->getRow("SELECT user_rank,rank_region FROM " .$GLOBALS['ecs']->table('users')." WHERE user_id = $user_id"); $user_rank = $data['user_rank']; $sort = get_user_rank_sort($user_rank); if($sort < 3){ show_message('区县代理以上才可以查看!', '返回', 'user.php', 'error'); die; } $rank_region =$data['rank_region']; $get_all_rewart = get_all_rewart($rank_region); $all_user_id = array(); $all_user_id1 = array(); foreach ($get_all_rewart as $key => $value) { if($sort == 3){ $all_user = $GLOBALS['db']->getAll("SELECT user_id,user_name,mobile_phone,user_rank,rank_region FROM ". $GLOBALS['ecs']->table('users'). " WHERE (user_rank = 8 OR user_rank = 12) AND rank_region = ".$value['region_id'].$where); $all_user_id = array_merge($all_user_id,$all_user); $all_user1 = $GLOBALS['db']->getAll("SELECT user_id,user_name,mobile_phone,user_rank,rank_region FROM ". $GLOBALS['ecs']->table('users')." WHERE (user_rank = 8 OR user_rank = 12) AND rank_region = ".$value['region_id']); $all_user_id1 = array_merge($all_user_id1,$all_user1); }else{ $all_user = $GLOBALS['db']->getAll("SELECT user_id,user_name,mobile_phone,user_rank,rank_region FROM ". $GLOBALS['ecs']->table('users'). " WHERE rank_region = ".$value['region_id'].$where); $all_user_id = array_merge($all_user_id,$all_user); $all_user1 = $GLOBALS['db']->getAll("SELECT user_id,user_name,mobile_phone,user_rank,rank_region FROM ". $GLOBALS['ecs']->table('users')." WHERE rank_region = ".$value['region_id']); $all_user_id1 = array_merge($all_user_id1,$all_user1); } } if ($sort == 3){ $all_user2 = $GLOBALS['db']->getAll("SELECT u.user_id,user_name,mobile_phone,user_rank,rank_region FROM ". $GLOBALS['ecs']->table('users').' as u '. 'LEFT JOIN ' . $GLOBALS['ecs']->table('order_info'). ' AS o ON u.user_id = o.user_id'." WHERE (u.user_rank = 8 OR u.user_rank = 12) AND o.district = ".$rank_region." GROUP BY u.user_id"); $all_user_id = array_merge($all_user_id,$all_user2); $all_user_id1 = array_merge($all_user_id1,$all_user2); } $all_uid = ''; foreach ($all_user_id1 as $k => $v){ $all_uid .= $v['user_id'].','; } // $all_user_id = array_unique($all_user_id); foreach ($all_user_id as $k => $v) { //$time = time()-24*60*60*$day; if ($sort ==3 && $all_user2){ foreach ($all_user2 as $kk => $vv){ if ($vv['user_id'] == $v['user_id']){ $all_user_id[$k]['user_sum'] = get_order_sum($v['user_id'],$data1,$data2); }else{ $all_user_id[$k]['user_sum'] = get_user_sum($v['user_id'],$data1,$data2) + get_order_sum($v['user_id'],$data1,$data2); } } }else{ $all_user_id[$k]['user_sum'] = get_user_sum($v['user_id'],$data1,$data2) + get_order_sum($v['user_id'],$data1,$data2); } $all_user_id[$k]['user_rank_name'] = get_user_rank_name($v['user_rank']); $all_user_id[$k]['region_name'] = $v['user_rank'] > 7 && $v['user_rank'] < 12 ? get_region_name($v['rank_region']) : ''; } $all_uid = trim($all_uid,','); if ($all_uid){ $sql = "SELECT r.region_id,r.region_name FROM " . $ecs->table('region') . " as r, (SELECT province FROM ".$ecs->table('users'). " WHERE user_id IN($all_uid) $where group BY province ) as u where u.province = r.region_id "; $user_area_list = $db->getAll($sql); if (empty($user_area_list)){ $user_area_list = array(); } $sql = "SELECT ur.rank_id,ur.rank_name FROM " . $ecs->table('user_rank') . " as ur, (SELECT user_rank FROM ".$ecs->table('users'). " WHERE user_id IN($all_uid) group BY user_rank ) as u where u.user_rank = ur.rank_id"; $user_rank_list = $db->getAll($sql); if(empty($user_rank_list)){ $user_rank_list = array(); } }else{ $user_area_list = array(); $user_rank_list = array(); } $user_sum = array_column($all_user_id,'user_sum'); array_multisort($user_sum,SORT_DESC,$all_user_id); $smarty->assign('user_name', $user_name); $smarty->assign('mobile', $mobile); $smarty->assign('user_area_id', $user_area_id); $smarty->assign('user_rank_id', $user_rank_id); $smarty->assign('time', $time); $smarty->assign('user_rank_list', $user_rank_list); $smarty->assign('user_area_list', $user_area_list); $smarty->assign('action', $action); $smarty->assign('day', $day); $smarty->assign('all_user', $all_user_id); $smarty->display('user_transaction.dwt'); } function get_region_name($rank_region){ $region = $GLOBALS['db']->getRow("SELECT region_name,region_type,parent_id FROM " . $GLOBALS['ecs']->table('region') . " WHERE region_id = '$rank_region'"); if($region['region_type'] > 1){ $region_name = get_region_name($region['parent_id']) . '-' . $region['region_name']; }else{ $region_name = $region['region_name']; } // $region_name = $region['region_name']; return $region_name; }