|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
代码片段如下:
$data
=
$villageDb
->alias(
'a'
)->join(
'br_esf_village_expand as b on a.villageId=b.villageId'
,
'LEFT'
)->where(
$where
)->limit(
$Page
->firstRow .
','
.
$Page
->listRows)->select();
$houseDb
=D(
"House"
);
foreach
(
$data
as
$key
=>
$val
){
$quyuname
=
''
;
if
(
$val
[
'fangAreaId'
]) {
$quyuname
=
$areaDb
->getAreaName(
$val
[
'fangAreaId'
]);
}
$shangquanname
=
''
;
if
(
$val
[
'fangTradingId'
]) {
$shangquanname
=
$areaDb
->getShangName(
$val
[
'fangTradingId'
]);
}
$data
[
$key
][
'quyuname'
] =
$quyuname
;
$data
[
$key
][
'shangquanname'
] =
$shangquanname
;
$data
[
$key
][
'ispublish'
]=
$houseDb
->ishouseCount(
$val
[
'villageId'
]);
$data
[
$key
][
'nopublish'
]=
$houseDb
->nohouseCount(
$val
[
'villageId'
]);
}
$d
=
$this
->multi_array_sort(
$data
,
'ispublish'
);
//键值ispublish排序
$this
->changename(
$fangareaId
);
//传值
$this
->assign(
'quyu'
,
$quyu
)
//得到区域
->assign(
'sqData'
,
$this
->changename(
$fangareaId
))
//搜索赋值商圈
->assign(
'data'
,
$d
);
// 得到商圈
$this
->display();
}
//二维数组键值排序
function
multi_array_sort(
$multi_array
,
$sort_key
,
$sort
= SORT_DESC) {
if
(
is_array
(
$multi_array
)) {
foreach
(
$multi_array
as
$row_array
) {
if
(
is_array
(
$row_array
)) {
$key_array
[] =
$row_array
[
$sort_key
];
}
else
{
return
FALSE;
}
}
}
else
{
return
FALSE;
}
array_multisort
(
$key_array
,
$sort
,
$multi_array
);
return
$multi_array
;
}
|
本文转自 liang3391 51CTO博客,原文链接:http://blog.51cto.com/liang3391/1825277