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
c3a8e23a
Commit
c3a8e23a
authored
Dec 14, 2018
by
hujun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
业绩单独处理
parent
ad95a319
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
48 additions
and
1 deletion
+48
-1
Finance.php
application/index/controller/Finance.php
+48
-1
No files found.
application/index/controller/Finance.php
View file @
c3a8e23a
...
@@ -2001,7 +2001,7 @@ class Finance extends Basic
...
@@ -2001,7 +2001,7 @@ class Finance extends Basic
if
(
empty
(
$this
->
params
[
'bargain_id'
]))
{
if
(
empty
(
$this
->
params
[
'bargain_id'
]))
{
return
$this
->
response
(
101
,
'成交报告id为空'
);
return
$this
->
response
(
101
,
'成交报告id为空'
);
}
}
$field
=
'a.id,a.scale,a.agent_id,a.role,a.scale_fee,b.scale as new_scale,b.should_commission,a.create_time,a.father_id'
;
$field
=
'a.id,a.scale,a.agent_id,a.role,a.scale_fee,b.scale as new_scale,b.should_commission,a.create_time,a.father_id
,a.create_time
'
;
if
(
$this
->
request
->
isGet
())
{
if
(
$this
->
request
->
isGet
())
{
$data
=
$this
->
m_bargain
->
getBargainPartialDetail
(
$field
,
[
'id'
=>
$this
->
params
[
'bargain_id'
]
]);
$data
=
$this
->
m_bargain
->
getBargainPartialDetail
(
$field
,
[
'id'
=>
$this
->
params
[
'bargain_id'
]
]);
return
$this
->
response
(
200
,
''
,
$data
);
return
$this
->
response
(
200
,
''
,
$data
);
...
@@ -2039,6 +2039,7 @@ class Finance extends Basic
...
@@ -2039,6 +2039,7 @@ class Finance extends Basic
$bargain_id
=
empty
(
$data_arr
[
'father_id'
])
?
$data_arr
[
'id'
]
:
$data_arr
[
'father_id'
];
$bargain_id
=
empty
(
$data_arr
[
'father_id'
])
?
$data_arr
[
'id'
]
:
$data_arr
[
'father_id'
];
$this
->
updatePerformanceAll
(
$bargain_id
,
1
);
$this
->
updatePerformanceAll
(
$bargain_id
,
1
);
$this
->
updatePerformanceAgent
(
$data_arr
[
'create_time'
],
$data_arr
[
'agent_id'
]);
/*记录日志 start*/
/*记录日志 start*/
$father_id
=
$this
->
params
[
'bargain_id'
];
$father_id
=
$this
->
params
[
'bargain_id'
];
if
(
$data_arr
[
'father_id'
]
==
0
)
{
if
(
$data_arr
[
'father_id'
]
==
0
)
{
...
@@ -2206,6 +2207,52 @@ class Finance extends Basic
...
@@ -2206,6 +2207,52 @@ class Finance extends Basic
return
true
;
return
true
;
}
}
/**
* 单独处理经纪人人业绩
*
* @param $create_time
* @param $agent_id 被修改的人
* @return bool|void
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public
function
updatePerformanceAgent
(
$create_time
,
$agent_id
)
{
if
(
empty
(
$agent_id
)
||
empty
(
$create_time
))
{
return
false
;
}
$create_time
=
date
(
'Y-m-d'
,
strtotime
(
$create_time
));
$where_bargain
[
'agent_id'
]
=
$agent_id
;
$where_bargain
[
'create_time'
]
=
[
'BETWEEN'
,
[
$create_time
.
' 00:00:00'
,
$create_time
.
' 23:59:59'
]];
$bargainSum
=
$this
->
m_bargain
->
getAddBargainNumGroupTimeNew
(
$where_bargain
,
1
);
$m_agent
=
new
AAgents
();
$agent_data
=
$m_agent
->
getAgentInfo
(
'id,store_id,district_id'
,
$agent_id
);
$m_agent_total
=
new
TAgentTotalModel
();
$id
=
$m_agent_total
->
getTotalEndTimeByAgentId
(
'id'
,
[
'total_time'
=>
$create_time
,
'agent_id'
=>
$agent_id
]);
if
(
!
empty
(
$id
))
{
$update_data
[
0
][
"performance"
]
=
!
empty
(
$bargainSum
[
0
][
"num"
])
?
$bargainSum
[
0
][
"num"
]
:
0
;
$update_data
[
0
][
'id'
]
=
$id
[
0
][
'id'
];
}
if
(
empty
(
$update_data
))
{
$insert_data
[]
=
[
'store_id'
=>
$agent_data
[
'store_id'
],
'district_id'
=>
$agent_data
[
'district_id'
],
'agent_id'
=>
$agent_id
,
'total_time'
=>
date
(
'Y-m-d'
),
'create_time'
=>
date
(
'Y-m-d H:i:s'
)
];
$m_agent_total
->
addTotal
(
$insert_data
);
}
else
{
$m_agent_total
->
saveTotal
(
$update_data
);
}
return
;
}
private
function
updatePerformanceData
(
$id
,
$create_time
,
$store_id
,
$district_id
)
{
private
function
updatePerformanceData
(
$id
,
$create_time
,
$store_id
,
$district_id
)
{
//更新业绩统计
//更新业绩统计
$sum
=
new
ResultsSummaryNewTask
();
$sum
=
new
ResultsSummaryNewTask
();
...
...
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