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
9aa586a6
Commit
9aa586a6
authored
Aug 14, 2018
by
clone
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
统计
parent
0c03168e
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
505 additions
and
38 deletions
+505
-38
AAgents.php
application/model/AAgents.php
+36
-26
ASuperviseModel.php
application/model/ASuperviseModel.php
+21
-0
GHouses.php
application/model/GHouses.php
+21
-0
OBargainModel.php
application/model/OBargainModel.php
+84
-12
OMarchInModel.php
application/model/OMarchInModel.php
+21
-0
OPayLogModel.php
application/model/OPayLogModel.php
+21
-0
OReportModel.php
application/model/OReportModel.php
+24
-0
TAgentTotalModel.php
application/model/TAgentTotalModel.php
+18
-0
Users.php
application/model/Users.php
+21
-0
route.php
application/route.php
+2
-0
ResultsSummaryNewTask.php
application/task/controller/ResultsSummaryNewTask.php
+236
-0
No files found.
application/model/AAgents.php
View file @
9aa586a6
...
@@ -273,7 +273,7 @@ class AAgents extends BaseModel
...
@@ -273,7 +273,7 @@ class AAgents extends BaseModel
$where_
[
"level"
]
=
$params
[
"level"
];
$where_
[
"level"
]
=
$params
[
"level"
];
}
}
if
(
isset
(
$params
[
'in_id'
]))
{
if
(
isset
(
$params
[
'in_id'
]))
{
$where_
[
'id'
]
=
[
'in'
,
$params
[
'in_id'
]
];
$where_
[
'id'
]
=
[
'in'
,
$params
[
'in_id'
]
];
}
}
$result
=
$this
->
field
(
$field
)
$result
=
$this
->
field
(
$field
)
->
where
(
$where_
)
->
where
(
$where_
)
...
@@ -352,8 +352,10 @@ class AAgents extends BaseModel
...
@@ -352,8 +352,10 @@ class AAgents extends BaseModel
*/
*/
public
function
getAgentsListByTask
(
$pageNo
=
1
,
$pageSize
=
15
,
$field
=
"id"
)
public
function
getAgentsListByTask
(
$pageNo
=
1
,
$pageSize
=
15
,
$field
=
"id"
)
{
{
$params
[
"district_id"
]
=
array
(
'not in'
,
array
(
'13'
,
'14'
,
'15'
)
);
return
Db
::
table
(
$this
->
table
)
return
Db
::
table
(
$this
->
table
)
->
field
(
$field
)
->
field
(
$field
)
->
where
(
$params
)
->
limit
(
$pageSize
)
->
limit
(
$pageSize
)
->
page
(
$pageNo
)
->
page
(
$pageNo
)
->
select
();
->
select
();
...
@@ -387,7 +389,9 @@ class AAgents extends BaseModel
...
@@ -387,7 +389,9 @@ class AAgents extends BaseModel
*/
*/
public
function
getAgentsCountByTask
()
public
function
getAgentsCountByTask
()
{
{
$params
[
"district_id"
]
=
array
(
'not in'
,
array
(
'13'
,
'14'
,
'15'
)
);
return
Db
::
table
(
$this
->
table
)
return
Db
::
table
(
$this
->
table
)
->
where
(
$params
)
->
count
();
->
count
();
}
}
...
@@ -489,12 +493,13 @@ class AAgents extends BaseModel
...
@@ -489,12 +493,13 @@ class AAgents extends BaseModel
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
* @throws \think\exception\DbException
*/
*/
public
function
getStoreOrDistrict
(
$params
){
public
function
getStoreOrDistrict
(
$params
)
{
$result
=
Db
::
table
(
$this
->
table
)
$result
=
Db
::
table
(
$this
->
table
)
->
field
(
"id,name,img"
)
->
field
(
"id,name,img"
)
->
where
(
$params
)
->
where
(
$params
)
->
select
();
->
select
();
//echo Db::table($this->table)->getLastSql();
//echo Db::table($this->table)->getLastSql();
return
$result
;
return
$result
;
}
}
...
@@ -776,15 +781,15 @@ class AAgents extends BaseModel
...
@@ -776,15 +781,15 @@ class AAgents extends BaseModel
public
function
getUser
(
$pageNo
=
1
,
$pageSize
=
15
,
$order_
=
'id desc'
,
$field
,
$params
,
$house_id
=
''
)
public
function
getUser
(
$pageNo
=
1
,
$pageSize
=
15
,
$order_
=
'id desc'
,
$field
,
$params
,
$house_id
=
''
)
{
{
return
$this
->
field
(
$field
)
->
alias
(
'a'
)
return
$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'
)
->
where
(
'c.type'
,
1
)
->
where
(
'c.type'
,
1
)
->
where
(
$params
)
->
where
(
$params
)
->
group
(
'a.id'
)
->
group
(
'a.id'
)
->
order
(
$order_
)
->
order
(
$order_
)
->
limit
(
$pageSize
)
->
limit
(
$pageSize
)
->
page
(
$pageNo
)
->
page
(
$pageNo
)
->
select
();
->
select
();
}
}
/**
/**
...
@@ -798,7 +803,8 @@ class AAgents extends BaseModel
...
@@ -798,7 +803,8 @@ class AAgents extends BaseModel
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
* @throws \think\exception\DbException
*/
*/
public
function
searchAgentShop
(
$pageNo
=
1
,
$pageSize
=
15
,
$order_
=
'id desc'
,
$field
=
''
,
$params
=
''
)
{
public
function
searchAgentShop
(
$pageNo
=
1
,
$pageSize
=
15
,
$order_
=
'id desc'
,
$field
=
''
,
$params
=
''
)
{
return
$this
->
field
(
$field
)
return
$this
->
field
(
$field
)
->
alias
(
'a'
)
->
alias
(
'a'
)
->
join
(
'a_store b'
,
'a.store_id = b.id'
,
'left'
)
->
join
(
'a_store b'
,
'a.store_id = b.id'
,
'left'
)
...
@@ -818,10 +824,11 @@ class AAgents extends BaseModel
...
@@ -818,10 +824,11 @@ class AAgents extends BaseModel
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
* @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"
)
{
$where_
[
'level'
]
=
array
(
"in"
,[
20
,
40
]
);
$where_
[
'level'
]
=
array
(
"in"
,
[
20
,
40
]
);
}
}
$result
=
Db
::
name
(
$this
->
table
)
$result
=
Db
::
name
(
$this
->
table
)
->
field
(
$field
)
->
field
(
$field
)
...
@@ -844,11 +851,12 @@ class AAgents extends BaseModel
...
@@ -844,11 +851,12 @@ class AAgents extends BaseModel
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
* @throws \think\exception\DbException
*/
*/
public
function
getUserAgent
(
$field
=
''
,
$params
=
[],
$house_id
=
0
)
{
public
function
getUserAgent
(
$field
=
''
,
$params
=
[],
$house_id
=
0
)
{
$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'
)
->
join
(
'u_users d'
,
'a.id = d.agent_id'
,
'left'
)
->
where
(
'c.houses_id'
,
$house_id
)
->
where
(
'c.houses_id'
,
$house_id
)
->
where
(
'c.type'
,
1
)
->
where
(
'c.type'
,
1
)
->
where
(
$params
)
->
where
(
$params
)
...
@@ -866,10 +874,11 @@ class AAgents extends BaseModel
...
@@ -866,10 +874,11 @@ class AAgents extends BaseModel
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
* @throws \think\exception\DbException
*/
*/
public
function
getAgentClient
(
string
$field
=
'*'
,
array
$params
=
[])
{
public
function
getAgentClient
(
string
$field
=
'*'
,
array
$params
=
[])
{
return
$this
->
field
(
$field
)
->
alias
(
'a'
)
return
$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
(
'u_users c'
,
'a.id = c.agent_id'
,
'left'
)
->
join
(
'u_users c'
,
'a.id = c.agent_id'
,
'left'
)
->
where
(
$params
)
->
where
(
$params
)
->
find
();
->
find
();
}
}
...
@@ -907,12 +916,12 @@ class AAgents extends BaseModel
...
@@ -907,12 +916,12 @@ class AAgents extends BaseModel
if
(
$id
)
{
if
(
$id
)
{
$result
=
$this
->
field
(
'id,name as realname,create_time,img,store_id'
)
->
find
(
$id
);
$result
=
$this
->
field
(
'id,name as realname,create_time,img,store_id'
)
->
find
(
$id
);
$evaluate_grade
=
Db
::
table
(
'u_evaluate'
)
$evaluate_grade
=
Db
::
table
(
'u_evaluate'
)
->
field
(
'sum(evaluate_grade) as evaluate_grade, count(*) as evaluate_num'
)
->
field
(
'sum(evaluate_grade) as evaluate_grade, count(*) as evaluate_num'
)
->
where
(
'agents_id'
,
$id
)
->
where
(
'is_show'
,
0
)
->
find
();
->
where
(
'agents_id'
,
$id
)
->
where
(
'is_show'
,
0
)
->
find
();
$m_store
=
new
AStore
();
$m_store
=
new
AStore
();
$result
[
'sub_shopname'
]
=
$m_store
->
getStoreKeyById
(
'store_name'
,
[
'id'
=>
$result
[
'store_id'
]
]);
$result
[
'sub_shopname'
]
=
$m_store
->
getStoreKeyById
(
'store_name'
,
[
'id'
=>
$result
[
'store_id'
]
]);
if
(
$evaluate_grade
[
'evaluate_grade'
])
{
if
(
$evaluate_grade
[
'evaluate_grade'
])
{
$grade
=
floor
((
$evaluate_grade
[
'evaluate_grade'
]
/
2
)
/
$evaluate_grade
[
'evaluate_num'
]);
$grade
=
floor
((
$evaluate_grade
[
'evaluate_grade'
]
/
2
)
/
$evaluate_grade
[
'evaluate_num'
]);
}
else
{
}
else
{
...
@@ -924,9 +933,9 @@ class AAgents extends BaseModel
...
@@ -924,9 +933,9 @@ class AAgents extends BaseModel
$result
[
'watch_shop'
]
=
Db
::
table
(
'u_appoint_watch_shop'
)
$result
[
'watch_shop'
]
=
Db
::
table
(
'u_appoint_watch_shop'
)
->
where
(
'agents_id'
,
$id
)
->
count
();
//看铺
->
where
(
'agents_id'
,
$id
)
->
count
();
//看铺
$result
[
'head_portrait'
]
=
AGENTHEADERIMGURL
.
$result
[
'img'
];
$result
[
'head_portrait'
]
=
AGENTHEADERIMGURL
.
$result
[
'img'
];
$bargain
=
new
OBargainModel
();
$bargain
=
new
OBargainModel
();
$result
[
'JournalAccounts'
]
=
$bargain
->
ifBargainNumByOrderId
([
'agent_id'
=>
$id
]);
//成交记录
$result
[
'JournalAccounts'
]
=
$bargain
->
ifBargainNumByOrderId
([
'agent_id'
=>
$id
]);
//成交记录
$current_time
=
time
();
$current_time
=
time
();
...
@@ -956,7 +965,8 @@ class AAgents extends BaseModel
...
@@ -956,7 +965,8 @@ class AAgents extends BaseModel
* @param $data
* @param $data
* @return AAgents|bool
* @return AAgents|bool
*/
*/
public
function
updateData
(
$id
,
$data
)
{
public
function
updateData
(
$id
,
$data
)
{
if
(
$id
)
{
if
(
$id
)
{
$result
=
$this
->
where
(
'id'
,
$id
)
->
update
(
$data
);
$result
=
$this
->
where
(
'id'
,
$id
)
->
update
(
$data
);
}
else
{
}
else
{
...
...
application/model/ASuperviseModel.php
View file @
9aa586a6
...
@@ -92,5 +92,25 @@ class ASuperviseModel extends Model
...
@@ -92,5 +92,25 @@ class ASuperviseModel extends Model
->
select
();
->
select
();
}
}
/**
* 统计监督执行数量分时间
* @param $params
* @return false|\PDOStatement|string|\think\Collection
*/
public
function
getAddPayLogNumGroupTimeNew
(
$params
){
$field
=
"count(1) as num"
;
$where_
=
[];
if
(
isset
(
$params
[
"agent_id"
])){
$where_
[
"agent_id"
]
=
$params
[
"agent_id"
];
}
if
(
isset
(
$params
[
"create_time"
])){
$where_
[
"create_time"
]
=
$params
[
"create_time"
];
}
return
Db
::
table
(
$this
->
table
)
->
field
(
$field
)
->
where
(
$where_
)
->
select
();
}
}
}
\ No newline at end of file
application/model/GHouses.php
View file @
9aa586a6
...
@@ -728,6 +728,27 @@ class GHouses extends BaseModel
...
@@ -728,6 +728,27 @@ class GHouses extends BaseModel
->
select
();
->
select
();
}
}
/**
* 获取添加的楼盘的每天数量
* @param $params
* @return false|\PDOStatement|string|\think\Collection
*/
public
function
getAddHouseNumGroupTimeNew
(
$params
)
{
$field
=
"count(1) as num"
;
$where_
=
[];
if
(
isset
(
$params
[
"agent_id"
]))
{
$where_
[
"upload_id"
]
=
$params
[
"agent_id"
];
}
if
(
isset
(
$params
[
"create_time"
]))
{
$where_
[
"create_time"
]
=
$params
[
"create_time"
];
}
return
Db
::
table
(
$this
->
table
)
->
field
(
$field
)
->
where
(
$where_
)
->
select
();
}
/**
/**
* 获取新增楼盘数量
* 获取新增楼盘数量
* @param $params
* @param $params
...
...
application/model/OBargainModel.php
View file @
9aa586a6
...
@@ -626,6 +626,34 @@ class OBargainModel extends Model
...
@@ -626,6 +626,34 @@ class OBargainModel extends Model
->
select
();
->
select
();
}
}
/**
* @param $params
* @return false|\PDOStatement|string|\think\Collection
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public
function
getReceivedGroupTimeNew
(
$params
)
{
$where_
=
[];
$field
=
"sum(b.practical_fee) as num"
;
if
(
isset
(
$params
[
"agent_id"
]))
{
$where_
[
"a.agent_id"
]
=
$params
[
"agent_id"
];
}
if
(
isset
(
$params
[
"create_time"
]))
{
$where_
[
"b.create_time"
]
=
$params
[
"create_time"
];
}
return
Db
::
table
(
$this
->
table
)
->
field
(
$field
)
->
alias
(
"a"
)
->
join
(
"o_partial_commission b"
,
"a.id=b.bargain_id"
,
"right"
)
->
where
(
$where_
)
->
select
();
}
/**
/**
* @param $params
* @param $params
* @param $type
* @param $type
...
@@ -655,6 +683,7 @@ class OBargainModel extends Model
...
@@ -655,6 +683,7 @@ class OBargainModel extends Model
if
(
isset
(
$params
[
"agent_id"
])
&&
$type
==
3
)
{
if
(
isset
(
$params
[
"agent_id"
])
&&
$type
==
3
)
{
unset
(
$where_
[
"agent_id"
]);
unset
(
$where_
[
"agent_id"
]);
$where_
[
"submit_agent_id"
]
=
$params
[
"agent_id"
];
$where_
[
"submit_agent_id"
]
=
$params
[
"agent_id"
];
$where_
[
"father_id"
]
=
0
;
}
}
if
(
isset
(
$params
[
"create_time"
]))
{
if
(
isset
(
$params
[
"create_time"
]))
{
...
@@ -668,6 +697,48 @@ class OBargainModel extends Model
...
@@ -668,6 +697,48 @@ class OBargainModel extends Model
->
select
();
->
select
();
}
}
/**
* @param $params
* @param $type
* @return false|\PDOStatement|string|\think\Collection
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public
function
getAddBargainNumGroupTimeNew
(
$params
,
$type
)
{
$field
=
""
;
$where_
=
[];
if
(
$type
==
1
)
{
$field
=
"sum(scale_fee) as num"
;
}
elseif
(
$type
==
2
)
{
$field
=
"sum(practical_fee) as num"
;
}
elseif
(
$type
==
3
)
{
$field
=
"count(1) as num"
;
//$where_["father_id"] = 0;
$where_
[
"trade_type"
]
=
10
;
//产品要求统计数量必须是出租类型的180620
}
if
(
isset
(
$params
[
"agent_id"
]))
{
$where_
[
"agent_id"
]
=
$params
[
"agent_id"
];
}
if
(
isset
(
$params
[
"agent_id"
])
&&
$type
==
3
)
{
unset
(
$where_
[
"agent_id"
]);
$where_
[
"submit_agent_id"
]
=
$params
[
"agent_id"
];
$where_
[
"father_id"
]
=
0
;
}
if
(
isset
(
$params
[
"create_time"
]))
{
$where_
[
"create_time"
]
=
$params
[
"create_time"
];
}
return
Db
::
table
(
$this
->
table
)
->
field
(
$field
)
->
where
(
$where_
)
->
select
();
}
public
function
getAddBargainNum
(
$params
,
$type
)
public
function
getAddBargainNum
(
$params
,
$type
)
{
{
$where_
=
[];
$where_
=
[];
...
@@ -709,7 +780,7 @@ class OBargainModel extends Model
...
@@ -709,7 +780,7 @@ class OBargainModel extends Model
->
join
(
$join
)
->
join
(
$join
)
->
where
(
$where_
)
->
where
(
$where_
)
->
select
();
->
select
();
// echo $this->getLastSql();
// echo $this->getLastSql();
return
$return
;
return
$return
;
}
}
...
@@ -1231,15 +1302,15 @@ class OBargainModel extends Model
...
@@ -1231,15 +1302,15 @@ class OBargainModel extends Model
}
}
public
function
performancelInfo
(
$where
,
$filed
,
$pageSize
,
$pageNo
)
public
function
performancelInfo
(
$where
,
$filed
,
$pageSize
,
$pageNo
)
{
{
$result
=
$this
->
db_
$result
=
$this
->
db_
->
field
(
$filed
)
->
field
(
$filed
)
->
alias
(
"Obargain"
)
->
alias
(
"Obargain"
)
->
join
(
"o_report Oreport"
,
"Obargain.report_id = Oreport.id"
,
"left"
)
->
join
(
"o_report Oreport"
,
"Obargain.report_id = Oreport.id"
,
"left"
)
->
join
(
"o_order Oorder"
,
"Obargain.order_id = Oorder.id"
,
"left"
)
->
join
(
"o_order Oorder"
,
"Obargain.order_id = Oorder.id"
,
"left"
)
->
join
(
"g_houses Houses"
,
"Oorder.house_id = Houses.id"
,
"left"
)
->
join
(
"g_houses Houses"
,
"Oorder.house_id = Houses.id"
,
"left"
)
->
join
(
"a_agents Agent"
,
"Obargain.agent_id = Agent.id"
,
"left"
)
->
join
(
"a_agents Agent"
,
"Obargain.agent_id = Agent.id"
,
"left"
)
->
join
(
'a_store Store'
,
'Agent.store_id = Store.id'
,
'left'
)
->
join
(
'a_store Store'
,
'Agent.store_id = Store.id'
,
'left'
)
->
join
(
'a_district District'
,
'Agent.district_id = District.id'
,
'left'
)
->
join
(
'a_district District'
,
'Agent.district_id = District.id'
,
'left'
)
->
where
(
$where
)
->
where
(
$where
)
...
@@ -1251,14 +1322,15 @@ class OBargainModel extends Model
...
@@ -1251,14 +1322,15 @@ class OBargainModel extends Model
return
$result
;
return
$result
;
}
}
public
function
performancelInfoTotal
(
$where
,
$filed
){
public
function
performancelInfoTotal
(
$where
,
$filed
)
$result
=
$this
->
db_
{
$result
=
$this
->
db_
->
field
(
$filed
)
->
field
(
$filed
)
->
alias
(
"Obargain"
)
->
alias
(
"Obargain"
)
->
join
(
"o_report Oreport"
,
"Obargain.report_id = Oreport.id"
,
"left"
)
->
join
(
"o_report Oreport"
,
"Obargain.report_id = Oreport.id"
,
"left"
)
->
join
(
"o_order Oorder"
,
"Obargain.order_id = Oorder.id"
,
"left"
)
->
join
(
"o_order Oorder"
,
"Obargain.order_id = Oorder.id"
,
"left"
)
->
join
(
"g_houses Houses"
,
"Oorder.house_id = Houses.id"
,
"left"
)
->
join
(
"g_houses Houses"
,
"Oorder.house_id = Houses.id"
,
"left"
)
->
join
(
"a_agents Agent"
,
"Obargain.agent_id = Agent.id"
,
"left"
)
->
join
(
"a_agents Agent"
,
"Obargain.agent_id = Agent.id"
,
"left"
)
->
join
(
'a_store Store'
,
'Agent.store_id = Store.id'
,
'left'
)
->
join
(
'a_store Store'
,
'Agent.store_id = Store.id'
,
'left'
)
->
join
(
'a_district District'
,
'Agent.district_id = District.id'
,
'left'
)
->
join
(
'a_district District'
,
'Agent.district_id = District.id'
,
'left'
)
->
where
(
$where
)
->
where
(
$where
)
...
...
application/model/OMarchInModel.php
View file @
9aa586a6
...
@@ -115,6 +115,27 @@ class OMarchInModel extends Model
...
@@ -115,6 +115,27 @@ class OMarchInModel extends Model
->
select
();
->
select
();
}
}
/**
* 查询经纪人进场数据 todo 产品定义同一天带看同一个客户去多个铺子算一个带看,下个方法同样
* @param $params
* @return false|\PDOStatement|string|\think\Collection
*/
public
function
getAddMarchInNumGroupTimeNew
(
$params
)
{
$field
=
"count(DISTINCT report_id) as num"
;
$where_
=
[];
if
(
isset
(
$params
[
"agent_id"
]))
{
$where_
[
"reception_id"
]
=
$params
[
"agent_id"
];
}
if
(
isset
(
$params
[
"create_time"
]))
{
$where_
[
"create_time"
]
=
$params
[
"create_time"
];
}
return
Db
::
table
(
$this
->
table
)
->
field
(
$field
)
->
where
(
$where_
)
->
select
();
}
/**
/**
* 统计房源进场数据 过滤重负
* 统计房源进场数据 过滤重负
* @param $params
* @param $params
...
...
application/model/OPayLogModel.php
View file @
9aa586a6
...
@@ -160,6 +160,27 @@ class OPayLogModel extends Model
...
@@ -160,6 +160,27 @@ class OPayLogModel extends Model
->
group
(
"day"
)
->
group
(
"day"
)
->
select
();
->
select
();
}
}
/**
* @param $params
* @return false|\PDOStatement|string|\think\Collection
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public
function
getAddPayLogNumGroupTimeNew
(
$params
){
$field
=
"count(1) as num"
;
$where_
=
[];
if
(
isset
(
$params
[
"agent_id"
])){
$where_
[
"agent_id"
]
=
$params
[
"agent_id"
];
}
if
(
isset
(
$params
[
"create_time"
])){
$where_
[
"create_time"
]
=
$params
[
"create_time"
];
}
return
Db
::
table
(
$this
->
table
)
->
field
(
$field
)
->
where
(
$where_
)
->
select
();
}
/**
/**
* @param $params
* @param $params
...
...
application/model/OReportModel.php
View file @
9aa586a6
...
@@ -546,6 +546,30 @@ class OReportModel extends Model
...
@@ -546,6 +546,30 @@ class OReportModel extends Model
->
select
();
->
select
();
}
}
/**
* @param $params
* @return false|\PDOStatement|string|\think\Collection
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public
function
getAddReportNumGroupTimeNew
(
$params
)
{
$field
=
"count(1) as num"
;
$where_
=
[];
if
(
isset
(
$params
[
"agent_id"
]))
{
$where_
[
"report_agent_id"
]
=
$params
[
"agent_id"
];
}
if
(
isset
(
$params
[
"create_time"
]))
{
$where_
[
"create_time"
]
=
$params
[
"create_time"
];
}
$where_
[
"status"
]
=
0
;
return
Db
::
table
(
$this
->
table
)
->
field
(
$field
)
->
where
(
$where_
)
->
select
();
}
/**
/**
* @param $params
* @param $params
* @return false|\PDOStatement|string|\think\Collection
* @return false|\PDOStatement|string|\think\Collection
...
...
application/model/TAgentTotalModel.php
View file @
9aa586a6
...
@@ -40,6 +40,24 @@ class TAgentTotalModel extends Model
...
@@ -40,6 +40,24 @@ class TAgentTotalModel extends Model
return
0
;
return
0
;
}
}
}
}
/**
* @param $params
* @return int
*/
public
function
saveTotal
(
$params
)
{
Db
::
startTrans
();
try
{
$this
->
saveAll
(
$params
);
Db
::
commit
();
return
1
;
}
catch
(
\Exception
$e
)
{
print_r
(
$e
);
Db
::
rollback
();
return
0
;
}
}
/**
/**
* 获取最后统计的时间
* 获取最后统计的时间
...
...
application/model/Users.php
View file @
9aa586a6
...
@@ -494,6 +494,27 @@ class Users extends Model
...
@@ -494,6 +494,27 @@ class Users extends Model
->
select
();
->
select
();
}
}
/**
* 按添加时间段分组统计
* @param $params
* @return false|\PDOStatement|string|\think\Collection
*/
public
function
getAddUserNumGroupTimeNew
(
$params
)
{
$field
=
"count(1) as num"
;
$where_
=
[];
if
(
isset
(
$params
[
"agent_id"
]))
{
$where_
[
"agent_id"
]
=
$params
[
"agent_id"
];
}
if
(
isset
(
$params
[
"create_time"
]))
{
$where_
[
"create_time"
]
=
$params
[
"create_time"
];
}
return
Db
::
table
(
$this
->
table
)
->
field
(
$field
)
->
where
(
$where_
)
->
select
();
}
public
function
getAddUserNum
(
$params
)
public
function
getAddUserNum
(
$params
)
{
{
$field
=
"count(1) as num"
;
$field
=
"count(1) as num"
;
...
...
application/route.php
View file @
9aa586a6
...
@@ -396,6 +396,8 @@ Route::group('task', [
...
@@ -396,6 +396,8 @@ Route::group('task', [
'totalAgentResults_new'
=>
[
'task/ResultsSummaryTask/totalAgentResults'
,
[
'method'
=>
'get'
]
],
//业绩统计
'totalAgentResults_new'
=>
[
'task/ResultsSummaryTask/totalAgentResults'
,
[
'method'
=>
'get'
]
],
//业绩统计
'totalAgentResults'
=>
[
'task/ResultsSummaryNewTask/totalAgentResults'
,
[
'method'
=>
'get'
]
],
//业绩统计
'updateTotalByAgentId'
=>
[
'task/ResultsSummaryNewTask/updateTotalByAgentId'
,
[
'method'
=>
'get'
]
],
//业绩统计
'rongBilledInformUrl'
=>
[
'task/PrivacyNumber/rongBilledInformUrl'
,
[
'method'
=>
'post | get'
]
],
//隐私号码回调[话单通知]
'rongBilledInformUrl'
=>
[
'task/PrivacyNumber/rongBilledInformUrl'
,
[
'method'
=>
'post | get'
]
],
//隐私号码回调[话单通知]
...
...
application/task/controller/ResultsSummaryNewTask.php
0 → 100644
View file @
9aa586a6
<?php
namespace
app\task\controller
;
use
app\extra\RedisExt
;
use
app\model\AAgents
;
use
app\model\ASuperviseModel
;
use
app\model\GHouses
;
use
app\model\OBargainModel
;
use
app\model\OMarchInModel
;
use
app\model\OPayLogModel
;
use
app\model\OReportModel
;
use
app\model\TAgentTotalModel
;
use
app\model\Users
;
/**
* Created by PhpStorm.
* User : zw
* Date : 2018/3/15
* Time : 上午10:07
* Intro:
*/
class
ResultsSummaryNewTask
{
private
$agentsModel
;
private
$tAgentTotalModel
;
private
$houseModel
;
private
$userModel
;
private
$bargainModel
;
private
$reportModel
;
private
$marchInModel
;
private
$payLogModel
;
private
$superviseModel
;
private
$redis_
;
function
__construct
()
{
$this
->
agentsModel
=
new
AAgents
();
$this
->
tAgentTotalModel
=
new
TAgentTotalModel
();
$this
->
houseModel
=
new
GHouses
();
$this
->
userModel
=
new
Users
();
$this
->
bargainModel
=
new
OBargainModel
();
$this
->
reportModel
=
new
OReportModel
();
$this
->
marchInModel
=
new
OMarchInModel
();
$this
->
payLogModel
=
new
OPayLogModel
();
$this
->
redis_
=
RedisExt
::
getRedis
();
$this
->
superviseModel
=
new
ASuperviseModel
();
}
public
function
totalAgentResults
()
{
set_time_limit
(
0
);
// 取消脚本运行时间的超时上限
//todo 按小时统计
//todo 1.分页查询经纪人, 2遍历执行,判断一个经纪人在统计表最后一条统计数据的日期
//TODO 3.日期加一天并判断是否大于等于当前时间大于return 4.执行此日期的统计,5.当次日期小于当前日期,递归日期加一。继续统计
$total
=
$this
->
agentsModel
->
getAgentsCountByTask
();
$pageSize
=
100
;
$pageTotal
=
ceil
(
$total
/
$pageSize
);
for
(
$pageNo
=
1
;
$pageNo
<=
$pageTotal
;
$pageNo
++
)
{
$resultArr
=
$this
->
agentsModel
->
getAgentsListByTask
(
$pageNo
,
$pageSize
,
"id,store_id,district_id"
);
$this
->
executeTotal
(
$resultArr
,
null
);
unset
(
$resultArr
);
break
;
}
unset
(
$this
->
agentsModel
);
unset
(
$this
->
tAgentTotalModel
);
unset
(
$this
->
houseModel
);
unset
(
$this
->
userModel
);
unset
(
$this
->
bargainModel
);
unset
(
$this
->
reportModel
);
unset
(
$this
->
marchInModel
);
unset
(
$this
->
payLogModel
);
}
/**
* @param $agent_id
* @param $store_id
* @param $district_id
* @param $total_time 比如修改了数据如成交报告,成交报告提交时间是昨天那么这里的时间就是昨天
*/
public
function
updateTotalByAgentId
(
$agent_id
,
$store_id
,
$district_id
,
$total_time
)
{
$params
[
0
][
"id"
]
=
$agent_id
;
$params
[
0
][
"store_id"
]
=
$store_id
;
$params
[
0
][
"district_id"
]
=
$district_id
;
/* $params[0]["id"] = 93;
$params[0]["store_id"] = 92;
$params[0]["district_id"] = 2;
$total_time = '2018-08-14';*/
$this
->
executeTotal
(
$params
,
$total_time
);
}
private
function
executeTotal
(
$resultArr
,
$total_time
)
{
$start_total_time
=
date
(
"Y-m-d 00:00:00"
,
time
());
$end_total_time
=
date
(
"Y-m-d H:i:s"
,
time
());
if
(
!
empty
(
$total_time
))
{
$start_total_time
=
$total_time
.
" 00:00:00"
;
$end_total_time
=
$total_time
.
" 23:59:59"
;
}
else
{
$total_time
=
date
(
"Y-m-d"
,
time
());
}
$insertArr
=
$updateArr
=
[];
foreach
(
$resultArr
as
$key
=>
$value
)
{
$param
[
"agent_id"
]
=
$value
[
"id"
];
$param
[
"is_del"
]
=
0
;
$param
[
"total_time"
]
=
$total_time
;
$total_time_arr
=
$this
->
tAgentTotalModel
->
getTotalEndTimeByAgentId
(
"id,total_time"
,
$param
);
$id
=
0
;
if
(
count
(
$total_time_arr
)
>
0
)
{
$id
=
$total_time_arr
[
0
][
"id"
];
}
$agent_id
=
empty
(
$value
[
"id"
])
?
0
:
$value
[
"id"
];
$district_id
=
empty
(
$value
[
"district_id"
])
?
0
:
$value
[
"district_id"
];
$store_id
=
empty
(
$value
[
"store_id"
])
?
0
:
$value
[
"store_id"
];
//todo 查询时间段的数据
$result
=
$this
->
selectTotal
(
$agent_id
,
$district_id
,
$store_id
,
$start_total_time
,
$end_total_time
);
if
(
empty
(
$result
))
continue
;
if
(
$id
>
0
)
{
$result
[
"id"
]
=
$id
;
unset
(
$result
[
"create_time"
]);
array_push
(
$updateArr
,
$result
);
}
else
{
array_push
(
$insertArr
,
$result
);
}
unset
(
$result
);
}
if
(
count
(
$insertArr
)
>
0
)
{
$this
->
tAgentTotalModel
->
addTotal
(
$insertArr
);
}
if
(
count
(
$updateArr
)
>
0
)
{
$this
->
tAgentTotalModel
->
saveTotal
(
$updateArr
);
}
}
/* public function test()
{
$params = $this->selectTotal(1, 1, 1, "2018-02-02", "2018-03-15");
$this->tAgentTotalModel->addTotal($params);
// dump($params);
}*/
private
function
selectTotal
(
$agent_id
,
$district_id
,
$store_id
,
$start_total_time
,
$end_total_time
)
{
//todo 如果查询出这个时间段都为0 则给此经纪人插入条最后一个日期的为空的数据
$result_arr
=
[];
//房源
$params
[
"agent_id"
]
=
$agent_id
;
$params
[
'create_time'
]
=
array
(
'between'
,
array
(
$start_total_time
,
$end_total_time
)
);
$addHouseNum
=
$this
->
houseModel
->
getAddHouseNumGroupTimeNew
(
$params
);
$result_arr
[
"house_num"
]
=
$addHouseNum
[
0
][
"num"
];
//dump($addHouseNum);
//客源
$addUserNum
=
$this
->
userModel
->
getAddUserNumGroupTimeNew
(
$params
);
$result_arr
[
"user_num"
]
=
$addUserNum
[
0
][
"num"
];
//dump($addUserNum);
//业绩
$performanceSum
=
$this
->
bargainModel
->
getAddBargainNumGroupTimeNew
(
$params
,
1
);
//1表示业绩 2表示实收
// dump($performanceSum);
$result_arr
[
"performance_sum"
]
=
$performanceSum
[
0
][
"num"
];
//实收
$receivedSum
=
$this
->
bargainModel
->
getReceivedGroupTimeNew
(
$params
);
$result_arr
[
"received_sum"
]
=
$receivedSum
[
0
][
"num"
];
//dump($receivedSum);
//约带看
$reportNum
=
$this
->
reportModel
->
getAddReportNumGroupTimeNew
(
$params
);
$result_arr
[
"report_num"
]
=
$reportNum
[
0
][
"num"
];
//dump($reportNum);
//进场
$addMarchInNum
=
$this
->
marchInModel
->
getAddMarchInNumGroupTimeNew
(
$params
);
$result_arr
[
"addMarch_in_num"
]
=
$addMarchInNum
[
0
][
"num"
];
//dump($addMarchInNum);
//收款
$payLogNum
=
$this
->
payLogModel
->
getAddPayLogNumGroupTimeNew
(
$params
);
$result_arr
[
"pay_log_num"
]
=
$payLogNum
[
0
][
"num"
];
//dump($payLogNum);
// 监督
$supervision_num
=
$this
->
superviseModel
->
getAddPayLogNumGroupTimeNew
(
$params
);
$result_arr
[
"supervision_num"
]
=
$supervision_num
[
0
][
"num"
];
//成交报告
$bargainSum
=
$this
->
bargainModel
->
getAddBargainNumGroupTimeNew
(
$params
,
3
);
//表示统计
$result_arr
[
"bargain_sum"
]
=
$bargainSum
[
0
][
"num"
];
return
$this
->
binAgentModel
(
$agent_id
,
$district_id
,
$store_id
,
$result_arr
,
$start_total_time
);
}
private
function
binAgentModel
(
$agent_id
,
$district_id
,
$store_id
,
$result_arr
,
$start_total_time
)
{
$params
=
[];
if
(
!
empty
(
$result_arr
[
"house_num"
])
||
!
empty
(
$result_arr
[
"user_num"
])
||
!
empty
(
$result_arr
[
"performance_sum"
])
||
!
empty
(
$result_arr
[
"received_sum"
])
||
!
empty
(
$result_arr
[
"report_num"
])
||
!
empty
(
$result_arr
[
"addMarch_in_num"
])
||
!
empty
(
$result_arr
[
"pay_log_num"
])
||
!
empty
(
$result_arr
[
"supervision_num"
])
||
!
empty
(
$result_arr
[
"bargain_sum"
]))
{
$params
[
"district_id"
]
=
$district_id
;
$params
[
"store_id"
]
=
$store_id
;
$params
[
"agent_id"
]
=
$agent_id
;
$params
[
"total_time"
]
=
$start_total_time
;
$params
[
"create_time"
]
=
date
(
"Y-m-d H:i:s"
,
time
());
$params
[
"update_time"
]
=
date
(
"Y-m-d H:i:s"
,
time
());
$params
[
"add_house_num"
]
=
!
empty
(
$result_arr
[
"house_num"
])
?
$result_arr
[
"house_num"
]
:
0
;
$params
[
"add_user_num"
]
=
!
empty
(
$result_arr
[
"user_num"
])
?
$result_arr
[
"user_num"
]
:
0
;
$params
[
"performance"
]
=
!
empty
(
$result_arr
[
"performance_sum"
])
?
$result_arr
[
"performance_sum"
]
:
0
;
$params
[
"official_receipts"
]
=
!
empty
(
$result_arr
[
"received_sum"
])
?
$result_arr
[
"received_sum"
]
:
0
;
$params
[
"look_at_num"
]
=
!
empty
(
$result_arr
[
"report_num"
])
?
$result_arr
[
"report_num"
]
:
0
;
$params
[
"march_in_num"
]
=
!
empty
(
$result_arr
[
"addMarch_in_num"
])
?
$result_arr
[
"addMarch_in_num"
]
:
0
;
$params
[
"paylog"
]
=
!
empty
(
$result_arr
[
"pay_log_num"
])
?
$result_arr
[
"pay_log_num"
]
:
0
;
$params
[
"supervision_num"
]
=
!
empty
(
$result_arr
[
"supervision_num"
])
?
$result_arr
[
"supervision_num"
]
:
0
;
$params
[
"bargain_sum"
]
=
!
empty
(
$result_arr
[
"bargain_sum"
])
?
$result_arr
[
"bargain_sum"
]
:
0
;
}
unset
(
$result_arr
);
return
$params
;
}
}
\ 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