Commit 062ac854 authored by hujun's avatar hujun

撤销成功报告优化

parent 995a8ebf
......@@ -2094,6 +2094,11 @@ class Finance extends Basic
return $this->response(101, '参数错误');
}
$check = $this->updatePerformanceAll($this->params['bargain_id']);
if ($check['status'] == 'fail') {
return $this->response(101, '更新个人业绩失败,请重试!');
}
$params['content'] = trim($this->params['content']); //撤销原因
$m_financial = new OFinancialAudit();
$result = $m_financial->backOutUpdate($this->params['bargain_id'], $params);
......@@ -2101,8 +2106,6 @@ class Finance extends Basic
if ($result) {
$code = 200;
$this->editRecordLog($this->params['bargain_id'], '[撤销成交报告]', 3); //日志记录
$this->updatePerformanceAll($this->params['bargain_id'], 1);
$bargain_data = $this->m_bargain->getBargainDetail('order_id,order_no,agent_id', [ 'id' => $this->params['bargain_id'] ]);
$financial_data['bargain_id'] = $this->params['bargain_id'];
$financial_data['audit_name'] = $this->userName;
......@@ -2157,14 +2160,11 @@ class Finance extends Basic
* 更新多人业绩
*
* @param int $bargain_id
* @param int $is_select 重新统计经纪人业绩
* @return bool
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
* @return array
*/
private function updatePerformanceAll(int $bargain_id = 0, $is_select = 0): bool
private function updatePerformanceAll(int $bargain_id = 0): array
{
try {
$where = $update_data = [];
if ($bargain_id) {
$where['b.id'] = $bargain_id;
......@@ -2178,7 +2178,13 @@ class Finance extends Basic
$this->totalOfficialReceipts($v['id'], $v['district_id'], $v['store_id'], $create_time);
}
}
return true;
$data['status'] = 'successful';
} catch (\Exception $e) {
$data['status'] = 'fail';
$data['msg'] = '内部错误:'.$e->getMessage();
}
return $data;
}
private function updatePerformanceData($id, $create_time, $store_id, $district_id) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment