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
592a317f
Commit
592a317f
authored
Sep 11, 2018
by
zhuwei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
运营数据
parent
5f66d0dc
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
184 additions
and
24 deletions
+184
-24
OperationData.php
application/index/controller/OperationData.php
+116
-24
AAgents.php
application/model/AAgents.php
+4
-0
ADistrict.php
application/model/ADistrict.php
+18
-0
ChatRelation.php
application/model/ChatRelation.php
+11
-0
OBargainModel.php
application/model/OBargainModel.php
+20
-0
OMarchInModel.php
application/model/OMarchInModel.php
+15
-0
No files found.
application/index/controller/OperationData.php
View file @
592a317f
...
...
@@ -7,7 +7,12 @@ namespace app\index\controller;
* Time: 15:40:20
*/
use
app\index\extend\Basic
;
use
app\model\AAgents
;
use
app\model\ADistrict
;
use
app\model\ChatRelation
;
use
app\model\GHouses
;
use
app\model\OBargainModel
;
use
app\model\OMarchInModel
;
use
app\model\Users
;
class
OperationData
extends
Basic
...
...
@@ -15,15 +20,15 @@ class OperationData extends Basic
private
$gHousesModel
;
private
$userModel
;
private
$marchInModel
;
public
function
__construct
(
$request
=
null
)
{
parent
::
__construct
(
$request
);
$this
->
gHousesModel
=
new
GHouses
();
$this
->
userModel
=
new
Users
();
$this
->
marchInModel
=
new
OMarchInModel
();
}
...
...
@@ -32,16 +37,14 @@ class OperationData extends Basic
* @return \think\Response
*/
public
function
chatUserNum
(){
$params
=
$this
->
params
;
$pageNo
=
empty
(
$params
[
'pageNo'
])
?
1
:
$params
[
'pageNo'
];
$pageSize
=
empty
(
$params
[
'pageSize'
])
?
15
:
$params
[
'pageSize'
];
$where
[
'create_time'
]
=
[
'between'
,
[
$params
[
'create_time_start'
]
.
' 00:00:00'
,
$params
[
'create_time_end'
]
.
' 23:59:59'
]];
//todo 发起微聊用户数
// $result["chat_user_num"] = ;
$chatRelationModel
=
new
ChatRelation
();
$where
[
'from_id'
]
=
[
'LIKE'
,
'%user_%'
];
$relationResult
=
$chatRelationModel
->
getChatUserNumOperation
(
$where
);
$result
[
"chat_user_num"
]
=
0
;
return
$this
->
response
(
200
,
'success'
,
$result
);
...
...
@@ -60,8 +63,26 @@ class OperationData extends Basic
$where
[
'create_time'
]
=
[
'between'
,
[
$params
[
'create_time_start'
]
.
' 00:00:00'
,
$params
[
'create_time_end'
]
.
' 23:59:59'
]];
//todo 发起微聊用户数
// $result["chat_user_num"] = ;
//todo 客户来电数
// 先查新所有部门
$district_list
=
$this
->
getDistrict
();
foreach
(
$district_list
as
$key
=>
$v
)
{
$result_
[
"id"
]
=
$v
[
'id'
];
$result_
[
"district_name"
]
=
$v
[
'district_name'
];
// 商场进场数
$agentIds
=
$this
->
getAgentIDsByDistrictId
(
$v
[
'id'
]);
// // dump($agentIds);
// $where["a.reception_id"] = array( "in", $agentIds );
// $res = $this->getFollowUpNum($where,0);
// // dump($res);
$result_
[
"user_phone_num"
]
=
0
;
$result
[]
=
$result_
;
}
return
$this
->
response
(
200
,
'success'
,
$result
);
...
...
@@ -121,32 +142,102 @@ class OperationData extends Basic
return
$this
->
response
(
200
,
'success'
,
$result
);
}
/**
* 各部门商场街铺进场数-商场街铺成交数
* @return \think\Response
*/
public
function
houseBargainNum
(){
$params
=
$this
->
params
;
$where
[
'a.create_time'
]
=
[
'between'
,
[
$params
[
'create_time_start'
]
.
' 00:00:00'
,
$params
[
'create_time_end'
]
.
' 23:59:59'
]];
// 先查新所有部门
$district_list
=
$this
->
getDistrict
();
foreach
(
$district_list
as
$key
=>
$v
)
{
$result_
[
"id"
]
=
$v
[
'id'
];
$result_
[
"district_name"
]
=
$v
[
'district_name'
];
// 商场进场数
$agentIds
=
$this
->
getAgentIDsByDistrictId
(
$v
[
'id'
]);
// dump($agentIds);
$where
[
"a.reception_id"
]
=
array
(
"in"
,
$agentIds
);
$res
=
$this
->
getFollowUpNum
(
$where
,
0
);
// dump($res);
$result_
[
"indoor_shop_look_at_num"
]
=
$res
;
// 街铺进场数
$res
=
$this
->
getFollowUpNum
(
$where
,
1
);
$result_
[
"outdoor_shop_look_at_num"
]
=
$res
;
// 商场成交数
$obargain
=
new
OBargainModel
();
$where_
[
'a.create_time'
]
=
$where
[
'a.create_time'
];
$where_
[
'a.agent_id'
]
=
array
(
"in"
,
$agentIds
);
// dump($where_);
// exit;
$performanceSum
=
$obargain
->
getAddBargainNumOperation
(
$where_
,
0
);
$result_
[
"indoor_shop_bargain_num"
]
=
isset
(
$performanceSum
[
0
][
"num"
])
?
$performanceSum
[
0
][
"num"
]
:
0
;
// 街铺成交数
$performanceSum
=
$obargain
->
getAddBargainNumOperation
(
$where_
,
1
);
$result_
[
"outdoor_shop_bargain_num"
]
=
isset
(
$performanceSum
[
0
][
"num"
])
?
$performanceSum
[
0
][
"num"
]
:
0
;
$result
[]
=
$result_
;
}
return
$this
->
response
(
200
,
'success'
,
$result
);
}
$pageNo
=
empty
(
$params
[
'pageNo'
])
?
1
:
$params
[
'pageNo'
];
$pageSize
=
empty
(
$params
[
'pageSize'
])
?
15
:
$params
[
'pageSize'
];
/**
* 获取部门列表
* @return \think\Response
*/
public
function
getDistrict
(){
$params
=
[];
$where
[
'create_time'
]
=
[
'between'
,
[
$params
[
'create_time_start'
]
.
' 00:00:00'
,
$params
[
'create_time_end'
]
.
' 23:59:59'
]];
$params
[
'status'
]
=
0
;
$field
=
'id,district_name'
;
$district_model
=
new
ADistrict
();
$result
=
$district_model
->
getDistrict
(
$params
,
$field
);
//todo 先查新所有部门
return
$result
;
//todo 商场进场数
// $result["chat_user_num"] = ;
}
//todo 街铺进场数
// $result["chat_user_num"] = ;
/**
* 获取进场数
* @return \think\Response
*/
public
function
getFollowUpNum
(
$params
,
$type
){
//shop_type '商铺类型(0商场,1街铺)'
$params
[
'c.shop_type'
]
=
$type
==
0
?
0
:
1
;
// dump($params);
$addMarchInNum
=
$this
->
marchInModel
->
getMarchInNumOperation
(
$params
);
//todo 商场成交数
return
$addMarchInNum
;
//todo 街铺成交数
// $result["chat_user_num"] = ;
return
$this
->
response
(
200
,
'success'
,
$result
);
}
public
function
getAgentIDsByDistrictId
(
$district_id
){
//查询总监下面门店的所有经纪人
$params
=
[];
$params
[
"district_id"
]
=
$district_id
;
$params
[
"status"
]
=
0
;
//只查询正常状态的经纪人
$agentModel
=
new
AAgents
();
$agentsArr
=
$agentModel
->
getAgentsByStoreId
(
$params
);
$agent_total
=
count
(
$agentsArr
);
if
(
$agent_total
>
0
)
{
$agentIds
=
""
;
foreach
(
$agentsArr
as
$key1
=>
$value1
)
{
$agentIds
.=
$value1
[
"id"
]
.
","
;
}
$agentIds
=
rtrim
(
$agentIds
,
","
);
//经纪人ID集合
}
//查询总监下面门店的所有经纪人 end
return
$agentIds
;
}
}
\ No newline at end of file
application/model/AAgents.php
View file @
592a317f
...
...
@@ -1187,4 +1187,7 @@ class AAgents extends BaseModel
return
$result
;
}
}
\ No newline at end of file
application/model/ADistrict.php
View file @
592a317f
...
...
@@ -218,4 +218,21 @@ class ADistrict extends BaseModel
return
$this
->
where
(
$where
)
->
value
(
$field
);
}
/**
* 获取部门
* @param $params
* @return false|\PDOStatement|string|\think\Collection
*/
public
function
getDistrict
(
$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/ChatRelation.php
View file @
592a317f
...
...
@@ -119,4 +119,14 @@ class ChatRelation extends Model
}
}
public
function
getChatUserNumOperation
(
$params
)
{
//dump($params);
$return
=
Db
::
table
(
$this
->
table
)
->
where
(
$params
)
->
count
();
dump
(
$this
->
getLastSql
(
$return
));
return
$return
;
}
}
\ No newline at end of file
application/model/OBargainModel.php
View file @
592a317f
...
...
@@ -1462,4 +1462,23 @@ class OBargainModel extends Model
// echo $this->getLastSql();
return
$result
;
}
public
function
getAddBargainNumOperation
(
$params
,
$type
)
{
$field
=
"count(1) as num"
;
//$where_["trade_type"] = 10;//产品要求统计数量必须是出租类型的180620
$params
[
"a.role"
]
=
3
;
//必须是反签方
$params
[
'c.shop_type'
]
=
$type
==
0
?
0
:
1
;
//dump($params);
$return
=
Db
::
table
(
$this
->
table
)
->
field
(
$field
)
->
alias
(
"a"
)
->
join
(
"o_order b"
,
"a.order_id = b.id"
,
"left"
)
->
join
(
"g_houses c"
,
"b.house_id = c.id"
,
"left"
)
->
where
(
$params
)
->
select
();
//echo $this->getLastSql();
return
$return
;
}
}
\ No newline at end of file
application/model/OMarchInModel.php
View file @
592a317f
...
...
@@ -374,4 +374,18 @@ class OMarchInModel extends Model
return
$result
;
}
public
function
getMarchInNumOperation
(
$params
)
{
//dump($params);
$return
=
Db
::
table
(
$this
->
table
)
->
alias
(
"a"
)
->
join
(
"o_order b"
,
"a.order_id = b.id"
,
"left"
)
->
join
(
'g_houses c'
,
'b.house_id = c.id'
,
'LEFT'
)
->
where
(
$params
)
->
count
();
//dump($this->getLastSql($return));
return
$return
;
}
}
\ 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