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
fea349bc
Commit
fea349bc
authored
Mar 23, 2018
by
clone
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改
parent
2aab4e53
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
288 additions
and
66 deletions
+288
-66
FollowUp.php
application/api_broker/controller/FollowUp.php
+4
-4
Performance.php
application/api_broker/controller/Performance.php
+36
-14
OrderLogService.php
application/api_broker/service/OrderLogService.php
+0
-19
PerformanceService.php
application/api_broker/service/PerformanceService.php
+101
-20
VerifyService.php
application/api_broker/service/VerifyService.php
+23
-1
GHousesToAgents.php
application/model/GHousesToAgents.php
+13
-0
OBargainModel.php
application/model/OBargainModel.php
+18
-1
OMarchInModel.php
application/model/OMarchInModel.php
+16
-0
OPayLogModel.php
application/model/OPayLogModel.php
+16
-0
OReportModel.php
application/model/OReportModel.php
+23
-0
TAgentTotalModel.php
application/model/TAgentTotalModel.php
+33
-7
route.php
application/route.php
+5
-0
No files found.
application/api_broker/controller/FollowUp.php
View file @
fea349bc
...
@@ -29,13 +29,13 @@ class FollowUp extends Basic
...
@@ -29,13 +29,13 @@ class FollowUp extends Basic
*/
*/
public
function
report
()
public
function
report
()
{
{
/*
$params = $this->params;
$params
=
$this
->
params
;
if
(
!
isset
(
$params
[
'report_agent_id'
])
||
!
isset
(
$params
[
'report_store_id'
])
||
!
isset
(
$params
[
'user_id'
])
||
if
(
!
isset
(
$params
[
'report_agent_id'
])
||
!
isset
(
$params
[
'report_store_id'
])
||
!
isset
(
$params
[
'user_id'
])
||
!
isset
(
$params
[
'house_ids'
])
||
!
isset
(
$params
[
'vehicle'
])
)
{
!
isset
(
$params
[
'house_ids'
])
||
!
isset
(
$params
[
'vehicle'
])
)
{
return
$this
->
response
(
"101"
,
"请求参数错误"
);
return
$this
->
response
(
"101"
,
"请求参数错误"
);
}
*/
}
$params
=
array
(
/*
$params = array(
"report_agent_id" => 1,
"report_agent_id" => 1,
"report_store_id" => 1,
"report_store_id" => 1,
"user_id" => 1,
"user_id" => 1,
...
@@ -43,7 +43,7 @@ class FollowUp extends Basic
...
@@ -43,7 +43,7 @@ class FollowUp extends Basic
"vehicle" => 10,
"vehicle" => 10,
"intro" => "123123123",
"intro" => "123123123",
"to_see_time" => date("Y-m-d H:i:s", time()),
"to_see_time" => date("Y-m-d H:i:s", time()),
);
);
*/
$result
=
$this
->
followUpModel
->
addFollowUp
(
$params
);
$result
=
$this
->
followUpModel
->
addFollowUp
(
$params
);
if
(
$result
[
"code"
]
==
200
){
if
(
$result
[
"code"
]
==
200
){
return
$this
->
response
(
"200"
,
"request success"
,
[
"id"
,
$result
[
"msg"
]]);
return
$this
->
response
(
"200"
,
"request success"
,
[
"id"
,
$result
[
"msg"
]]);
...
...
application/api_broker/controller/Performance.php
View file @
fea349bc
<?php
<?php
namespace
app\api_broker\controller
;
namespace
app\api_broker\controller
;
use
app\api_broker\extend\Basic
;
use
app\api_broker\extend\Basic
;
use
app\api_broker\service\PerformanceService
;
use
app\api_broker\service\PerformanceService
;
use
think\Request
;
use
think\Request
;
...
@@ -11,10 +13,12 @@ use think\Request;
...
@@ -11,10 +13,12 @@ use think\Request;
* Time : 下午2:06
* Time : 下午2:06
* Intro: 业绩模块
* Intro: 业绩模块
*/
*/
class
Performance
extends
Basic
{
class
Performance
extends
Basic
{
private
$service_
;
private
$service_
;
function
__construct
(
Request
$request
=
null
)
function
__construct
(
Request
$request
=
null
)
{
{
parent
::
__construct
(
$request
);
parent
::
__construct
(
$request
);
...
@@ -28,28 +32,46 @@ class Performance extends Basic{
...
@@ -28,28 +32,46 @@ class Performance extends Basic{
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
* @throws \think\exception\DbException
*/
*/
public
function
selectPerformanceByTime
(){
public
function
selectPerformanceByTime
()
{
$params
=
$this
->
params
;
$params
=
$this
->
params
;
/* $params = array(
/* $params = array(
"agent_id" => 1,
"agent_id" => 1,
"type" => 1, //1表示个人业绩排行 2门店 3区域
"type" => 1, //1表示个人业绩排行 2门店 3区域
);*/
);*/
if
(
!
isset
(
$params
[
"agent_id"
])
||
!
isset
(
$params
[
"type"
]))
{
if
(
!
isset
(
$params
[
"agent_id"
])
||
!
isset
(
$params
[
"type"
]))
{
return
$this
->
response
(
"101"
,
"请求参数错误"
);
return
$this
->
response
(
"101"
,
"请求参数错误"
);
}
}
$yesterday
=
date
(
"Y-m-d"
,
strtotime
(
"-1 day"
));
$yesterday
=
date
(
"Y-m-d"
,
strtotime
(
"-1 day"
));
$end_day
=
date
(
"Y-m-d"
,
strtotime
(
"-7 day"
));
$end_day
=
date
(
"Y-m-d"
,
strtotime
(
"-7 day"
));
$list
=
$this
->
service_
->
totalAgent
(
$params
[
"agent_id"
],
$params
[
"type"
],
$yesterday
,
$end_day
);
$list
=
$this
->
service_
->
totalAgent
(
$params
[
"agent_id"
],
$params
[
"type"
],
$yesterday
,
$end_day
);
//dump($list);
//dump($list);
if
(
count
(
$list
)
>
0
)
{
if
(
count
(
$list
)
>
0
)
{
$result
[
"list"
]
=
$list
;
$result
[
"list"
]
=
$list
;
$result
[
"start_time"
]
=
$yesterday
;
$result
[
"start_time"
]
=
$yesterday
;
$result
[
"end_time"
]
=
$end_day
;
$result
[
"end_time"
]
=
$end_day
;
return
$this
->
response
(
"200"
,
"request success"
,
$result
);
return
$this
->
response
(
"200"
,
"request success"
,
$result
);
}
}
public
function
agentPerformanceBySearch
()
{
$params
=
$this
->
params
;
$params
=
array
(
"agent_id"
=>
1
,
"start_time"
=>
"2018-03-23"
,
"end_time"
=>
"2018-03-23"
,
"is_case"
=>
1
,
//1经纪人 2案场
);
if
(
!
isset
(
$params
[
"agent_id"
])
||
!
isset
(
$params
[
"start_time"
])
||
!
isset
(
$params
[
"end_time"
]))
{
return
$this
->
response
(
"101"
,
"请求参数错误"
);
}
}
$result
=
$this
->
service_
->
personagePerformance
(
$params
[
"agent_id"
],
$params
[
"start_time"
],
$params
[
"end_time"
],
$params
[
"is_case"
]);
return
$this
->
response
(
"200"
,
"request success"
,
$result
);
}
}
}
}
application/api_broker/service/OrderLogService.php
View file @
fea349bc
...
@@ -386,22 +386,4 @@ class OrderLogService
...
@@ -386,22 +386,4 @@ class OrderLogService
}
}
/**
* 根据手机号和用户名搜索经纪人
* @param $keyWord
* @return false|\PDOStatement|string|\think\Collection
*/
/* public function searchAgents($agent_id, $keyWord)
{
$params["a.phone|a.name|b."] = array( "like", "%$keyWord%" );
//$field = "id,store_id,auth_group_id,district_id,level,name,phone";
$filed = "a.id,a.create_time,b.user_phone,b.user_name,b.user_id,d.id as house_id,d.internal_title,d.internal_address";
$agentModel = new AAgents();
return $agentModel->searchAgentsByKeyword($field, $params);
}*/
}
}
\ No newline at end of file
application/api_broker/service/PerformanceService.php
View file @
fea349bc
...
@@ -3,7 +3,13 @@
...
@@ -3,7 +3,13 @@
namespace
app\api_broker\service
;
namespace
app\api_broker\service
;
use
app\model\AAgents
;
use
app\model\AAgents
;
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\TAgentTotalModel
;
use
app\model\Users
;
/**
/**
* Created by PhpStorm.
* Created by PhpStorm.
...
@@ -16,11 +22,27 @@ class PerformanceService
...
@@ -16,11 +22,27 @@ class PerformanceService
{
{
private
$totalModel
;
private
$totalModel
;
private
$agentModel
;
private
$agentModel
;
private
$agentsModel
;
private
$tAgentTotalModel
;
private
$houseModel
;
private
$userModel
;
private
$bargainModel
;
private
$reportModel
;
private
$marchInModel
;
private
$payLogModel
;
public
function
__construct
()
public
function
__construct
()
{
{
$this
->
totalModel
=
new
TAgentTotalModel
();
$this
->
totalModel
=
new
TAgentTotalModel
();
$this
->
agentModel
=
new
AAgents
();
$this
->
agentModel
=
new
AAgents
();
$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
();
}
}
...
@@ -41,11 +63,11 @@ class PerformanceService
...
@@ -41,11 +63,11 @@ class PerformanceService
$where_
=
[];
$where_
=
[];
$where_
[
'total_time'
]
=
array
(
'between'
,
array
(
$end_day
,
$yesterday
,
)
);
$where_
[
'total_time'
]
=
array
(
'between'
,
array
(
$end_day
,
$yesterday
)
);
$result
=
$this
->
totalModel
->
getTotalByAgentId
(
$where_
,
$type
);
$result
=
$this
->
totalModel
->
getTotalByAgentId
(
$where_
,
$type
);
//dump($result);
//dump($result);
$arr
=
[];
$arr
=
[];
$field
=
"a.name,a.img,b.store_name,c.district_name"
;
$field
=
"a.name,a.img,b.store_name,c.district_name"
;
foreach
(
$result
as
$key
=>
$value
)
{
foreach
(
$result
as
$key
=>
$value
)
{
switch
(
$type
)
{
switch
(
$type
)
{
...
@@ -53,11 +75,11 @@ class PerformanceService
...
@@ -53,11 +75,11 @@ class PerformanceService
if
(
$value
[
"agent_id"
]
==
$agent_info
[
"id"
]
||
$key
<
5
)
{
if
(
$value
[
"agent_id"
]
==
$agent_info
[
"id"
]
||
$key
<
5
)
{
$value
[
"index_"
]
=
$key
+
1
;
$value
[
"index_"
]
=
$key
+
1
;
$value
[
"is_my"
]
=
$agent_info
[
"id"
];
$value
[
"is_my"
]
=
$agent_info
[
"id"
];
$info
=
$this
->
agentModel
->
getAgentsInfoByAgentId
(
$field
,[
"agent_id"
=>
$value
[
"agent_id"
]
]);
$info
=
$this
->
agentModel
->
getAgentsInfoByAgentId
(
$field
,
[
"agent_id"
=>
$value
[
"agent_id"
]
]);
if
(
count
(
$info
)
>
0
)
{
if
(
count
(
$info
)
>
0
)
{
$value
[
"name"
]
=
$info
[
0
][
"name"
];
$value
[
"name"
]
=
$info
[
0
][
"name"
];
$value
[
"img"
]
=
AGENTHEADERIMGURL
.
$info
[
0
][
"img"
];
$value
[
"img"
]
=
AGENTHEADERIMGURL
.
$info
[
0
][
"img"
];
$value
[
"store_name"
]
=
$info
[
0
][
"store_name"
];
$value
[
"store_name"
]
=
$info
[
0
][
"store_name"
];
$value
[
"district_name"
]
=
$info
[
0
][
"district_name"
];
$value
[
"district_name"
]
=
$info
[
0
][
"district_name"
];
}
}
array_push
(
$arr
,
$value
);
array_push
(
$arr
,
$value
);
...
@@ -67,11 +89,11 @@ class PerformanceService
...
@@ -67,11 +89,11 @@ class PerformanceService
if
(
$value
[
"store_id"
]
==
$agent_info
[
"store_id"
]
||
$key
<
5
)
{
if
(
$value
[
"store_id"
]
==
$agent_info
[
"store_id"
]
||
$key
<
5
)
{
$value
[
"index_"
]
=
$key
+
1
;
$value
[
"index_"
]
=
$key
+
1
;
$value
[
"is_my"
]
=
$agent_info
[
"store_id"
];
$value
[
"is_my"
]
=
$agent_info
[
"store_id"
];
$info
=
$this
->
agentModel
->
getAgentsInfoByAgentId
(
$field
,[
"agent_id"
=>
$value
[
"agent_id"
]
]);
$info
=
$this
->
agentModel
->
getAgentsInfoByAgentId
(
$field
,
[
"agent_id"
=>
$value
[
"agent_id"
]
]);
if
(
count
(
$info
)
>
0
)
{
if
(
count
(
$info
)
>
0
)
{
$value
[
"name"
]
=
$info
[
0
][
"name"
];
$value
[
"name"
]
=
$info
[
0
][
"name"
];
$value
[
"img"
]
=
AGENTHEADERIMGURL
.
$info
[
0
][
"img"
];
$value
[
"img"
]
=
AGENTHEADERIMGURL
.
$info
[
0
][
"img"
];
$value
[
"store_name"
]
=
$info
[
0
][
"store_name"
];
$value
[
"store_name"
]
=
$info
[
0
][
"store_name"
];
$value
[
"district_name"
]
=
$info
[
0
][
"district_name"
];
$value
[
"district_name"
]
=
$info
[
0
][
"district_name"
];
}
}
array_push
(
$arr
,
$value
);
array_push
(
$arr
,
$value
);
...
@@ -80,11 +102,11 @@ class PerformanceService
...
@@ -80,11 +102,11 @@ class PerformanceService
case
3
:
case
3
:
$value
[
"index_"
]
=
$key
+
1
;
$value
[
"index_"
]
=
$key
+
1
;
$value
[
"is_my"
]
=
$agent_info
[
"district_id"
];
$value
[
"is_my"
]
=
$agent_info
[
"district_id"
];
$info
=
$this
->
agentModel
->
getAgentsInfoByAgentId
(
$field
,[
"agent_id"
=>
$value
[
"agent_id"
]
]);
$info
=
$this
->
agentModel
->
getAgentsInfoByAgentId
(
$field
,
[
"agent_id"
=>
$value
[
"agent_id"
]
]);
if
(
count
(
$info
)
>
0
)
{
if
(
count
(
$info
)
>
0
)
{
$value
[
"name"
]
=
$info
[
0
][
"name"
];
$value
[
"name"
]
=
$info
[
0
][
"name"
];
$value
[
"img"
]
=
AGENTHEADERIMGURL
.
$info
[
0
][
"img"
];
$value
[
"img"
]
=
AGENTHEADERIMGURL
.
$info
[
0
][
"img"
];
$value
[
"store_name"
]
=
$info
[
0
][
"store_name"
];
$value
[
"store_name"
]
=
$info
[
0
][
"store_name"
];
$value
[
"district_name"
]
=
$info
[
0
][
"district_name"
];
$value
[
"district_name"
]
=
$info
[
0
][
"district_name"
];
}
}
array_push
(
$arr
,
$value
);
array_push
(
$arr
,
$value
);
...
@@ -105,7 +127,6 @@ class PerformanceService
...
@@ -105,7 +127,6 @@ class PerformanceService
*/
*/
public
function
getStoreAndDistrict
(
$agent_id
)
public
function
getStoreAndDistrict
(
$agent_id
)
{
{
$params
[
"agent_id"
]
=
$agent_id
;
$params
[
"agent_id"
]
=
$agent_id
;
$agent_info
=
$this
->
agentModel
->
getAgentById
(
"id,store_id,district_id,level"
,
$params
);
$agent_info
=
$this
->
agentModel
->
getAgentById
(
"id,store_id,district_id,level"
,
$params
);
if
(
count
(
$agent_info
)
>
0
)
{
if
(
count
(
$agent_info
)
>
0
)
{
...
@@ -115,4 +136,63 @@ class PerformanceService
...
@@ -115,4 +136,63 @@ class PerformanceService
}
}
public
function
personagePerformance
(
$agent_id
,
$start_time
,
$end_time
,
$is_case
)
{
$field
=
"agent_id,sum(look_at_num) as look_at_num,sum(march_in_num) as march_in_num , sum(paylog) as paylog ,
sum(bargain_sum) as bargain_sum"
;
$result
=
[];
if
(
$is_case
==
2
){
//案场
$vService
=
new
VerifyService
();
$house_id_arr
=
$vService
->
getAgentsByAgentId
(
$agent_id
);
}
$now_date
=
date
(
"Y-m-d"
,
time
());
if
(
$start_time
==
$now_date
&&
$end_time
==
$now_date
)
{
$params
[
"agent_id"
]
=
$agent_id
;
$params
[
'create_time'
]
=
array
(
'between'
,
array
(
$start_time
.
" 00:00:00"
,
$end_time
.
" 23:59:59"
)
);
$result
=
$this
->
nowTimeSum
(
$params
);
}
else
{
$where_
[
"agent_id"
]
=
$agent_id
;
$where_
[
'total_time'
]
=
array
(
'between'
,
array
(
$start_time
,
$end_time
)
);
$list
=
$this
->
totalModel
->
personagePerformance
(
$field
,
$where_
);
if
(
count
(
$list
)
>
0
)
{
$result
=
$list
[
0
];
}
}
if
(
count
(
$result
)
>
0
)
{
return
$result
;
}
else
{
return
null
;
}
}
/**
* @param $params
* @return array
*/
private
function
nowTimeSum
(
$params
)
{
$result
=
[];
$reportNum
=
$this
->
reportModel
->
getAddReportNum
(
$params
);
if
(
count
(
$reportNum
)
>
0
)
{
$result
[
"look_at_num"
]
=
$reportNum
[
0
][
"num"
];
}
$addMarchInNum
=
$this
->
marchInModel
->
getAddMarchInNum
(
$params
);
if
(
count
(
$addMarchInNum
)
>
0
)
{
$result
[
"march_in_num"
]
=
$addMarchInNum
[
0
][
"num"
];
}
$payLogNum
=
$this
->
payLogModel
->
getAddPayLogNum
(
$params
);
if
(
count
(
$payLogNum
)
>
0
)
{
$result
[
"paylog"
]
=
$payLogNum
[
0
][
"num"
];
}
$bargainSum
=
$this
->
bargainModel
->
getAddBargainNum
(
$params
);
//表示统计
if
(
count
(
$bargainSum
)
>
0
)
{
$result
[
"bargain_sum"
]
=
$bargainSum
[
0
][
"num"
];
}
return
$result
;
}
}
}
\ No newline at end of file
application/api_broker/service/VerifyService.php
View file @
fea349bc
...
@@ -3,6 +3,7 @@
...
@@ -3,6 +3,7 @@
namespace
app\api_broker\service
;
namespace
app\api_broker\service
;
use
app\model\AAgents
;
use
app\model\AAgents
;
use
app\model\GHousesToAgents
;
/**
/**
* Created by PhpStorm.
* Created by PhpStorm.
...
@@ -20,6 +21,11 @@ class VerifyService
...
@@ -20,6 +21,11 @@ class VerifyService
$this
->
agentModel
=
new
AAgents
();
$this
->
agentModel
=
new
AAgents
();
}
}
/**
* 经纪人身份验证
* @param $agent_id
* @return null|string
*/
public
function
getAgentsByAgentId
(
$agent_id
)
public
function
getAgentsByAgentId
(
$agent_id
)
{
{
$params
[
"id"
]
=
$agent_id
;
$params
[
"id"
]
=
$agent_id
;
...
@@ -38,7 +44,7 @@ class VerifyService
...
@@ -38,7 +44,7 @@ class VerifyService
break
;
break
;
}
}
$ids
=
""
;
$ids
=
""
;
if
(
count
(
$arr_list
)
>
0
)
{
if
(
count
(
$arr_list
)
>
0
)
{
foreach
(
$arr_list
as
$item
)
{
foreach
(
$arr_list
as
$item
)
{
$ids
.=
$item
[
"id"
]
.
","
;
$ids
.=
$item
[
"id"
]
.
","
;
}
}
...
@@ -49,4 +55,19 @@ class VerifyService
...
@@ -49,4 +55,19 @@ class VerifyService
}
}
return
null
;
return
null
;
}
}
public
function
getCaseHouseIdByAgentId
(
$agent_id
)
{
$houseToAgentModel
=
new
GHousesToAgents
();
$params
[
"agents_id"
]
=
$agent_id
;
$params
[
"type"
]
=
1
;
//案场权限人
$params
[
"is_del"
]
=
0
;
$house_arr
=
$houseToAgentModel
->
getHouseByAgentId
(
"houses_id"
,
$params
);
if
(
count
(
$house_arr
)
>
0
)
{
return
$house_arr
;
}
return
null
;
}
}
}
\ No newline at end of file
application/model/GHousesToAgents.php
View file @
fea349bc
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
namespace
app\model
;
namespace
app\model
;
use
Think\Db
;
use
think\Model
;
use
think\Model
;
class
GHousesToAgents
extends
BaseModel
class
GHousesToAgents
extends
BaseModel
...
@@ -138,6 +139,18 @@ class GHousesToAgents extends BaseModel
...
@@ -138,6 +139,18 @@ class GHousesToAgents extends BaseModel
->
select
();
->
select
();
}
}
/**
* @param $field
* @param $params
* @return false|\PDOStatement|string|\think\Collection
*/
public
function
getHouseByAgentId
(
$field
,
$params
){
return
Db
::
name
(
$this
->
table
)
->
field
(
$field
)
->
where
(
$params
)
->
select
();
}
/**
/**
* 楼盘对应的经纪人信息
* 楼盘对应的经纪人信息
*
*
...
...
application/model/OBargainModel.php
View file @
fea349bc
...
@@ -309,7 +309,6 @@ class OBargainModel extends Model
...
@@ -309,7 +309,6 @@ class OBargainModel extends Model
$field
=
"count(1) as num,DATE(create_time) as day"
;
$field
=
"count(1) as num,DATE(create_time) as day"
;
}
}
$where_
[
"status"
]
=
11
;
//审核成功
if
(
isset
(
$params
[
"agent_id"
])){
if
(
isset
(
$params
[
"agent_id"
])){
$where_
[
"agent_id"
]
=
$params
[
"agent_id"
];
$where_
[
"agent_id"
]
=
$params
[
"agent_id"
];
...
@@ -324,4 +323,21 @@ class OBargainModel extends Model
...
@@ -324,4 +323,21 @@ class OBargainModel extends Model
->
group
(
"day"
)
->
group
(
"day"
)
->
select
();
->
select
();
}
}
public
function
getAddBargainNum
(
$params
){
$where_
=
[];
$field
=
"count(1) as num"
;
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/OMarchInModel.php
View file @
fea349bc
...
@@ -96,4 +96,19 @@ class OMarchInModel extends Model
...
@@ -96,4 +96,19 @@ class OMarchInModel extends Model
->
select
();
->
select
();
}
}
public
function
getAddMarchInNum
(
$params
){
$field
=
"count(1) 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
();
}
}
}
\ No newline at end of file
application/model/OPayLogModel.php
View file @
fea349bc
...
@@ -93,4 +93,19 @@ class OPayLogModel extends Model
...
@@ -93,4 +93,19 @@ class OPayLogModel extends Model
->
group
(
"day"
)
->
group
(
"day"
)
->
select
();
->
select
();
}
}
public
function
getAddPayLogNum
(
$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/OReportModel.php
View file @
fea349bc
...
@@ -153,4 +153,26 @@ class OReportModel extends Model
...
@@ -153,4 +153,26 @@ class OReportModel extends Model
->
group
(
"day"
)
->
group
(
"day"
)
->
select
();
->
select
();
}
}
public
function
getAddReportNum
(
$params
){
$field
=
"count(1) as num"
;
$where_
=
[];
if
(
isset
(
$params
[
"agent_id"
])){
$where_
[
"a.report_agent_id"
]
=
$params
[
"agent_id"
];
}
if
(
isset
(
$params
[
"create_time"
])){
$where_
[
"a.create_time"
]
=
$params
[
"create_time"
];
}
if
(
isset
(
$params
[
"house_ids"
])){
$where_
[
"b.house_id"
]
=
array
(
"in"
,
$params
[
"house_ids"
]);
}
$where_
[
"a.status"
]
=
0
;
return
Db
::
table
(
$this
->
table
)
->
field
(
$field
)
->
alias
(
"a"
)
->
join
(
"o_order b"
,
"a.order_id = b.id"
,
"left"
)
->
where
(
$where_
)
->
select
();
}
}
}
\ No newline at end of file
application/model/TAgentTotalModel.php
View file @
fea349bc
<?php
<?php
namespace
app\model
;
namespace
app\model
;
use
think\Db
;
use
think\Db
;
use
think\Model
;
use
think\Model
;
...
@@ -10,8 +12,8 @@ use think\Model;
...
@@ -10,8 +12,8 @@ use think\Model;
* Time : 下午2:00
* Time : 下午2:00
* Intro:
* Intro:
*/
*/
class
TAgentTotalModel
extends
Model
class
TAgentTotalModel
extends
Model
{
{
protected
$table
=
"t_agent_total"
;
protected
$table
=
"t_agent_total"
;
private
$db_
;
private
$db_
;
...
@@ -24,7 +26,8 @@ class TAgentTotalModel extends Model{
...
@@ -24,7 +26,8 @@ class TAgentTotalModel extends Model{
* @param $params
* @param $params
* @return int
* @return int
*/
*/
public
function
addTotal
(
$params
){
public
function
addTotal
(
$params
)
{
Db
::
startTrans
();
Db
::
startTrans
();
try
{
try
{
$this
->
db_
->
insertAll
(
$params
);
$this
->
db_
->
insertAll
(
$params
);
...
@@ -44,7 +47,8 @@ class TAgentTotalModel extends Model{
...
@@ -44,7 +47,8 @@ class TAgentTotalModel extends Model{
* @param $param
* @param $param
* @return false|\PDOStatement|string|\think\Collection
* @return false|\PDOStatement|string|\think\Collection
*/
*/
public
function
getTotalEndTimeByAgentId
(
$field
,
$param
){
public
function
getTotalEndTimeByAgentId
(
$field
,
$param
)
{
return
$this
->
db_
return
$this
->
db_
->
field
(
$field
)
->
field
(
$field
)
->
where
(
$param
)
->
where
(
$param
)
...
@@ -53,9 +57,16 @@ class TAgentTotalModel extends Model{
...
@@ -53,9 +57,16 @@ class TAgentTotalModel extends Model{
->
select
();
->
select
();
}
}
public
function
getTotalByAgentId
(
$params
,
$type
){
/**
* 获取分组统计数据
* @param $params
* @param $type
* @return false|\PDOStatement|string|\think\Collection
*/
public
function
getTotalByAgentId
(
$params
,
$type
)
{
$group_
=
"agent_id"
;
$group_
=
"agent_id"
;
switch
(
$type
){
switch
(
$type
)
{
case
1
:
case
1
:
$group_
=
"agent_id"
;
$group_
=
"agent_id"
;
break
;
break
;
...
@@ -66,7 +77,7 @@ class TAgentTotalModel extends Model{
...
@@ -66,7 +77,7 @@ class TAgentTotalModel extends Model{
$group_
=
"district_id"
;
$group_
=
"district_id"
;
break
;
break
;
}
}
$result
=
$this
->
db_
$result
=
$this
->
db_
->
field
(
"agent_id,store_id,district_id,sum(performance) as performance_total"
)
->
field
(
"agent_id,store_id,district_id,sum(performance) as performance_total"
)
->
where
(
$params
)
->
where
(
$params
)
->
group
(
$group_
)
->
group
(
$group_
)
...
@@ -76,4 +87,18 @@ class TAgentTotalModel extends Model{
...
@@ -76,4 +87,18 @@ class TAgentTotalModel extends Model{
return
$result
;
return
$result
;
}
}
/**
* 统计时间端经纪人业绩
* @param $field
* @param $param
* @return false|\PDOStatement|string|\think\Collection
*/
public
function
personagePerformance
(
$field
,
$param
)
{
return
$this
->
db_
->
field
(
$field
)
->
where
(
$param
)
->
select
();
}
}
}
\ No newline at end of file
application/route.php
View file @
fea349bc
...
@@ -361,10 +361,14 @@ Route::group('broker', [
...
@@ -361,10 +361,14 @@ Route::group('broker', [
'selectPerformanceByTime'
=>
[
'api_broker/Performance/selectPerformanceByTime'
,
[
'method'
=>
'get'
]],
'selectPerformanceByTime'
=>
[
'api_broker/Performance/selectPerformanceByTime'
,
[
'method'
=>
'get'
]],
'agentPerformanceBySearch'
=>
[
'api_broker/Performance/agentPerformanceBySearch'
,
[
'method'
=>
'get'
]],
'weekWorkImg'
=>
[
'api_broker/Statement/weekWorkImg'
,
[
'method'
=>
'post'
]],
//生成周报和日报图片
'weekWorkImg'
=>
[
'api_broker/Statement/weekWorkImg'
,
[
'method'
=>
'post'
]],
//生成周报和日报图片
'setReportContent'
=>
[
'api_broker/Statement/setReportContent'
,
[
'method'
=>
'get|post'
]],
//保存日报周报四个字段
'setReportContent'
=>
[
'api_broker/Statement/setReportContent'
,
[
'method'
=>
'get|post'
]],
//保存日报周报四个字段
'getWeekOrDay'
=>
[
'api_broker/Statement/getWeekOrDay'
,
[
'method'
=>
'get'
]],
//获取日报或者周报
'getWeekOrDay'
=>
[
'api_broker/Statement/getWeekOrDay'
,
[
'method'
=>
'get'
]],
//获取日报或者周报
]);
]);
//Route::miss('api/index/miss');//处理错误的url
//Route::miss('api/index/miss');//处理错误的url
\ 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