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
c6890fe2
Commit
c6890fe2
authored
Apr 04, 2018
by
clone
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
首页均价和出售数量
parent
7c33e801
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
85 additions
and
37 deletions
+85
-37
Index.php
application/api/controller/Index.php
+5
-2
GHouses.php
application/model/GHouses.php
+61
-34
OrderModel.php
application/model/OrderModel.php
+19
-1
No files found.
application/api/controller/Index.php
View file @
c6890fe2
...
@@ -9,8 +9,10 @@
...
@@ -9,8 +9,10 @@
namespace
app\api\controller
;
namespace
app\api\controller
;
use
app\api\extend\Basic
;
use
app\api\extend\Basic
;
use
app\model\GHouses
;
use
app\model\HouseInfos
;
use
app\model\HouseInfos
;
use
app\model\JournalAccounts
;
use
app\model\JournalAccounts
;
use
app\model\OrderModel
;
class
Index
extends
Basic
class
Index
extends
Basic
{
{
...
@@ -23,9 +25,10 @@ class Index extends Basic
...
@@ -23,9 +25,10 @@ class Index extends Basic
*/
*/
public
function
averagePriceAndTurnover
(){
public
function
averagePriceAndTurnover
(){
$houseInfos
=
new
HouseInfo
s
();
$houseInfos
=
new
GHouse
s
();
$averagePrice
=
$houseInfos
->
getAveragePrice
();
$averagePrice
=
$houseInfos
->
getAveragePrice
();
$journalAccounts
=
new
JournalAccounts
();
// $journalAccounts = new JournalAccounts();
$journalAccounts
=
new
OrderModel
();
$turnover
=
$journalAccounts
->
getTurnover
();
$turnover
=
$journalAccounts
->
getTurnover
();
$result
[
'averagePrice'
]
=
$averagePrice
;
$result
[
'averagePrice'
]
=
$averagePrice
;
$result
[
'turnover'
]
=
$turnover
;
$result
[
'turnover'
]
=
$turnover
;
...
...
application/model/GHouses.php
View file @
c6890fe2
...
@@ -41,27 +41,27 @@ class GHouses extends BaseModel
...
@@ -41,27 +41,27 @@ class GHouses extends BaseModel
$dish_str
=
''
;
$dish_str
=
''
;
foreach
(
$agents_data
as
$k
=>
$v
)
{
foreach
(
$agents_data
as
$k
=>
$v
)
{
if
(
$v
[
'type'
]
==
1
)
{
if
(
$v
[
'type'
]
==
1
)
{
$agents_str
.=
$v
[
'id'
]
.
','
;
$agents_str
.=
$v
[
'id'
]
.
','
;
$data
[
'agents_name'
][]
=
$v
[
'id'
]
.
'-'
.
$v
[
'name'
]
.
'-'
.
$v
[
'phone'
];
$data
[
'agents_name'
][]
=
$v
[
'id'
]
.
'-'
.
$v
[
'name'
]
.
'-'
.
$v
[
'phone'
];
$data
[
'agents_name_arr'
][]
=
[
$data
[
'agents_name_arr'
][]
=
[
'id'
=>
$v
[
'id'
],
'id'
=>
$v
[
'id'
],
'name'
=>
$v
[
'name'
],
'name'
=>
$v
[
'name'
],
'phone'
=>
$v
[
'phone'
],
'phone'
=>
$v
[
'phone'
],
];
];
}
elseif
(
$v
[
'type'
]
==
2
)
{
}
elseif
(
$v
[
'type'
]
==
2
)
{
$dish_str
.=
$v
[
'id'
]
.
','
;
$dish_str
.=
$v
[
'id'
]
.
','
;
$data
[
'dish_name'
][]
=
$v
[
'id'
]
.
'-'
.
$v
[
'name'
]
.
'-'
.
$v
[
'phone'
];
$data
[
'dish_name'
][]
=
$v
[
'id'
]
.
'-'
.
$v
[
'name'
]
.
'-'
.
$v
[
'phone'
];
$data
[
'dish_name_arr'
][]
=
[
$data
[
'dish_name_arr'
][]
=
[
'id'
=>
$v
[
'id'
],
'id'
=>
$v
[
'id'
],
'name'
=>
$v
[
'name'
],
'name'
=>
$v
[
'name'
],
'phone'
=>
$v
[
'phone'
],
'phone'
=>
$v
[
'phone'
],
];
];
}
elseif
(
$v
[
'type'
]
==
3
)
{
}
elseif
(
$v
[
'type'
]
==
3
)
{
$exclusive_str
.=
$v
[
'id'
]
.
','
;
$exclusive_str
.=
$v
[
'id'
]
.
','
;
$data
[
'exclusive_name'
][]
=
$v
[
'id'
]
.
'-'
.
$v
[
'name'
]
.
'-'
.
$v
[
'phone'
];
$data
[
'exclusive_name'
][]
=
$v
[
'id'
]
.
'-'
.
$v
[
'name'
]
.
'-'
.
$v
[
'phone'
];
$data
[
'exclusive_name_arr'
][]
=
[
$data
[
'exclusive_name_arr'
][]
=
[
'id'
=>
$v
[
'id'
],
'id'
=>
$v
[
'id'
],
'name'
=>
$v
[
'name'
],
'name'
=>
$v
[
'name'
],
'phone'
=>
$v
[
'phone'
],
'phone'
=>
$v
[
'phone'
],
];
];
}
}
...
@@ -86,11 +86,11 @@ class GHouses extends BaseModel
...
@@ -86,11 +86,11 @@ class GHouses extends BaseModel
$data
[
'province_code'
]
=
$area
[
'0'
];
$data
[
'province_code'
]
=
$area
[
'0'
];
$data
[
'city_code'
]
=
$area
[
'1'
];
$data
[
'city_code'
]
=
$area
[
'1'
];
$data
[
'disc_code'
]
=
$area
[
'2'
];
$data
[
'disc_code'
]
=
$area
[
'2'
];
$data
[
'slide_show'
]
=
[];
$data
[
'slide_show'
]
=
[];
$data
[
'plan'
]
=
[];
$data
[
'plan'
]
=
[];
$data
[
'exclusive_img'
]
=
[];
$data
[
'exclusive_img'
]
=
[];
foreach
(
$img_data
as
$k
=>
$v
)
{
foreach
(
$img_data
as
$k
=>
$v
)
{
$v
->
img_name
=
CK_IMG_URL
.
'images/'
.
$v
->
img_name
;
$v
->
img_name
=
CK_IMG_URL
.
'images/'
.
$v
->
img_name
;
switch
(
$v
->
img_type
)
{
switch
(
$v
->
img_type
)
{
case
1
:
case
1
:
$data
[
'cover'
]
=
$v
->
img_name
;
$data
[
'cover'
]
=
$v
->
img_name
;
...
@@ -126,7 +126,7 @@ class GHouses extends BaseModel
...
@@ -126,7 +126,7 @@ class GHouses extends BaseModel
*/
*/
public
function
getHouseList
(
$pageNo
=
1
,
$pageSize
=
15
,
$order_
=
'id desc'
,
$field
=
''
,
$params
=
''
,
$agents_id
=
''
)
public
function
getHouseList
(
$pageNo
=
1
,
$pageSize
=
15
,
$order_
=
'id desc'
,
$field
=
''
,
$params
=
''
,
$agents_id
=
''
)
{
{
$data
=
$this
->
field
(
$field
)
$data
=
$this
->
field
(
$field
)
->
where
(
$params
)
->
where
(
$params
)
->
order
(
$order_
)
->
order
(
$order_
)
->
limit
(
$pageSize
)
->
limit
(
$pageSize
)
...
@@ -194,9 +194,9 @@ class GHouses extends BaseModel
...
@@ -194,9 +194,9 @@ class GHouses extends BaseModel
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
* @throws \think\exception\DbException
*/
*/
public
function
getHouseListDish
(
$pageNo
=
1
,
$pageSize
=
15
,
$order_
=
'id desc'
,
$field
=
''
,
$params
=
''
,
$agents_id
=
''
)
public
function
getHouseListDish
(
$pageNo
=
1
,
$pageSize
=
15
,
$order_
=
'id desc'
,
$field
=
''
,
$params
=
''
,
$agents_id
=
''
)
{
{
$data
=
$this
->
field
(
$field
)
->
alias
(
'a'
)
$data
=
$this
->
field
(
$field
)
->
alias
(
'a'
)
->
join
(
'g_houses_to_agents b'
,
'a.id=b.houses_id'
,
'left'
)
->
join
(
'g_houses_to_agents b'
,
'a.id=b.houses_id'
,
'left'
)
->
join
(
'a_agents c'
,
'b.agents_id=c.id'
,
'left'
)
->
join
(
'a_agents c'
,
'b.agents_id=c.id'
,
'left'
)
->
where
(
$params
)
->
where
(
$params
)
...
@@ -469,26 +469,28 @@ class GHouses extends BaseModel
...
@@ -469,26 +469,28 @@ class GHouses extends BaseModel
* @param $params
* @param $params
* @return array|false|\PDOStatement|string|\think\Model
* @return array|false|\PDOStatement|string|\think\Model
*/
*/
public
function
getHouseDetailById
(
$field
,
$params
){
public
function
getHouseDetailById
(
$field
,
$params
)
{
return
Db
::
table
(
$this
->
table
)
return
Db
::
table
(
$this
->
table
)
->
field
(
$field
)
->
field
(
$field
)
->
alias
(
"a"
)
->
alias
(
"a"
)
->
join
(
'g_houses_ext b'
,
'a.id=b.house_id'
,
'left'
)
->
join
(
'g_houses_ext b'
,
'a.id=b.house_id'
,
'left'
)
->
where
(
$params
)
->
where
(
$params
)
->
find
(
$params
[
"id"
]);
->
find
(
$params
[
"id"
]);
}
}
/**
/**
* 获取经纪人时间段中新添加的楼盘个数
* 获取经纪人时间段中新添加的楼盘个数
* @param $params
* @param $params
* @return int|string
* @return int|string
*/
*/
public
function
getAddHouseNumByAgentId
(
$params
){
public
function
getAddHouseNumByAgentId
(
$params
)
{
$where_
=
[];
$where_
=
[];
if
(
isset
(
$params
[
"agent_id"
]))
{
if
(
isset
(
$params
[
"agent_id"
]))
{
$where_
[
"upload_id"
]
=
$params
[
"agent_id"
];
$where_
[
"upload_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"
];
}
}
return
Db
::
table
(
$this
->
table
)
return
Db
::
table
(
$this
->
table
)
...
@@ -502,13 +504,14 @@ class GHouses extends BaseModel
...
@@ -502,13 +504,14 @@ class GHouses extends BaseModel
* @param $params
* @param $params
* @return false|\PDOStatement|string|\think\Collection
* @return false|\PDOStatement|string|\think\Collection
*/
*/
public
function
getAddHouseNumGroupTime
(
$params
){
public
function
getAddHouseNumGroupTime
(
$params
)
$field
=
"count(1) as num,DATE(create_time) as day"
;
{
$field
=
"count(1) as num,DATE(create_time) as day"
;
$where_
=
[];
$where_
=
[];
if
(
isset
(
$params
[
"agent_id"
]))
{
if
(
isset
(
$params
[
"agent_id"
]))
{
$where_
[
"upload_id"
]
=
$params
[
"agent_id"
];
$where_
[
"upload_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"
];
}
}
return
Db
::
table
(
$this
->
table
)
return
Db
::
table
(
$this
->
table
)
...
@@ -518,13 +521,14 @@ class GHouses extends BaseModel
...
@@ -518,13 +521,14 @@ class GHouses extends BaseModel
->
select
();
->
select
();
}
}
public
function
getAddHouseNum
(
$params
){
public
function
getAddHouseNum
(
$params
)
$field
=
"count(1) as num"
;
{
$field
=
"count(1) as num"
;
$where_
=
[];
$where_
=
[];
if
(
isset
(
$params
[
"agent_id"
]))
{
if
(
isset
(
$params
[
"agent_id"
]))
{
$where_
[
"upload_id"
]
=
$params
[
"agent_id"
];
$where_
[
"upload_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"
];
}
}
$result
=
Db
::
table
(
$this
->
table
)
$result
=
Db
::
table
(
$this
->
table
)
...
@@ -535,6 +539,28 @@ class GHouses extends BaseModel
...
@@ -535,6 +539,28 @@ class GHouses extends BaseModel
return
$result
;
return
$result
;
}
}
/**
* 获取月均价
* @return float
*/
function
getAveragePrice
()
{
//price
$params
[
'rent_type'
]
=
array
(
"eq"
,
3
);
//1.月租金 2.营业额扣点 3.每平方米租金
$params
[
'status'
]
=
array
(
"eq"
,
1
);
//上架的商铺
$sumPrice
=
Db
::
table
(
$this
->
table
)
->
where
(
$params
)
->
sum
(
"rent_price"
);
$count_
=
Db
::
table
(
$this
->
table
)
->
field
(
"id"
)
->
where
(
$params
)
->
count
(
"id"
);
$averagePrice
=
round
(
$sumPrice
/
$count_
);
return
$averagePrice
;
}
/******zw end ************/
/******zw end ************/
...
@@ -548,7 +574,8 @@ class GHouses extends BaseModel
...
@@ -548,7 +574,8 @@ class GHouses extends BaseModel
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
* @throws \think\exception\DbException
*/
*/
public
function
app_add
(
$params
){
public
function
app_add
(
$params
)
{
$case
=
new
ACase
();
$case
=
new
ACase
();
$case_id
=
$case
->
addCase
(
$params
[
'phone'
]);
$case_id
=
$case
->
addCase
(
$params
[
'phone'
]);
$params
[
'case_id'
]
=
$case_id
;
$params
[
'case_id'
]
=
$case_id
;
...
@@ -564,7 +591,7 @@ class GHouses extends BaseModel
...
@@ -564,7 +591,7 @@ class GHouses extends BaseModel
$house_id
=
$this
->
id
;
$house_id
=
$this
->
id
;
}
else
{
}
else
{
$params
[
'operation_id'
]
=
$params
[
'userId'
];
$params
[
'operation_id'
]
=
$params
[
'userId'
];
$params
[
'status'
]
=
2
;
$params
[
'status'
]
=
2
;
$this
->
allowField
(
true
)
->
isUpdate
(
true
)
->
save
(
$params
,
[
'id'
=>
$params
[
'id'
]
]);
$this
->
allowField
(
true
)
->
isUpdate
(
true
)
->
save
(
$params
,
[
'id'
=>
$params
[
'id'
]
]);
$house_id
=
$this
->
id
;
$house_id
=
$this
->
id
;
}
}
...
...
application/model/OrderModel.php
View file @
c6890fe2
...
@@ -3,6 +3,7 @@
...
@@ -3,6 +3,7 @@
namespace
app\model
;
namespace
app\model
;
use
think\Db
;
use
think\Db
;
use
think\helper\Time
;
use
think\Model
;
use
think\Model
;
/**
/**
...
@@ -151,5 +152,21 @@ class OrderModel extends Model
...
@@ -151,5 +152,21 @@ class OrderModel extends Model
->
find
();
->
find
();
}
}
// public function getOrder
/**
* 获取月均价
* @return float
*/
function
getTurnover
()
{
$timeArr
=
Time
::
lastWeek
();
$signStartTime
=
date
(
"Y-m-d H:i:s"
,
$timeArr
[
0
]);
$signEndTime
=
date
(
"Y-m-d H:i:s"
,
$timeArr
[
1
]);
$where_
[
'a.create_time'
]
=
array
(
"between"
,
array
(
$signStartTime
,
$signEndTime
)
);
$where_
[
'b.father_id'
]
=
array
(
"eq"
,
0
);
return
$this
->
db_
->
alias
(
"a"
)
->
join
(
"o_bargain b"
,
"a.id = b.order_id"
,
"left"
)
->
where
(
$where_
)
->
count
();
}
}
}
\ 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