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
ff92a238
Commit
ff92a238
authored
May 28, 2018
by
clone
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
没有分佣默认给成交报告中的比列
parent
b23049ca
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
133 additions
and
89 deletions
+133
-89
OrderLogService.php
application/api_broker/service/OrderLogService.php
+15
-0
OBargainModel.php
application/model/OBargainModel.php
+118
-89
No files found.
application/api_broker/service/OrderLogService.php
View file @
ff92a238
...
@@ -842,6 +842,7 @@ class OrderLogService
...
@@ -842,6 +842,7 @@ class OrderLogService
$cent_commission_arr
=
$partialCommissionModel
->
getCommissionListByBargainId
(
$field
,
$commissionParams
);
$cent_commission_arr
=
$partialCommissionModel
->
getCommissionListByBargainId
(
$field
,
$commissionParams
);
//dump($cent_commission_arr);exit;
//dump($cent_commission_arr);exit;
$cent_commission_
=
$cent_commission
=
array
();
$cent_commission_
=
$cent_commission
=
array
();
if
(
count
(
$cent_commission_arr
)
>
0
)
{
foreach
(
$cent_commission_arr
as
$k
=>
$v
)
{
foreach
(
$cent_commission_arr
as
$k
=>
$v
)
{
$cent_commission_
[
$v
[
'agent_id'
]][]
=
$v
;
$cent_commission_
[
$v
[
'agent_id'
]][]
=
$v
;
}
}
...
@@ -866,6 +867,20 @@ class OrderLogService
...
@@ -866,6 +867,20 @@ class OrderLogService
}
}
$z
++
;
$z
++
;
}
}
}
else
{
$bargainList
=
$this
->
bargainModel
->
getAgentTypeByBargainId
(
$params
[
"bargain_id"
]);
$z
=
0
;
foreach
(
$bargainList
as
$item
)
{
$cent_commission
[
$z
][
"agent_id"
]
=
$item
[
"id"
];
$cent_commission
[
$z
][
"role"
]
=
$item
[
"role"
];
$cent_commission
[
$z
][
"scale"
]
=
$item
[
"scale"
];
$cent_commission
[
$z
][
"name"
]
=
$item
[
"name"
];
$cent_commission
[
$z
][
"phone"
]
=
$item
[
"phone"
];
$cent_commission
[
$z
][
"should_commission"
]
=
$item
[
"scale_fee"
];
$z
++
;
}
}
$result
[
"cent_commission"
]
=
$cent_commission
;
$result
[
"cent_commission"
]
=
$cent_commission
;
//税费
//税费
...
...
application/model/OBargainModel.php
View file @
ff92a238
...
@@ -34,6 +34,7 @@ class OBargainModel extends Model
...
@@ -34,6 +34,7 @@ class OBargainModel extends Model
return
0
;
return
0
;
}
}
}
}
public
function
insertBargain
(
$params
)
public
function
insertBargain
(
$params
)
{
{
Db
::
startTrans
();
Db
::
startTrans
();
...
@@ -134,25 +135,26 @@ class OBargainModel extends Model
...
@@ -134,25 +135,26 @@ class OBargainModel extends Model
return
$this
->
db_
return
$this
->
db_
->
field
(
$filed
)
->
field
(
$filed
)
->
alias
(
"a"
)
->
alias
(
"a"
)
->
join
(
"a_agents b"
,
"a.agent_id = b.id"
,
"left"
)
->
join
(
"a_agents b"
,
"a.agent_id = b.id"
,
"left"
)
->
where
(
$where_
)
->
where
(
$where_
)
->
select
();
->
select
();
}
}
public
function
getBargainByOrderId
(
$field
,
$params
){
public
function
getBargainByOrderId
(
$field
,
$params
)
{
$where_
=
[];
$where_
=
[];
if
(
isset
(
$params
[
"order_id"
]))
{
if
(
isset
(
$params
[
"order_id"
]))
{
$where_
[
"a.order_id"
]
=
$params
[
"order_id"
];
$where_
[
"a.order_id"
]
=
$params
[
"order_id"
];
}
}
if
(
isset
(
$params
[
"house_title"
]))
{
if
(
isset
(
$params
[
"house_title"
]))
{
$where_
[
"b.house_title"
]
=
$params
[
"house_title"
];
$where_
[
"b.house_title"
]
=
$params
[
"house_title"
];
}
}
return
Db
::
table
(
$this
->
table
)
return
Db
::
table
(
$this
->
table
)
->
field
(
$field
)
->
field
(
$field
)
->
alias
(
"a"
)
->
alias
(
"a"
)
->
join
(
"o_order b"
,
"a.order_id = b.id"
,
"left"
)
->
join
(
"o_order b"
,
"a.order_id = b.id"
,
"left"
)
->
join
(
"a_agents c"
,
"a.agent_id = c.id"
,
"left"
)
->
join
(
"a_agents c"
,
"a.agent_id = c.id"
,
"left"
)
->
join
(
"a_store d"
,
"c.store_id = d.id"
,
"left"
)
->
join
(
"a_store d"
,
"c.store_id = d.id"
,
"left"
)
->
where
(
$where_
)
->
where
(
$where_
)
->
select
();
->
select
();
}
}
...
@@ -169,17 +171,18 @@ class OBargainModel extends Model
...
@@ -169,17 +171,18 @@ class OBargainModel extends Model
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
* @throws \think\exception\DbException
*/
*/
public
function
selectBargainList
(
$filed
,
$params
,
$pageNo
,
$pageSize
){
public
function
selectBargainList
(
$filed
,
$params
,
$pageNo
,
$pageSize
)
{
$where_
=
[];
$where_
=
[];
if
(
isset
(
$params
[
"status"
]))
{
if
(
isset
(
$params
[
"status"
]))
{
$where_
[
"a.status"
]
=
$params
[
"status"
];
$where_
[
"a.status"
]
=
$params
[
"status"
];
}
}
if
(
isset
(
$params
[
"ids"
]))
{
if
(
isset
(
$params
[
"ids"
]))
{
$where_
[
"a.agent_id"
]
=
array
(
"in"
,
$params
[
"ids"
]
);
$where_
[
"a.agent_id"
]
=
array
(
"in"
,
$params
[
"ids"
]
);
}
}
if
(
isset
(
$params
[
"keyword"
]))
{
if
(
isset
(
$params
[
"keyword"
]))
{
$where_
[
"b.user_phone|b.user_name|d.internal_address"
]
=
array
(
"like"
,
"%"
.
$params
[
"keyword"
]
.
"%"
)
;
$where_
[
"b.user_phone|b.user_name|d.internal_address"
]
=
array
(
"like"
,
"%"
.
$params
[
"keyword"
]
.
"%"
)
;
}
}
$where_
[
"b.status"
]
=
0
;
$where_
[
"b.status"
]
=
0
;
...
@@ -187,9 +190,9 @@ class OBargainModel extends Model
...
@@ -187,9 +190,9 @@ class OBargainModel extends Model
$result
=
$this
->
db_
$result
=
$this
->
db_
->
field
(
$filed
)
->
field
(
$filed
)
->
alias
(
"a"
)
->
alias
(
"a"
)
->
join
(
"o_report b"
,
"a.report_id = b.id"
,
"left"
)
->
join
(
"o_report b"
,
"a.report_id = b.id"
,
"left"
)
->
join
(
"o_order c"
,
"a.order_id = c.id"
,
"left"
)
->
join
(
"o_order c"
,
"a.order_id = c.id"
,
"left"
)
->
join
(
"g_houses d"
,
"c.house_id = d.id"
,
"left"
)
->
join
(
"g_houses d"
,
"c.house_id = d.id"
,
"left"
)
->
where
(
$where_
)
->
where
(
$where_
)
->
order
(
"a.create_time desc"
)
->
order
(
"a.create_time desc"
)
->
limit
(
$pageSize
)
->
limit
(
$pageSize
)
...
@@ -209,8 +212,9 @@ class OBargainModel extends Model
...
@@ -209,8 +212,9 @@ class OBargainModel extends Model
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
* @throws \think\exception\DbException
*/
*/
public
function
selectBargainDetail
(
$filed
,
$params
){
public
function
selectBargainDetail
(
$filed
,
$params
)
$where_
=
$whereOr_
=
[];
{
$where_
=
$whereOr_
=
[];
if
(
isset
(
$params
[
"bargain_id"
]))
{
if
(
isset
(
$params
[
"bargain_id"
]))
{
$where_
[
"a.id"
]
=
$params
[
"bargain_id"
];
$where_
[
"a.id"
]
=
$params
[
"bargain_id"
];
}
}
...
@@ -218,9 +222,9 @@ class OBargainModel extends Model
...
@@ -218,9 +222,9 @@ class OBargainModel extends Model
$result
=
$this
->
db_
$result
=
$this
->
db_
->
field
(
$filed
)
->
field
(
$filed
)
->
alias
(
"a"
)
->
alias
(
"a"
)
->
join
(
"o_order b"
,
"a.order_id = b.id"
,
"left"
)
->
join
(
"o_order b"
,
"a.order_id = b.id"
,
"left"
)
->
join
(
"g_houses c"
,
"b.house_id = c.id"
,
"left"
)
->
join
(
"g_houses c"
,
"b.house_id = c.id"
,
"left"
)
->
join
(
"o_report d"
,
"a.report_id = d.id"
,
"left"
)
->
join
(
"o_report d"
,
"a.report_id = d.id"
,
"left"
)
->
where
(
$where_
)
->
where
(
$where_
)
->
whereOr
(
$whereOr_
)
->
whereOr
(
$whereOr_
)
->
order
(
"a.id asc"
)
->
order
(
"a.id asc"
)
...
@@ -242,12 +246,13 @@ class OBargainModel extends Model
...
@@ -242,12 +246,13 @@ class OBargainModel extends Model
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
* @throws \think\exception\DbException
*/
*/
public
function
getBargain
(
$pageNo
=
1
,
$pageSize
=
15
,
$order_
=
'id desc'
,
$field
=
''
,
$params
=
''
)
{
public
function
getBargain
(
$pageNo
=
1
,
$pageSize
=
15
,
$order_
=
'id desc'
,
$field
=
''
,
$params
=
''
)
{
return
$this
->
field
(
$field
)
->
alias
(
'a'
)
return
$this
->
field
(
$field
)
->
alias
(
'a'
)
->
join
(
'o_report b'
,
'a.report_id = b.id'
,
'left'
)
->
join
(
'o_report b'
,
'a.report_id = b.id'
,
'left'
)
->
join
(
'o_order c'
,
'a.order_id = c.id'
,
'left'
)
->
join
(
'o_order c'
,
'a.order_id = c.id'
,
'left'
)
->
join
(
'g_houses d'
,
'c.house_id = d.id'
,
'left'
)
->
join
(
'g_houses d'
,
'c.house_id = d.id'
,
'left'
)
->
join
(
'o_financial_audit e'
,
'e.bargain_id = a.id'
,
'left'
)
->
join
(
'o_financial_audit e'
,
'e.bargain_id = a.id'
,
'left'
)
->
where
(
$params
)
->
where
(
$params
)
->
order
(
$order_
)
->
order
(
$order_
)
->
limit
(
$pageSize
)
->
limit
(
$pageSize
)
...
@@ -261,12 +266,13 @@ class OBargainModel extends Model
...
@@ -261,12 +266,13 @@ class OBargainModel extends Model
* @param string $params
* @param string $params
* @return int|string
* @return int|string
*/
*/
public
function
getBargainTotal
(
$params
=
''
)
{
public
function
getBargainTotal
(
$params
=
''
)
{
return
$this
->
alias
(
'a'
)
return
$this
->
alias
(
'a'
)
->
join
(
'o_report b'
,
'a.report_id = b.id'
,
'left'
)
->
join
(
'o_report b'
,
'a.report_id = b.id'
,
'left'
)
->
join
(
'o_order c'
,
'a.order_id = c.id'
,
'left'
)
->
join
(
'o_order c'
,
'a.order_id = c.id'
,
'left'
)
->
join
(
'g_houses d'
,
'c.house_id = d.id'
,
'left'
)
->
join
(
'g_houses d'
,
'c.house_id = d.id'
,
'left'
)
->
join
(
'o_financial_audit e'
,
'e.bargain_id = a.id'
,
'left'
)
->
join
(
'o_financial_audit e'
,
'e.bargain_id = a.id'
,
'left'
)
->
where
(
$params
)
->
where
(
$params
)
->
count
();
->
count
();
}
}
...
@@ -284,7 +290,8 @@ class OBargainModel extends Model
...
@@ -284,7 +290,8 @@ class OBargainModel extends Model
* @throws \think\exception\DbException
* @throws \think\exception\DbException
* @throws \think\exception\PDOException
* @throws \think\exception\PDOException
*/
*/
public
function
addCheckBargain
(
int
$id
,
array
$data
,
int
$source
,
int
$status
)
:
bool
{
public
function
addCheckBargain
(
int
$id
,
array
$data
,
int
$source
,
int
$status
)
:
bool
{
$this
->
startTrans
();
$this
->
startTrans
();
$bargain_data
=
$this
->
field
(
'id,report_id,agent_id,order_no,order_id'
)
->
where
([
$bargain_data
=
$this
->
field
(
'id,report_id,agent_id,order_no,order_id'
)
->
where
([
'id'
=>
$id
,
'id'
=>
$id
,
...
@@ -305,7 +312,7 @@ class OBargainModel extends Model
...
@@ -305,7 +312,7 @@ class OBargainModel extends Model
$save_data
[
'audit_id'
]
=
$data
[
'audit_id'
];
$save_data
[
'audit_id'
]
=
$data
[
'audit_id'
];
$save_data
[
'audit_name'
]
=
$data
[
'audit_name'
];
$save_data
[
'audit_name'
]
=
$data
[
'audit_name'
];
$return
=
0
;
$return
=
0
;
$audit_level
=
$data
[
'audit_level'
]
-
1
;
$audit_level
=
$data
[
'audit_level'
]
-
1
;
//是否有审核记录,只做一次审核。
//是否有审核记录,只做一次审核。
if
(
isset
(
$audit_data
[
'id'
]))
{
if
(
isset
(
$audit_data
[
'id'
]))
{
...
@@ -328,11 +335,11 @@ class OBargainModel extends Model
...
@@ -328,11 +335,11 @@ class OBargainModel extends Model
$update_data
[
'status'
]
=
11
;
$update_data
[
'status'
]
=
11
;
$update_data
[
'account_statement'
]
=
1
;
$update_data
[
'account_statement'
]
=
1
;
$update_data
[
'account_time'
]
=
time
();
$update_data
[
'account_time'
]
=
time
();
$this
->
save
(
$update_data
,
[
'id'
=>
$bargain_data
[
'id'
]
]);
$this
->
save
(
$update_data
,
[
'id'
=>
$bargain_data
[
'id'
]
]);
}
}
if
(
$data
[
'audit_level'
]
==
3
&&
$status
==
20
)
{
if
(
$data
[
'audit_level'
]
==
3
&&
$status
==
20
)
{
$this
->
where
(
'id'
,
$bargain_data
[
'id'
])
->
setField
(
'status'
,
21
);
$this
->
where
(
'id'
,
$bargain_data
[
'id'
])
->
setField
(
'status'
,
21
);
}
}
$this
->
commit
();
$this
->
commit
();
...
@@ -358,11 +365,12 @@ class OBargainModel extends Model
...
@@ -358,11 +365,12 @@ class OBargainModel extends Model
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
* @throws \think\exception\DbException
*/
*/
public
function
getBargainInfo
(
$field
,
$params
)
{
public
function
getBargainInfo
(
$field
,
$params
)
{
$data
=
$this
->
field
(
$field
)
->
alias
(
'a'
)
$data
=
$this
->
field
(
$field
)
->
alias
(
'a'
)
->
join
(
'o_report b'
,
'a.report_id = b.id'
,
'left'
)
->
join
(
'o_report b'
,
'a.report_id = b.id'
,
'left'
)
->
join
(
'o_order c'
,
'a.order_id = c.id'
,
'left'
)
->
join
(
'o_order c'
,
'a.order_id = c.id'
,
'left'
)
->
join
(
'g_houses d'
,
'c.house_id = d.id'
,
'left'
)
->
join
(
'g_houses d'
,
'c.house_id = d.id'
,
'left'
)
->
where
(
$params
)
->
where
(
$params
)
->
find
();
->
find
();
...
@@ -382,21 +390,22 @@ class OBargainModel extends Model
...
@@ -382,21 +390,22 @@ class OBargainModel extends Model
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
* @throws \think\exception\DbException
*/
*/
public
function
getAddBargainNumGroupTime
(
$params
,
$type
){
public
function
getAddBargainNumGroupTime
(
$params
,
$type
)
{
$field
=
""
;
$field
=
""
;
$where_
=
[];
$where_
=
[];
if
(
$type
==
1
)
{
if
(
$type
==
1
)
{
$field
=
"sum(scale_fee) as num,DATE(create_time) as day"
;
$field
=
"sum(scale_fee) as num,DATE(create_time) as day"
;
}
elseif
(
$type
==
2
)
{
}
elseif
(
$type
==
2
)
{
$field
=
"sum(practical_fee) as num,DATE(create_time) as day"
;
$field
=
"sum(practical_fee) as num,DATE(create_time) as day"
;
}
elseif
(
$type
==
3
)
{
}
elseif
(
$type
==
3
)
{
$field
=
"count(1) as num,DATE(create_time) as day"
;
$field
=
"count(1) as num,DATE(create_time) as day"
;
}
}
if
(
isset
(
$params
[
"agent_id"
]))
{
if
(
isset
(
$params
[
"agent_id"
]))
{
$where_
[
"agent_id"
]
=
$params
[
"agent_id"
];
$where_
[
"agent_id"
]
=
$params
[
"agent_id"
];
}
}
if
(
isset
(
$params
[
"create_time"
]))
{
if
(
isset
(
$params
[
"create_time"
]))
{
$where_
[
"create_time"
]
=
$params
[
"create_time"
];
$where_
[
"create_time"
]
=
$params
[
"create_time"
];
}
}
...
@@ -408,58 +417,59 @@ class OBargainModel extends Model
...
@@ -408,58 +417,59 @@ class OBargainModel extends Model
}
}
public
function
getAddBargainNum
(
$params
,
$type
)
public
function
getAddBargainNum
(
$params
,
$type
)
{
{
$where_
=
[];
$where_
=
[];
$field
=
""
;
$field
=
""
;
if
(
$type
==
1
)
{
if
(
$type
==
1
)
{
$field
=
"sum(scale_fee) as num"
;
$field
=
"sum(scale_fee) as num"
;
}
elseif
(
$type
==
2
)
{
}
elseif
(
$type
==
2
)
{
$field
=
"sum(practical_fee) as num"
;
$field
=
"sum(practical_fee) as num"
;
}
elseif
(
$type
==
3
)
{
}
elseif
(
$type
==
3
)
{
$field
=
"count(1) as num"
;
$field
=
"count(1) as num"
;
}
}
if
(
isset
(
$params
[
"agent_id"
]))
{
if
(
isset
(
$params
[
"agent_id"
]))
{
$where_
[
"a.agent_id"
]
=
$params
[
"agent_id"
];
$where_
[
"a.agent_id"
]
=
$params
[
"agent_id"
];
}
}
if
(
isset
(
$params
[
"create_time"
]))
{
if
(
isset
(
$params
[
"create_time"
]))
{
$where_
[
"a.create_time"
]
=
$params
[
"create_time"
];
$where_
[
"a.create_time"
]
=
$params
[
"create_time"
];
}
}
if
(
isset
(
$params
[
"house_ids"
]))
{
if
(
isset
(
$params
[
"house_ids"
]))
{
$where_
[
"b.house_id"
]
=
array
(
"in"
,
$params
[
"house_ids"
]
);
$where_
[
"b.house_id"
]
=
array
(
"in"
,
$params
[
"house_ids"
]
);
}
}
return
Db
::
table
(
$this
->
table
)
return
Db
::
table
(
$this
->
table
)
->
field
(
$field
)
->
field
(
$field
)
->
alias
(
"a"
)
->
alias
(
"a"
)
->
join
(
"o_order b"
,
"a.order_id = b.id"
,
"left"
)
->
join
(
"o_order b"
,
"a.order_id = b.id"
,
"left"
)
->
where
(
$where_
)
->
where
(
$where_
)
->
select
();
->
select
();
}
}
public
function
getAddBargainOrderList
(
$field
,
$params
){
public
function
getAddBargainOrderList
(
$field
,
$params
)
{
$where_
=
[];
$where_
=
[];
if
(
isset
(
$params
[
"agent_id"
]))
{
if
(
isset
(
$params
[
"agent_id"
]))
{
$where_
[
"a.agent_id"
]
=
$params
[
"agent_id"
];
$where_
[
"a.agent_id"
]
=
$params
[
"agent_id"
];
}
}
if
(
isset
(
$params
[
"create_time"
]))
{
if
(
isset
(
$params
[
"create_time"
]))
{
$where_
[
"a.create_time"
]
=
$params
[
"create_time"
];
$where_
[
"a.create_time"
]
=
$params
[
"create_time"
];
}
}
if
(
isset
(
$params
[
"house_ids"
]))
{
if
(
isset
(
$params
[
"house_ids"
]))
{
$where_
[
"b.house_id"
]
=
array
(
"in"
,
$params
[
"house_ids"
]
);
$where_
[
"b.house_id"
]
=
array
(
"in"
,
$params
[
"house_ids"
]
);
}
}
return
Db
::
table
(
$this
->
table
)
return
Db
::
table
(
$this
->
table
)
->
field
(
$field
)
->
field
(
$field
)
->
alias
(
"a"
)
->
alias
(
"a"
)
->
join
(
"o_order b"
,
"a.order_id = b.id"
,
"left"
)
->
join
(
"o_order b"
,
"a.order_id = b.id"
,
"left"
)
->
join
(
"o_report c"
,
"b.f_id = c.id"
,
"left"
)
->
join
(
"o_report c"
,
"b.f_id = c.id"
,
"left"
)
->
join
(
'g_houses d'
,
'b.house_id = d.id'
,
'left'
)
->
join
(
'g_houses d'
,
'b.house_id = d.id'
,
'left'
)
->
where
(
$where_
)
->
where
(
$where_
)
->
select
();
->
select
();
}
}
...
@@ -467,7 +477,8 @@ class OBargainModel extends Model
...
@@ -467,7 +477,8 @@ class OBargainModel extends Model
/**
/**
* 判断同一个订单是否有多个成交报告
* 判断同一个订单是否有多个成交报告
*/
*/
public
function
ifBargainNumByOrderId
(
$params
){
public
function
ifBargainNumByOrderId
(
$params
)
{
return
Db
::
table
(
$this
->
table
)
return
Db
::
table
(
$this
->
table
)
->
where
(
$params
)
->
where
(
$params
)
->
count
();
->
count
();
...
@@ -481,7 +492,8 @@ class OBargainModel extends Model
...
@@ -481,7 +492,8 @@ class OBargainModel extends Model
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
* @throws \think\exception\DbException
*/
*/
public
function
getBargainDetail
(
$field
,
$params
){
public
function
getBargainDetail
(
$field
,
$params
)
{
return
Db
::
table
(
$this
->
table
)
return
Db
::
table
(
$this
->
table
)
->
field
(
$field
)
->
field
(
$field
)
->
where
(
$params
)
->
where
(
$params
)
...
@@ -503,7 +515,8 @@ class OBargainModel extends Model
...
@@ -503,7 +515,8 @@ class OBargainModel extends Model
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
* @throws \think\exception\DbException
*/
*/
public
function
addBargainCommission
(
$id
,
$submit_agent_id
,
$agent_id
,
$role
,
$scale_fee
,
$scale
,
$source
)
{
public
function
addBargainCommission
(
$id
,
$submit_agent_id
,
$agent_id
,
$role
,
$scale_fee
,
$scale
,
$source
)
{
$this
->
startTrans
();
$this
->
startTrans
();
$bargain_data
=
$this
->
where
(
'id'
,
$id
)
->
find
();
$bargain_data
=
$this
->
where
(
'id'
,
$id
)
->
find
();
...
@@ -555,10 +568,11 @@ class OBargainModel extends Model
...
@@ -555,10 +568,11 @@ class OBargainModel extends Model
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
* @throws \think\exception\DbException
*/
*/
public
function
getBargainPartial
(
$pageNo
,
$pageSize
,
$order_
=
'id desc'
,
$fields
,
$where
)
{
public
function
getBargainPartial
(
$pageNo
,
$pageSize
,
$order_
=
'id desc'
,
$fields
,
$where
)
{
$data
=
$this
->
field
(
$fields
)
$data
=
$this
->
field
(
$fields
)
->
alias
(
'a'
)
->
alias
(
'a'
)
->
join
(
'a_agents b'
,
'a.agent_id = b.id'
,
'left'
)
->
join
(
'a_agents b'
,
'a.agent_id = b.id'
,
'left'
)
->
where
(
$where
)
->
where
(
$where
)
->
order
(
$order_
)
->
order
(
$order_
)
->
limit
(
$pageSize
)
->
limit
(
$pageSize
)
...
@@ -574,31 +588,36 @@ class OBargainModel extends Model
...
@@ -574,31 +588,36 @@ class OBargainModel extends Model
$result
[
$k
]
=
$v
;
$result
[
$k
]
=
$v
;
if
(
isset
(
$v
[
'agent_id'
]))
{
if
(
isset
(
$v
[
'agent_id'
]))
{
$agent_data
=
$m_agent
->
getStoreDistrict
(
$fields_str
,
[
'a.id'
=>
$v
[
'agent_id'
]
]);
$agent_data
=
$m_agent
->
getStoreDistrict
(
$fields_str
,
[
'a.id'
=>
$v
[
'agent_id'
]
]);
$result
[
$k
][
'agent'
]
=
$agent_data
[
'name'
]
.
'-'
.
$agent_data
[
'phone'
];
$result
[
$k
][
'agent'
]
=
$agent_data
[
'name'
]
.
'-'
.
$agent_data
[
'phone'
];
$result
[
$k
][
'district_store'
]
=
$agent_data
[
'district_name'
]
.
'-'
.
$agent_data
[
'store_name'
];
$result
[
$k
][
'district_store'
]
=
$agent_data
[
'district_name'
]
.
'-'
.
$agent_data
[
'store_name'
];
}
}
if
(
isset
(
$v
[
'role'
]))
{
if
(
isset
(
$v
[
'role'
]))
{
switch
(
$v
[
'role'
])
{
switch
(
$v
[
'role'
])
{
case
1
:
case
1
:
$result
[
$k
][
'role_name'
]
=
'盘方'
;
break
;
$result
[
$k
][
'role_name'
]
=
'盘方'
;
break
;
case
2
:
case
2
:
$result
[
$k
][
'role_name'
]
=
'客方'
;
break
;
$result
[
$k
][
'role_name'
]
=
'客方'
;
break
;
case
3
:
case
3
:
$result
[
$k
][
'role_name'
]
=
'反签'
;
break
;
$result
[
$k
][
'role_name'
]
=
'反签'
;
break
;
case
4
:
case
4
:
$result
[
$k
][
'role_name'
]
=
'独家'
;
break
;
$result
[
$k
][
'role_name'
]
=
'独家'
;
break
;
case
5
:
case
5
:
$result
[
$k
][
'role_name'
]
=
'合作方'
;
break
;
$result
[
$k
][
'role_name'
]
=
'合作方'
;
break
;
default
:
default
:
$result
[
$k
][
'role_name'
]
=
'无'
;
$result
[
$k
][
'role_name'
]
=
'无'
;
}
}
}
}
$result
[
$k
][
'partial_commission'
]
=
$m_partial
->
field
(
'id,scale,practical_fee,cash,service_charge,charity_fund,real_fee,confirm_date,should_commission'
)
$result
[
$k
][
'partial_commission'
]
=
$m_partial
->
field
(
'id,scale,practical_fee,cash,service_charge,charity_fund,real_fee,confirm_date,should_commission'
)
->
where
(
'bargain_id'
,
$v
[
'id'
])
->
where
(
'bargain_id'
,
$v
[
'id'
])
->
where
(
'is_del'
,
0
)
->
where
(
'is_del'
,
0
)
->
select
();
->
select
();
}
}
return
$result
;
return
$result
;
...
@@ -618,7 +637,8 @@ class OBargainModel extends Model
...
@@ -618,7 +637,8 @@ class OBargainModel extends Model
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
* @throws \think\exception\DbException
*/
*/
public
function
getCommissionTotalList
(
$pageNo
=
1
,
$pageSize
=
15
,
$order_
=
'a.id desc'
,
$field
=
''
,
$params
=
''
,
$whereOr
=
[])
{
public
function
getCommissionTotalList
(
$pageNo
=
1
,
$pageSize
=
15
,
$order_
=
'a.id desc'
,
$field
=
''
,
$params
=
''
,
$whereOr
=
[])
{
$data
=
$this
->
alias
(
'a'
)
$data
=
$this
->
alias
(
'a'
)
->
field
(
$field
)
->
field
(
$field
)
->
join
(
'o_taxes b'
,
'a.id = b.bargain_id'
,
'left'
)
->
join
(
'o_taxes b'
,
'a.id = b.bargain_id'
,
'left'
)
...
@@ -637,8 +657,8 @@ class OBargainModel extends Model
...
@@ -637,8 +657,8 @@ class OBargainModel extends Model
$m_fee
=
new
OTaxes
();
$m_fee
=
new
OTaxes
();
foreach
(
$data
as
$k
=>
$v
)
{
foreach
(
$data
as
$k
=>
$v
)
{
if
(
isset
(
$v
[
'agent_id'
]))
{
if
(
isset
(
$v
[
'agent_id'
]))
{
$district_store
=
$m_agent
->
getStoreDistrict
(
'store_name,district_name'
,
[
'a.id'
=>
$v
[
'agent_id'
]
]);
$district_store
=
$m_agent
->
getStoreDistrict
(
'store_name,district_name'
,
[
'a.id'
=>
$v
[
'agent_id'
]
]);
$data
[
$k
][
'district_store'
]
=
$district_store
[
'district_name'
]
.
'-'
.
$district_store
[
'store_name'
];
$data
[
$k
][
'district_store'
]
=
$district_store
[
'district_name'
]
.
'-'
.
$district_store
[
'store_name'
];
}
}
// $data[$k]['tax_fee'] = $m_fee->where('bargain_id', $v['id'])->sum('fee');
// $data[$k]['tax_fee'] = $m_fee->where('bargain_id', $v['id'])->sum('fee');
...
@@ -654,7 +674,8 @@ class OBargainModel extends Model
...
@@ -654,7 +674,8 @@ class OBargainModel extends Model
* @param array $whereOr
* @param array $whereOr
* @return int|string
* @return int|string
*/
*/
public
function
getCommissionTotalListTotal
(
$params
,
$whereOr
=
[])
{
public
function
getCommissionTotalListTotal
(
$params
,
$whereOr
=
[])
{
return
$this
->
alias
(
'a'
)
return
$this
->
alias
(
'a'
)
->
join
(
'o_taxes b'
,
'a.id = b.bargain_id'
,
'left'
)
->
join
(
'o_taxes b'
,
'a.id = b.bargain_id'
,
'left'
)
->
join
(
'o_partial_commission c'
,
'a.id = c.bargain_id'
,
'left'
)
->
join
(
'o_partial_commission c'
,
'a.id = c.bargain_id'
,
'left'
)
...
@@ -675,21 +696,22 @@ class OBargainModel extends Model
...
@@ -675,21 +696,22 @@ class OBargainModel extends Model
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
* @throws \think\exception\DbException
*/
*/
public
function
getAgentTypeByBargainId
(
int
$bargain_id
)
:
array
{
public
function
getAgentTypeByBargainId
(
int
$bargain_id
)
:
array
{
$m_partial
=
new
OPartialCommission
();
$m_partial
=
new
OPartialCommission
();
$data
=
$m_partial
->
getBragainScale
(
$bargain_id
);
$data
=
$m_partial
->
getBragainScale
(
$bargain_id
);
if
(
empty
(
$data
))
{
if
(
empty
(
$data
))
{
$data
=
$this
->
field
(
'role,agent_id,scale'
)
$data
=
$this
->
field
(
'role,agent_id,scale
,scale_fee
'
)
->
where
(
'id'
,
$bargain_id
)
->
where
(
'id'
,
$bargain_id
)
->
whereOr
(
'father_id'
,
$bargain_id
)
->
whereOr
(
'father_id'
,
$bargain_id
)
->
select
();
->
select
();
}
}
$m_agent
=
new
AAgents
();
$m_agent
=
new
AAgents
();
$result
=
[];
$result
=
[];
foreach
(
$data
as
$k
=>
$v
)
{
foreach
(
$data
as
$k
=>
$v
)
{
if
(
isset
(
$v
[
'role'
]))
{
if
(
isset
(
$v
[
'role'
]))
{
$agent_name
=
$m_agent
->
getAgentInfo
(
'id,name,phone'
,
$v
[
'agent_id'
]);
$agent_name
=
$m_agent
->
getAgentInfo
(
'id,name,phone'
,
$v
[
'agent_id'
]);
...
@@ -698,18 +720,24 @@ class OBargainModel extends Model
...
@@ -698,18 +720,24 @@ class OBargainModel extends Model
$result
[
$k
][
'phone'
]
=
$agent_name
[
'phone'
];
$result
[
$k
][
'phone'
]
=
$agent_name
[
'phone'
];
$result
[
$k
][
'role'
]
=
$v
[
'role'
];
$result
[
$k
][
'role'
]
=
$v
[
'role'
];
$result
[
$k
][
'scale'
]
=
$v
[
'scale'
];
$result
[
$k
][
'scale'
]
=
$v
[
'scale'
];
$result
[
$k
][
'scale_fee'
]
=
$v
[
'scale_fee'
];
switch
(
$v
[
'role'
])
{
switch
(
$v
[
'role'
])
{
case
1
:
case
1
:
$result
[
$k
][
'role_name'
]
=
'盘方'
;
break
;
$result
[
$k
][
'role_name'
]
=
'盘方'
;
break
;
case
2
:
case
2
:
$result
[
$k
][
'role_name'
]
=
'客方'
;
break
;
$result
[
$k
][
'role_name'
]
=
'客方'
;
break
;
case
3
:
case
3
:
$result
[
$k
][
'role_name'
]
=
'反签'
;
break
;
$result
[
$k
][
'role_name'
]
=
'反签'
;
break
;
case
4
:
case
4
:
$result
[
$k
][
'role_name'
]
=
'独家'
;
break
;
$result
[
$k
][
'role_name'
]
=
'独家'
;
break
;
case
5
:
case
5
:
$result
[
$k
][
'role_name'
]
=
'合作方'
;
break
;
$result
[
$k
][
'role_name'
]
=
'合作方'
;
break
;
}
}
}
}
}
}
...
@@ -727,7 +755,8 @@ class OBargainModel extends Model
...
@@ -727,7 +755,8 @@ class OBargainModel extends Model
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
* @throws \think\exception\DbException
*/
*/
public
function
getCheckBargain
(
string
$field
,
int
$id
)
{
public
function
getCheckBargain
(
string
$field
,
int
$id
)
{
return
$this
->
field
(
$field
)
return
$this
->
field
(
$field
)
->
where
(
'status'
,
'in'
,
'10,11'
)
->
where
(
'status'
,
'in'
,
'10,11'
)
->
where
(
'id'
,
$id
)
->
where
(
'id'
,
$id
)
...
...
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