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
4781720a
Commit
4781720a
authored
Jun 28, 2019
by
zhuwei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
4af05bba
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
50 additions
and
30 deletions
+50
-30
OBargainModel.php
application/model/OBargainModel.php
+50
-30
No files found.
application/model/OBargainModel.php
View file @
4781720a
...
@@ -640,7 +640,7 @@ class OBargainModel extends Model
...
@@ -640,7 +640,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_
[
"a.status"
]
=
array
(
"in"
,
"10,11,13"
);
return
Db
::
table
(
$this
->
table
)
return
Db
::
table
(
$this
->
table
)
->
field
(
$field
)
->
field
(
$field
)
->
alias
(
"a"
)
->
alias
(
"a"
)
...
@@ -825,6 +825,45 @@ class OBargainModel extends Model
...
@@ -825,6 +825,45 @@ class OBargainModel extends Model
->
select
();
->
select
();
return
$return
;
return
$return
;
}
}
public
function
getAddBargainNumV3
(
$params
,
$type
)
{
$where_
=
[];
$field
=
""
;
$join
=
[];
if
(
$type
==
1
)
{
$field
=
"sum(scale_fee) as num"
;
$where_
[
"a.status"
]
=
array
(
"in"
,
'10,11,13'
);
}
elseif
(
$type
==
2
)
{
$field
=
"sum(practical_fee) as num"
;
}
elseif
(
$type
==
3
)
{
$field
=
"count(1) as num"
;
$where_
[
"a.role"
]
=
3
;
//必须是反签方1
$where_
[
"a.status"
]
=
array
(
"in"
,
'10,11,13'
);
}
if
(
isset
(
$params
[
"agent_id"
]))
{
$where_
[
"a.agent_id"
]
=
$params
[
"agent_id"
];
}
if
(
isset
(
$params
[
"create_time"
]))
{
$where_
[
"a.create_time"
]
=
$params
[
"create_time"
];
}
if
(
isset
(
$params
[
"house_ids"
]))
{
$where_
[
"b.house_id"
]
=
array
(
"in"
,
$params
[
"house_ids"
]
);
array_push
(
$join
,
[
' o_order b'
,
'a.order_id = b.id'
,
'left'
]);
}
$return
=
Db
::
table
(
$this
->
table
)
->
field
(
$field
)
->
alias
(
"a"
)
->
join
(
$join
)
->
where
(
$where_
)
->
select
();
return
$return
;
}
/**
/**
* @param $params
* @param $params
* @return false|\PDOStatement|string|\think\Collection
* @return false|\PDOStatement|string|\think\Collection
...
@@ -1367,7 +1406,6 @@ class OBargainModel extends Model
...
@@ -1367,7 +1406,6 @@ class OBargainModel extends Model
->
field
(
$filed
)
->
field
(
$filed
)
->
alias
(
"a"
)
->
alias
(
"a"
)
->
join
(
"o_partial_commission b"
,
"a.id = b.bargain_id"
,
"left"
)
->
join
(
"o_partial_commission b"
,
"a.id = b.bargain_id"
,
"left"
)
->
join
(
"o_real_income c"
,
"b.real_income_id = c.id"
,
"left"
)
->
where
(
$where_
)
->
where
(
$where_
)
->
whereOr
(
$whereOr_
)
->
whereOr
(
$whereOr_
)
->
order
(
"a.id asc"
)
->
order
(
"a.id asc"
)
...
@@ -1453,15 +1491,15 @@ class OBargainModel extends Model
...
@@ -1453,15 +1491,15 @@ class OBargainModel extends Model
->
join
(
"o_order Oorder"
,
"Obargain.order_id = Oorder.id"
,
"left"
)
->
join
(
"o_order Oorder"
,
"Obargain.order_id = Oorder.id"
,
"left"
)
->
join
(
"g_houses Houses"
,
"Oorder.house_id = Houses.id"
,
"left"
)
->
join
(
"g_houses Houses"
,
"Oorder.house_id = Houses.id"
,
"left"
)
->
join
(
"a_agents Agent"
,
"Obargain.agent_id = Agent.id"
,
"left"
)
->
join
(
"a_agents Agent"
,
"Obargain.agent_id = Agent.id"
,
"left"
)
// ->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
)
->
order
(
"Obargain.create_time desc"
)
->
order
(
"Obargain.create_time desc"
)
->
limit
(
$pageSize
)
->
limit
(
$pageSize
)
->
page
(
$pageNo
)
->
page
(
$pageNo
)
->
select
();
->
select
();
//echo $this->db_->getLastSql();
//echo $this->db_->getLastSql();
return
$result
;
return
$result
;
}
}
...
@@ -1474,8 +1512,8 @@ class OBargainModel extends Model
...
@@ -1474,8 +1512,8 @@ class OBargainModel extends Model
->
join
(
"o_order Oorder"
,
"Obargain.order_id = Oorder.id"
,
"left"
)
->
join
(
"o_order Oorder"
,
"Obargain.order_id = Oorder.id"
,
"left"
)
->
join
(
"g_houses Houses"
,
"Oorder.house_id = Houses.id"
,
"left"
)
->
join
(
"g_houses Houses"
,
"Oorder.house_id = Houses.id"
,
"left"
)
->
join
(
"a_agents Agent"
,
"Obargain.agent_id = Agent.id"
,
"left"
)
->
join
(
"a_agents Agent"
,
"Obargain.agent_id = Agent.id"
,
"left"
)
// ->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
)
->
order
(
"Obargain.create_time desc"
)
->
order
(
"Obargain.create_time desc"
)
...
@@ -1493,8 +1531,8 @@ class OBargainModel extends Model
...
@@ -1493,8 +1531,8 @@ class OBargainModel extends Model
->
join
(
"o_order Oorder"
,
"Obargain.order_id = Oorder.id"
,
"left"
)
->
join
(
"o_order Oorder"
,
"Obargain.order_id = Oorder.id"
,
"left"
)
->
join
(
"g_houses Houses"
,
"Oorder.house_id = Houses.id"
,
"left"
)
->
join
(
"g_houses Houses"
,
"Oorder.house_id = Houses.id"
,
"left"
)
->
join
(
"a_agents Agent"
,
"Obargain.agent_id = Agent.id"
,
"left"
)
->
join
(
"a_agents Agent"
,
"Obargain.agent_id = Agent.id"
,
"left"
)
// ->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
)
->
order
(
"Obargain.create_time desc"
)
->
order
(
"Obargain.create_time desc"
)
...
@@ -1517,8 +1555,8 @@ class OBargainModel extends Model
...
@@ -1517,8 +1555,8 @@ class OBargainModel extends Model
->
join
(
"o_order Oorder"
,
"Obargain.order_id = Oorder.id"
,
"left"
)
->
join
(
"o_order Oorder"
,
"Obargain.order_id = Oorder.id"
,
"left"
)
->
join
(
"g_houses Houses"
,
"Oorder.house_id = Houses.id"
,
"left"
)
->
join
(
"g_houses Houses"
,
"Oorder.house_id = Houses.id"
,
"left"
)
->
join
(
"a_agents Agent"
,
"Obargain.agent_id = Agent.id"
,
"left"
)
->
join
(
"a_agents Agent"
,
"Obargain.agent_id = Agent.id"
,
"left"
)
// ->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
)
...
@@ -1588,7 +1626,7 @@ class OBargainModel extends Model
...
@@ -1588,7 +1626,7 @@ class OBargainModel extends Model
//$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
)
->
field
(
$field
)
->
field
(
$field
)
->
alias
(
"a"
)
->
alias
(
"a"
)
...
@@ -1632,24 +1670,6 @@ class OBargainModel extends Model
...
@@ -1632,24 +1670,6 @@ class OBargainModel extends Model
->
select
();
->
select
();
}
}
/**
* @param $field
* @param $where
* @return false|\PDOStatement|string|\think\Collection
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public
function
agentBargainIncome
(
$field
,
$where
)
{
return
$this
->
db_
->
alias
(
'a'
)
->
field
(
$field
)
->
join
(
'a_agents b'
,
'a.agent_id = b.id'
,
'left'
)
->
join
(
'o_partial_commission c'
,
'a.id = c.bargain_id'
,
'left'
)
->
join
(
'o_real_income d'
,
'c.real_income_id = d.id'
,
'left'
)
->
where
(
$where
)
->
select
();
}
/**
/**
* @param $field
* @param $field
* @param $where
* @param $where
...
...
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