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
aa8f9d25
Commit
aa8f9d25
authored
Dec 14, 2018
by
hujun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
业绩单独处理
parent
ab0fb461
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
57 deletions
+17
-57
Finance.php
application/index/controller/Finance.php
+17
-57
No files found.
application/index/controller/Finance.php
View file @
aa8f9d25
...
...
@@ -2034,17 +2034,14 @@ class Finance extends Basic
$partial_data
[
'role'
]
=
$this
->
params
[
'role'
];
$partial_data
[
'should_commission'
]
=
$this
->
params
[
'scale_fee'
];
$comm
->
editData
(
$partial_data
,
$this
->
params
[
'bargain_id'
],
'bargain_id'
);
// $this->updatePerformance(0, $this->params['agent_id']);
// $this->updatePerformance(0, $data_arr['agent_id']);
$bargain_id
=
empty
(
$data_arr
[
'father_id'
])
?
$data_arr
[
'id'
]
:
$data_arr
[
'father_id'
];
$this
->
updatePerformanceAll
(
$bargain_id
,
1
);
$this
->
updatePerformanceAgent
(
$data_arr
[
'create_time'
],
$data_arr
[
'agent_id'
]);
/*记录日志 start*/
$father_id
=
$this
->
params
[
'bargain_id'
];
if
(
$data_arr
[
'father_id'
]
==
0
)
{
$father_id
=
$data_arr
[
'father_id'
];
}
$this
->
totalOfficialReceipts
(
$data_arr
[
'agent_id'
],
$data_arr
[
'district_id'
],
$data_arr
[
'store_id'
],
$data_arr
[
'create_time'
]);
$this
->
totalOfficialReceipts
(
$this
->
params
[
'agent_id'
],
$data_arr
[
'district_id'
],
$data_arr
[
'store_id'
],
$data_arr
[
'create_time'
]);
$content
=
''
;
if
(
$data_arr
[
'agent_id'
]
!=
$this
->
params
[
'agent_id'
])
{
...
...
@@ -2207,52 +2204,6 @@ class Finance extends Basic
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
)
{
//更新业绩统计
$sum
=
new
ResultsSummaryNewTask
();
...
...
@@ -2306,13 +2257,17 @@ class Finance extends Basic
public
function
totalOfficialReceipts
(
$agent_id
,
$district_id
,
$store_id
,
$date
)
{
//获取被修改人信息
$m_agent_total
=
new
TAgentTotalModel
();
$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
->
m_bargain
->
getReceivedGroupTimeNew
(
$where_bargain
);
$received_sum
=
empty
(
$receivedSum
[
0
][
"num"
])
?
""
:
$receivedSum
[
0
][
"num"
];
//实收
$receivedSum
=
$this
->
m_bargain
->
getReceivedGroupTimeNew
(
$where_bargain
);
$received_sum
=
empty
(
$receivedSum
[
0
][
"num"
])
?
0
:
$receivedSum
[
0
][
"num"
];
//业绩
$performanceSum
=
$this
->
m_bargain
->
getAddBargainNumGroupTimeNew
(
$where_bargain
,
1
);
//1表示业绩 2表示实收
$performance_sum
=
empty
(
$performanceSum
[
0
][
"num"
])
?
0
:
$performanceSum
[
0
][
"num"
];
$id
=
$m_agent_total
->
getTotalEndTimeByAgentId
(
'id'
,
[
'total_time'
=>
$date
,
'agent_id'
=>
$where_bargain
[
'agent_id'
]]);
if
(
empty
(
$id
[
0
]))
{
...
...
@@ -2320,14 +2275,19 @@ class Finance extends Basic
'store_id'
=>
$store_id
,
'district_id'
=>
$district_id
,
'agent_id'
=>
$agent_id
,
'official_receipts'
=>
$received_sum
,
'performance'
=>
$performance_sum
,
'total_time'
=>
date
(
'Y-m-d'
),
'create_time'
=>
date
(
'Y-m-d H:i:s'
)
];
$m_agent_total
->
addTotal
(
$insert_data
);
}
else
{
$update_data
[
0
][
"official_receipts"
]
=
empty
(
$received_sum
)
?
0
:
$received_sum
;
$update_data
[
0
][
'id'
]
=
$id
[
0
][
'id'
];
$update_data
[
0
][
'update_time'
]
=
date
(
'Y-m-d H:i:s'
);
$update_data
[]
=
[
'official_receipts'
=>
$received_sum
,
'performance'
=>
$performance_sum
,
'id'
=>
$id
[
0
][
'id'
],
'update_time'
=>
date
(
'Y-m-d H:i:s'
)
];
$m_agent_total
->
saveTotal
(
$update_data
);
}
...
...
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