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
91e0ac56
Commit
91e0ac56
authored
Jun 24, 2019
by
zhuwei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
office_t_agent_total 建统计表模型
parent
5313ac6c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
357 additions
and
2 deletions
+357
-2
OfficePerformanceService.php
application/index/service/OfficePerformanceService.php
+2
-2
OfficeTAgentTotalModel.php
application/model/OfficeTAgentTotalModel.php
+355
-0
No files found.
application/index/service/OfficePerformanceService.php
View file @
91e0ac56
...
...
@@ -7,6 +7,7 @@ use app\model\ADistrict;
use
app\model\AStore
;
use
app\model\GHouses
;
use
app\model\OBargainModel
;
use
app\model\OfficeTAgentTotalModel
;
use
app\model\OMarchInModel
;
use
app\model\OReportModel
;
use
app\model\TAgentTotalModel
;
...
...
@@ -36,7 +37,7 @@ class OfficePerformanceService
public
function
__construct
()
{
$this
->
totalModel
=
new
TAgentTotalModel
();
$this
->
totalModel
=
new
Office
TAgentTotalModel
();
$this
->
agentModel
=
new
AAgents
();
$this
->
houseModel
=
new
GHouses
();
$this
->
userModel
=
new
Users
();
...
...
@@ -46,7 +47,6 @@ class OfficePerformanceService
$this
->
districtModel
=
new
ADistrict
();
$this
->
storeModel
=
new
AStore
();
}
...
...
application/model/OfficeTAgentTotalModel.php
0 → 100644
View file @
91e0ac56
<?php
namespace
app\model
;
use
think\Db
;
use
think\Model
;
/**
* Created by PhpStorm.
* User : zw
* Date : 2018/3/15
* Time : 下午2:00
* Intro:
*/
class
OfficeTAgentTotalModel
extends
Model
{
protected
$table
=
"office_t_agent_total"
;
private
$db_
;
function
__construct
()
{
$this
->
db_
=
Db
::
name
(
$this
->
table
);
}
/**
* @param $params
* @return int
*/
public
function
addTotal
(
$params
)
{
Db
::
startTrans
();
try
{
$this
->
db_
->
insertAll
(
$params
);
Db
::
commit
();
return
1
;
}
catch
(
\Exception
$e
)
{
Db
::
rollback
();
return
0
;
}
}
/**
* @param $params
* @return int
*/
public
function
saveTotal
(
$params
)
{
Db
::
startTrans
();
try
{
foreach
(
$params
as
$k
=>
$v
)
{
$this
->
db_
->
table
(
$this
->
table
)
->
update
(
$v
);
}
Db
::
commit
();
return
1
;
}
catch
(
\Exception
$e
)
{
Db
::
rollback
();
return
0
;
}
}
/**
* @param $params
* @return int
*/
public
function
updateTotal
(
$params
,
$where
)
{
Db
::
startTrans
();
try
{
$this
->
db_
->
where
(
$where
)
->
update
(
$params
);
Db
::
commit
();
return
1
;
}
catch
(
\Exception
$e
)
{
Db
::
rollback
();
return
0
;
}
}
/**
* 获取最后统计的时间
* @param $field
* @param $param
* @return false|\PDOStatement|string|\think\Collection
*/
public
function
getTotalEndTimeByAgentId
(
$field
,
$param
)
{
return
$this
->
db_
->
field
(
$field
)
->
where
(
$param
)
->
order
(
"total_time desc"
)
->
limit
(
1
)
->
select
();
}
/**
* 获取分组统计数据
* @param $field
* @param $params
* @param $type
* @param string $order
* @return false|\PDOStatement|string|\think\Collection
*/
public
function
getTotalByAgentId
(
$field
,
$params
,
$type
,
$order
=
""
)
{
$group_
=
""
;
switch
(
$type
)
{
case
1
:
$group_
=
"agent_id"
;
break
;
case
2
:
$group_
=
"store_id"
;
break
;
case
3
:
$group_
=
"district_id"
;
break
;
}
$result
=
$this
->
db_
->
field
(
$field
)
->
where
(
$params
)
->
group
(
$group_
)
->
order
(
$order
)
->
select
();
//echo $this->db_->getLastSql();
return
$result
;
}
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
)
->
limit
(
$limit
)
->
select
();
//echo $this->db_->getLastSql();
return
$result
;
}
/**
* 获取分组统计数据-加入站点
* @param $field
* @param $params
* @param $type
* @param string $order
* @return false|\PDOStatement|string|\think\Collection
*/
public
function
getTotalByAgentIdSite
(
$field
,
$params
,
$type
,
$order
=
""
)
{
$group_
=
""
;
switch
(
$type
)
{
case
1
:
$group_
=
"a.agent_id"
;
break
;
case
2
:
$group_
=
"a.store_id"
;
break
;
case
3
:
$group_
=
"a.district_id"
;
break
;
}
$result
=
$this
->
db_
->
field
(
$field
)
->
alias
(
'a'
)
->
join
(
'a_district d'
,
'a.district_id = d.id'
,
'left'
)
->
where
(
$params
)
->
group
(
$group_
)
->
order
(
$order
)
->
select
();
//echo $this->db_->getLastSql();exit;
return
$result
;
}
public
function
getTotalByAgentIdPage
(
$pageNo
,
$pageSize
,
$field
,
$params
,
$type
,
$order
=
""
)
{
$group_
=
""
;
switch
(
$type
)
{
case
1
:
$group_
=
"agent_id"
;
break
;
case
2
:
$group_
=
"store_id"
;
break
;
case
3
:
$group_
=
"district_id"
;
break
;
}
$result
=
$this
->
db_
->
field
(
$field
)
->
where
(
$params
)
->
group
(
$group_
)
->
order
(
$order
)
->
limit
(
$pageSize
)
->
page
(
$pageNo
)
->
select
();
//echo $this->db_->getLastSql();
return
$result
;
}
public
function
getTotalByAgentIdCount
(
$field
,
$params
,
$type
,
$order
=
""
)
{
$group_
=
""
;
switch
(
$type
)
{
case
1
:
$group_
=
"agent_id"
;
break
;
case
2
:
$group_
=
"store_id"
;
break
;
case
3
:
$group_
=
"district_id"
;
break
;
}
$result
=
$this
->
db_
->
field
(
$field
)
->
where
(
$params
)
->
group
(
$group_
)
->
order
(
$order
)
->
count
();
// echo $this->db_->getLastSql();
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
();
}
/**
* 获取分组统计数据-pc后台业绩用
* @param $field
* @param $params
* @param $type
* @param string $order
* @return false|\PDOStatement|string|\think\Collection
*/
public
function
getTotalByAgentIdForPcPerformance
(
$field
,
$params
,
$type
,
$order
=
""
,
$pageSize
,
$pageNo
)
{
$group_
=
""
;
switch
(
$type
)
{
case
1
:
$group_
=
"a.agent_id"
;
break
;
case
2
:
$group_
=
"a.store_id"
;
break
;
case
3
:
$group_
=
"a.district_id"
;
break
;
}
$result
=
$this
->
db_
->
field
(
$field
)
->
alias
(
'a'
)
->
join
(
'a_district d'
,
'a.district_id = d.id'
,
'left'
)
->
where
(
$params
)
->
group
(
$group_
)
->
order
(
$order
)
->
limit
(
$pageSize
)
->
page
(
$pageNo
)
->
select
();
//echo $this->db_->getLastSql();
return
$result
;
}
public
function
getTotalByAgentIdForPcPerformanceTotal
(
$field
,
$params
,
$type
,
$order
=
""
)
{
$group_
=
""
;
switch
(
$type
)
{
case
1
:
$group_
=
"a.agent_id"
;
break
;
case
2
:
$group_
=
"a.store_id"
;
break
;
case
3
:
$group_
=
"a.district_id"
;
break
;
}
$result
=
$this
->
db_
->
field
(
$field
)
->
alias
(
'a'
)
->
join
(
'a_district d'
,
'a.district_id = d.id'
,
'left'
)
->
where
(
$params
)
->
group
(
$group_
)
->
count
();
//echo $this->db_->getLastSql();
return
$result
;
}
public
function
getTotalByAgentIdForPcPerformanceSum
(
$field
,
$params
,
$type
,
$order
=
""
)
{
$group_
=
""
;
switch
(
$type
)
{
case
1
:
$group_
=
"a.agent_id"
;
break
;
case
2
:
$group_
=
"a.store_id"
;
break
;
case
3
:
$group_
=
"a.district_id"
;
break
;
}
$result
=
$this
->
db_
->
field
(
$field
)
->
alias
(
'a'
)
->
join
(
'a_district d'
,
'a.district_id = d.id'
,
'left'
)
->
where
(
$params
)
->
group
(
$group_
)
->
select
();
//echo $this->db_->getLastSql();
return
$result
;
}
}
\ 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