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
133badac
Commit
133badac
authored
Feb 06, 2018
by
hujun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
商铺编辑案场联系人修改
parent
dcdc6ee9
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
61 additions
and
48 deletions
+61
-48
GHouses.php
application/model/GHouses.php
+61
-48
No files found.
application/model/GHouses.php
View file @
133badac
...
...
@@ -4,6 +4,7 @@ namespace app\model;
use
think\Db
;
use
think\Session
;
class
GHouses
extends
BaseModel
{
...
...
@@ -19,62 +20,72 @@ class GHouses extends BaseModel
* @throws \think\exception\DbException
*/
public
function
getHouseById
(
$id
)
{
$data
=
array
();
$fields
=
'a.*,b.*'
;
$select_data
=
$this
->
alias
(
'a'
)
->
field
(
$fields
)
->
join
(
'g_houses_ext b'
,
'a.id = b.house_id'
,
'left'
)
->
where
(
'a.id'
,
$id
)
->
where
(
'a.status'
,
'<>'
,
3
)
->
find
();
$data
=
$select_data
->
getData
();
/*案场,盘方,独家 start*/
$houseAgents
=
new
GHousesToAgents
();
$agents_data
=
$houseAgents
->
getHousesAgents
(
$id
);
$agents_str
=
''
;
$exclusive_str
=
''
;
$dish_str
=
''
;
foreach
(
$agents_data
as
$k
=>
$v
)
{
if
(
$v
[
'type'
]
==
1
)
{
$agents_str
.=
$v
[
'id'
]
.
','
;
$data
[
'agents_name'
][
$k
]
=
$v
[
'id'
]
.
'-'
.
$v
[
'name'
]
.
'-'
.
$v
[
'phone'
];
}
elseif
(
$v
[
'type'
]
==
2
)
{
$dish_str
.=
$v
[
'id'
]
.
','
;
$data
[
'dish_name'
][
$k
]
=
$v
[
'id'
]
.
'-'
.
$v
[
'name'
]
.
'-'
.
$v
[
'phone'
];
}
elseif
(
$v
[
'type'
]
==
3
)
{
$exclusive_str
.=
$v
[
'id'
]
.
','
;
$data
[
'exclusive_name'
][
$k
]
=
$v
[
'id'
]
.
'-'
.
$v
[
'name'
]
.
'-'
.
$v
[
'phone'
];
if
(
$select_data
)
{
$data
=
$select_data
->
getData
();
/*案场,盘方,独家 start*/
$houseAgents
=
new
GHousesToAgents
();
$agents_data
=
$houseAgents
->
getHousesAgents
(
$id
);
$agents_str
=
''
;
$exclusive_str
=
''
;
$dish_str
=
''
;
foreach
(
$agents_data
as
$k
=>
$v
)
{
if
(
$v
[
'type'
]
==
1
)
{
$agents_str
.=
$v
[
'id'
]
.
','
;
$data
[
'agents_name'
][
$k
]
=
$v
[
'id'
]
.
'-'
.
$v
[
'name'
]
.
'-'
.
$v
[
'phone'
];
}
elseif
(
$v
[
'type'
]
==
2
)
{
$dish_str
.=
$v
[
'id'
]
.
','
;
$data
[
'dish_name'
][
$k
]
=
$v
[
'id'
]
.
'-'
.
$v
[
'name'
]
.
'-'
.
$v
[
'phone'
];
}
elseif
(
$v
[
'type'
]
==
3
)
{
$exclusive_str
.=
$v
[
'id'
]
.
','
;
$data
[
'exclusive_name'
][
$k
]
=
$v
[
'id'
]
.
'-'
.
$v
[
'name'
]
.
'-'
.
$v
[
'phone'
];
}
}
}
$data
[
'agent_data'
]
=
rtrim
(
$agents_str
,
','
);
$data
[
'agent_dish'
]
=
rtrim
(
$dish_str
,
','
);
$data
[
'exclusive_ids'
]
=
rtrim
(
$exclusive_str
,
','
);
/*案场,盘方,独家 end*/
/*案场联系人 start*/
$case
=
new
ACase
();
$data
[
'phone'
]
=
$case
->
where
(
'id'
,
'in'
,
$data
[
'case_id'
])
->
where
(
'status'
,
0
)
->
column
(
'name,phone'
);
/*案场联系人 end*/
/*图片 start*/
$img
=
new
GHousesImgs
();
$img_data
=
$img
->
field
(
'id,img_type,img_name'
)
->
where
(
'img_status = 0 AND house_id = '
.
$id
)
->
select
();
$area
=
explode
(
'##'
,
$data
[
'code'
]);
$data
[
'province_code'
]
=
$area
[
'0'
];
$data
[
'city_code'
]
=
$area
[
'1'
];
$data
[
'disc_code'
]
=
$area
[
'2'
];
foreach
(
$img_data
as
$k
=>
$v
)
{
switch
(
$v
->
img_type
)
{
case
1
:
$data
[
'cover'
]
=
$v
->
img_name
;
break
;
case
2
:
$data
[
'slide_show'
][
$k
]
=
$v
->
img_name
;
break
;
case
3
:
$data
[
'plan'
][
$k
]
=
$v
->
img_name
;
break
;
default
:
$data
[
'exclusive_img'
][
$k
]
=
$v
->
img_name
;
$data
[
'agent_data'
]
=
rtrim
(
$agents_str
,
','
);
$data
[
'agent_dish'
]
=
rtrim
(
$dish_str
,
','
);
$data
[
'exclusive_ids'
]
=
rtrim
(
$exclusive_str
,
','
);
/*案场,盘方,独家 end*/
/*案场联系人 start*/
$case
=
new
ACase
();
$data
[
'phone'
]
=
$case
->
field
(
'id,name,phone'
)
->
where
(
'id'
,
'in'
,
$data
[
'case_id'
])
->
where
(
'status'
,
0
)
->
select
();
/*案场联系人 end*/
/*图片 start*/
$img
=
new
GHousesImgs
();
$img_data
=
$img
->
field
(
'id,img_type,img_name'
)
->
where
(
'img_status = 0 AND house_id = '
.
$id
)
->
select
();
$area
=
explode
(
'##'
,
$data
[
'code'
]);
$data
[
'province_code'
]
=
$area
[
'0'
];
$data
[
'city_code'
]
=
$area
[
'1'
];
$data
[
'disc_code'
]
=
$area
[
'2'
];
foreach
(
$img_data
as
$k
=>
$v
)
{
switch
(
$v
->
img_type
)
{
case
1
:
$data
[
'cover'
]
=
$v
->
img_name
;
break
;
case
2
:
$data
[
'slide_show'
][
$k
]
=
$v
->
img_name
;
break
;
case
3
:
$data
[
'plan'
][
$k
]
=
$v
->
img_name
;
break
;
default
:
$data
[
'exclusive_img'
][
$k
]
=
$v
->
img_name
;
}
}
/*图片 start*/
}
/*图片 start*/
return
$data
;
}
...
...
@@ -239,9 +250,11 @@ class GHouses extends BaseModel
//新增或编辑
if
(
$params
[
'id'
]
==
''
)
{
$params
[
'upload_id'
]
=
Session
::
get
(
'userId'
);
$this
->
allowField
(
true
)
->
save
(
$params
);
$house_id
=
$this
->
id
;
}
else
{
$params
[
'operation_id'
]
=
Session
::
get
(
'userId'
);
$this
->
allowField
(
true
)
->
isUpdate
(
true
)
->
save
(
$params
,
[
'id'
=>
$params
[
'id'
]]);
$house_id
=
$this
->
id
;
}
...
...
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