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
f53eab4c
Commit
f53eab4c
authored
Sep 02, 2019
by
clone
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
7c9e6fac
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
77 additions
and
64 deletions
+77
-64
BargainService.php
application/api_broker/service/BargainService.php
+13
-8
OBargainModel.php
application/model/OBargainModel.php
+64
-56
No files found.
application/api_broker/service/BargainService.php
View file @
f53eab4c
...
@@ -14,15 +14,18 @@ use think\Log;
...
@@ -14,15 +14,18 @@ use think\Log;
*/
*/
class
BargainService
class
BargainService
{
{
/**
/**获取成交报告列表
* 获取成交报告列表
* @param $pageNo
* @param $pageNo
* @param $pageSize
* @param $pageSize
* @param $submit_agent_id
* @param $submit_agent_id
* @param $status
* @param $status
* @param $is_my_correlation
* @param $is_my_correlation
* @param $keyword
* @param $keyword
* @return array|false|\PDOStatement|string|\think\Collection
* @param $bargain_id
* @return mixed
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
*/
public
function
getBargainList
(
$pageNo
,
$pageSize
,
$submit_agent_id
,
$status
,
$is_my_correlation
,
$keyword
,
$bargain_id
)
public
function
getBargainList
(
$pageNo
,
$pageSize
,
$submit_agent_id
,
$status
,
$is_my_correlation
,
$keyword
,
$bargain_id
)
{
{
...
@@ -32,7 +35,8 @@ class BargainService
...
@@ -32,7 +35,8 @@ class BargainService
$aService
=
new
VerifyService
();
$aService
=
new
VerifyService
();
$ids
=
$aService
->
getAgentsByAgentId
(
$submit_agent_id
);
$ids
=
$aService
->
getAgentsByAgentId
(
$submit_agent_id
);
$condition
[
"ids"
]
=
$ids
;
$condition
[
"ids"
]
=
$ids
;
$condition
[
"submit_agent_id"
]
=
$submit_agent_id
;
}
else
{
}
else
{
$condition
[
"father_id"
]
=
0
;
$condition
[
"father_id"
]
=
0
;
}
}
...
@@ -51,7 +55,7 @@ class BargainService
...
@@ -51,7 +55,7 @@ class BargainService
$condition
[
"status"
]
=
21
;
$condition
[
"status"
]
=
21
;
break
;
break
;
case
5
://
调账
->
搜成交报告
不包括
待撤销和已撤销
case
5
://
调账
->
搜成交报告
不包括
待撤销和已撤销
$condition
[
"status"
]
=
array
(
'not in'
,
'20,21'
);
$condition
[
"status"
]
=
array
(
'not in'
,
'20,21'
);
break
;
break
;
default
:
default
:
}
}
...
@@ -74,7 +78,7 @@ class BargainService
...
@@ -74,7 +78,7 @@ class BargainService
return
$convertResult
;
return
$convertResult
;
}
}
public
function
getBargainListV2
(
$pageNo
,
$pageSize
,
$submit_agent_id
,
$status
,
$is_my_correlation
,
$keyword
,
$bargain_id
,
$type
)
public
function
getBargainListV2
(
$pageNo
,
$pageSize
,
$submit_agent_id
,
$status
,
$is_my_correlation
,
$keyword
,
$bargain_id
,
$type
)
{
{
$condition
=
[];
$condition
=
[];
...
@@ -82,7 +86,8 @@ class BargainService
...
@@ -82,7 +86,8 @@ class BargainService
$aService
=
new
VerifyService
();
$aService
=
new
VerifyService
();
$ids
=
$aService
->
getAgentsByAgentId
(
$submit_agent_id
);
$ids
=
$aService
->
getAgentsByAgentId
(
$submit_agent_id
);
$condition
[
"ids"
]
=
$ids
;
$condition
[
"ids"
]
=
$ids
;
$condition
[
"submit_agent_id"
]
=
$submit_agent_id
;
}
else
{
}
else
{
$condition
[
"father_id"
]
=
0
;
$condition
[
"father_id"
]
=
0
;
}
}
...
@@ -101,7 +106,7 @@ class BargainService
...
@@ -101,7 +106,7 @@ class BargainService
$condition
[
"status"
]
=
21
;
$condition
[
"status"
]
=
21
;
break
;
break
;
case
5
://
调账
->
搜成交报告
不包括
待撤销和已撤销
case
5
://
调账
->
搜成交报告
不包括
待撤销和已撤销
$condition
[
"status"
]
=
array
(
'not in'
,
'20,21'
);
$condition
[
"status"
]
=
array
(
'not in'
,
'20,21'
);
break
;
break
;
default
:
default
:
}
}
...
...
application/model/OBargainModel.php
View file @
f53eab4c
...
@@ -17,7 +17,7 @@ use think\Model;
...
@@ -17,7 +17,7 @@ use think\Model;
class
OBargainModel
extends
Model
class
OBargainModel
extends
Model
{
{
protected
$table
=
"o_bargain"
;
protected
$table
=
"o_bargain"
;
private
$db_
;
private
$db_
;
public
function
__construct
()
public
function
__construct
()
{
{
...
@@ -143,7 +143,7 @@ class OBargainModel extends Model
...
@@ -143,7 +143,7 @@ class OBargainModel extends Model
public
function
selectBargainListByHouseId
(
$house_id
)
public
function
selectBargainListByHouseId
(
$house_id
)
{
{
$params
[
"b.house_id"
]
=
$house_id
;
$params
[
"b.house_id"
]
=
$house_id
;
$params
[
"a.status"
]
=
array
(
"not in"
,
"21,30"
);
$params
[
"a.status"
]
=
array
(
"not in"
,
"21,30"
);
$data
=
$this
->
db_
$data
=
$this
->
db_
->
field
(
"a.id,a.industry_type"
)
->
field
(
"a.id,a.industry_type"
)
->
alias
(
"a"
)
->
alias
(
"a"
)
...
@@ -243,7 +243,10 @@ class OBargainModel extends Model
...
@@ -243,7 +243,10 @@ class OBargainModel extends Model
$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
[
"submit_agent_id"
]))
{
$where_
[
"a.submit_agent_id"
]
=
$params
[
"submit_agent_id"
];
}
}
if
(
isset
(
$params
[
"account_statement"
]))
{
if
(
isset
(
$params
[
"account_statement"
]))
{
...
@@ -258,14 +261,14 @@ class OBargainModel extends Model
...
@@ -258,14 +261,14 @@ class OBargainModel extends Model
}
}
if
(
!
isset
(
$params
[
"type"
])
&&
isset
(
$params
[
"keyword"
]))
{
if
(
!
isset
(
$params
[
"type"
])
&&
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"
]
.
"%"
);
}
}
switch
((
int
)
$params
[
"type"
]){
//1商铺id 2商铺地址 3成交报告id 4带看id 5客户id
switch
((
int
)
$params
[
"type"
])
{
//1商铺id 2商铺地址 3成交报告id 4带看id 5客户id
case
1
:
case
1
:
$where_
[
"d.id"
]
=
$params
[
"keyword"
];
$where_
[
"d.id"
]
=
$params
[
"keyword"
];
break
;
break
;
case
2
:
case
2
:
$where_
[
"d.internal_address"
]
=
array
(
"like"
,
"%"
.
trim
(
$params
[
'keyword'
])
.
"%"
);
$where_
[
"d.internal_address"
]
=
array
(
"like"
,
"%"
.
trim
(
$params
[
'keyword'
])
.
"%"
);
break
;
break
;
case
3
:
case
3
:
$where_
[
"a.id"
]
=
$params
[
"keyword"
];
$where_
[
"a.id"
]
=
$params
[
"keyword"
];
...
@@ -351,7 +354,7 @@ class OBargainModel extends Model
...
@@ -351,7 +354,7 @@ class OBargainModel extends Model
if
(
isset
(
$params
[
'id'
]))
{
if
(
isset
(
$params
[
'id'
]))
{
$where_
[
'a.id'
]
=
$params
[
'id'
];
$where_
[
'a.id'
]
=
$params
[
'id'
];
}
}
$where_
[
'a.status'
]
=
array
(
"<>"
,
30
);
$where_
[
'a.status'
]
=
array
(
"<>"
,
30
);
$result
=
$this
->
db_
$result
=
$this
->
db_
->
field
(
$filed
)
->
field
(
$filed
)
...
@@ -448,7 +451,7 @@ class OBargainModel extends Model
...
@@ -448,7 +451,7 @@ class OBargainModel extends Model
$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
,
'status'
=>
[
'in'
,
'10,11,20,21'
]
'status'
=>
[
'in'
,
'10,11,20,21'
]
])
->
find
();
])
->
find
();
if
(
$bargain_data
!=
''
)
{
if
(
$bargain_data
!=
''
)
{
...
@@ -500,8 +503,8 @@ class OBargainModel extends Model
...
@@ -500,8 +503,8 @@ class OBargainModel extends Model
//记录第几级审核-与 OFinancialAudit 表一致
//记录第几级审核-与 OFinancialAudit 表一致
$update_data
[
'audit_level'
]
=
$data
[
'audit_level'
];
$update_data
[
'audit_level'
]
=
$data
[
'audit_level'
];
$where_bargain
[
'status'
]
=
[
'<>'
,
30
];
$where_bargain
[
'status'
]
=
[
'<>'
,
30
];
$where_bargain
[]
=
[
'EXP'
,
'id='
.
$bargain_data
[
'id'
]
.
' or father_id='
.
$bargain_data
[
'id'
]
];
$where_bargain
[]
=
[
'EXP'
,
'id='
.
$bargain_data
[
'id'
]
.
' or father_id='
.
$bargain_data
[
'id'
]
];
$this
->
where
(
$where_bargain
)
->
update
(
$update_data
);
$this
->
where
(
$where_bargain
)
->
update
(
$update_data
);
$this
->
commit
();
$this
->
commit
();
...
@@ -640,7 +643,7 @@ class OBargainModel extends Model
...
@@ -640,7 +643,7 @@ class OBargainModel extends Model
if
(
isset
(
$params
[
"create_time"
]))
{
if
(
isset
(
$params
[
"create_time"
]))
{
$where_
[
"c.income_time"
]
=
$params
[
"create_time"
];
$where_
[
"c.income_time"
]
=
$params
[
"create_time"
];
}
}
$where_
[
"status"
]
=
array
(
"in"
,
"10,11,13"
);
$where_
[
"status"
]
=
array
(
"in"
,
"10,11,13"
);
return
Db
::
table
(
$this
->
table
)
return
Db
::
table
(
$this
->
table
)
->
field
(
$field
)
->
field
(
$field
)
->
alias
(
"a"
)
->
alias
(
"a"
)
...
@@ -710,12 +713,12 @@ class OBargainModel extends Model
...
@@ -710,12 +713,12 @@ class OBargainModel extends Model
}
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"
;
//$where_["trade_type"] = 10;//产品要求统计数量必须是出租类型的180620
//$where_["trade_type"] = 10;//产品要求统计数量必须是出租类型的180620
$where_
[
"role"
]
=
3
;
//必须是反签方
$where_
[
"role"
]
=
3
;
//必须是反签方
}
}
$where_
[
"status"
]
=
array
(
"in"
,
"10,11,13"
);
$where_
[
"status"
]
=
array
(
"in"
,
"10,11,13"
);
if
(
isset
(
$params
[
"agent_id"
]))
{
if
(
isset
(
$params
[
"agent_id"
]))
{
$where_
[
"agent_id"
]
=
$params
[
"agent_id"
];
$where_
[
"agent_id"
]
=
$params
[
"agent_id"
];
...
@@ -756,7 +759,7 @@ class OBargainModel extends Model
...
@@ -756,7 +759,7 @@ class OBargainModel extends Model
if
(
isset
(
$params
[
"is_case"
])
&&
$params
[
"is_case"
]
==
2
)
{
if
(
isset
(
$params
[
"is_case"
])
&&
$params
[
"is_case"
]
==
2
)
{
$where_
[
"a.father_id"
]
=
0
;
$where_
[
"a.father_id"
]
=
0
;
}
}
array_push
(
$join
,
[
' o_report c'
,
'a.report_id=c.id'
,
'left'
]);
array_push
(
$join
,
[
' o_report c'
,
'a.report_id=c.id'
,
'left'
]);
}
}
if
(
isset
(
$params
[
"agent_id"
]))
{
if
(
isset
(
$params
[
"agent_id"
]))
{
...
@@ -771,8 +774,8 @@ class OBargainModel extends Model
...
@@ -771,8 +774,8 @@ class OBargainModel extends Model
}
}
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"
]
);
array_push
(
$join
,
[
' o_order b'
,
'a.order_id = b.id'
,
'left'
]);
array_push
(
$join
,
[
' o_order b'
,
'a.order_id = b.id'
,
'left'
]);
}
}
if
(
isset
(
$params
[
"status"
]))
{
if
(
isset
(
$params
[
"status"
]))
{
...
@@ -788,6 +791,7 @@ class OBargainModel extends Model
...
@@ -788,6 +791,7 @@ class OBargainModel extends Model
->
select
();
->
select
();
return
$return
;
return
$return
;
}
}
public
function
getAddBargainNumV2
(
$params
,
$type
)
public
function
getAddBargainNumV2
(
$params
,
$type
)
{
{
$where_
=
[];
$where_
=
[];
...
@@ -798,9 +802,9 @@ class OBargainModel extends Model
...
@@ -798,9 +802,9 @@ class OBargainModel extends Model
}
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"
;
$where_
[
"a.role"
]
=
3
;
//必须是反签方
$where_
[
"a.role"
]
=
3
;
//必须是反签方
$where_
[
"a.status"
]
=
array
(
"in"
,
'10,11,13'
);
$where_
[
"a.status"
]
=
array
(
"in"
,
'10,11,13'
);
}
}
...
@@ -813,8 +817,8 @@ class OBargainModel extends Model
...
@@ -813,8 +817,8 @@ class OBargainModel extends Model
}
}
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"
]
);
array_push
(
$join
,
[
' o_order b'
,
'a.order_id = b.id'
,
'left'
]);
array_push
(
$join
,
[
' o_order b'
,
'a.order_id = b.id'
,
'left'
]);
}
}
$return
=
Db
::
table
(
$this
->
table
)
$return
=
Db
::
table
(
$this
->
table
)
...
@@ -833,14 +837,14 @@ class OBargainModel extends Model
...
@@ -833,14 +837,14 @@ class OBargainModel extends Model
$field
=
""
;
$field
=
""
;
$join
=
[];
$join
=
[];
if
(
$type
==
1
)
{
if
(
$type
==
1
)
{
$field
=
"sum(scale_fee) as num"
;
$field
=
"sum(scale_fee) as num"
;
$where_
[
"a.status"
]
=
array
(
"in"
,
'10,11,13'
);
$where_
[
"a.status"
]
=
array
(
"in"
,
'10,11,13'
);
}
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"
;
$where_
[
"a.role"
]
=
3
;
//必须是反签方1
$where_
[
"a.role"
]
=
3
;
//必须是反签方1
$where_
[
"a.status"
]
=
array
(
"in"
,
'10,11,13'
);
$where_
[
"a.status"
]
=
array
(
"in"
,
'10,11,13'
);
}
}
if
(
isset
(
$params
[
"agent_id"
]))
{
if
(
isset
(
$params
[
"agent_id"
]))
{
...
@@ -852,8 +856,8 @@ class OBargainModel extends Model
...
@@ -852,8 +856,8 @@ class OBargainModel extends Model
}
}
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"
]
);
array_push
(
$join
,
[
' o_order b'
,
'a.order_id = b.id'
,
'left'
]);
array_push
(
$join
,
[
' o_order b'
,
'a.order_id = b.id'
,
'left'
]);
}
}
$return
=
Db
::
table
(
$this
->
table
)
$return
=
Db
::
table
(
$this
->
table
)
...
@@ -864,6 +868,7 @@ class OBargainModel extends Model
...
@@ -864,6 +868,7 @@ class OBargainModel extends Model
->
select
();
->
select
();
return
$return
;
return
$return
;
}
}
/**
/**
* @param $params
* @param $params
* @return false|\PDOStatement|string|\think\Collection
* @return false|\PDOStatement|string|\think\Collection
...
@@ -895,7 +900,6 @@ class OBargainModel extends Model
...
@@ -895,7 +900,6 @@ class OBargainModel extends Model
}
}
/**
/**
* @param $page_no
* @param $page_no
* @param $page_size
* @param $page_size
...
@@ -953,9 +957,9 @@ class OBargainModel extends Model
...
@@ -953,9 +957,9 @@ class OBargainModel extends Model
}
}
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"
]
);
}
}
$where_
[
"a.status"
]
=
array
(
"in"
,
"10,11,13,20"
);
$where_
[
"a.status"
]
=
array
(
"in"
,
"10,11,13,20"
);
return
Db
::
table
(
$this
->
table
)
return
Db
::
table
(
$this
->
table
)
->
field
(
$field
)
->
field
(
$field
)
->
alias
(
"a"
)
->
alias
(
"a"
)
...
@@ -994,7 +998,7 @@ class OBargainModel extends Model
...
@@ -994,7 +998,7 @@ class OBargainModel extends Model
}
}
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"
]
);
}
}
$data
=
Db
::
table
(
$this
->
table
)
$data
=
Db
::
table
(
$this
->
table
)
...
@@ -1134,7 +1138,7 @@ class OBargainModel extends Model
...
@@ -1134,7 +1138,7 @@ 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'
];
$result
[
$k
][
'agent'
]
=
$agent_data
[
'name'
];
$result
[
$k
][
'district_store'
]
=
$agent_data
[
'store_name'
];
$result
[
$k
][
'district_store'
]
=
$agent_data
[
'store_name'
];
}
}
...
@@ -1174,11 +1178,11 @@ class OBargainModel extends Model
...
@@ -1174,11 +1178,11 @@ class OBargainModel extends Model
->
select
();
->
select
();
foreach
(
$partial_commission
as
$k2
=>
$v2
)
{
foreach
(
$partial_commission
as
$k2
=>
$v2
)
{
if
(
empty
(
$v2
[
'real_income_id'
]))
{
if
(
empty
(
$v2
[
'real_income_id'
]))
{
$income_time
=
$m_real
->
field
(
'id,income_time'
)
->
where
([
'bargain_id'
=>
$bargain_id
,
'is_del'
=>
0
])
->
select
();
$income_time
=
$m_real
->
field
(
'id,income_time'
)
->
where
([
'bargain_id'
=>
$bargain_id
,
'is_del'
=>
0
])
->
select
();
//当只有一个收入日期,给前端显示用
//当只有一个收入日期,给前端显示用
if
(
count
(
$income_time
)
==
1
)
{
if
(
count
(
$income_time
)
==
1
)
{
$income_time_add
[
'id'
]
=
$income_time
[
0
][
'id'
];
$income_time_add
[
'id'
]
=
$income_time
[
0
][
'id'
];
$income_time_add
[
'income_time'
]
=
$income_time
[
0
][
'income_time'
];
$income_time_add
[
'income_time'
]
=
$income_time
[
0
][
'income_time'
];
$partial_commission
[
$k2
][
'income_time_add'
]
=
$income_time_add
;
$partial_commission
[
$k2
][
'income_time_add'
]
=
$income_time_add
;
}
}
}
else
{
}
else
{
...
@@ -1261,7 +1265,7 @@ class OBargainModel extends Model
...
@@ -1261,7 +1265,7 @@ class OBargainModel extends Model
$m_agent
=
new
AAgents
();
$m_agent
=
new
AAgents
();
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'
];
}
}
}
}
...
@@ -1309,11 +1313,11 @@ class OBargainModel extends Model
...
@@ -1309,11 +1313,11 @@ class OBargainModel extends Model
}
}
$data
=
$this
->
field
(
'role,agent_id,scale,scale_fee'
)
$data
=
$this
->
field
(
'role,agent_id,scale,scale_fee'
)
->
where
(
''
,
'EXP'
,
'id='
.
$bargain_id
.
' OR father_id='
.
$bargain_id
)
->
where
(
''
,
'EXP'
,
'id='
.
$bargain_id
.
' OR father_id='
.
$bargain_id
)
->
where
(
'status'
,
'<>'
,
30
)
->
where
(
'status'
,
'<>'
,
30
)
->
select
();
->
select
();
foreach
(
$data
as
$k
=>
$v
)
{
foreach
(
$data
as
$k
=>
$v
)
{
if
(
in_array
(
$v
[
'agent_id'
],
$bargain_id_arr
))
{
if
(
in_array
(
$v
[
'agent_id'
],
$bargain_id_arr
))
{
unset
(
$data
[
$k
]);
unset
(
$data
[
$k
]);
}
}
...
@@ -1376,7 +1380,7 @@ class OBargainModel extends Model
...
@@ -1376,7 +1380,7 @@ class OBargainModel extends Model
return
$this
->
field
(
$field
)
->
alias
(
'a'
)
return
$this
->
field
(
$field
)
->
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
(
'a_agents d'
,
'a.agent_id=d.id'
,
'left'
)
->
join
(
'a_agents d'
,
'a.agent_id=d.id'
,
'left'
)
->
where
(
'a.status'
,
'in'
,
$status
)
->
where
(
'a.status'
,
'in'
,
$status
)
->
where
(
'a.id'
,
$id
)
->
where
(
'a.id'
,
$id
)
->
find
();
->
find
();
...
@@ -1416,7 +1420,7 @@ class OBargainModel extends Model
...
@@ -1416,7 +1420,7 @@ class OBargainModel extends Model
$result
[
'scale_fee'
]
=
empty
(
$result
[
'should_commission'
])
?
$result
[
'scale_fee'
]
:
$result
[
'should_commission'
];
$result
[
'scale_fee'
]
=
empty
(
$result
[
'should_commission'
])
?
$result
[
'scale_fee'
]
:
$result
[
'should_commission'
];
$m_agent
=
new
AAgents
();
$m_agent
=
new
AAgents
();
$filed_agent
=
'a.id,a.name,a.phone,b.store_name,c.district_name,a.store_id,a.district_id'
;
$filed_agent
=
'a.id,a.name,a.phone,b.store_name,c.district_name,a.store_id,a.district_id'
;
$agent_info
=
$m_agent
->
getStoreDistrict
(
$filed_agent
,
[
'a.id'
=>
$result
[
'agent_id'
]
]);
$agent_info
=
$m_agent
->
getStoreDistrict
(
$filed_agent
,
[
'a.id'
=>
$result
[
'agent_id'
]
]);
$result
[
'district_name'
]
=
$agent_info
[
'district_name'
];
$result
[
'district_name'
]
=
$agent_info
[
'district_name'
];
$result
[
'store_name'
]
=
$agent_info
[
'store_name'
];
$result
[
'store_name'
]
=
$agent_info
[
'store_name'
];
$result
[
'name'
]
=
$agent_info
[
'name'
];
$result
[
'name'
]
=
$agent_info
[
'name'
];
...
@@ -1559,7 +1563,6 @@ class OBargainModel extends Model
...
@@ -1559,7 +1563,6 @@ class OBargainModel extends Model
// ->join('a_store Store', 'Agent.store_id = Store.id', 'left')
// ->join('a_store Store', 'Agent.store_id = Store.id', 'left')
// ->join('a_district District', 'Agent.district_id = District.id', 'left')
// ->join('a_district District', 'Agent.district_id = District.id', 'left')
->
join
(
'o_partial_commission PartialCommission'
,
'PartialCommission.bargain_id = Obargain.id'
,
'left'
)
->
join
(
'o_partial_commission PartialCommission'
,
'PartialCommission.bargain_id = Obargain.id'
,
'left'
)
->
where
(
$where
)
->
where
(
$where
)
->
count
();
->
count
();
// echo $this->db_->getLastSql();
// echo $this->db_->getLastSql();
...
@@ -1587,8 +1590,7 @@ class OBargainModel extends Model
...
@@ -1587,8 +1590,7 @@ class OBargainModel extends Model
}
}
public
function
getBargainSumList
(
$field
,
$params
,
$page_size
,
$page_no
,
$request_source_type
)
public
function
getBargainSumList
(
$field
,
$params
,
$page_size
,
$page_no
,
$request_source_type
)
{
{
$where_
=
[];
$where_
=
[];
...
@@ -1599,11 +1601,11 @@ class OBargainModel extends Model
...
@@ -1599,11 +1601,11 @@ class OBargainModel extends Model
if
(
isset
(
$params
[
"create_time"
]))
{
if
(
isset
(
$params
[
"create_time"
]))
{
$where_
[
"a.create_time"
]
=
$params
[
"create_time"
];
$where_
[
"a.create_time"
]
=
$params
[
"create_time"
];
}
}
$where_
[
"a.status"
]
=
array
(
"in"
,
"10,11,13"
);
$where_
[
"a.status"
]
=
array
(
"in"
,
"10,11,13"
);
if
(
$request_source_type
&&
$request_source_type
==
1
)
{
if
(
$request_source_type
&&
$request_source_type
==
1
)
{
//pc后台业绩 成交单数 需要调用
//pc后台业绩 成交单数 需要调用
$where_
[
"a.role"
]
=
3
;
//必须是反签方
$where_
[
"a.role"
]
=
3
;
//必须是反签方
}
}
$result
=
$this
->
db_
$result
=
$this
->
db_
->
field
(
$field
)
->
field
(
$field
)
...
@@ -1625,7 +1627,7 @@ class OBargainModel extends Model
...
@@ -1625,7 +1627,7 @@ class OBargainModel extends Model
{
{
$field
=
"count(1) as num"
;
$field
=
"count(1) as num"
;
//$where_["trade_type"] = 10;//产品要求统计数量必须是出租类型的180620
//$where_["trade_type"] = 10;//产品要求统计数量必须是出租类型的180620
$params
[
"a.role"
]
=
3
;
//必须是反签方
$params
[
"a.role"
]
=
3
;
//必须是反签方
$params
[
'c.shop_type'
]
=
$type
==
0
?
0
:
1
;
$params
[
'c.shop_type'
]
=
$type
==
0
?
0
:
1
;
// dump($params);
// dump($params);
$return
=
Db
::
table
(
$this
->
table
)
$return
=
Db
::
table
(
$this
->
table
)
...
@@ -1645,7 +1647,8 @@ class OBargainModel extends Model
...
@@ -1645,7 +1647,8 @@ class OBargainModel extends Model
* @param $where
* @param $where
* @return float|int
* @return float|int
*/
*/
public
function
sumField
(
$field
,
$where
)
{
public
function
sumField
(
$field
,
$where
)
{
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'
)
...
@@ -1663,7 +1666,8 @@ class OBargainModel extends Model
...
@@ -1663,7 +1666,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
agentBargainAll
(
$field
,
$where
)
{
public
function
agentBargainAll
(
$field
,
$where
)
{
return
$this
->
db_
->
alias
(
'a'
)
return
$this
->
db_
->
alias
(
'a'
)
->
field
(
$field
)
->
field
(
$field
)
->
join
(
'a_agents b'
,
'a.agent_id = b.id'
,
'left'
)
->
join
(
'a_agents b'
,
'a.agent_id = b.id'
,
'left'
)
...
@@ -1676,7 +1680,8 @@ class OBargainModel extends Model
...
@@ -1676,7 +1680,8 @@ class OBargainModel extends Model
* @param $where
* @param $where
* @return mixed
* @return mixed
*/
*/
public
function
getFieldValue
(
$field
,
$where
)
{
public
function
getFieldValue
(
$field
,
$where
)
{
return
$this
->
db_
->
where
(
$where
)
->
value
(
$field
);
return
$this
->
db_
->
where
(
$where
)
->
value
(
$field
);
}
}
...
@@ -1685,7 +1690,8 @@ class OBargainModel extends Model
...
@@ -1685,7 +1690,8 @@ class OBargainModel extends Model
* @param $where
* @param $where
* @return mixed
* @return mixed
*/
*/
public
function
getFieldColumn
(
$field
,
$where
)
{
public
function
getFieldColumn
(
$field
,
$where
)
{
return
$this
->
db_
->
where
(
$where
)
->
column
(
$field
);
return
$this
->
db_
->
where
(
$where
)
->
column
(
$field
);
}
}
...
@@ -1697,7 +1703,8 @@ class OBargainModel extends Model
...
@@ -1697,7 +1703,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
getDetail
(
$field
,
$where
)
{
public
function
getDetail
(
$field
,
$where
)
{
return
$this
->
db_
->
field
(
$field
)
return
$this
->
db_
->
field
(
$field
)
->
where
(
$where
)
->
where
(
$where
)
->
find
();
->
find
();
...
@@ -1711,7 +1718,8 @@ class OBargainModel extends Model
...
@@ -1711,7 +1718,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
agentBargainIncome
(
$field
,
$where
)
{
public
function
agentBargainIncome
(
$field
,
$where
)
{
return
$this
->
db_
->
alias
(
'a'
)
return
$this
->
db_
->
alias
(
'a'
)
->
field
(
$field
)
->
field
(
$field
)
->
join
(
'a_agents b'
,
'a.agent_id = b.id'
,
'left'
)
->
join
(
'a_agents b'
,
'a.agent_id = b.id'
,
'left'
)
...
...
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