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
6e23cb7e
Commit
6e23cb7e
authored
Jul 15, 2019
by
hujun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
同步统计
parent
bd050d24
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
91 additions
and
12 deletions
+91
-12
ResultsSummaryNewTask.php
application/task/controller/ResultsSummaryNewTask.php
+91
-12
No files found.
application/task/controller/ResultsSummaryNewTask.php
View file @
6e23cb7e
...
@@ -369,10 +369,9 @@ class ResultsSummaryNewTask
...
@@ -369,10 +369,9 @@ class ResultsSummaryNewTask
}
}
if
(
!
empty
(
$where
))
{
if
(
!
empty
(
$where
))
{
//获取被修改人信息
//获取被修改人信息
$agent_data
=
$this
->
agentsModel
->
agentBargainAll
(
'a.id,a.store_id,a.district_id,b.create_time'
,
$where
);
$agent_data
=
$this
->
agentsModel
->
agentBargainAll
(
'a.id,a.store_id,a.district_id,
d.income_time,
b.create_time'
,
$where
);
foreach
(
$agent_data
as
$k
=>
$v
)
{
foreach
(
$agent_data
as
$k
=>
$v
)
{
$create_time
=
date
(
'Y-m-d'
,
strtotime
(
$v
[
'create_time'
]));
$this
->
totalOfficialReceipts
(
$v
[
'id'
],
$v
[
'district_id'
],
$v
[
'store_id'
],
$v
[
'create_time'
],
$v
[
'income_time'
]);
$this
->
totalOfficialReceipts
(
$v
[
'id'
],
$v
[
'district_id'
],
$v
[
'store_id'
],
$create_time
);
}
}
}
}
$data
[
'code'
]
=
200
;
$data
[
'code'
]
=
200
;
...
@@ -395,22 +394,27 @@ class ResultsSummaryNewTask
...
@@ -395,22 +394,27 @@ class ResultsSummaryNewTask
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
* @throws \think\exception\DbException
*/
*/
public
function
totalOfficialReceipts
(
$agent_id
,
$district_id
,
$store_id
,
$
dat
e
)
{
public
function
totalOfficialReceipts
(
$agent_id
,
$district_id
,
$store_id
,
$
create_time
,
$income_tim
e
)
{
//获取被修改人信息
//获取被修改人信息
$date
=
date
(
'Y-m-d'
,
strtotime
(
$date
));
$m_agent_total
=
new
TAgentTotalModel
();
$update_data
=
[];
$where_bargain
[
'agent_id'
]
=
$agent_id
;
$where_bargain
[
'agent_id'
]
=
$agent_id
;
if
(
!
empty
(
$create_time
)
&&
$income_time
==
$create_time
)
{
//处理同一天
$date
=
date
(
'Y-m-d'
,
strtotime
(
$create_time
));
$where_bargain
[
'create_time'
]
=
[
'BETWEEN'
,
[
$date
.
' 00:00:00'
,
$date
.
' 23:59:59'
]];
$where_bargain
[
'create_time'
]
=
[
'BETWEEN'
,
[
$date
.
' 00:00:00'
,
$date
.
' 23:59:59'
]];
//实收
//实收
$receivedSum
=
$this
->
bargainModel
->
getAddBargainNumGroupTimeNew
(
$where_bargain
,
2
);
//1表示业绩 2表示实收
$receivedSum
=
$this
->
bargainModel
->
getReceivedGroupTimeNew
(
$where_bargain
);
//1表示业绩 2表示实收
$received_sum
=
empty
(
$receivedSum
[
0
][
"num"
])
?
0
:
$receivedSum
[
0
][
"num"
];
$received_sum
=
empty
(
$receivedSum
[
0
][
"num"
])
?
'0.00'
:
$receivedSum
[
0
][
"num"
];
//业绩
//业绩
$performanceSum
=
$this
->
bargainModel
->
getAddBargainNumGroupTimeNew
(
$where_bargain
,
1
);
//1表示业绩 2表示实收
$performanceSum
=
$this
->
bargainModel
->
getAddBargainNumGroupTimeNew
(
$where_bargain
,
1
);
//1表示业绩 2表示实收
$performance_sum
=
empty
(
$performanceSum
[
0
][
"num"
])
?
0
:
$performanceSum
[
0
][
"num"
];
$performance_sum
=
empty
(
$performanceSum
[
0
][
"num"
])
?
'0.00'
:
$performanceSum
[
0
][
"num"
];
$id
=
$this
->
tAgentTotalMode
l
->
getTotalEndTimeByAgentId
(
'id'
,
[
'total_time'
=>
$date
,
'agent_id'
=>
$where_bargain
[
'agent_id'
]]);
$id
=
$m_agent_tota
l
->
getTotalEndTimeByAgentId
(
'id'
,
[
'total_time'
=>
$date
,
'agent_id'
=>
$where_bargain
[
'agent_id'
]]);
//成交报告
$bargainSum
=
$this
->
bargainModel
->
getAddBargainNumGroupTimeNew
(
$where_bargain
,
3
);
//表示统计
$bargain_sum
=
empty
(
$bargainSum
[
0
][
"num"
])
?
'0.00'
:
$bargainSum
[
0
][
'num'
];
if
(
empty
(
$id
[
0
][
'id'
]))
{
if
(
empty
(
$id
[
0
][
'id'
]))
{
if
(
$received_sum
!=
'0.00'
||
$performance_sum
!=
'0.00'
||
$bargain_sum
!=
'0.00'
)
{
$insert_data
[]
=
[
$insert_data
[]
=
[
'store_id'
=>
$store_id
,
'store_id'
=>
$store_id
,
'district_id'
=>
$district_id
,
'district_id'
=>
$district_id
,
...
@@ -418,19 +422,93 @@ class ResultsSummaryNewTask
...
@@ -418,19 +422,93 @@ class ResultsSummaryNewTask
'official_receipts'
=>
$received_sum
,
'official_receipts'
=>
$received_sum
,
'performance'
=>
$performance_sum
,
'performance'
=>
$performance_sum
,
'total_time'
=>
$date
,
'total_time'
=>
$date
,
'bargain_sum'
=>
$bargain_sum
,
'create_time'
=>
date
(
'Y-m-d H:i:s'
)
'create_time'
=>
date
(
'Y-m-d H:i:s'
)
];
];
$this
->
tAgentTotalModel
->
addTotal
(
$insert_data
);
}
}
else
{
}
else
{
$update_data
[]
=
[
$update_data
[]
=
[
'official_receipts'
=>
$received_sum
,
'official_receipts'
=>
$received_sum
,
'performance'
=>
$performance_sum
,
'performance'
=>
$performance_sum
,
'bargain_sum'
=>
$bargain_sum
,
'id'
=>
$id
[
0
][
'id'
],
'update_time'
=>
date
(
'Y-m-d H:i:s'
)
];
}
}
else
{
//处理时间不一致
if
(
$create_time
)
{
$date
=
date
(
'Y-m-d'
,
strtotime
(
$create_time
));
$where_bargain
[
'create_time'
]
=
[
'BETWEEN'
,
[
$date
.
' 00:00:00'
,
$date
.
' 23:59:59'
]];
//业绩
$performanceSum
=
$this
->
bargainModel
->
getAddBargainNumGroupTimeNew
(
$where_bargain
,
1
);
//1表示业绩 2表示实收
$performance_sum
=
empty
(
$performanceSum
[
0
][
"num"
])
?
0.00
:
$performanceSum
[
0
][
"num"
];
$id
=
$m_agent_total
->
getTotalEndTimeByAgentId
(
'id'
,
[
'total_time'
=>
$date
,
'agent_id'
=>
$where_bargain
[
'agent_id'
]]);
//成交报告
$bargainSum
=
$this
->
bargainModel
->
getAddBargainNumGroupTimeNew
(
$where_bargain
,
3
);
//表示统计
$bargain_sum
=
empty
(
$bargainSum
[
0
][
"num"
])
?
'0.00'
:
$bargainSum
[
0
][
'num'
];
if
(
empty
(
$id
[
0
][
'id'
]))
{
if
(
$performance_sum
!=
'0.00'
||
$bargain_sum
!=
'0.00'
)
{
$insert_data
[]
=
[
'store_id'
=>
$store_id
,
'district_id'
=>
$district_id
,
'agent_id'
=>
$agent_id
,
'official_receipts'
=>
0
,
'performance'
=>
$performance_sum
,
'total_time'
=>
$date
,
'bargain_sum'
=>
$bargain_sum
,
'create_time'
=>
date
(
'Y-m-d H:i:s'
)
];
}
}
else
{
$update_data
[]
=
[
'performance'
=>
$performance_sum
,
'bargain_sum'
=>
$bargain_sum
,
'id'
=>
$id
[
0
][
'id'
],
'id'
=>
$id
[
0
][
'id'
],
'update_time'
=>
date
(
'Y-m-d H:i:s'
)
'update_time'
=>
date
(
'Y-m-d H:i:s'
)
];
];
$this
->
tAgentTotalModel
->
saveTotal
(
$update_data
);
}
}
//实收
if
(
$income_time
)
{
$date
=
date
(
'Y-m-d'
,
strtotime
(
$income_time
));
$where_bargain
[
'create_time'
]
=
[
'BETWEEN'
,
[
$date
.
' 00:00:00'
,
$date
.
' 23:59:59'
]];
$receivedSum
=
$this
->
bargainModel
->
getReceivedGroupTimeNew
(
$where_bargain
);
$received_sum
=
empty
(
$receivedSum
[
0
][
"num"
])
?
'0.00'
:
$receivedSum
[
0
][
"num"
];
$id
=
$m_agent_total
->
getTotalEndTimeByAgentId
(
'id'
,
[
'total_time'
=>
$date
,
'agent_id'
=>
$where_bargain
[
'agent_id'
]]);
if
(
empty
(
$id
[
0
][
'id'
]))
{
if
(
$received_sum
!=
'0.00'
)
{
$insert_data
[]
=
[
'store_id'
=>
$store_id
,
'district_id'
=>
$district_id
,
'agent_id'
=>
$agent_id
,
'official_receipts'
=>
$received_sum
,
'performance'
=>
0
,
'total_time'
=>
$date
,
'bargain_sum'
=>
0
,
'create_time'
=>
date
(
'Y-m-d H:i:s'
)
];
}
}
else
{
$update_data
[]
=
[
'official_receipts'
=>
$received_sum
,
'id'
=>
$id
[
0
][
'id'
],
'update_time'
=>
date
(
'Y-m-d H:i:s'
)
];
}
}
}
}
if
(
isset
(
$insert_data
))
{
$m_agent_total
->
addTotal
(
$insert_data
);
}
if
(
isset
(
$update_data
))
{
$m_agent_total
->
saveTotal
(
$update_data
);
}
return
;
return
;
}
}
}
}
\ 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