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
3de68c80
Commit
3de68c80
authored
Jan 26, 2018
by
hujun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
楼盘与经纪人关系编辑
parent
dc3e66dc
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
7 deletions
+30
-7
GHouses.php
application/model/GHouses.php
+3
-0
GHousesToAgents.php
application/model/GHousesToAgents.php
+27
-7
No files found.
application/model/GHouses.php
View file @
3de68c80
...
...
@@ -245,8 +245,11 @@ class GHouses extends BaseModel
/***保存图片 hujun 2018.1.19 end***/
$agents
=
new
GHousesToAgents
();
//权限人
$agents
->
addAgents
(
$params
[
'agent_data'
],
$house_id
,
1
);
//盘方
$agents
->
addAgents
(
$params
[
'agent_dish'
],
$house_id
,
2
);
//独家方
$agents
->
addAgents
(
$params
[
'exclusive_ids'
],
$house_id
,
3
);
return
$house_id
;
}
...
...
application/model/GHousesToAgents.php
View file @
3de68c80
...
...
@@ -26,9 +26,27 @@ class GHousesToAgents extends BaseModel
*/
public
function
addAgents
(
$agents_id
,
$houses_id
,
$type
){
$agent_arr
=
array
();
$date
=
date
(
'Y-m-d H:i:s'
);
$agents_id
=
array_unique
(
explode
(
','
,
$agents_id
));
$where
[
'type'
]
=
$type
;
$where
[
'houses_id'
]
=
$houses_id
;
$where
[
'is_del'
]
=
0
;
//为空全部伪删除
if
(
empty
(
$agents_id
[
0
]))
{
$res
=
$this
->
where
(
$where
)
->
setField
(
'is_del'
,
1
);
}
else
{
$houses_data
=
$this
->
where
(
$where
)
->
select
();
$key
=
0
;
foreach
(
$houses_data
as
$k
=>
$v
)
{
if
(
!
in_array
(
$v
[
'agents_id'
],
$agents_id
)
&&
$type
==
$v
[
'type'
])
{
$agent_arr
[
$key
][
'id'
]
=
$v
[
'id'
];
$agent_arr
[
$key
][
'is_del'
]
=
1
;
$agent_arr
[
$key
][
'update_time'
]
=
$date
;
$key
++
;
}
}
foreach
(
$agents_id
as
$k
=>
$v
)
{
$check
=
$this
->
where
([
'houses_id'
=>
$houses_id
,
...
...
@@ -39,14 +57,16 @@ class GHousesToAgents extends BaseModel
if
(
$check
)
{
continue
;
}
$agent_arr
[
$k
][
'agents_id'
]
=
$v
;
$agent_arr
[
$k
][
'houses_id'
]
=
$houses_id
;
$agent_arr
[
$k
][
'type'
]
=
$type
;
$agent_arr
[
$k
][
'create_time'
]
=
$this
->
date
;
$agent_arr
[
$k
][
'update_time'
]
=
$this
->
date
;
$agent_arr
[
$key
][
'agents_id'
]
=
$v
;
$agent_arr
[
$key
][
'houses_id'
]
=
$houses_id
;
$agent_arr
[
$key
][
'type'
]
=
$type
;
$agent_arr
[
$key
][
'create_time'
]
=
$this
->
date
;
$agent_arr
[
$key
][
'update_time'
]
=
$this
->
date
;
$key
++
;
}
$res
=
$this
->
saveAll
(
$agent_arr
);
}
return
$res
;
}
...
...
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