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
0f421b77
Commit
0f421b77
authored
Apr 20, 2018
by
hujun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
咨询经纪人客方显示在第一个位置
parent
ae87a3f6
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
72 additions
and
30 deletions
+72
-30
Broker.php
application/api/controller/Broker.php
+20
-15
TransferHouseInfo.php
application/api/controller/TransferHouseInfo.php
+17
-13
AAgents.php
application/model/AAgents.php
+35
-2
No files found.
application/api/controller/Broker.php
View file @
0f421b77
...
@@ -11,7 +11,7 @@ use app\model\Remarks;
...
@@ -11,7 +11,7 @@ use app\model\Remarks;
/**
/**
* Description of Agents
* Description of Agents
*
*
* @user :hujun
* @user :hu
jun
* @date :2017-12-11
* @date :2017-12-11
* @time :11:15:05
* @time :11:15:05
* Intro :
* Intro :
...
@@ -29,22 +29,22 @@ class Broker extends Basic{
...
@@ -29,22 +29,22 @@ class Broker extends Basic{
public
function
index
()
{
public
function
index
()
{
$params
=
$this
->
params
;
$params
=
$this
->
params
;
$data
[
'status'
]
=
101
;
$data
[
'status'
]
=
101
;
$data
[
'data'
]
=
array
();
$data
[
'data'
]
=
[];
$data
[
'msg'
]
=
''
;
if
(
$params
[
'house_id'
])
{
if
(
$params
[
'house_id'
])
{
$pageNo
=
empty
(
$params
[
'pageNo'
])
?
1
:
$params
[
'pageNo'
];
$pageNo
=
empty
(
$params
[
'pageNo'
])
?
1
:
$params
[
'pageNo'
];
$pageSize
=
empty
(
$params
[
'pageSize'
])
?
PAGESIZE
:
$params
[
'pageSize'
];
$pageSize
=
empty
(
$params
[
'pageSize'
])
?
PAGESIZE
:
$params
[
'pageSize'
];
$agents
=
new
AAgents
();
$agents
=
new
AAgents
();
$data
[
'msg'
]
=
''
;
$fields
=
'a.id,name,phone,COUNT(b.id) evaluate,sum(evaluate_grade) as evaluate_grade,a.img'
;
$fields
=
'a.id,name,phone,COUNT(b.id) evaluate,sum(evaluate_grade) as evaluate_grade,a.img,d.id as user_id'
;
$list
=
$agents
->
getUser
(
$pageNo
,
$pageSize
,
'evaluate desc'
,
$fields
,
''
,
$params
[
'house_id'
]);
$list
=
$agents
->
getUser
(
$pageNo
,
$pageSize
,
'evaluate desc'
,
$fields
,
''
,
$params
[
'house_id'
]);
if
(
$list
)
{
if
(
!
empty
(
$list
)
)
{
foreach
(
$list
as
$k
=>
$v
)
{
foreach
(
$list
as
$k
=>
$v
)
{
$v
->
head_portrait
=
AGENTHEADERIMGURL
.
$v
->
img
;
$v
[
'head_portrait'
]
=
AGENTHEADERIMGURL
.
$v
[
'img'
];
$list
[
$k
]
=
$v
->
toArray
();
if
(
$list
[
$k
][
'evaluate_grade'
])
{
if
(
$list
[
$k
][
'evaluate_grade'
])
{
$evaluate_grade
=
floor
((
$list
[
$k
][
'evaluate_grade'
]
/
2
)
/
$list
[
$k
][
'evaluate'
]);
$evaluate_grade
=
floor
((
$list
[
$k
][
'evaluate_grade'
]
/
2
)
/
$list
[
$k
][
'evaluate'
]);
}
else
{
}
else
{
...
@@ -62,13 +62,15 @@ class Broker extends Basic{
...
@@ -62,13 +62,15 @@ class Broker extends Basic{
}
else
{
}
else
{
$data
[
'msg'
]
=
'house_id 为空'
;
$data
[
'msg'
]
=
'house_id 为空'
;
}
}
return
$this
->
response
(
$data
[
'status'
],
$data
[
'msg'
],
$data
[
'data'
]
);
return
$this
->
response
(
$data
[
'status'
],
$data
[
'msg'
],
$data
[
'data'
]
);
}
}
/**
/**
* 评价经纪人
* 评价经纪人
*
*
* @return type
* @return \think\Response
* @throws \Exception
*/
*/
public
function
appraiser
()
{
public
function
appraiser
()
{
$params
=
$this
->
params
;
$params
=
$this
->
params
;
...
@@ -190,11 +192,14 @@ class Broker extends Basic{
...
@@ -190,11 +192,14 @@ class Broker extends Basic{
return
$this
->
response
(
$data
[
'status'
],
$data
[
'msg'
],
$data
[
'data'
]);
return
$this
->
response
(
$data
[
'status'
],
$data
[
'msg'
],
$data
[
'data'
]);
}
}
/**
/**
* 经纪人详情
* 经纪人详情
*
*
* @return type
* @return \think\Response
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
*/
public
function
brokerDetail
()
{
public
function
brokerDetail
()
{
...
...
application/api/controller/TransferHouseInfo.php
View file @
0f421b77
...
@@ -21,7 +21,7 @@ class TransferHouseInfo extends Controller
...
@@ -21,7 +21,7 @@ class TransferHouseInfo extends Controller
*/
*/
public
function
table
()
{
public
function
table
()
{
Db
::
table
(
'g_houses'
)
->
execute
(
'TRUNCATE `g_houses`'
);
Db
::
table
(
'g_houses'
)
->
execute
(
'TRUNCATE `g_houses`'
);
Db
::
table
(
'g_houses_to_agents'
)
->
execute
(
'TRUNCATE `g_houses_to_agents`'
);
//
Db::table('g_houses_to_agents')->execute('TRUNCATE `g_houses_to_agents`');
Db
::
table
(
'houseinfo_exts'
)
->
execute
(
'TRUNCATE `g_houses_ext`'
);
Db
::
table
(
'houseinfo_exts'
)
->
execute
(
'TRUNCATE `g_houses_ext`'
);
$num
=
Db
::
table
(
'houseinfos'
)
->
order
(
'id desc'
)
->
value
(
'id'
);
$num
=
Db
::
table
(
'houseinfos'
)
->
order
(
'id desc'
)
->
value
(
'id'
);
$regions
=
new
Regions
();
$regions
=
new
Regions
();
...
@@ -217,33 +217,36 @@ class TransferHouseInfo extends Controller
...
@@ -217,33 +217,36 @@ class TransferHouseInfo extends Controller
$agent_data
=
Db
::
table
(
'agents'
)
->
field
(
'id,house_ids,house_ids2'
)
->
where
(
'level in(2,5)'
)
->
select
();
$agent_data
=
Db
::
table
(
'agents'
)
->
field
(
'id,house_ids,house_ids2'
)
->
where
(
'level in(2,5)'
)
->
select
();
$agent_house_data
=
[];
$agent_house_data
=
[];
$key
=
0
;
foreach
(
$agent_data
as
$k
=>
$v
)
{
foreach
(
$agent_data
as
$k
=>
$v
)
{
$key
=
0
;
if
(
!
empty
(
$v
[
'house_ids'
]))
{
if
(
!
empty
(
$v
[
'house_ids'
]))
{
$house_ids_arr
=
explode
(
','
,
$v
[
'house_ids'
]);
$house_ids_arr
=
explode
(
','
,
$v
[
'house_ids'
]);
$house_ids_arr
=
array_unique
(
$house_ids_arr
);
foreach
(
$house_ids_arr
as
$kk
=>
$vv
)
{
foreach
(
$house_ids_arr
as
$kk
=>
$vv
)
{
$agent_house_data
[
$key
][
'houses_id'
]
=
$vv
;
$agent_house_data_arr
[
$key
]
=
$vv
.
'-|-'
.
$v
[
'id'
];
$agent_house_data
[
$key
][
'agents_id'
]
=
$v
[
'id'
];
$agent_house_data
[
$key
][
'type'
]
=
1
;
$key
++
;
$key
++
;
}
}
}
}
if
(
!
empty
(
$v
[
'house_ids2'
]))
{
if
(
!
empty
(
$v
[
'house_ids2'
]))
{
$house_ids_arr
=
explode
(
','
,
$v
[
'house_ids2'
]);
$house_ids_arr
=
explode
(
','
,
$v
[
'house_ids2'
]);
$house_ids_arr
=
array_unique
(
$house_ids_arr
);
foreach
(
$house_ids_arr
as
$kkk
=>
$vvv
)
{
foreach
(
$house_ids_arr
as
$kkk
=>
$vvv
)
{
$agent_house_data
[
$key
][
'houses_id'
]
=
$vvv
;
$agent_house_data_arr
[
$key
]
=
$vvv
.
'-|-'
.
$v
[
'id'
];
$agent_house_data
[
$key
][
'agents_id'
]
=
$v
[
'id'
];
$agent_house_data
[
$key
][
'type'
]
=
1
;
$key
++
;
$key
++
;
}
}
}
}
}
if
(
!
empty
(
$agent_house_data
))
{
$agent_house_data_arr
=
array_unique
(
$agent_house_data_arr
);
//去重
$result
[]
=
Db
::
table
(
'g_houses_to_agents'
)
->
insertAll
(
$agent_house_data
);
}
foreach
(
$agent_house_data_arr
as
$k
=>
$v
)
{
$data_house_arr
=
explode
(
'-|-'
,
$v
);
$agent_house_data
[
$k
][
'houses_id'
]
=
$data_house_arr
[
0
];
$agent_house_data
[
$k
][
'agents_id'
]
=
$data_house_arr
[
1
];
}
}
dump
(
$result
);
die
;
$result
=
Db
::
table
(
'g_houses_to_agents'
)
->
insertAll
(
$agent_house_data
);
dump
(
$result
);
}
}
}
}
\ No newline at end of file
application/model/AAgents.php
View file @
0f421b77
...
@@ -732,8 +732,9 @@ class AAgents extends BaseModel
...
@@ -732,8 +732,9 @@ class AAgents extends BaseModel
$data
=
$this
->
field
(
$field
)
->
alias
(
'a'
)
$data
=
$this
->
field
(
$field
)
->
alias
(
'a'
)
->
join
(
'u_evaluate b'
,
'a.id = b.agents_id'
,
'left'
)
->
join
(
'u_evaluate b'
,
'a.id = b.agents_id'
,
'left'
)
->
join
(
'g_houses_to_agents c'
,
'a.id=c.agents_id'
,
'left'
)
->
join
(
'g_houses_to_agents c'
,
'a.id=c.agents_id'
,
'left'
)
->
join
(
'u_users d'
,
'a.id = d.agent_id'
,
'left'
)
->
where
(
'c.houses_id'
,
$house_id
)
->
where
(
'c.houses_id'
,
$house_id
)
->
where
(
'type'
,
1
)
->
where
(
'
c.
type'
,
1
)
->
where
(
$params
)
->
where
(
$params
)
->
group
(
'a.id'
)
->
group
(
'a.id'
)
->
order
(
$order_
)
->
order
(
$order_
)
...
@@ -767,7 +768,15 @@ class AAgents extends BaseModel
...
@@ -767,7 +768,15 @@ class AAgents extends BaseModel
->
select
();
->
select
();
}
}
/**
* @param $field
* @param $params
* @param $group
* @return false|\PDOStatement|string|\think\Collection
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public
function
getAgentsList
(
$field
,
$params
,
$group
){
public
function
getAgentsList
(
$field
,
$params
,
$group
){
$where_
=
[];
$where_
=
[];
if
(
$group
==
"store_id"
){
if
(
$group
==
"store_id"
){
...
@@ -782,4 +791,27 @@ class AAgents extends BaseModel
...
@@ -782,4 +791,27 @@ class AAgents extends BaseModel
return
$result
;
return
$result
;
}
}
/**
* 获取用户的客方经纪人
*
* @param string $field
* @param array $params
* @param int $house_id
* @return array|false|\PDOStatement|string|\think\Model
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public
function
getUserAgent
(
$field
=
''
,
$params
=
[],
$house_id
=
0
)
{
$data
=
$this
->
field
(
$field
)
->
alias
(
'a'
)
->
join
(
'u_evaluate b'
,
'a.id = b.agents_id'
,
'left'
)
->
join
(
'g_houses_to_agents c'
,
'a.id=c.agents_id'
,
'left'
)
->
join
(
'u_users d'
,
'a.id = d.agent_id'
,
'left'
)
->
where
(
'c.houses_id'
,
$house_id
)
->
where
(
'c.type'
,
1
)
->
where
(
$params
)
->
find
();
return
$data
;
}
}
}
\ No newline at end of file
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