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
11699609
Commit
11699609
authored
Apr 08, 2019
by
hujun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
根据bargain_id统计
parent
1884bd6d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
88 additions
and
0 deletions
+88
-0
route.php
application/route.php
+1
-0
ResultsSummaryNewTask.php
application/task/controller/ResultsSummaryNewTask.php
+87
-0
No files found.
application/route.php
View file @
11699609
...
...
@@ -626,6 +626,7 @@ Route::group('task', [
'updateCouponExpired'
=>
[
'task/UpdateCouponTask/updateCouponExpired'
,
[
'method'
=>
'get'
]],
//超过有效期的券改过期
'killOutTimeSql'
=>
[
'task/KillOutTimeSql/killOutTimeSql'
,
[
'method'
=>
'get'
]],
//超过有效期的券改过期
'delHouseVideo'
=>
[
'task/JobTask/delHouseVideo'
,
[
'method'
=>
'get'
]],
//删除无效视频
'updateBargainPerformance'
=>
[
'task/ResultsSummaryNewTask/updateBargainPerformance'
,
[
'method'
=>
'get'
]],
//根据bargain_id统计
]);
Route
::
group
(
'broker'
,
[
...
...
application/task/controller/ResultsSummaryNewTask.php
View file @
11699609
...
...
@@ -15,6 +15,7 @@ use app\model\UPhoneFollowUp;
use
app\model\UPhoneFollowUpTemporary
;
use
app\model\Users
;
use
Think\Log
;
use
think\Request
;
/**
* Created by PhpStorm.
...
...
@@ -333,4 +334,89 @@ class ResultsSummaryNewTask
unset
(
$result_arr
);
return
$params
;
}
/**
* 根据bargain_id统计
*
* @param Request $request
* @return false|string
*/
public
function
updateBargainPerformance
(
Request
$request
)
{
try
{
$bargain_id
=
$request
->
get
(
'bargain_id'
);
if
(
empty
(
$bargain_id
))
{
return
json_encode
([
'code'
=>
101
,
'msg'
=>
'params is error'
]);
}
$data
[
'msg'
]
=
''
;
$where
=
$update_data
=
[];
if
(
$bargain_id
)
{
$where
[
'b.id'
]
=
$bargain_id
;
}
if
(
!
empty
(
$where
))
{
//获取被修改人信息
$agent_data
=
$this
->
agentsModel
->
agentBargainAll
(
'a.id,a.store_id,a.district_id,b.create_time'
,
$where
);
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'
],
$create_time
);
}
}
$data
[
'code'
]
=
200
;
}
catch
(
\Exception
$e
)
{
$data
[
'code'
]
=
101
;
$data
[
'msg'
]
=
'内部错误:'
.
$e
->
getMessage
();
}
return
json_encode
([
'code'
=>
$data
[
'code'
],
'msg'
=>
$data
[
'msg'
]]);
}
/**
* (临时处理)业绩统计-实收统计
*
* @param $agent_id
* @param $district_id
* @param $store_id
* @param $date
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public
function
totalOfficialReceipts
(
$agent_id
,
$district_id
,
$store_id
,
$date
)
{
//获取被修改人信息
$date
=
date
(
'Y-m-d'
,
strtotime
(
$date
));
$update_data
=
[];
$where_bargain
[
'agent_id'
]
=
$agent_id
;
$where_bargain
[
'create_time'
]
=
[
'BETWEEN'
,
[
$date
.
' 00:00:00'
,
$date
.
' 23:59:59'
]];
//实收
$receivedSum
=
$this
->
bargainModel
->
getAddBargainNumGroupTimeNew
(
$where_bargain
,
2
);
//1表示业绩 2表示实收
$received_sum
=
empty
(
$receivedSum
[
0
][
"num"
])
?
0
:
$receivedSum
[
0
][
"num"
];
//业绩
$performanceSum
=
$this
->
bargainModel
->
getAddBargainNumGroupTimeNew
(
$where_bargain
,
1
);
//1表示业绩 2表示实收
$performance_sum
=
empty
(
$performanceSum
[
0
][
"num"
])
?
0
:
$performanceSum
[
0
][
"num"
];
$id
=
$this
->
tAgentTotalModel
->
getTotalEndTimeByAgentId
(
'id'
,
[
'total_time'
=>
$date
,
'agent_id'
=>
$where_bargain
[
'agent_id'
]]);
if
(
empty
(
$id
[
0
][
'id'
]))
{
$insert_data
[]
=
[
'store_id'
=>
$store_id
,
'district_id'
=>
$district_id
,
'agent_id'
=>
$agent_id
,
'official_receipts'
=>
$received_sum
,
'performance'
=>
$performance_sum
,
'total_time'
=>
$date
,
'create_time'
=>
date
(
'Y-m-d H:i:s'
)
];
$this
->
tAgentTotalModel
->
addTotal
(
$insert_data
);
}
else
{
$update_data
[]
=
[
'official_receipts'
=>
$received_sum
,
'performance'
=>
$performance_sum
,
'id'
=>
$id
[
0
][
'id'
],
'update_time'
=>
date
(
'Y-m-d H:i:s'
)
];
$this
->
tAgentTotalModel
->
saveTotal
(
$update_data
);
}
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