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
d0c246e4
Commit
d0c246e4
authored
May 24, 2018
by
hujun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改成交报告经纪人查询
parent
0d3f4aaa
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
57 deletions
+29
-57
OBargainModel.php
application/model/OBargainModel.php
+29
-57
No files found.
application/model/OBargainModel.php
View file @
d0c246e4
...
@@ -665,76 +665,48 @@ class OBargainModel extends Model
...
@@ -665,76 +665,48 @@ class OBargainModel extends Model
}
}
/**
/**
*
//
1盘方,2客方,3反签,4独家,5合作方
* 1盘方,2客方,3反签,4独家,5合作方
*
*
* @param $bargain_id
* @param int $bargain_id
* @param string $field
* @return array
* @return array
* @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
getAgentTypeByBargainId
(
$bargain_id
,
$field
=
''
)
{
public
function
getAgentTypeByBargainId
(
int
$bargain_id
)
:
array
{
$field
=
'b.house_id,c.user_id,c.report_agent_id,d.name,d.phone'
;
$bargain_data
=
$this
->
alias
(
'a'
)
$data
=
$this
->
field
(
'role,agent_id'
)
->
field
(
$field
)
->
where
(
'id'
,
$bargain_id
)
->
join
(
'o_order b'
,
'a.order_id = b.id'
,
'left'
)
->
whereOr
(
'father_id'
,
$bargain_id
)
->
join
(
'o_report c'
,
'a.report_id = c.id'
,
'left'
)
->
select
();
->
join
(
'a_agents d'
,
'c.report_agent_id = d.id'
,
'left'
)
->
where
(
'a.id'
,
$bargain_id
)
->
find
();
$m_house_agent
=
new
GHousesToAgents
();
$m_agent
=
new
AAgents
();
$m_user
=
new
Users
();
$result
=
[];
$agent_arr
=
[];
foreach
(
$data
as
$k
=>
$v
)
{
$key
=
0
;
if
(
isset
(
$bargain_data
[
'phone'
]))
{
$agent_arr
[
$key
][
'id'
]
=
$bargain_data
[
'report_agent_id'
];
$agent_arr
[
$key
][
'name'
]
=
$bargain_data
[
'name'
];
$agent_arr
[
$key
][
'phone'
]
=
$bargain_data
[
'phone'
];
$agent_arr
[
$key
][
'type_str'
]
=
'反签方'
;
$agent_arr
[
$key
][
'type'
]
=
3
;
$key
++
;
}
if
(
!
empty
(
$bargain_data
[
'user_id'
]))
{
$agent_user
=
$m_user
->
getAgentByUserId
(
'b.id,b.phone,b.name'
,
[
'a.id'
=>
$bargain_data
[
'user_id'
]]);
if
(
isset
(
$agent_user
[
0
][
'phone'
]))
{
$agent_arr
[
$key
][
'id'
]
=
$agent_user
[
0
][
'id'
];
$agent_arr
[
$key
][
'name'
]
=
$agent_user
[
0
][
'name'
];
$agent_arr
[
$key
][
'phone'
]
=
$agent_user
[
0
][
'phone'
];
$agent_arr
[
$key
][
'type_str'
]
=
'客方'
;
$agent_arr
[
$key
][
'type'
]
=
2
;
$key
++
;
}
}
if
(
!
empty
(
$bargain_data
[
'house_id'
]))
{
if
(
isset
(
$v
[
'role'
]))
{
//盘方和独家
$agent_name
=
$m_agent
->
getAgentInfo
(
'id,name,phone'
,
$v
[
'agent_id'
]);
$where
[
'a.houses_id'
]
=
$bargain_data
[
'house_id'
];
$result
[
$k
][
'id'
]
=
$agent_name
[
'id'
];
$where
[
'a.type'
]
=
[
'in'
,
'2,3'
];
$result
[
$k
][
'name'
]
=
$agent_name
[
'name'
];
$agent_house
=
$m_house_agent
->
getAgentsByHouseId
(
'b.id,b.name,b.phone,a.type'
,
$where
);
$result
[
$k
][
'phone'
]
=
$agent_name
[
'phone'
];
foreach
(
$agent_house
as
$k
=>
$v
)
{
$result
[
$k
][
'role'
]
=
$v
[
'role'
];
if
(
isset
(
$v
[
'phone'
]))
{
$agent_arr
[
$key
][
'id'
]
=
$v
[
'id'
];
switch
(
$v
[
'role'
])
{
$agent_arr
[
$key
][
'name'
]
=
$v
[
'name'
];
case
1
:
$agent_arr
[
$key
][
'phone'
]
=
$v
[
'phone'
];
$result
[
$k
][
'role_name'
]
=
'盘方'
;
break
;
case
2
:
if
(
$v
[
'type'
]
==
2
)
{
$result
[
$k
][
'role_name'
]
=
'客方'
;
break
;
$agent_arr
[
$key
][
'type_str'
]
=
'盘方'
;
case
3
:
$agent_arr
[
$key
][
'type'
]
=
1
;
$result
[
$k
][
'role_name'
]
=
'反签'
;
break
;
}
else
{
case
4
:
$agent_arr
[
$key
][
'type_str'
]
=
'独家方'
;
$result
[
$k
][
'role_name'
]
=
'独家'
;
break
;
$agent_arr
[
$key
][
'type'
]
=
4
;
case
5
:
}
$result
[
$k
][
'role_name'
]
=
'合作方'
;
break
;
$key
++
;
}
}
}
}
}
}
return
$
agent_arr
;
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