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
66ce71ae
Commit
66ce71ae
authored
Apr 16, 2018
by
clone
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bug
parent
9a62e3bf
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
62 additions
and
41 deletions
+62
-41
VerifyService.php
application/api_broker/service/VerifyService.php
+3
-2
GHousesToAgents.php
application/model/GHousesToAgents.php
+59
-39
No files found.
application/api_broker/service/VerifyService.php
View file @
66ce71ae
...
@@ -106,13 +106,13 @@ class VerifyService
...
@@ -106,13 +106,13 @@ class VerifyService
}
}
/**
/**
*
*
获取盘方经纪人ids
* @param $house_id
* @param $house_id
* @return false|\PDOStatement|string|\think\Collection
* @return false|\PDOStatement|string|\think\Collection
*/
*/
public
function
getPanpartyAgentsByHouseId
(
$house_id
)
public
function
getPanpartyAgentsByHouseId
(
$house_id
)
{
{
$houseToAgentModel
=
new
GHousesToAgents
();
$houseToAgentModel
=
new
GHousesToAgents
();
return
$houseToAgentModel
->
getHousesAgents
(
$house_id
);
return
$houseToAgentModel
->
getHouses
Update
Agents
(
$house_id
);
}
}
}
}
\ No newline at end of file
application/model/GHousesToAgents.php
View file @
66ce71ae
...
@@ -12,40 +12,41 @@ class GHousesToAgents extends BaseModel
...
@@ -12,40 +12,41 @@ class GHousesToAgents extends BaseModel
/**
/**
* @param $agents_id
* @param $agents_id
* @param $houses_id
* @param $houses_id
* @param $type
//案场权限人:0,盘方:1,独家:2
* @param $type //案场权限人:0,盘方:1,独家:2
* @return array|false
* @return array|false
* @throws \Exception
* @throws \Exception
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
* @throws \think\exception\DbException
*/
*/
public
function
addAgents
(
$agents_id
,
$houses_id
,
$type
){
public
function
addAgents
(
$agents_id
,
$houses_id
,
$type
)
$agent_arr
=
array
();
{
$agents_id
=
array_unique
(
explode
(
','
,
$agents_id
));
$agent_arr
=
array
();
$del_agents_id
=
$record_agents_id
=
[];
$agents_id
=
array_unique
(
explode
(
','
,
$agents_id
));
$del_agents_id
=
$record_agents_id
=
[];
$where
[
'type'
]
=
$type
;
$where
[
'type'
]
=
$type
;
$where
[
'houses_id'
]
=
$houses_id
;
$where
[
'houses_id'
]
=
$houses_id
;
$where
[
'is_del'
]
=
0
;
$where
[
'is_del'
]
=
0
;
$records
=
new
GOperatingRecords
();
$records
=
new
GOperatingRecords
();
$agents
=
new
AAgents
();
$agents
=
new
AAgents
();
//为空全部伪删除
//为空全部伪删除
if
(
empty
(
$agents_id
[
0
]))
{
if
(
empty
(
$agents_id
[
0
]))
{
if
(
$type
==
2
)
{
if
(
$type
==
2
)
{
$house_agents
=
$this
->
field
(
'agents_id'
)
->
where
(
'houses_id'
,
$houses_id
)
->
where
(
'is_del'
,
0
)
->
select
();
$house_agents
=
$this
->
field
(
'agents_id'
)
->
where
(
'houses_id'
,
$houses_id
)
->
where
(
'is_del'
,
0
)
->
select
();
$name
=
array
();
$name
=
array
();
foreach
(
$house_agents
as
$k2
=>
$v2
){
foreach
(
$house_agents
as
$k2
=>
$v2
)
{
$name
[]
=
$agents
->
where
(
'id'
,
$v2
[
'agents_id'
])
->
value
(
'name'
);
$name
[]
=
$agents
->
where
(
'id'
,
$v2
[
'agents_id'
])
->
value
(
'name'
);
}
}
$records
->
record
(
''
,
2
,
'删除盘方'
.
implode
(
','
,
$name
),
$houses_id
);
$records
->
record
(
''
,
2
,
'删除盘方'
.
implode
(
','
,
$name
),
$houses_id
);
}
}
$res
=
$this
->
where
(
$where
)
->
setField
(
'is_del'
,
1
);
$res
=
$this
->
where
(
$where
)
->
setField
(
'is_del'
,
1
);
}
else
{
}
else
{
$houses_data
=
$this
->
where
(
$where
)
->
select
();
$houses_data
=
$this
->
where
(
$where
)
->
select
();
$key
=
0
;
$key
=
0
;
foreach
(
$houses_data
as
$k
=>
$v
)
{
foreach
(
$houses_data
as
$k
=>
$v
)
{
if
(
!
in_array
(
$v
[
'agents_id'
],
$agents_id
)
&&
(
$type
==
$v
[
'type'
])
&&
(
$v
[
'agents_id'
]
!=
NULL
))
{
if
(
!
in_array
(
$v
[
'agents_id'
],
$agents_id
)
&&
(
$type
==
$v
[
'type'
])
&&
(
$v
[
'agents_id'
]
!=
NULL
))
{
$agent_arr
[
$key
][
'id'
]
=
$v
[
'id'
];
$agent_arr
[
$key
][
'id'
]
=
$v
[
'id'
];
$agent_arr
[
$key
][
'is_del'
]
=
1
;
$agent_arr
[
$key
][
'is_del'
]
=
1
;
$key
++
;
$key
++
;
...
@@ -55,11 +56,11 @@ class GHousesToAgents extends BaseModel
...
@@ -55,11 +56,11 @@ class GHousesToAgents extends BaseModel
}
}
}
}
foreach
(
$agents_id
as
$k
=>
$v
)
{
foreach
(
$agents_id
as
$k
=>
$v
)
{
$check
=
$this
->
where
([
$check
=
$this
->
where
([
'houses_id'
=>
$houses_id
,
'houses_id'
=>
$houses_id
,
'agents_id'
=>
$v
,
'agents_id'
=>
$v
,
'is_del'
=>
0
,
'is_del'
=>
0
,
'type'
=>
$type
'type'
=>
$type
])
->
find
();
])
->
find
();
if
(
$check
)
{
if
(
$check
)
{
...
@@ -67,7 +68,7 @@ class GHousesToAgents extends BaseModel
...
@@ -67,7 +68,7 @@ class GHousesToAgents extends BaseModel
}
}
$agent_arr
[
$key
][
'agents_id'
]
=
$v
;
$agent_arr
[
$key
][
'agents_id'
]
=
$v
;
$agent_arr
[
$key
][
'houses_id'
]
=
$houses_id
;
$agent_arr
[
$key
][
'houses_id'
]
=
$houses_id
;
$agent_arr
[
$key
][
'type'
]
=
$type
;
$agent_arr
[
$key
][
'type'
]
=
$type
;
$key
++
;
$key
++
;
if
(
$type
==
2
)
{
if
(
$type
==
2
)
{
...
@@ -78,19 +79,19 @@ class GHousesToAgents extends BaseModel
...
@@ -78,19 +79,19 @@ class GHousesToAgents extends BaseModel
if
(
count
(
$del_agents_id
)
>
0
)
{
if
(
count
(
$del_agents_id
)
>
0
)
{
$name
=
array
();
$name
=
array
();
foreach
(
$del_agents_id
as
$k2
=>
$v2
){
foreach
(
$del_agents_id
as
$k2
=>
$v2
)
{
$name
[]
=
$agents
->
where
(
'id'
,
$v2
)
->
value
(
'name'
);
$name
[]
=
$agents
->
where
(
'id'
,
$v2
)
->
value
(
'name'
);
}
}
$records
->
record
(
''
,
2
,
'删除盘方:'
.
implode
(
','
,
$name
),
$houses_id
);
$records
->
record
(
''
,
2
,
'删除盘方:'
.
implode
(
','
,
$name
),
$houses_id
);
}
}
if
(
count
(
$record_agents_id
)
>
0
)
{
if
(
count
(
$record_agents_id
)
>
0
)
{
$records
=
new
GOperatingRecords
();
$records
=
new
GOperatingRecords
();
$name
=
array
();
$name
=
array
();
foreach
(
$record_agents_id
as
$k2
=>
$v2
){
foreach
(
$record_agents_id
as
$k2
=>
$v2
)
{
$name
[]
=
$agents
->
where
(
'id'
,
$v2
)
->
value
(
'name'
);
$name
[]
=
$agents
->
where
(
'id'
,
$v2
)
->
value
(
'name'
);
}
}
$records
->
record
(
''
,
2
,
'新增盘方:'
.
implode
(
','
,
$name
),
$houses_id
);
$records
->
record
(
''
,
2
,
'新增盘方:'
.
implode
(
','
,
$name
),
$houses_id
);
}
}
$res
=
$this
->
saveAll
(
$agent_arr
);
$res
=
$this
->
saveAll
(
$agent_arr
);
...
@@ -106,9 +107,10 @@ class GHousesToAgents extends BaseModel
...
@@ -106,9 +107,10 @@ class GHousesToAgents extends BaseModel
* @param $houses_id
* @param $houses_id
* @return bool|false|int
* @return bool|false|int
*/
*/
public
function
del
(
$id
,
$houses_id
)
{
public
function
del
(
$id
,
$houses_id
)
{
if
(
$id
)
{
if
(
$id
)
{
$res
=
$this
->
save
([
'is_del'
=>
1
],[
'agents_id'
=>
$id
,
'houses_id'
=>
$houses_id
]);
$res
=
$this
->
save
([
'is_del'
=>
1
],
[
'agents_id'
=>
$id
,
'houses_id'
=>
$houses_id
]);
}
else
{
}
else
{
$res
=
false
;
$res
=
false
;
}
}
...
@@ -129,10 +131,11 @@ class GHousesToAgents extends BaseModel
...
@@ -129,10 +131,11 @@ class GHousesToAgents extends BaseModel
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
* @throws \think\exception\DbException
*/
*/
public
function
getAgentsHousesList
(
$pageNo
=
1
,
$pageSize
=
15
,
$order_
=
'id desc'
,
$field
=
''
,
$params
=
''
)
{
public
function
getAgentsHousesList
(
$pageNo
=
1
,
$pageSize
=
15
,
$order_
=
'id desc'
,
$field
=
''
,
$params
=
''
)
{
return
$this
->
field
(
$field
)
return
$this
->
field
(
$field
)
->
alias
(
'a'
)
->
alias
(
'a'
)
->
join
(
'a_agents b'
,
'a.agents_id = b.id'
,
'left'
)
->
join
(
'a_agents b'
,
'a.agents_id = b.id'
,
'left'
)
->
where
(
$params
)
->
where
(
$params
)
->
order
(
$order_
)
->
order
(
$order_
)
->
limit
(
$pageSize
)
->
limit
(
$pageSize
)
...
@@ -148,24 +151,26 @@ class GHousesToAgents extends BaseModel
...
@@ -148,24 +151,26 @@ class GHousesToAgents extends BaseModel
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
* @throws \think\exception\DbException
*/
*/
public
function
getHouseByAgentId
(
$field
,
$params
){
public
function
getHouseByAgentId
(
$field
,
$params
)
{
$result
=
Db
::
name
(
$this
->
table
)
$result
=
Db
::
name
(
$this
->
table
)
->
field
(
$field
)
->
field
(
$field
)
->
alias
(
"a"
)
->
alias
(
"a"
)
->
join
(
"g_houses b"
,
"a.houses_id = b.id"
,
"left"
)
->
join
(
"g_houses b"
,
"a.houses_id = b.id"
,
"left"
)
->
where
(
$params
)
->
where
(
$params
)
->
select
();
->
select
();
// echo Db::name($this->table)->getLastSql();
// echo Db::name($this->table)->getLastSql();
return
$result
;
return
$result
;
}
}
public
function
getAgentsByHouseId
(
$field
,
$params
){
public
function
getAgentsByHouseId
(
$field
,
$params
)
{
$result
=
Db
::
name
(
$this
->
table
)
$result
=
Db
::
name
(
$this
->
table
)
->
field
(
$field
)
->
field
(
$field
)
->
alias
(
"a"
)
->
alias
(
"a"
)
->
join
(
"a_agents b"
,
"a.agents_id = b.id"
,
"left"
)
->
join
(
"a_agents b"
,
"a.agents_id = b.id"
,
"left"
)
->
where
(
$params
)
->
where
(
$params
)
->
select
();
->
select
();
//echo Db::name($this->table)->getLastSql();
//echo Db::name($this->table)->getLastSql();
...
@@ -181,11 +186,25 @@ class GHousesToAgents extends BaseModel
...
@@ -181,11 +186,25 @@ class GHousesToAgents extends BaseModel
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
* @throws \think\exception\DbException
*/
*/
public
function
getHousesAgents
(
$houses_id
)
{
public
function
getHousesAgents
(
$houses_id
)
{
$select_data
=
$this
->
field
(
'b.id,name,a.type,b.phone'
)
->
alias
(
'a'
)
->
join
(
'a_agents b'
,
'a.agents_id = b.id'
,
'LEFT'
)
->
where
([
'houses_id'
=>
$houses_id
,
'is_del'
=>
0
])
->
select
();
return
$select_data
;
}
public
function
getHousesUpdateAgents
(
$houses_id
)
{
$select_data
=
$this
->
field
(
'b.id,name,a.type,b.phone'
)
->
alias
(
'a'
)
$select_data
=
$this
->
field
(
'b.id,name,a.type,b.phone'
)
->
alias
(
'a'
)
->
join
(
'a_agents b'
,
'a.agents_id = b.id'
,
'LEFT'
)
->
join
(
'a_agents b'
,
'a.agents_id = b.id'
,
'LEFT'
)
->
where
([
->
where
([
'houses_id'
=>
$houses_id
,
'houses_id'
=>
$houses_id
,
'type'
=>
2
,
'is_del'
=>
0
'is_del'
=>
0
])
->
select
();
])
->
select
();
...
@@ -202,11 +221,12 @@ class GHousesToAgents extends BaseModel
...
@@ -202,11 +221,12 @@ class GHousesToAgents extends BaseModel
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
* @throws \think\exception\DbException
*/
*/
public
function
getAgentList
(
$house_id
,
$type
=
1
)
{
public
function
getAgentList
(
$house_id
,
$type
=
1
)
{
return
$this
->
field
(
'b.id,device_id,store_name,d.internal_title,b.name,b.phone'
)
return
$this
->
field
(
'b.id,device_id,store_name,d.internal_title,b.name,b.phone'
)
->
alias
(
'a'
)
->
alias
(
'a'
)
->
join
(
'a_agents b'
,
'a.agents_id = b.id'
,
'left'
)
->
join
(
'a_agents b'
,
'a.agents_id = b.id'
,
'left'
)
->
join
(
'a_store c'
,
'b.store_id = c.id'
,
'left'
)
->
join
(
'a_store c'
,
'b.store_id = c.id'
,
'left'
)
->
join
(
'g_houses d'
,
'd.id = a.houses_id'
,
'left'
)
->
join
(
'g_houses d'
,
'd.id = a.houses_id'
,
'left'
)
->
where
(
'houses_id'
,
$house_id
)
->
where
(
'houses_id'
,
$house_id
)
->
where
(
'type'
,
$type
)
->
where
(
'type'
,
$type
)
...
...
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