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
b5aeddc2
Commit
b5aeddc2
authored
Sep 12, 2018
by
clone
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bug
parent
1489ef8f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
86 additions
and
65 deletions
+86
-65
Finance.php
application/index/controller/Finance.php
+86
-65
No files found.
application/index/controller/Finance.php
View file @
b5aeddc2
...
@@ -111,41 +111,41 @@ class Finance extends Basic
...
@@ -111,41 +111,41 @@ class Finance extends Basic
}
}
if
(
!
empty
(
$this
->
params
[
'agent_phone'
]))
{
if
(
!
empty
(
$this
->
params
[
'agent_phone'
]))
{
$agent_where
[
'a.phone'
]
=
[
'LIKE'
,
'%'
.
$this
->
params
[
'agent_phone'
]
.
'%'
];
$agent_where
[
'a.phone'
]
=
[
'LIKE'
,
'%'
.
$this
->
params
[
'agent_phone'
]
.
'%'
];
}
}
if
(
!
empty
(
$this
->
params
[
'agent_name'
]))
{
if
(
!
empty
(
$this
->
params
[
'agent_name'
]))
{
$agent_where
[
'a.name'
]
=
[
'LIKE'
,
'%'
.
$this
->
params
[
'agent_name'
]
.
'%'
];
$agent_where
[
'a.name'
]
=
[
'LIKE'
,
'%'
.
$this
->
params
[
'agent_name'
]
.
'%'
];
}
}
if
(
!
empty
(
$agent_where
))
{
if
(
!
empty
(
$agent_where
))
{
$m_agent
=
new
AAgents
();
$m_agent
=
new
AAgents
();
$where_bargain_id
=
$m_agent
->
agentBargainAll
(
'b.id'
,
$agent_where
);
$where_bargain_id
=
$m_agent
->
agentBargainAll
(
'b.id'
,
$agent_where
);
if
(
empty
(
$where_bargain_id
))
{
if
(
empty
(
$where_bargain_id
))
{
return
$this
->
response
(
200
,
''
);
return
$this
->
response
(
200
,
''
);
}
else
{
}
else
{
$where_id
=
[];
$where_id
=
[];
foreach
(
$where_bargain_id
as
$k
=>
$v
)
{
foreach
(
$where_bargain_id
as
$k
=>
$v
)
{
$where_id
[]
=
$v
[
'id'
];
$where_id
[]
=
$v
[
'id'
];
}
}
$where
[
'a.id'
]
=
[
'in'
,
$where_id
];
$where
[
'a.id'
]
=
[
'in'
,
$where_id
];
}
}
}
}
//分佣方姓名
//分佣方姓名
if
(
!
empty
(
$this
->
params
[
'partial_id'
]))
{
if
(
!
empty
(
$this
->
params
[
'partial_id'
]))
{
$m_agent
=
new
AAgents
();
$m_agent
=
new
AAgents
();
$where_bargain_id
=
$m_agent
->
agentBargainAll
(
'b.id'
,
[
'a.id'
=>
$this
->
params
[
'partial_id'
]
]);
$where_bargain_id
=
$m_agent
->
agentBargainAll
(
'b.id'
,
[
'a.id'
=>
$this
->
params
[
'partial_id'
]
]);
if
(
empty
(
$where_bargain_id
))
{
if
(
empty
(
$where_bargain_id
))
{
return
$this
->
response
(
200
,
''
);
return
$this
->
response
(
200
,
''
);
}
else
{
}
else
{
$where_id
=
[];
$where_id
=
[];
foreach
(
$where_bargain_id
as
$k
=>
$v
)
{
foreach
(
$where_bargain_id
as
$k
=>
$v
)
{
$where_id
[]
=
$v
[
'id'
];
$where_id
[]
=
$v
[
'id'
];
}
}
$where
[
'a.id'
]
=
[
'in'
,
$where_id
];
$where
[
'a.id'
]
=
[
'in'
,
$where_id
];
}
}
}
}
...
@@ -171,14 +171,14 @@ class Finance extends Basic
...
@@ -171,14 +171,14 @@ class Finance extends Basic
$where
[
'a.audit_level'
]
=
3
;
$where
[
'a.audit_level'
]
=
3
;
break
;
break
;
case
5
:
case
5
:
//成交报告列表-待撤销
//成交报告列表-待撤销
$where
[
'a.status'
]
=
20
;
$where
[
'a.status'
]
=
20
;
$where
[
'a.audit_level'
]
=
0
;
$where
[
'a.audit_level'
]
=
0
;
break
;
break
;
case
6
:
case
6
:
//成交报告列表-已撤销
//成交报告列表-已撤销
$where
[
'a.status'
]
=
21
;
$where
[
'a.status'
]
=
21
;
break
;
break
;
case
7
:
case
7
:
//成交报告列表-待撤销-第一级审核
//成交报告列表-待撤销-第一级审核
$where
[
'a.status'
]
=
20
;
$where
[
'a.status'
]
=
20
;
...
@@ -211,7 +211,7 @@ class Finance extends Basic
...
@@ -211,7 +211,7 @@ class Finance extends Basic
$data
[
'data'
][
'total'
]
=
$bargain
->
getBargainTotal
(
$where
);
$data
[
'data'
][
'total'
]
=
$bargain
->
getBargainTotal
(
$where
);
$data
[
'data'
][
'step'
]
=
$check_status
;
$data
[
'data'
][
'step'
]
=
$check_status
;
}
catch
(
\Exception
$e
)
{
}
catch
(
\Exception
$e
)
{
return
$this
->
response
(
101
,
'内部错误,获取列表失败!请联系运营。'
.
$e
->
getMessage
());
return
$this
->
response
(
101
,
'内部错误,获取列表失败!请联系运营。'
.
$e
->
getMessage
());
}
}
return
$this
->
response
(
$data
[
'code'
],
$data
[
'msg'
],
$data
[
'data'
]);
return
$this
->
response
(
$data
[
'code'
],
$data
[
'msg'
],
$data
[
'data'
]);
...
@@ -461,11 +461,11 @@ class Finance extends Basic
...
@@ -461,11 +461,11 @@ class Finance extends Basic
$data
[
'code'
]
=
101
;
$data
[
'code'
]
=
101
;
$data
[
'msg'
]
=
'Id is null.'
;
$data
[
'msg'
]
=
'Id is null.'
;
}
else
{
}
else
{
$m_comm
=
new
OBargainModel
();
$m_comm
=
new
OBargainModel
();
$fields
=
'a.id,a.role,a.agent_id,a.scale,a.scale_fee,a.father_id'
;
$fields
=
'a.id,a.role,a.agent_id,a.scale,a.scale_fee,a.father_id'
;
$where
[
0
]
=
[
'EXP'
,
"a.id =
{
$this
->
params
[
'id'
]
}
or a.father_id =
{
$this
->
params
[
'id'
]
}
"
];
$where
[
0
]
=
[
'EXP'
,
"a.id =
{
$this
->
params
[
'id'
]
}
or a.father_id =
{
$this
->
params
[
'id'
]
}
"
];
$where
[
'a.status'
]
=
[
'<>'
,
30
];
$where
[
'a.status'
]
=
[
'<>'
,
30
];
$data
[
'data'
]
=
$m_comm
->
getBargainPartial
(
1
,
100
,
'a.id desc'
,
$fields
,
$where
);
$data
[
'data'
]
=
$m_comm
->
getBargainPartial
(
1
,
100
,
'a.id desc'
,
$fields
,
$where
);
}
}
return
$this
->
response
(
$data
[
'code'
],
$data
[
'msg'
],
$data
[
'data'
]);
return
$this
->
response
(
$data
[
'code'
],
$data
[
'msg'
],
$data
[
'data'
]);
...
@@ -503,6 +503,24 @@ class Finance extends Basic
...
@@ -503,6 +503,24 @@ class Finance extends Basic
return
$this
->
response
(
$data
[
'code'
],
$data
[
'msg'
],
$data
[
'data'
]);
return
$this
->
response
(
$data
[
'code'
],
$data
[
'msg'
],
$data
[
'data'
]);
}
}
/**
* 删除收款记录
* @return \think\Response
*/
public
function
updatePayLog
()
{
$params
=
$this
->
params
;
if
(
!
isset
(
$params
[
"id"
]))
{
return
$this
->
response
(
"101"
,
"请求参数错误"
);
}
$where_
[
"id"
]
=
$params
[
"id"
];
$where_
[
"is_del"
]
=
1
;
$order
=
new
OPayLogModel
();
$id
=
$order
->
updatePayLog
(
$where_
);
return
$this
->
response
(
"200"
,
"success"
,
$id
);
}
/**
/**
* 报备时间轴
* 报备时间轴
*
*
...
@@ -694,7 +712,7 @@ class Finance extends Basic
...
@@ -694,7 +712,7 @@ class Finance extends Basic
}
}
if
(
!
empty
(
$this
->
params
[
'bargain_id'
]))
{
if
(
!
empty
(
$this
->
params
[
'bargain_id'
]))
{
$where
[]
=
[
'EXP'
,
'b.id ='
.
$this
->
params
[
'bargain_id'
]
.
' or father_id='
.
$this
->
params
[
'bargain_id'
]
];
$where
[]
=
[
'EXP'
,
'b.id ='
.
$this
->
params
[
'bargain_id'
]
.
' or father_id='
.
$this
->
params
[
'bargain_id'
]
];
}
}
$field
=
'a.id,b.id as bargain_id,a.confirm_date,a.practical_fee,b.scale_fee,d.internal_address,b.agent_id,b.house_number,b.father_id,b.order_id'
;
$field
=
'a.id,b.id as bargain_id,a.confirm_date,a.practical_fee,b.scale_fee,d.internal_address,b.agent_id,b.house_number,b.father_id,b.order_id'
;
...
@@ -789,7 +807,7 @@ class Finance extends Basic
...
@@ -789,7 +807,7 @@ class Finance extends Basic
//todo 修改成交报告 判断id> 0
//todo 修改成交报告 判断id> 0
$m_partial
=
new
OPartialCommission
();
$m_partial
=
new
OPartialCommission
();
$check
=
new
VipService
();
$check
=
new
VipService
();
$data
=
$this
->
params
[
"commission_date"
];
$data
=
$this
->
params
[
"commission_date"
];
$add_arr
=
$update_arr
=
$log_data
=
[];
$add_arr
=
$update_arr
=
$log_data
=
[];
...
@@ -813,7 +831,7 @@ class Finance extends Basic
...
@@ -813,7 +831,7 @@ class Finance extends Basic
//确认分佣加时间 否则 只是保存分佣数据
//确认分佣加时间 否则 只是保存分佣数据
if
(
$this
->
params
[
'is_account_commission'
]
==
1
)
{
if
(
$this
->
params
[
'is_account_commission'
]
==
1
)
{
if
(
$check
->
vip
(
$this
->
userId
,
'account_commission'
))
{
if
(
$check
->
vip
(
$this
->
userId
,
'account_commission'
))
{
return
$this
->
response
(
101
,
'没有权限!'
);
return
$this
->
response
(
101
,
'没有权限!'
);
}
}
$update_arr
[
$i
][
'confirm_date'
]
=
date
(
"Y-m-d H:i:s"
,
time
());
$update_arr
[
$i
][
'confirm_date'
]
=
date
(
"Y-m-d H:i:s"
,
time
());
$update_arr
[
$i
][
'confirm_status'
]
=
1
;
$update_arr
[
$i
][
'confirm_status'
]
=
1
;
...
@@ -838,7 +856,7 @@ class Finance extends Basic
...
@@ -838,7 +856,7 @@ class Finance extends Basic
//确认分佣加时间 否则 只是保存分佣数据
//确认分佣加时间 否则 只是保存分佣数据
if
(
$this
->
params
[
'is_account_commission'
]
==
1
)
{
if
(
$this
->
params
[
'is_account_commission'
]
==
1
)
{
if
(
$check
->
vip
(
$this
->
userId
,
'account_commission'
))
{
if
(
$check
->
vip
(
$this
->
userId
,
'account_commission'
))
{
return
$this
->
response
(
101
,
'没有权限!'
);
return
$this
->
response
(
101
,
'没有权限!'
);
}
}
$add_arr
[
$j
][
'confirm_date'
]
=
date
(
"Y-m-d H:i:s"
,
time
());
$add_arr
[
$j
][
'confirm_date'
]
=
date
(
"Y-m-d H:i:s"
,
time
());
...
@@ -1263,11 +1281,11 @@ class Finance extends Basic
...
@@ -1263,11 +1281,11 @@ class Finance extends Basic
$data
[
'is_del'
]
=
1
;
//去除之前的审核记录
$data
[
'is_del'
]
=
1
;
//去除之前的审核记录
$data
=
$m_financial
->
editData
(
$data
,
$this
->
params
[
'bargain_id'
],
'bargain_id'
);
$data
=
$m_financial
->
editData
(
$data
,
$this
->
params
[
'bargain_id'
],
'bargain_id'
);
$m_bargain
=
new
OBargainModel
();
$m_bargain
=
new
OBargainModel
();
$update_data
[
'status'
]
=
10
;
$update_data
[
'status'
]
=
10
;
$update_data
[
'audit_level'
]
=
0
;
$update_data
[
'audit_level'
]
=
0
;
$where
[]
=
[
'EXP'
,
'id='
.
$this
->
params
[
'bargain_id'
]
.
' or father_id='
.
$this
->
params
[
'bargain_id'
]
];
$where
[]
=
[
'EXP'
,
'id='
.
$this
->
params
[
'bargain_id'
]
.
' or father_id='
.
$this
->
params
[
'bargain_id'
]
];
$where
[
'status'
]
=
[
'<>'
,
30
];
$where
[
'status'
]
=
[
'<>'
,
30
];
$m_bargain
->
updateBargainByWhere
(
$update_data
,
$where
);
$m_bargain
->
updateBargainByWhere
(
$update_data
,
$where
);
$msg
=
''
;
$msg
=
''
;
if
(
$data
>
0
)
{
if
(
$data
>
0
)
{
...
@@ -1294,7 +1312,7 @@ class Finance extends Basic
...
@@ -1294,7 +1312,7 @@ class Finance extends Basic
return
$this
->
response
(
101
,
'参数错误'
);
return
$this
->
response
(
101
,
'参数错误'
);
}
}
$m_bargain
=
new
OBargainModel
();
$m_bargain
=
new
OBargainModel
();
$m_partial_commission
=
new
OPartialCommission
();
$m_partial_commission
=
new
OPartialCommission
();
$confirm_status
=
$m_partial_commission
->
checkConfirmStatus
(
$this
->
params
[
'bargain_id'
]);
$confirm_status
=
$m_partial_commission
->
checkConfirmStatus
(
$this
->
params
[
'bargain_id'
]);
...
@@ -1340,15 +1358,15 @@ class Finance extends Basic
...
@@ -1340,15 +1358,15 @@ class Finance extends Basic
$where
=
[];
$where
=
[];
if
(
!
empty
(
$this
->
params
[
'create_time'
])
&&
empty
(
$this
->
params
[
'end_time'
]))
{
if
(
!
empty
(
$this
->
params
[
'create_time'
])
&&
empty
(
$this
->
params
[
'end_time'
]))
{
$where
[
'a.create_time'
]
=
[
'> time'
,
$this
->
params
[
'create_time'
]
.
' 00:00:00'
];
$where
[
'a.create_time'
]
=
[
'> time'
,
$this
->
params
[
'create_time'
]
.
' 00:00:00'
];
}
}
if
(
!
empty
(
$this
->
params
[
'end_time'
])
&&
empty
(
$this
->
params
[
'create_time'
]))
{
if
(
!
empty
(
$this
->
params
[
'end_time'
])
&&
empty
(
$this
->
params
[
'create_time'
]))
{
$where
[
'a.create_time'
]
=
[
'< time'
,
$this
->
params
[
'create_time'
]
.
' 23:59:59'
];
$where
[
'a.create_time'
]
=
[
'< time'
,
$this
->
params
[
'create_time'
]
.
' 23:59:59'
];
}
}
if
(
!
empty
(
$this
->
params
[
'create_time'
])
&&
!
empty
(
$this
->
params
[
'end_time'
]))
{
if
(
!
empty
(
$this
->
params
[
'create_time'
])
&&
!
empty
(
$this
->
params
[
'end_time'
]))
{
$where
[
'a.create_time'
]
=
[
'between time'
,
[
$this
->
params
[
'create_time'
]
.
' 00:00:00'
,
$this
->
params
[
'end_time'
]
.
' 23:59:59'
]
];
$where
[
'a.create_time'
]
=
[
'between time'
,
[
$this
->
params
[
'create_time'
]
.
' 00:00:00'
,
$this
->
params
[
'end_time'
]
.
' 23:59:59'
]
];
}
}
//商铺号
//商铺号
...
@@ -1470,7 +1488,7 @@ class Finance extends Basic
...
@@ -1470,7 +1488,7 @@ class Finance extends Basic
return
$this
->
response
(
101
,
'参数错误'
);
return
$this
->
response
(
101
,
'参数错误'
);
$m_taxes
=
new
OTaxes
();
$m_taxes
=
new
OTaxes
();
$num
=
$m_taxes
->
updateTaxesById
([
'id_or_father_id'
=>
$this
->
params
[
'taxes_id'
]],[
'is_del'
=>
1
]);
$num
=
$m_taxes
->
updateTaxesById
([
'id_or_father_id'
=>
$this
->
params
[
'taxes_id'
]
],
[
'is_del'
=>
1
]);
if
(
$num
>
0
)
{
if
(
$num
>
0
)
{
$result
[
'code'
]
=
200
;
$result
[
'code'
]
=
200
;
$result
[
'msg'
]
=
'删除成功'
;
$result
[
'msg'
]
=
'删除成功'
;
...
@@ -1490,29 +1508,30 @@ class Finance extends Basic
...
@@ -1490,29 +1508,30 @@ class Finance extends Basic
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
* @throws \think\exception\DbException
*/
*/
public
function
getBargainCommission
()
{
public
function
getBargainCommission
()
{
if
(
empty
(
$this
->
params
[
'bargain_id'
]))
{
if
(
empty
(
$this
->
params
[
'bargain_id'
]))
{
return
$this
->
response
(
101
,
'成交报告id为空'
);
return
$this
->
response
(
101
,
'成交报告id为空'
);
}
}
$m_bargain
=
new
OBargainModel
();
$m_bargain
=
new
OBargainModel
();
if
(
$this
->
request
->
isGet
())
{
if
(
$this
->
request
->
isGet
())
{
$field
=
'a.id,a.scale,a.agent_id,a.role,a.scale_fee,b.scale as new_scale,b.should_commission'
;
$field
=
'a.id,a.scale,a.agent_id,a.role,a.scale_fee,b.scale as new_scale,b.should_commission'
;
$data
=
$m_bargain
->
getBargainPartialDetail
(
$field
,
[
'id'
=>
$this
->
params
[
'bargain_id'
]
]);
$data
=
$m_bargain
->
getBargainPartialDetail
(
$field
,
[
'id'
=>
$this
->
params
[
'bargain_id'
]
]);
return
$this
->
response
(
200
,
''
,
$data
);
return
$this
->
response
(
200
,
''
,
$data
);
}
}
if
(
empty
(
$this
->
params
[
'agent_id'
]))
{
if
(
empty
(
$this
->
params
[
'agent_id'
]))
{
return
$this
->
response
(
101
,
'经纪人id为空'
);
return
$this
->
response
(
101
,
'经纪人id为空'
);
}
}
if
(
empty
(
$this
->
params
[
'scale'
]))
{
if
(
empty
(
$this
->
params
[
'scale'
]))
{
return
$this
->
response
(
101
,
'分佣比例为空'
);
return
$this
->
response
(
101
,
'分佣比例为空'
);
}
}
//检查成交报告是否存在
//检查成交报告是否存在
$data_arr
=
$m_bargain
->
getBargainPartialDetail
(
'a.id,a.agent_id,a.create_time'
,
[
'id'
=>
$this
->
params
[
'bargain_id'
]
]);
$data_arr
=
$m_bargain
->
getBargainPartialDetail
(
'a.id,a.agent_id,a.create_time'
,
[
'id'
=>
$this
->
params
[
'bargain_id'
]
]);
if
(
empty
(
$data_arr
[
'id'
]))
{
if
(
empty
(
$data_arr
[
'id'
]))
{
return
$this
->
response
(
101
,
'没有成交报告信息'
);
return
$this
->
response
(
101
,
'没有成交报告信息'
);
...
@@ -1525,16 +1544,16 @@ class Finance extends Basic
...
@@ -1525,16 +1544,16 @@ class Finance extends Basic
$data
=
$m_bargain
->
updateBargainById
(
$this
->
params
[
'bargain_id'
],
$update
);
//更改分佣方
$data
=
$m_bargain
->
updateBargainById
(
$this
->
params
[
'bargain_id'
],
$update
);
//更改分佣方
$comm
=
new
OPartialCommission
();
$comm
=
new
OPartialCommission
();
$partial_data
[
'scale'
]
=
$this
->
params
[
'scale'
];
$partial_data
[
'scale'
]
=
$this
->
params
[
'scale'
];
$partial_data
[
'should_commission'
]
=
$this
->
params
[
'scale_fee'
];
$partial_data
[
'should_commission'
]
=
$this
->
params
[
'scale_fee'
];
$comm
->
editData
(
$partial_data
,
$this
->
params
[
'bargain_id'
],
'bargain_id'
);
$comm
->
editData
(
$partial_data
,
$this
->
params
[
'bargain_id'
],
'bargain_id'
);
$this
->
updatePerformance
(
0
,
$this
->
params
[
'agent_id'
]);
$this
->
updatePerformance
(
0
,
$this
->
params
[
'agent_id'
]);
$this
->
updatePerformance
(
0
,
$data_arr
[
'agent_id'
]);
$this
->
updatePerformance
(
0
,
$data_arr
[
'agent_id'
]);
/*记录日志 start*/
/*记录日志 start*/
$bargain_data
=
$m_bargain
->
selectBargainByOrderNo
(
'agent_id,father_id'
,
[
'id'
=>
$this
->
params
[
'bargain_id'
]
]);
$bargain_data
=
$m_bargain
->
selectBargainByOrderNo
(
'agent_id,father_id'
,
[
'id'
=>
$this
->
params
[
'bargain_id'
]
]);
$father_id
=
$this
->
params
[
'bargain_id'
];
$father_id
=
$this
->
params
[
'bargain_id'
];
if
(
$bargain_data
[
0
][
'father_id'
]
!=
0
)
{
if
(
$bargain_data
[
0
][
'father_id'
]
!=
0
)
{
$father_id
=
$bargain_data
[
0
][
'father_id'
];
$father_id
=
$bargain_data
[
0
][
'father_id'
];
}
}
...
@@ -1542,11 +1561,11 @@ class Finance extends Basic
...
@@ -1542,11 +1561,11 @@ class Finance extends Basic
$agent_id
[
0
]
=
$bargain_data
[
0
][
'agent_id'
];
$agent_id
[
0
]
=
$bargain_data
[
0
][
'agent_id'
];
$agent_id
[
1
]
=
$this
->
params
[
'agent_id'
];
$agent_id
[
1
]
=
$this
->
params
[
'agent_id'
];
$m_agent
=
new
AAgents
();
$m_agent
=
new
AAgents
();
$agent_data
=
$m_agent
->
getAgentById
(
'id,name,phone'
,
[
'in_id'
=>
$agent_id
]);
$agent_data
=
$m_agent
->
getAgentById
(
'id,name,phone'
,
[
'in_id'
=>
$agent_id
]);
$content
=
'修改成交报告【编号:'
.
$father_id
.
'】【分佣方:'
.
$agent_data
[
0
][
'name'
]
.
'-'
.
$agent_data
[
0
][
'phone'
]
$content
=
'修改成交报告【编号:'
.
$father_id
.
'】【分佣方:'
.
$agent_data
[
0
][
'name'
]
.
'-'
.
$agent_data
[
0
][
'phone'
]
.
'修改为:'
.
$agent_data
[
1
][
'name'
]
.
'-'
.
$agent_data
[
1
][
'phone'
]
.
'】'
;
.
'修改为:'
.
$agent_data
[
1
][
'name'
]
.
'-'
.
$agent_data
[
1
][
'phone'
]
.
'】'
;
$this
->
editRecordLog
(
$this
->
params
[
'bargain_id'
],
$content
);
$this
->
editRecordLog
(
$this
->
params
[
'bargain_id'
],
$content
);
/*记录日志 end*/
/*记录日志 end*/
...
@@ -1561,14 +1580,15 @@ class Finance extends Basic
...
@@ -1561,14 +1580,15 @@ class Finance extends Basic
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
* @throws \think\exception\DbException
*/
*/
public
function
backOutToOne
()
{
public
function
backOutToOne
()
{
if
(
empty
(
$this
->
params
[
'bargain_id'
]))
{
if
(
empty
(
$this
->
params
[
'bargain_id'
]))
{
return
$this
->
response
(
101
,
'参数错误'
);
return
$this
->
response
(
101
,
'参数错误'
);
}
}
$params
[
'content'
]
=
trim
(
$this
->
params
[
'content'
]);
//撤销原因
$params
[
'content'
]
=
trim
(
$this
->
params
[
'content'
]);
//撤销原因
$m_financial
=
new
OFinancialAudit
();
$m_financial
=
new
OFinancialAudit
();
$result
=
$m_financial
->
backOutUpdate
(
$this
->
params
[
'bargain_id'
],
$params
);
$result
=
$m_financial
->
backOutUpdate
(
$this
->
params
[
'bargain_id'
],
$params
);
if
(
$result
)
{
if
(
$result
)
{
$code
=
200
;
$code
=
200
;
...
@@ -1576,18 +1596,18 @@ class Finance extends Basic
...
@@ -1576,18 +1596,18 @@ class Finance extends Basic
$this
->
updatePerformance
(
$this
->
params
[
'bargain_id'
]);
$this
->
updatePerformance
(
$this
->
params
[
'bargain_id'
]);
$bargain
=
new
OBargainModel
();
$bargain
=
new
OBargainModel
();
$bargain_data
=
$bargain
->
getBargainDetail
(
'order_id,order_no,agent_id'
,
[
'id'
=>
$this
->
params
[
'bargain_id'
]
]);
$bargain_data
=
$bargain
->
getBargainDetail
(
'order_id,order_no,agent_id'
,
[
'id'
=>
$this
->
params
[
'bargain_id'
]
]);
$financial_data
[
'bargain_id'
]
=
$this
->
params
[
'bargain_id'
];
$financial_data
[
'bargain_id'
]
=
$this
->
params
[
'bargain_id'
];
$financial_data
[
'audit_name'
]
=
$this
->
userName
;
$financial_data
[
'audit_name'
]
=
$this
->
userName
;
$financial_data
[
'audit_id'
]
=
$this
->
userId
;
$financial_data
[
'audit_id'
]
=
$this
->
userId
;
$financial_data
[
'agent_id'
]
=
$bargain_data
[
0
][
'agent_id'
];
$financial_data
[
'agent_id'
]
=
$bargain_data
[
0
][
'agent_id'
];
$financial_data
[
'order_no'
]
=
$bargain_data
[
0
][
'order_no'
];
$financial_data
[
'order_no'
]
=
$bargain_data
[
0
][
'order_no'
];
$financial_data
[
'order_id'
]
=
$bargain_data
[
0
][
'order_id'
];
$financial_data
[
'order_id'
]
=
$bargain_data
[
0
][
'order_id'
];
$financial_data
[
'status'
]
=
1
;
$financial_data
[
'status'
]
=
1
;
$financial_data
[
'source'
]
=
3
;
$financial_data
[
'source'
]
=
3
;
$financial_data
[
'audit_level'
]
=
0
;
$financial_data
[
'audit_level'
]
=
0
;
$financial_data
[
'remark'
]
=
empty
(
$this
->
params
[
'content'
])
?
""
:
$this
->
params
[
'content'
];
$financial_data
[
'remark'
]
=
empty
(
$this
->
params
[
'content'
])
?
""
:
$this
->
params
[
'content'
];
$financial_data
[
'audit_id'
]
=
$this
->
userId
;
$financial_data
[
'audit_id'
]
=
$this
->
userId
;
$m_financial
->
addAudit
(
$financial_data
);
$m_financial
->
addAudit
(
$financial_data
);
$msg
=
'撤销成功'
;
$msg
=
'撤销成功'
;
}
else
{
}
else
{
...
@@ -1604,7 +1624,8 @@ class Finance extends Basic
...
@@ -1604,7 +1624,8 @@ class Finance extends Basic
* @param int $agent_id
* @param int $agent_id
* @return bool
* @return bool
*/
*/
private
function
updatePerformance
(
int
$bargain_id
=
0
,
int
$agent_id
=
0
)
:
bool
{
private
function
updatePerformance
(
int
$bargain_id
=
0
,
int
$agent_id
=
0
)
:
bool
{
$where
=
[];
$where
=
[];
if
(
$bargain_id
)
{
if
(
$bargain_id
)
{
...
@@ -1617,11 +1638,11 @@ class Finance extends Basic
...
@@ -1617,11 +1638,11 @@ class Finance extends Basic
if
(
!
empty
(
$where
))
{
if
(
!
empty
(
$where
))
{
//获取被修改人信息
//获取被修改人信息
$m_agent
=
new
AAgents
();
$m_agent
=
new
AAgents
();
$agent_data
=
$m_agent
->
agentBargainDetail
(
'a.id,a.store_id,a.district_id,b.create_time'
,
[
'b.id'
=>
$bargain_id
]);
$agent_data
=
$m_agent
->
agentBargainDetail
(
'a.id,a.store_id,a.district_id,b.create_time'
,
[
'b.id'
=>
$bargain_id
]);
//更新业绩统计
//更新业绩统计
$sum
=
new
ResultsSummaryNewTask
();
$sum
=
new
ResultsSummaryNewTask
();
$date
=
date
(
'Y-m-d'
,
strtotime
(
$agent_data
[
'create_time'
]));
$date
=
date
(
'Y-m-d'
,
strtotime
(
$agent_data
[
'create_time'
]));
$sum
->
updateTotalByAgentId
(
$agent_data
[
'id'
],
$agent_data
[
'store_id'
],
$agent_data
[
'district_id'
],
$date
);
//被修改的人
$sum
->
updateTotalByAgentId
(
$agent_data
[
'id'
],
$agent_data
[
'store_id'
],
$agent_data
[
'district_id'
],
$date
);
//被修改的人
}
}
...
...
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