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
ba9a8f00
Commit
ba9a8f00
authored
Jul 22, 2018
by
clone
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'chat_0705' into test
parents
fb8deaf4
1b3674d5
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
41 additions
and
20 deletions
+41
-20
StatementService.php
application/api_broker/service/StatementService.php
+38
-19
OBargainModel.php
application/model/OBargainModel.php
+3
-1
No files found.
application/api_broker/service/StatementService.php
View file @
ba9a8f00
...
...
@@ -55,6 +55,8 @@ class StatementService
$field
=
"id,store_id,district_id,level,name,phone,sex,status"
;
$agent_result
=
$this
->
agentModel
->
getAgentById
(
$field
,
[
"agent_id"
=>
$agent_id
]);
//dump($agent_result);
if
(
count
(
$agent_result
)
<=
0
)
{
return
null
;
}
...
...
@@ -70,8 +72,7 @@ class StatementService
$conditions
[
"agent_id"
]
=
$agent_id
;
$conditions
[
'create_time'
]
=
array
(
'between'
,
array
(
$time_start
,
$time_end
)
);
//dump($user_type);
return
$this
->
selectStatement
(
$conditions
,
$user_type
,
$store_id
,
$district_id
,
$day_or_week
);
return
$this
->
selectStatement
(
$conditions
,
$user_type
,
$store_id
,
$district_id
,
$day_or_week
,
$agent_id
);
}
...
...
@@ -83,7 +84,7 @@ class StatementService
* @param $district_id
* @return array
*/
private
function
selectStatement
(
$conditions
,
$user_type
,
$store_id
,
$district_id
,
$day_or_week
)
private
function
selectStatement
(
$conditions
,
$user_type
,
$store_id
,
$district_id
,
$day_or_week
,
$agent_id
)
{
$result
=
$params
=
[];
...
...
@@ -94,7 +95,7 @@ class StatementService
case
1
:
//todo 统计门店下的所有经纪人
$params
[
"store_id"
]
=
$store_id
;
$params
[
"level"
]
=
array
(
"neq"
,
"30"
);
//
$params["level"] = array( "neq", "30" );
$params
[
"status"
]
=
0
;
//只查询正常状态的经纪人
break
;
case
2
:
...
...
@@ -137,17 +138,20 @@ class StatementService
//本月业绩
$start_time
=
date
(
"Y-m-01"
,
time
());
$end_time
=
date
(
"Y-m-d"
,
strtotime
(
"-1 day"
));
if
(
$user_type
==
2
)
{
//如果是总监
$where_
[
"agent_id"
]
=
array
(
"in"
,
$agentIds
);
}
else
{
$end_time
=
date
(
"Y-m-d"
,
time
());
if
(
$user_type
==
2
)
{
//如果是总监 $conditions["agent_id"]
$where_
[
"district_id"
]
=
$district_id
;
}
else
if
(
$user_type
==
0
){
$where_
[
"agent_id"
]
=
$conditions
[
"agent_id"
];
}
else
{
$where_
[
"agent_id"
]
=
array
(
"in"
,
$agentIds
);
}
$where_
[
'create_time'
]
=
array
(
'between'
,
array
(
$start_time
.
" 00:00:00"
,
$end_time
.
" 23:59:59"
)
);
//dump($where_);
$obargain
=
new
OBargainModel
();
$performanceSum
=
$obargain
->
getAddBargainNum
(
$where_
,
1
);
//1表示业绩 2表示实收
$result
[
"performance_month"
]
=
isset
(
$performanceSum
[
0
][
"num"
])
?
$performanceSum
[
0
][
"num"
]
:
0
;
//本周业绩
...
...
@@ -156,18 +160,27 @@ class StatementService
$performanceSum
=
$obargain
->
getAddBargainNum
(
$where_
,
1
);
//1表示业绩 2表示实收
$result
[
"performance_week"
]
=
isset
(
$performanceSum
[
0
][
"num"
])
?
$performanceSum
[
0
][
"num"
]
:
0
;
//本周客源
$start_time
=
date
(
"Y-m-d"
,
strtotime
(
"-7 day"
));
$where_
[
'create_time'
]
=
[
'between'
,
[
$start_time
.
" 00:00:00"
,
$end_time
.
" 23:59:59"
]
];
$addUserNum
=
$this
->
userModel
->
getAddUserNum
(
$where_
);
$result
[
"add_user_num_week"
]
=
isset
(
$addUserNum
[
0
][
"num"
])
?
$addUserNum
[
0
][
"num"
]
:
0
;
//本月完成单数
$start_time
=
date
(
"Y-m-01"
,
time
());
$end_time
=
date
(
"Y-m-d"
,
strtotime
(
"-1 day"
));
if
(
$user_type
==
2
)
{
//如果是总监
$where_
[
"agent_id"
]
=
array
(
"in"
,
$agentIds
);
}
else
{
$end_time
=
date
(
"Y-m-d"
,
time
());
if
(
$user_type
==
2
)
{
//如果是总监 $conditions["agent_id"]
$where_
[
"district_id"
]
=
$district_id
;
}
else
if
(
$user_type
==
0
){
$where_
[
"agent_id"
]
=
$conditions
[
"agent_id"
];
}
else
{
$where_
[
"agent_id"
]
=
array
(
"in"
,
$agentIds
);
}
$where_
[
'create_time'
]
=
array
(
'between'
,
array
(
$start_time
.
" 00:00:00"
,
$end_time
.
" 23:59:59"
)
);
// dump($where_);
$performanceSum
=
$obargain
->
getAddBargainNum
(
$where_
,
3
);
//1表示业绩 2表示实收
$result
[
"bargain_sum"
]
=
isset
(
$performanceSum
[
0
][
"num"
])
?
$performanceSum
[
0
][
"num"
]
:
0
;
//exit;
//客源
$addUserNum
=
$this
->
userModel
->
getAddUserNum
(
$where_
);
...
...
@@ -176,13 +189,19 @@ class StatementService
//当日业绩
$start_time
=
date
(
"Y-m-d"
,
time
());
$end_time
=
$start_time
;
$where_
[
"agent_id"
]
=
array
(
"in"
,
$agentIds
);
if
(
$user_type
==
0
){
$where_
[
"agent_id"
]
=
$conditions
[
"agent_id"
];
}
else
{
$where_
[
"agent_id"
]
=
array
(
"in"
,
$agentIds
);
}
$where_
[
'create_time'
]
=
array
(
'between'
,
array
(
$start_time
.
" 00:00:00"
,
$end_time
.
" 23:59:59"
)
);
$performanceSum
=
$obargain
->
getAddBargainNum
(
$where_
,
1
);
//1表示业绩 2表示实收
$result
[
"performance_day"
]
=
isset
(
$performanceSum
[
0
][
"num"
])
?
$performanceSum
[
0
][
"num"
]
:
0
;
//当日客源
// dump($where_);
// dump($where_);
$addUserNum
=
$this
->
userModel
->
getAddUserNum
(
$where_
);
$result
[
"add_user_num_day"
]
=
isset
(
$addUserNum
[
0
][
"num"
])
?
$addUserNum
[
0
][
"num"
]
:
0
;
...
...
@@ -191,9 +210,9 @@ class StatementService
$where_
=
[];
$start_time
=
date
(
"Y-m-d"
,
time
());
$end_time
=
$start_time
;
$where_
[
"agent_id"
]
=
$
store
_id
;
$where_
[
"agent_id"
]
=
$
agent
_id
;
$where_
[
'create_time'
]
=
array
(
'between'
,
array
(
$start_time
.
" 00:00:00"
,
$end_time
.
" 23:59:59"
)
);
// dump($where_);
$performanceSum
=
$obargain
->
getAddBargainNum
(
$where_
,
3
);
//1表示业绩 2表示实收
$result
[
"bargain_sum_store"
]
=
isset
(
$performanceSum
[
0
][
"num"
])
?
$performanceSum
[
0
][
"num"
]
:
0
;
...
...
@@ -202,10 +221,10 @@ class StatementService
$where_
=
[];
$start_time
=
date
(
"Y-m-d"
,
time
());
$end_time
=
$start_time
;
$where_
[
"agent_id"
]
=
$
store
_id
;
$where_
[
"agent_id"
]
=
$
agent
_id
;
$where_
[
'create_time'
]
=
array
(
'between'
,
array
(
$start_time
.
" 00:00:00"
,
$end_time
.
" 23:59:59"
)
);
$reportNum
=
$this
->
reportModel
->
getAddReportNum
(
$
params
);
//dump($where_);
$reportNum
=
$this
->
reportModel
->
getAddReportNum
(
$
where_
);
$result
[
"look_at_num_day_store"
]
=
isset
(
$reportNum
[
0
][
"num"
])
?
$reportNum
[
0
][
"num"
]
:
0
;
//todo
...
...
application/model/OBargainModel.php
View file @
ba9a8f00
...
...
@@ -668,12 +668,14 @@ class OBargainModel extends Model
$where_
[
"b.house_id"
]
=
array
(
"in"
,
$params
[
"house_ids"
]
);
}
return
Db
::
table
(
$this
->
table
)
$return
=
Db
::
table
(
$this
->
table
)
->
field
(
$field
)
->
alias
(
"a"
)
->
join
(
"o_order b"
,
"a.order_id = b.id"
,
"left"
)
->
where
(
$where_
)
->
select
();
//dump($this->getLastSql());
return
$return
;
}
public
function
getReceived
(
$params
)
...
...
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