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
21807c3b
Commit
21807c3b
authored
Oct 25, 2018
by
zhuwei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
业绩排行修改
parent
f6a0dc31
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
176 additions
and
156 deletions
+176
-156
PerformanceInfo.php
application/index/controller/PerformanceInfo.php
+2
-2
PerformanceService.php
application/index/service/PerformanceService.php
+117
-153
AAgents.php
application/model/AAgents.php
+39
-0
AStore.php
application/model/AStore.php
+17
-0
OBargainModel.php
application/model/OBargainModel.php
+1
-1
No files found.
application/index/controller/PerformanceInfo.php
View file @
21807c3b
...
...
@@ -35,7 +35,7 @@ class PerformanceInfo extends Basic
$pageNo
=
empty
(
$this
->
params
[
'pageNo'
])
?
1
:
$this
->
params
[
'pageNo'
];
$pageSize
=
empty
(
$this
->
params
[
'pageSize'
])
?
15
:
$this
->
params
[
'pageSize'
];
$where
[
'Obargain.status'
]
=
[
'in'
,
'10,11,13'
]
;
$where
[
'Obargain.status'
]
=
array
(
'neq'
,
30
)
;
/*开始结束时间*/
if
((
$this
->
params
[
'create_time_start'
]
!=
NULL
)
&&
(
$this
->
params
[
'create_time_end'
]
!=
NULL
))
{
$where
[
'Obargain.create_time'
]
=
[
'between time'
,
[
$this
->
params
[
'create_time_start'
]
.
' 00:00:00'
,
$this
->
params
[
'create_time_end'
]
.
' 23:59:59'
]];
...
...
@@ -133,7 +133,7 @@ class PerformanceInfo extends Basic
public
function
getPerformanceInfoExcel
()
{
$where
[
'Obargain.status'
]
=
[
'in'
,
'10,11,13'
]
;
$where
[
'Obargain.status'
]
=
array
(
'neq'
,
30
)
;
/*开始结束时间*/
if
((
$this
->
params
[
'create_time_start'
]
!=
NULL
)
&&
(
$this
->
params
[
'create_time_end'
]
!=
NULL
))
{
$where
[
'Obargain.create_time'
]
=
[
'between time'
,
[
$this
->
params
[
'create_time_start'
]
.
' 00:00:00'
,
$this
->
params
[
'create_time_end'
]
.
' 23:59:59'
]];
...
...
application/index/service/PerformanceService.php
View file @
21807c3b
...
...
@@ -3,6 +3,8 @@ namespace app\index\service;
use
app\index\untils\ExportExcelUntil
;
use
app\model\AAgents
;
use
app\model\ADistrict
;
use
app\model\AStore
;
use
app\model\GHouses
;
use
app\model\OBargainModel
;
use
app\model\OMarchInModel
;
...
...
@@ -23,8 +25,8 @@ class PerformanceService
{
private
$totalModel
;
private
$agentModel
;
private
$
agents
Model
;
private
$
tAgentTotal
Model
;
private
$
store
Model
;
private
$
district
Model
;
private
$houseModel
;
private
$userModel
;
private
$bargainModel
;
...
...
@@ -41,6 +43,10 @@ class PerformanceService
$this
->
bargainModel
=
new
OBargainModel
();
$this
->
reportModel
=
new
OReportModel
();
$this
->
marchInModel
=
new
OMarchInModel
();
$this
->
districtModel
=
new
ADistrict
();
$this
->
storeModel
=
new
AStore
();
}
...
...
@@ -108,95 +114,71 @@ class PerformanceService
$total_result
=
$this
->
totalModel
->
getTotalByAgentIdForPcPerformanceTotal
(
$field
,
$where_
,
$type
);
/*计算总业绩*/
$field
=
"sum(performance) as performance_total"
;
$field
=
"sum(performance) as performance_total"
;
$sum_result
=
$this
->
totalModel
->
getTotalByAgentIdForPcPerformanceSum
(
$field
,
$where_
,
$type
);
$sum_result_num
=
0
;
$sum_result_num
=
0
;
foreach
(
$sum_result
as
$k1
=>
$v1
)
{
$sum_result_num
+=
$v1
[
'performance_total'
];
}
/*计算总业绩 end*/
$arr
=
[];
$field
=
"a.name,a.img,b.store_name,c.district_name"
;
$arr
=
[];
$num
=
(
$pageNo
-
1
)
*
$pageSize
;
foreach
(
$result
as
$key
=>
$value
)
{
if
(
$order_
==
'desc'
)
{
$result
[
$key
][
"index_"
]
=
$key
+
1
+
$num
;
}
else
{
$result
[
$key
][
"index_"
]
=
$total_result
-
$key
-
$num
;
}
switch
(
$type
)
{
case
1
:
if
(
$order_
==
'desc'
)
{
$value
[
"index_"
]
=
$key
+
1
+
$num
;
}
else
{
$value
[
"index_"
]
=
$total_result
-
$key
-
$num
;
}
$info
=
$this
->
agentModel
->
getAgentsInfoByAgentId
(
$field
,
[
"agent_id"
=>
$value
[
"agent_id"
]
]);
if
(
count
(
$info
)
>
0
)
{
$value
[
"name"
]
=
$info
[
0
][
"name"
];
$value
[
"img"
]
=
AGENTHEADERIMGURL
.
$info
[
0
][
"img"
];
$value
[
"store_name"
]
=
$info
[
0
][
"store_name"
];
$value
[
"district_name"
]
=
$info
[
0
][
"district_name"
];
array_push
(
$arr
,
$value
);
}
break
;
case
2
://
门店
if
(
$order_
==
'desc'
)
{
$value
[
"index_"
]
=
$key
+
1
+
$num
;
}
else
{
$value
[
"index_"
]
=
$total_result
-
$key
-
$num
;
}
$info
=
$this
->
agentModel
->
getAgentsInfoByAgentId
(
$field
,
[
"store_id"
=>
$value
[
"store_id"
],
""
]);
$store_name
=
$this
->
agentModel
->
getStoreOrDistrict
([
"store_id"
=>
$value
[
"store_id"
],
"level"
=>
[
"in"
,
"20,40"
]
]);
if
(
count
(
$info
)
>
0
)
{
$value
[
"name"
]
=
count
(
$store_name
)
>
0
?
$store_name
[
0
][
"name"
]
:
"---"
;
$value
[
"img"
]
=
AGENTHEADERIMGURL
.
$store_name
[
0
][
"img"
];
$value
[
"store_name"
]
=
$info
[
0
][
"store_name"
];
$value
[
"district_name"
]
=
$info
[
0
][
"district_name"
];
}
//计算门店人数
$params
=
[];
$params
[
'store_id'
]
=
$value
[
"store_id"
];
$params
[
"status"
]
=
0
;
//只查询正常状态的经纪人
$value
[
"team_num"
]
=
$this
->
agentModel
->
getAgentsCountByStoreId
(
$params
);
array_push
(
$arr
,
$value
);
break
;
case
3
://
区域
if
(
$order_
==
'desc'
)
{
$value
[
"index_"
]
=
$key
+
1
+
$num
;
}
else
{
$value
[
"index_"
]
=
$total_result
-
$key
-
$num
;
}
$info
=
$this
->
agentModel
->
getAgentsInfoByAgentId
(
$field
,
[
"district_id"
=>
$value
[
"district_id"
]
]);
$district_name
=
$this
->
agentModel
->
getStoreOrDistrict
([
"district_id"
=>
$value
[
"district_id"
],
"level"
=>
[
"in"
,
"30,40"
]
]);
if
(
count
(
$info
)
>
0
)
{
$value
[
"name"
]
=
count
(
$district_name
)
>
0
?
$district_name
[
0
][
"name"
]
:
"---"
;
$value
[
"img"
]
=
AGENTHEADERIMGURL
.
$district_name
[
0
][
"img"
];
$value
[
"store_name"
]
=
$info
[
0
][
"store_name"
];
$value
[
"district_name"
]
=
$info
[
0
][
"district_name"
];
}
//计算区域人数
$params_
=
[];
$params_
[
'district_id'
]
=
$value
[
"district_id"
];
$params_
[
"status"
]
=
0
;
//只查询正常状态的经纪人
$value
[
"team_num"
]
=
$this
->
agentModel
->
getAgentsCountByStoreId
(
$params_
);
if
(
$type
==
1
)
{
#个人
$field
=
"a.name,b.store_name,c.district_name"
;
$agent_result
=
$this
->
agentModel
->
getAgentsInfoByAgentIdForPerformanceService
(
$field
,
[
"agent_id"
=>
$value
[
"agent_id"
]
]);
$result
[
$key
][
"name"
]
=
$agent_result
[
0
][
"name"
]
?
$agent_result
[
0
][
"name"
]
:
'未知'
;
$result
[
$key
][
"store_name"
]
=
$agent_result
[
0
][
"store_name"
]
?
$agent_result
[
0
][
"store_name"
]
:
'未知'
;
$result
[
$key
][
"district_name"
]
=
$agent_result
[
0
][
"district_name"
]
?
$agent_result
[
0
][
"district_name"
]
:
'未知'
;
}
elseif
(
$type
==
2
)
{
#门店
$store_params
[
'id'
]
=
$value
[
"store_id"
];
$store_field
=
'id,store_name'
;
$store_result
=
$this
->
storeModel
->
getStore
(
$store_params
,
$store_field
);
$result
[
$key
][
"store_name"
]
=
$store_result
[
0
][
"store_name"
]
?
$store_result
[
0
][
"store_name"
]
:
'未知'
;
//计算门店人数
$params
=
[];
$params
[
'store_id'
]
=
$value
[
"store_id"
];
$params
[
"status"
]
=
0
;
//只查询正常状态的经纪人
$result
[
$key
][
"team_num"
]
=
$this
->
agentModel
->
getAgentsCountByStoreId
(
$params
);
}
elseif
(
$type
==
3
)
{
#部门
$district_params
[
'id'
]
=
$value
[
"district_id"
];
$district_params
[
'status'
]
=
0
;
$district_field
=
'id,district_name'
;
$district_result
=
$this
->
districtModel
->
getDistrict
(
$district_params
,
$district_field
);
$result
[
$key
][
"district_name"
]
=
$district_result
[
0
][
"district_name"
]
?
$district_result
[
0
][
"district_name"
]
:
'未知'
;
//计算区域人数
$params_
=
[];
$params_
[
'district_id'
]
=
$value
[
"district_id"
];
$params_
[
"status"
]
=
0
;
//只查询正常状态的经纪人
$result
[
$key
][
"team_num"
]
=
$this
->
agentModel
->
getAgentsCountByStoreId
(
$params_
);
array_push
(
$arr
,
$value
);
break
;
}
}
if
(
count
(
$arr
)
==
1
)
{
$agent_id
=
$arr
[
0
][
'agent_id'
];
//只有一条数据说明是经纪人个人业绩查询,将完整排名查下,将个人排名查出来
$ranking_num
=
$this
->
getRanking
(
$type
,
$yesterday
,
$end_day
,
$pageNo
,
$pageSize
,
$params
,
$agent_id
);
$
arr
[
0
][
'index_'
]
=
$ranking_num
;
$ranking_num
=
$this
->
getRanking
(
$type
,
$yesterday
,
$end_day
,
$pageNo
,
$pageSize
,
$params
,
$agent_id
);
$
result
[
0
][
'index_'
]
=
$ranking_num
;
}
return
[
'list'
=>
$arr
,
'total'
=>
$total_result
,
'performance_total'
=>
$sum_result_num
];
return
[
'list'
=>
$result
,
'total'
=>
$total_result
,
'performance_total'
=>
$sum_result_num
];
}
/**
...
...
@@ -325,6 +307,7 @@ class PerformanceService
{
$where_
=
[];
$e_data_new
=
[];
if
(
$father_id
){
if
(
$type
==
1
){
$where_
[
'a.store_id'
]
=
$father_id
;
...
...
@@ -360,105 +343,86 @@ class PerformanceService
团队人数 team_num*/
$field
=
"a.agent_id,a.store_id,a.district_id,
sum(a.performance) as performance_total,
sum(a.bargain_sum) as bargain_sum_total,
sum(a.paylog) as paylog_total,
sum(a.march_in_num) as march_in_num_total,
sum(a.look_at_num) as look_at_num_total,
sum(a.add_house_num) as add_house_num_total,
sum(a.add_user_num) as add_user_num_total
"
;
sum(a.performance) as performance_total,
sum(a.bargain_sum) as bargain_sum_total,
sum(a.paylog) as paylog_total,
sum(a.march_in_num) as march_in_num_total,
sum(a.look_at_num) as look_at_num_total,
sum(a.add_house_num) as add_house_num_total,
sum(a.add_user_num) as add_user_num_total"
;
$order
=
"performance_total desc"
;
$result
=
$this
->
totalModel
->
getTotalByAgentIdSite
(
$field
,
$where_
,
$type
,
$order
);
$arr
=
[];
$field
=
"a.name,a.img,b.store_name,c.district_name"
;
foreach
(
$result
as
$key
=>
$value
)
{
switch
(
$type
)
{
case
1
:
$value
[
"index_"
]
=
$key
+
1
;
$info
=
$this
->
agentModel
->
getAgentsInfoByAgentId
(
$field
,
[
"agent_id"
=>
$value
[
"agent_id"
]
]);
if
(
count
(
$info
)
>
0
)
{
$value
[
"name"
]
=
$info
[
0
][
"name"
];
$value
[
"img"
]
=
AGENTHEADERIMGURL
.
$info
[
0
][
"img"
];
$value
[
"store_name"
]
=
$info
[
0
][
"store_name"
];
$value
[
"district_name"
]
=
$info
[
0
][
"district_name"
];
array_push
(
$arr
,
$value
);
}
break
;
case
2
:
$value
[
"index_"
]
=
$key
+
1
;
$info
=
$this
->
agentModel
->
getAgentsInfoByAgentId
(
$field
,
[
"store_id"
=>
$value
[
"store_id"
],
""
]);
$store_name
=
$this
->
agentModel
->
getStoreOrDistrict
([
"store_id"
=>
$value
[
"store_id"
],
"level"
=>
20
]);
if
(
count
(
$info
)
>
0
)
{
$value
[
"name"
]
=
count
(
$store_name
)
>
0
?
$store_name
[
0
][
"name"
]
:
"---"
;
$value
[
"img"
]
=
AGENTHEADERIMGURL
.
$store_name
[
0
][
"img"
];
$value
[
"store_name"
]
=
$info
[
0
][
"store_name"
];
$value
[
"district_name"
]
=
$info
[
0
][
"district_name"
];
}
//计算门店人数
$params
=
[];
$params
[
'store_id'
]
=
$value
[
"store_id"
];
$params
[
"status"
]
=
0
;
//只查询正常状态的经纪人
$value
[
"team_num"
]
=
$this
->
agentModel
->
getAgentsCountByStoreId
(
$params
);
array_push
(
$arr
,
$value
);
$result
[
$key
][
"index_"
]
=
$key
+
1
;
if
(
$type
==
1
)
{
#个人
$field
=
"a.name,b.store_name,c.district_name"
;
$agent_result
=
$this
->
agentModel
->
getAgentsInfoByAgentIdForPerformanceService
(
$field
,
[
"agent_id"
=>
$value
[
"agent_id"
]
]);
$result
[
$key
][
"name"
]
=
$agent_result
[
0
][
"name"
]
?
$agent_result
[
0
][
"name"
]
:
'未知'
;
$result
[
$key
][
"store_name"
]
=
$agent_result
[
0
][
"store_name"
]
?
$agent_result
[
0
][
"store_name"
]
:
'未知'
;
$result
[
$key
][
"district_name"
]
=
$agent_result
[
0
][
"district_name"
]
?
$agent_result
[
0
][
"district_name"
]
:
'未知'
;
}
elseif
(
$type
==
2
)
{
#门店
$store_params
[
'id'
]
=
$value
[
"store_id"
];
$store_field
=
'id,store_name'
;
$store_result
=
$this
->
storeModel
->
getStore
(
$store_params
,
$store_field
);
$result
[
$key
][
"store_name"
]
=
$store_result
[
0
][
"store_name"
]
?
$store_result
[
0
][
"store_name"
]
:
'未知'
;
//计算门店人数
$params
=
[];
$params
[
'store_id'
]
=
$value
[
"store_id"
];
$params
[
"status"
]
=
0
;
//只查询正常状态的经纪人
$result
[
$key
][
"team_num"
]
=
$this
->
agentModel
->
getAgentsCountByStoreId
(
$params
);
}
elseif
(
$type
==
3
)
{
#部门
$district_params
[
'id'
]
=
$value
[
"district_id"
];
$district_params
[
'status'
]
=
0
;
$district_field
=
'id,district_name'
;
$district_result
=
$this
->
districtModel
->
getDistrict
(
$district_params
,
$district_field
);
$result
[
$key
][
"district_name"
]
=
$district_result
[
0
][
"district_name"
]
?
$district_result
[
0
][
"district_name"
]
:
'未知'
;
//计算区域人数
$params_
=
[];
$params_
[
'district_id'
]
=
$value
[
"district_id"
];
$params_
[
"status"
]
=
0
;
//只查询正常状态的经纪人
$result
[
$key
][
"team_num"
]
=
$this
->
agentModel
->
getAgentsCountByStoreId
(
$params_
);
break
;
case
3
:
$value
[
"index_"
]
=
$key
+
1
;
$info
=
$this
->
agentModel
->
getAgentsInfoByAgentId
(
$field
,
[
"district_id"
=>
$value
[
"district_id"
]
]);
$district_name
=
$this
->
agentModel
->
getStoreOrDistrict
([
"district_id"
=>
$value
[
"district_id"
],
"level"
=>
[
"in"
,
"30,40"
]
]);
if
(
count
(
$info
)
>
0
)
{
$value
[
"name"
]
=
count
(
$district_name
)
>
0
?
$district_name
[
0
][
"name"
]
:
"---"
;
$value
[
"img"
]
=
AGENTHEADERIMGURL
.
$district_name
[
0
][
"img"
];
$value
[
"store_name"
]
=
$info
[
0
][
"store_name"
];
$value
[
"district_name"
]
=
$info
[
0
][
"district_name"
];
}
//计算区域人数
$params
=
[];
$params
[
'district_id'
]
=
$value
[
"district_id"
];
$params
[
"status"
]
=
0
;
//只查询正常状态的经纪人
$value
[
"team_num"
]
=
$this
->
agentModel
->
getAgentsCountByStoreId
(
$params
);
array_push
(
$arr
,
$value
);
break
;
}
}
//dump(json_encode($where_));exit;
//return ['list'=>$arr,'total'=>0];
if
(
!
$
arr
){
if
(
!
$
result
){
exit
(
'暂无数据'
);
}
$export
=
new
ExportExcelUntil
();
foreach
(
$
arr
as
$key
=>
$v
)
{
foreach
(
$
result
as
$key
=>
$v
)
{
$e_data_old
[
'index'
]
=
$v
[
"index_"
];
//排名
if
(
$type
==
1
)
{
if
(
$type
==
1
)
{
$e_data_old
[
'district_name'
]
=
$v
[
'name'
];
//个人
}
elseif
(
$type
==
2
)
{
}
elseif
(
$type
==
2
)
{
$e_data_old
[
'district_name'
]
=
$v
[
'store_name'
];
//门店
}
else
{
}
else
{
$e_data_old
[
'district_name'
]
=
$v
[
'district_name'
];
//部门
}
$e_data_old
[
'performance_total'
]
=
$v
[
'performance_total'
];
//业绩
$e_data_old
[
'bargain_sum_total'
]
=
$v
[
'bargain_sum_total'
];
//成交单数
$e_data_old
[
'paylog_total'
]
=
$v
[
'paylog_total'
];
//收款数
$e_data_old
[
'march_in_num_total'
]
=
$v
[
'march_in_num_total'
];
//进场数
$e_data_old
[
'look_at_num_total'
]
=
$v
[
'look_at_num_total'
];
//报备数
$e_data_old
[
'add_house_num_total'
]
=
$v
[
'add_house_num_total'
];
//新增商铺
$e_data_old
[
'add_user_num_total'
]
=
$v
[
'add_user_num_total'
];
//新增客户
if
(
$type
!=
1
){
if
(
$type
!=
1
)
{
$e_data_old
[
'team_num'
]
=
$v
[
'team_num'
];
//团队人数
}
$e_data_new
[]
=
$e_data_old
;
$e_data_old
[
'add_user_num_total'
]
=
$v
[
'add_user_num_total'
];
//新增客户
$e_data_old
[
'add_house_num_total'
]
=
$v
[
'add_house_num_total'
];
//新增商铺
$e_data_old
[
'look_at_num_total'
]
=
$v
[
'look_at_num_total'
];
//报备数
$e_data_old
[
'march_in_num_total'
]
=
$v
[
'march_in_num_total'
];
//进场数
$e_data_old
[
'paylog_total'
]
=
$v
[
'paylog_total'
];
//收款数
$e_data_old
[
'bargain_sum_total'
]
=
$v
[
'bargain_sum_total'
];
//成交单数
$e_data_old
[
'performance_total'
]
=
$v
[
'performance_total'
];
//业绩
$e_data_new
[]
=
$e_data_old
;
}
...
...
@@ -466,14 +430,14 @@ class PerformanceService
$field_num
=
10
;
if
(
$type
==
1
){
$title
=
[
'排名'
,
'个人'
,
'
业绩'
,
'成交单数'
,
'收款数'
,
'进场数'
,
'报备数'
,
'新增商铺'
,
'新增客户
'
];
$title
=
[
'排名'
,
'个人'
,
'
新增客户'
,
'新增商铺'
,
'报备数'
,
'进场数'
,
'收款数'
,
'成交单数'
,
'业绩
'
];
$field_num
=
9
;
$title2
=
'个人业绩排行表('
.
$end_day
.
'至'
.
$yesterday
.
')'
;
}
elseif
(
$type
==
2
){
$title
=
[
'排名'
,
'门店'
,
'
业绩'
,
'成交单数'
,
'收款数'
,
'进场数'
,
'报备数'
,
'新增商铺'
,
'新增客户'
,
'团队人数
'
];
$title
=
[
'排名'
,
'门店'
,
'
团队人数'
,
'新增客户'
,
'新增商铺'
,
'报备数'
,
'进场数'
,
'收款数'
,
'成交单数'
,
'业绩
'
];
$title2
=
'门店业绩排行表('
.
$end_day
.
'至'
.
$yesterday
.
')'
;
}
else
{
$title
=
[
'排名'
,
'部门'
,
'
业绩'
,
'成交单数'
,
'收款数'
,
'进场数'
,
'报备数'
,
'新增商铺'
,
'新增客户'
,
'团队人数
'
];
$title
=
[
'排名'
,
'部门'
,
'
团队人数'
,
'新增客户'
,
'新增商铺'
,
'报备数'
,
'进场数'
,
'收款数'
,
'成交单数'
,
'业绩
'
];
$title2
=
'部门业绩排行表('
.
$end_day
.
'至'
.
$yesterday
.
')'
;
}
...
...
application/model/AAgents.php
View file @
21807c3b
...
...
@@ -527,6 +527,45 @@ class AAgents extends BaseModel
->
join
(
"a_district c"
,
"a.district_id = c.id"
,
"left"
)
->
where
(
$where_
)
->
select
();
//echo $this->getLastSql();
return
$result
;
}
/**
* 查询经纪人信息-业绩排行用
* @param $field
* @param $params
* @return false|\PDOStatement|string|\think\Collection
*/
public
function
getAgentsInfoByAgentIdForPerformanceService
(
$field
,
$params
)
{
$where_
=
[];
if
(
isset
(
$params
[
"agent_id"
]))
{
$where_
[
"a.id"
]
=
$params
[
"agent_id"
];
}
if
(
isset
(
$params
[
"phone"
]))
{
$where_
[
"a.phone"
]
=
$params
[
"phone"
];
}
if
(
isset
(
$params
[
"store_id"
]))
{
$where_
[
"b.id"
]
=
$params
[
"store_id"
];
$where_
[
"a.level"
]
=
array
(
"in"
,
"20,40"
);
}
if
(
isset
(
$params
[
"district_id"
]))
{
$where_
[
"c.id"
]
=
$params
[
"district_id"
];
$where_
[
"a.level"
]
=
array
(
"in"
,
"30,40"
);
}
$result
=
Db
::
table
(
$this
->
table
)
->
field
(
$field
)
->
alias
(
"a"
)
->
join
(
"a_store b"
,
"a.store_id = b.id"
,
"left"
)
->
join
(
"a_district c"
,
"a.district_id = c.id"
,
"left"
)
->
where
(
$where_
)
->
select
();
//echo $this->getLastSql();
return
$result
;
}
...
...
application/model/AStore.php
View file @
21807c3b
...
...
@@ -259,4 +259,20 @@ class AStore extends BaseModel
->
where
(
$where
)
->
find
();
}
/**
* 获取门店
* @param $params
* @return false|\PDOStatement|string|\think\Collection
*/
public
function
getStore
(
$params
,
$field
)
{
$result
=
$this
->
field
(
$field
)
->
where
(
$params
)
->
select
();
//echo Db::table($this->table)->getLastSql();
//dump($this->getLastSql());
return
$result
;
}
}
\ No newline at end of file
application/model/OBargainModel.php
View file @
21807c3b
...
...
@@ -1411,7 +1411,7 @@ class OBargainModel extends Model
->
limit
(
$pageSize
)
->
page
(
$pageNo
)
->
select
();
//
echo $this->db_->getLastSql();
echo
$this
->
db_
->
getLastSql
();
return
$result
;
}
...
...
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