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
a079fd68
Commit
a079fd68
authored
May 21, 2018
by
hujun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
编辑成交报告佣金
parent
a7a702c5
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
50 additions
and
9 deletions
+50
-9
Finance.php
application/index/controller/Finance.php
+13
-7
OFee.php
application/model/OFee.php
+37
-2
No files found.
application/index/controller/Finance.php
View file @
a079fd68
...
...
@@ -14,6 +14,7 @@ use app\index\extend\Basic;
use
app\index\untils\ExportExcelUntil
;
use
app\model\AAgents
;
use
app\model\OBargainModel
;
use
app\model\OFee
;
use
app\model\OPartialCommission
;
use
app\model\OPayLogModel
;
use
app\model\ORefundModel
;
...
...
@@ -192,6 +193,7 @@ class Finance extends Basic
* 修改成交报告中佣金和备注
*
* @return \think\Response
* @throws \Exception
*/
public
function
editBargainInfo
()
{
$data
[
'code'
]
=
200
;
...
...
@@ -202,23 +204,27 @@ class Finance extends Basic
$data
[
'code'
]
=
101
;
$data
[
'msg'
]
=
'Id is null.'
;
}
else
{
$bargain
=
new
OBargainModel
();
$m_bargain
=
new
OBargainModel
();
$m_fee
=
new
OFee
();
$update_data
=
[];
if
(
!
empty
(
$this
->
params
[
'scale_fee'
]))
{
$update_data
[
'scale_fee'
]
=
$this
->
params
[
'scale_fee'
];
if
(
count
(
$this
->
params
[
'practical_fee'
])
>
5
)
{
return
$this
->
response
(
'101'
,
'实收佣金数量超过限制'
);
}
if
(
!
empty
(
$this
->
params
[
'
practical_fee
'
]))
{
$update_data
[
'
practical_fee'
]
=
$this
->
params
[
'practical_fee
'
];
if
(
!
empty
(
$this
->
params
[
'
commission
'
]))
{
$update_data
[
'
commission'
]
=
$this
->
params
[
'commission
'
];
}
if
(
!
empty
(
$this
->
params
[
'content'
]))
{
$update_data
[
'content'
]
=
$this
->
params
[
'content'
];
}
$data
[
'data'
]
=
$bargain
->
updateBargainById
(
$this
->
params
[
'id'
],
$update_data
);
$data
[
'data'
]
=
$
m_
bargain
->
updateBargainById
(
$this
->
params
[
'id'
],
$update_data
);
if
(
$data
[
'data'
]
!=
1
)
{
if
(
$data
[
'data'
]
==
1
)
{
$m_fee
->
addFee
(
$this
->
params
[
'practical_fee'
],
$this
->
params
[
'id'
],
0
,
$this
->
userId
);
}
else
{
$data
[
'code'
]
=
101
;
$data
[
'msg'
]
=
'Modify the failure.'
;
}
...
...
application/model/OFee.php
View file @
a079fd68
...
...
@@ -12,7 +12,7 @@ namespace app\model;
class
OFee
extends
BaseModel
{
/**
* 根据成交报告查询
* 根据成交报告
-实收佣金 或 税费开票
查询
*
* @param int $bargain_id
* @param int $type
...
...
@@ -22,11 +22,45 @@ class OFee extends BaseModel
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public
function
getBargainFee
(
int
$bargain_id
,
$type
=
0
,
string
$field
=
'id as fee_id,
tax_fee,create_tim
e'
)
{
public
function
getBargainFee
(
int
$bargain_id
,
$type
=
0
,
string
$field
=
'id as fee_id,
fee,operation_dat
e'
)
{
return
$this
->
field
(
$field
)
->
where
(
'bargain_id'
,
$bargain_id
)
->
where
(
'type'
,
$type
)
->
select
();
}
/**
* 根据成交报告-实收佣金 或 税费开票 查询数量
*
* @param int $bargain_id
* @param int $type
* @return int|string
*/
public
function
getBargainFeeTotal
(
int
$bargain_id
,
int
$type
=
0
)
{
return
$this
->
where
(
'bargain_id'
,
$bargain_id
)
->
where
(
'type'
,
$type
)
->
count
();
}
/**
* 新增实收佣金 或 税费开票
*
* @param $data
* @param $bargain_id
* @param int $type 0实收佣金 1税费
* @param int $agent_id 操作人id
* @return array|false
* @throws \Exception
*/
public
function
addFee
(
$data
,
$bargain_id
,
$type
=
0
,
int
$agent_id
)
{
$insert_data
=
[];
foreach
(
$data
as
$k
=>
$v
)
{
$insert_data
[
$k
][
'bargain_id'
]
=
$bargain_id
;
$insert_data
[
$k
][
'fee'
]
=
$v
[
'fee'
];
$insert_data
[
$k
][
'agent_id'
]
=
$agent_id
;
$insert_data
[
$k
][
'type'
]
=
$type
;
$insert_data
[
$k
][
'operation_date'
]
=
$v
[
'operation_date'
];
}
return
$this
->
saveAll
(
$insert_data
);
}
}
\ 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