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
ab12e9fa
Commit
ab12e9fa
authored
Nov 14, 2018
by
zw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
pk
parent
01ad11e9
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
78 additions
and
23 deletions
+78
-23
RankingList.php
application/index/controller/RankingList.php
+21
-0
RankingListService.php
application/index/service/RankingListService.php
+20
-0
TAgentTotalModel.php
application/model/TAgentTotalModel.php
+36
-23
route.php
application/route.php
+1
-0
No files found.
application/index/controller/RankingList.php
View file @
ab12e9fa
...
@@ -45,4 +45,24 @@ class RankingList extends Basic{
...
@@ -45,4 +45,24 @@ class RankingList extends Basic{
$export
->
exportTables
(
'PK明细表'
,
$result
,
6
,
'PK明细表'
,
$title
);
$export
->
exportTables
(
'PK明细表'
,
$result
,
6
,
'PK明细表'
,
$title
);
return
''
;
return
''
;
}
}
public
function
selectPkSortByTime
()
{
$params
=
$this
->
params
;
/* $params = array(
"site_id" => 10001
);*/
if
(
!
isset
(
$params
[
"site_id"
]))
{
return
$this
->
response
(
"101"
,
"请求参数错误"
);
}
$start_day
=
date
(
'Y-m-01 00:00:00'
,
strtotime
(
'-1 month'
));
$end_day
=
date
(
"Y-m-d 23:59:59"
,
strtotime
(
-
date
(
'd'
)
.
'day'
));
$list
=
$this
->
service_
->
totalAgent
(
$start_day
,
$end_day
,
$params
[
"site_id"
]);
if
(
count
(
$list
)
>
0
)
{
return
$this
->
response
(
"200"
,
"request success"
,
$list
);
}
return
$this
->
response
(
"200"
,
"request null"
);
}
}
}
\ No newline at end of file
application/index/service/RankingListService.php
View file @
ab12e9fa
...
@@ -116,4 +116,23 @@ class RankingListService
...
@@ -116,4 +116,23 @@ class RankingListService
}
}
public
function
totalAgent
(
$yesterday
,
$end_day
,
$site_id
)
{
$totalModel
=
new
TAgentTotalModel
();
$where_
=
[];
$where_
[
'b.site_id'
]
=
$site_id
;
$where_
[
'a.total_time'
]
=
array
(
'between'
,
array
(
$yesterday
,
$end_day
)
);
$field
=
"a.agent_id,b.name,c.store_name,sum(a.performance) as performance_total"
;
$order
=
"performance_total desc"
;
$data
[
"agent_sort"
]
=
$totalModel
->
getTotalByPk
(
$field
,
$where_
,
1
,
$order
);
$data
[
"store_sort"
]
=
$totalModel
->
getTotalByPk
(
$field
,
$where_
,
2
,
$order
);
return
$data
;
}
}
}
\ No newline at end of file
application/model/TAgentTotalModel.php
View file @
ab12e9fa
...
@@ -40,6 +40,7 @@ class TAgentTotalModel extends Model
...
@@ -40,6 +40,7 @@ class TAgentTotalModel extends Model
return
0
;
return
0
;
}
}
}
}
/**
/**
* @param $params
* @param $params
* @return int
* @return int
...
@@ -48,7 +49,7 @@ class TAgentTotalModel extends Model
...
@@ -48,7 +49,7 @@ class TAgentTotalModel extends Model
{
{
Db
::
startTrans
();
Db
::
startTrans
();
try
{
try
{
foreach
(
$params
as
$k
=>
$v
)
{
foreach
(
$params
as
$k
=>
$v
)
{
$this
->
db_
->
table
(
$this
->
table
)
->
update
(
$v
);
$this
->
db_
->
table
(
$this
->
table
)
->
update
(
$v
);
}
}
// $this->saveAll($params);
// $this->saveAll($params);
...
@@ -87,7 +88,7 @@ class TAgentTotalModel extends Model
...
@@ -87,7 +88,7 @@ class TAgentTotalModel extends Model
* @param string $order
* @param string $order
* @return false|\PDOStatement|string|\think\Collection
* @return false|\PDOStatement|string|\think\Collection
*/
*/
public
function
getTotalByAgentId
(
$field
,
$params
,
$type
,
$order
=
""
)
public
function
getTotalByAgentId
(
$field
,
$params
,
$type
,
$order
=
""
)
{
{
$group_
=
""
;
$group_
=
""
;
switch
(
$type
)
{
switch
(
$type
)
{
...
@@ -113,6 +114,33 @@ class TAgentTotalModel extends Model
...
@@ -113,6 +114,33 @@ class TAgentTotalModel extends Model
}
}
public
function
getTotalByPk
(
$field
,
$params
,
$type
,
$order
=
""
,
$limit
=
5
)
{
$group_
=
""
;
switch
(
$type
)
{
case
1
:
$group_
=
"a.agent_id"
;
break
;
case
2
:
$group_
=
"a.store_id"
;
break
;
default
:
return
null
;
}
$result
=
$this
->
db_
->
field
(
$field
)
->
alias
(
"a"
)
->
join
(
"a_agents b"
,
"a.agent_id=b.id"
,
"left"
)
->
join
(
"a_store c"
,
"a.store_id=c.id"
,
"left"
)
->
where
(
$params
)
->
group
(
$group_
)
->
order
(
$order
)
->
select
();
//echo $this->db_->getLastSql();
return
$result
;
}
/**
/**
* 获取分组统计数据-加入站点
* 获取分组统计数据-加入站点
* @param $field
* @param $field
...
@@ -121,7 +149,7 @@ class TAgentTotalModel extends Model
...
@@ -121,7 +149,7 @@ class TAgentTotalModel extends Model
* @param string $order
* @param string $order
* @return false|\PDOStatement|string|\think\Collection
* @return false|\PDOStatement|string|\think\Collection
*/
*/
public
function
getTotalByAgentIdSite
(
$field
,
$params
,
$type
,
$order
=
""
)
public
function
getTotalByAgentIdSite
(
$field
,
$params
,
$type
,
$order
=
""
)
{
{
$group_
=
""
;
$group_
=
""
;
switch
(
$type
)
{
switch
(
$type
)
{
...
@@ -149,7 +177,7 @@ class TAgentTotalModel extends Model
...
@@ -149,7 +177,7 @@ class TAgentTotalModel extends Model
}
}
public
function
getTotalByAgentIdPage
(
$pageNo
,
$pageSize
,
$field
,
$params
,
$type
,
$order
=
""
)
public
function
getTotalByAgentIdPage
(
$pageNo
,
$pageSize
,
$field
,
$params
,
$type
,
$order
=
""
)
{
{
$group_
=
""
;
$group_
=
""
;
switch
(
$type
)
{
switch
(
$type
)
{
...
@@ -177,7 +205,7 @@ class TAgentTotalModel extends Model
...
@@ -177,7 +205,7 @@ class TAgentTotalModel extends Model
}
}
public
function
getTotalByAgentIdCount
(
$field
,
$params
,
$type
,
$order
=
""
)
public
function
getTotalByAgentIdCount
(
$field
,
$params
,
$type
,
$order
=
""
)
{
{
$group_
=
""
;
$group_
=
""
;
switch
(
$type
)
{
switch
(
$type
)
{
...
@@ -204,8 +232,6 @@ class TAgentTotalModel extends Model
...
@@ -204,8 +232,6 @@ class TAgentTotalModel extends Model
}
}
/**
/**
* 统计时间端经纪人业绩
* 统计时间端经纪人业绩
* @param $field
* @param $field
...
@@ -221,7 +247,6 @@ class TAgentTotalModel extends Model
...
@@ -221,7 +247,6 @@ class TAgentTotalModel extends Model
}
}
/**
/**
* 获取分组统计数据-pc后台业绩用
* 获取分组统计数据-pc后台业绩用
* @param $field
* @param $field
...
@@ -230,7 +255,7 @@ class TAgentTotalModel extends Model
...
@@ -230,7 +255,7 @@ class TAgentTotalModel extends Model
* @param string $order
* @param string $order
* @return false|\PDOStatement|string|\think\Collection
* @return false|\PDOStatement|string|\think\Collection
*/
*/
public
function
getTotalByAgentIdForPcPerformance
(
$field
,
$params
,
$type
,
$order
=
""
,
$pageSize
,
$pageNo
)
public
function
getTotalByAgentIdForPcPerformance
(
$field
,
$params
,
$type
,
$order
=
""
,
$pageSize
,
$pageNo
)
{
{
$group_
=
""
;
$group_
=
""
;
switch
(
$type
)
{
switch
(
$type
)
{
...
@@ -260,7 +285,7 @@ class TAgentTotalModel extends Model
...
@@ -260,7 +285,7 @@ class TAgentTotalModel extends Model
}
}
public
function
getTotalByAgentIdForPcPerformanceTotal
(
$field
,
$params
,
$type
,
$order
=
""
)
public
function
getTotalByAgentIdForPcPerformanceTotal
(
$field
,
$params
,
$type
,
$order
=
""
)
{
{
$group_
=
""
;
$group_
=
""
;
switch
(
$type
)
{
switch
(
$type
)
{
...
@@ -287,7 +312,7 @@ class TAgentTotalModel extends Model
...
@@ -287,7 +312,7 @@ class TAgentTotalModel extends Model
}
}
public
function
getTotalByAgentIdForPcPerformanceSum
(
$field
,
$params
,
$type
,
$order
=
""
)
public
function
getTotalByAgentIdForPcPerformanceSum
(
$field
,
$params
,
$type
,
$order
=
""
)
{
{
$group_
=
""
;
$group_
=
""
;
switch
(
$type
)
{
switch
(
$type
)
{
...
@@ -313,15 +338,4 @@ class TAgentTotalModel extends Model
...
@@ -313,15 +338,4 @@ class TAgentTotalModel extends Model
return
$result
;
return
$result
;
}
}
public
function
getSortPerformance
(
$field
,
$params
){
$data
=
$this
->
db_
->
field
(
$field
)
->
where
(
$params
)
->
group
(
"agent_id"
)
->
order
(
"performance desc"
)
->
select
();
//echo $this->getLastSql();
return
$data
;
}
}
}
\ No newline at end of file
application/route.php
View file @
ab12e9fa
...
@@ -360,6 +360,7 @@ Route::group('index', [
...
@@ -360,6 +360,7 @@ Route::group('index', [
'getRandKingList'
=>
[
'index/RankingList/getRandKingList'
,
[
'method'
=>
'GET|POST'
]],
//设置角色站点
'getRandKingList'
=>
[
'index/RankingList/getRandKingList'
,
[
'method'
=>
'GET|POST'
]],
//设置角色站点
'exportReport'
=>
[
'index/RankingList/exportReport'
,
[
'method'
=>
'GET|POST'
]],
'exportReport'
=>
[
'index/RankingList/exportReport'
,
[
'method'
=>
'GET|POST'
]],
'selectPkSortByTime'
=>
[
'index/RankingList/selectPkSortByTime'
,
[
'method'
=>
'GET|POST'
]],
]);
]);
...
...
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