Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
tl_estate
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
hujun
tl_estate
Commits
1bf7e43e
Commit
1bf7e43e
authored
Jan 22, 2018
by
hujun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
楼盘列表
parent
3660d0b0
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
38 additions
and
7 deletions
+38
-7
GHouses.php
application/model/GHouses.php
+38
-7
No files found.
application/model/GHouses.php
View file @
1bf7e43e
...
...
@@ -3,7 +3,6 @@
namespace
app\model
;
use
think\Db
;
class
GHouses
extends
BaseModel
...
...
@@ -22,12 +21,11 @@ class GHouses extends BaseModel
public
function
getHouseById
(
$id
)
{
$fields
=
'a.*,b.fee_rule,internal_item_advantage,external_item_advantage,tiny_brochure_url,auditorium,traffic,
enter_num,do_business_date,start_business_date,singn_rule,landlord_phone'
;
$data
=
$this
->
alias
(
'a'
)
->
field
(
$fields
)
$
select_
data
=
$this
->
alias
(
'a'
)
->
field
(
$fields
)
->
join
(
'g_houses_ext b'
,
'a.id = b.house_id'
,
'left'
)
->
where
(
'a.id'
,
$id
)
->
find
();
$data
=
$data
->
toArray
();
$data
=
$select_data
->
getData
();
$img
=
new
GHousesImgs
();
$img_data
=
$img
->
field
(
'id,img_type,img_name'
)
->
where
(
'img_status = 0 AND house_id = '
.
$id
)
...
...
@@ -66,10 +64,43 @@ class GHouses extends BaseModel
->
limit
(
$pageSize
)
->
page
(
$pageNo
)
->
select
();
$house_id
=
array
();
foreach
(
$data
as
$k
=>
$v
)
{
$result
[
$k
]
=
$v
->
getData
();
$rsult
[
$k
][
'dish'
]
=
Db
::
table
(
'g_houses_to_agents'
)
->
where
(
'houses_id'
,
$result
[
$k
][
'house_id'
])
->
select
();
$house_id
[
$k
]
=
$v
[
'id'
];
}
/*案场权限人*/
$house_agents
=
Db
::
table
(
'g_houses_to_agents'
)
->
alias
(
'a'
)
->
field
(
'a.houses_id,b.id,b.name,b.phone'
)
->
join
(
'a_agents b'
,
'a.agents_id=b.id'
,
'left'
)
->
where
(
'a.houses_id'
,
'IN'
,
implode
(
','
,
$house_id
))
->
select
();
/*盘方*/
$house_dish
=
Db
::
table
(
'g_houses_dish'
)
->
alias
(
'a'
)
->
field
(
'a.houses_id,b.id,b.name,b.phone'
)
->
join
(
'a_agents b'
,
'a.agents_id=b.id'
,
'left'
)
->
where
(
'a.houses_id'
,
'IN'
,
implode
(
','
,
$house_id
))
->
select
();
$result
=
array
();
foreach
(
$data
as
$k
=>
$v
)
{
$result
[
$k
]
=
$v
->
toArray
();
foreach
(
$house_agents
as
$k2
=>
$v2
)
{
if
(
$v
->
id
==
$v2
[
'houses_id'
])
{
$result
[
$k
][
'agents_name'
][
$k2
][
'id'
]
=
$v2
[
'id'
];
$result
[
$k
][
'agents_name'
][
$k2
][
'name'
]
=
$v2
[
'name'
];
$result
[
$k
][
'agents_name'
][
$k2
][
'phone'
]
=
$v2
[
'phone'
];
}
}
foreach
(
$house_dish
as
$k3
=>
$v3
)
{
if
(
$v
->
id
==
$v3
[
'houses_id'
])
{
$result
[
$k
][
'dish_name'
][
$k3
][
'id'
]
=
$v3
[
'id'
];
$result
[
$k
][
'dish_name'
][
$k3
][
'name'
]
=
$v3
[
'name'
];
$result
[
$k
][
'dish_name'
][
$k3
][
'phone'
]
=
$v3
[
'phone'
];
}
}
}
return
$result
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment