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
6d7ea626
Commit
6d7ea626
authored
Aug 14, 2019
by
clone
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
5e893071
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
150 additions
and
77 deletions
+150
-77
Shop.php
application/api/controller/Shop.php
+6
-74
ShopService.php
application/api/service/ShopService.php
+137
-0
LookShopService.php
application/api_broker/service/LookShopService.php
+7
-3
No files found.
application/api/controller/Shop.php
View file @
6d7ea626
...
...
@@ -11,6 +11,7 @@ namespace app\api\controller;
*/
use
app\api\extend\Basic
;
use
app\api\service\ShopService
;
use
app\api_broker\service\LookShopService
;
use
app\api_broker\service\VerifyService
;
use
app\index\service\HouseService
;
...
...
@@ -324,6 +325,7 @@ class Shop extends Basic
"id" => 7407,
"site_area" => 3, //1.c端 3.b端 4.pc端
//"user_id" => 2 //if c端 用户登录后传入user_id
"type" = >1 //1app 2小程序 3微信
);*/
...
...
@@ -334,6 +336,8 @@ class Shop extends Basic
if
(
empty
(
$params
[
'site_area'
]))
{
return
$this
->
response
(
"101"
,
"请求来源错误"
);
}
$user_id
=
empty
(
$params
[
"user_id"
])
?
0
:
$params
[
"user_id"
];
$type
=
empty
(
$params
[
"type"
])
?
1
:
$params
[
"type"
];
$field
=
"a.id,a.internal_title,a.external_title as title,a.external_address as address,a.city,a.disc,a.business_district_id,a.status,a.external_image_id,
a.industry_type,a.shop_area_start,a.shop_area_end,a.shop_type,a.residue_num,a.shop_sign,a.is_carefully_chosen,a.rent_type,
...
...
@@ -348,83 +352,11 @@ class Shop extends Basic
$conditions
[
'a.id'
]
=
array
(
"eq"
,
$params
[
"id"
]);
$result
=
$this
->
gHousesModel
->
getHouseDetailById
(
$field
,
$conditions
);
$service
=
new
ShopService
();
$result
=
$service
->
getShopDetail
(
$field
,
$conditions
,
$params
[
'site_area'
],
$user_id
,
$type
);
if
(
count
(
$result
)
<=
0
)
{
return
$this
->
response
(
"101"
,
'此楼盘不存在'
);
}
if
(
$result
[
"start_business_date"
]
==
"0000-00-00 00:00:00"
||
empty
(
$result
[
"start_business_date"
]))
{
$result
[
"start_business_date"
]
=
""
;
}
else
{
$result
[
"start_business_date"
]
=
date
(
"Y-m-d"
,
strtotime
(
$result
[
"start_business_date"
]));
}
if
(
$result
[
"opening_date"
]
==
"0000-00-00 00:00:00"
||
empty
(
$result
[
"opening_date"
]))
{
$result
[
"opening_date"
]
=
""
;
}
else
{
$result
[
"opening_date"
]
=
date
(
"Y-m-d"
,
strtotime
(
$result
[
"opening_date"
]));
}
$result
[
"rent_price"
]
=
$result
[
"rent_price"
]
*
0.01
;
$result
[
"management_fee"
]
=
$result
[
"management_fee"
]
*
0.01
;
$result
[
"slotting_fee"
]
=
$result
[
"slotting_fee"
]
*
0.01
;
if
(
$result
[
"external_slotting_fee"
]
!=
'-1'
)
{
$result
[
"external_slotting_fee"
]
=
$result
[
"external_slotting_fee"
]
*
0.01
;
}
if
(
empty
(
$result
[
'is_show_image'
]))
{
$result
[
"api_path"
]
=
SHOP_IMAGE_DEPOT_URL
;
$result
[
"images"
]
=
[];
if
(
$result
[
"external_image_id"
])
{
$param
[
"id"
]
=
array
(
"in"
,
$result
[
"external_image_id"
]);
$param
[
"img_status"
]
=
0
;
$field
=
'id,0 as house_id,img_type,label,img_name,img_status'
;
$res
=
$this
->
imageDepotModel
->
getImageDepotById
(
$field
,
$param
);
$result
[
"images"
]
=
count
(
$res
)
>
0
?
$res
:
[];
}
}
else
{
$result
[
"api_path"
]
=
CK_IMG_URL
.
'images/'
;
$param
[
"house_id"
]
=
$params
[
'id'
];
//todo 这里的是否要更改成b端后台上传的类型
$param
[
"img_type"
]
=
2
;
$result
[
"images"
]
=
$this
->
gHousesImgModel
->
getHouseImages
(
$param
,
15
);
$param
[
"img_type"
]
=
3
;
//图片类型:1效果图,2实景图,3样板图,4户型图,5交通图
$result
[
"plan_images"
]
=
$this
->
gHousesImgModel
->
getHouseImages
(
$param
,
1
);
}
if
(
$result
[
'status'
]
==
0
)
{
return
$this
->
response
(
"101"
,
'此楼盘已下架'
);
}
//todo 查询关注门店
if
(
$params
[
'site_area'
]
==
1
&&
isset
(
$params
[
'user_id'
]))
{
$attention
[
"user_id"
]
=
array
(
"eq"
,
$params
[
'user_id'
]);
$attention
[
"house_id"
]
=
array
(
"eq"
,
$params
[
"id"
]);
$attention
[
"is_del"
]
=
array
(
"eq"
,
0
);
$attResult
=
$this
->
attentionModel
->
getAttentionByUserIdAndHouseId
(
$attention
);
if
(
count
(
$attResult
)
>
0
)
$result
[
"attention"
]
=
$attResult
[
0
][
"id"
];
}
//todo 查询成交报告中的提交的业态拼接到已入驻中
$bargainModel
=
new
OBargainModel
();
$str
=
$bargainModel
->
selectBargainListByHouseId
(
$params
[
"id"
]);
$result
[
"enter_num"
]
.=
$str
;
$verify
=
new
VerifyService
();
$agentId
=
$verify
->
getPanpartyAgentsByHouseId
(
$params
[
"id"
]);
$result
[
"panParty"
]
=
$agentId
;
$result
[
"head_portrait"
]
=
AGENTHEADERIMGURL
;
$result
[
'new_sign_rule'
]
=
"付
{
$result
[
'payment_month'
]
}
押
{
$result
[
'deposit_month'
]
}
,签订
{
$result
[
'age_limit'
]
}
年"
;
$result
[
'payment_deposit'
]
=
empty
(
$result
[
'payment_month'
])
?
""
:
"付
{
$result
[
'payment_month'
]
}
押
{
$result
[
'deposit_month'
]
}
"
;
$result
[
'age_limit'
]
=
empty
(
$result
[
'age_limit'
])
?
""
:
"签订
{
$result
[
'age_limit'
]
}
年"
;
$result
[
'address'
]
=
$result
[
'city'
]
.
$result
[
'disc'
]
.
$result
[
'internal_title'
];
//7151
#商铺视频
$s_house
=
new
HouseService
();
$result
[
'shop_videos'
]
=
$s_house
->
getHouseVideoList
(
$params
[
"id"
]);
$result
[
'shop_videos_length'
]
=
$s_house
->
getHouseVideoLength
();
$this
->
lookShopService_
->
addUserLookShop
((
int
)
$params
[
"user_id"
],
(
int
)
$params
[
"id"
]);
return
$this
->
response
(
"200"
,
'request success'
,
$result
);
}
...
...
application/api/service/ShopService.php
0 → 100644
View file @
6d7ea626
<?php
namespace
app\api\service
;
use
app\api_broker\service\LookShopService
;
use
app\api_broker\service\VerifyService
;
use
app\index\service\HouseService
;
use
app\model\AttentionModel
;
use
app\model\GHouses
;
use
app\model\GHousesImgs
;
use
app\model\GImageDepot
;
use
app\model\GLabels
;
use
app\model\OBargainModel
;
use
app\model\OfficeGLabels
;
/**
* Created by PhpStorm.
* User: zw
* Date: 2019/8/14
* Time: 10:59
*/
class
ShopService
{
protected
$db
;
protected
$dbImg
;
protected
$labels
;
protected
$room_labels
;
protected
$attentionModel
;
private
$gHousesModel
;
private
$gHousesImgModel
;
private
$lookShopService_
;
private
$imageDepotModel
;
function
__construct
()
{
$this
->
db
=
new
GHouses
();
$this
->
dbImg
=
new
GHousesImgs
();
$this
->
labels
=
new
GLabels
();
$this
->
room_labels
=
new
OfficeGLabels
();
$this
->
attentionModel
=
new
AttentionModel
();
$this
->
gHousesModel
=
new
GHouses
();
$this
->
gHousesImgModel
=
new
GHousesImgs
();
$this
->
lookShopService_
=
new
LookShopService
();
$this
->
imageDepotModel
=
new
GImageDepot
();
}
/**
* @param $field
* @param $conditions
* @param $site_area
* @param $user_id
* @param $type
* @return array|false|\PDOStatement|string|\think\Model
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public
function
getShopDetail
(
$field
,
$conditions
,
$site_area
,
$user_id
,
$type
)
{
$result
=
$this
->
gHousesModel
->
getHouseDetailById
(
$field
,
$conditions
);
if
(
!
$result
||
$result
[
'status'
]
==
0
){
return
null
;
}
if
(
$result
[
"start_business_date"
]
==
"0000-00-00 00:00:00"
||
empty
(
$result
[
"start_business_date"
]))
{
$result
[
"start_business_date"
]
=
""
;
}
else
{
$result
[
"start_business_date"
]
=
date
(
"Y-m-d"
,
strtotime
(
$result
[
"start_business_date"
]));
}
if
(
$result
[
"opening_date"
]
==
"0000-00-00 00:00:00"
||
empty
(
$result
[
"opening_date"
]))
{
$result
[
"opening_date"
]
=
""
;
}
else
{
$result
[
"opening_date"
]
=
date
(
"Y-m-d"
,
strtotime
(
$result
[
"opening_date"
]));
}
$result
[
"rent_price"
]
=
$result
[
"rent_price"
]
*
0.01
;
$result
[
"management_fee"
]
=
$result
[
"management_fee"
]
*
0.01
;
$result
[
"slotting_fee"
]
=
$result
[
"slotting_fee"
]
*
0.01
;
if
(
$result
[
"external_slotting_fee"
]
!=
'-1'
)
{
$result
[
"external_slotting_fee"
]
=
$result
[
"external_slotting_fee"
]
*
0.01
;
}
if
(
empty
(
$result
[
'is_show_image'
]))
{
$result
[
"api_path"
]
=
SHOP_IMAGE_DEPOT_URL
;
$result
[
"images"
]
=
[];
if
(
$result
[
"external_image_id"
])
{
$param
[
"id"
]
=
array
(
"in"
,
$result
[
"external_image_id"
]);
$param
[
"img_status"
]
=
0
;
$field
=
'id,0 as house_id,img_type,label,img_name,img_status'
;
$res
=
$this
->
imageDepotModel
->
getImageDepotById
(
$field
,
$param
);
$result
[
"images"
]
=
count
(
$res
)
>
0
?
$res
:
[];
}
}
else
{
$result
[
"api_path"
]
=
CK_IMG_URL
.
'images/'
;
$param
[
"house_id"
]
=
$result
[
'id'
];
$param
[
"img_type"
]
=
2
;
$result
[
"images"
]
=
$this
->
gHousesImgModel
->
getHouseImages
(
$param
,
15
);
$param
[
"img_type"
]
=
3
;
//图片类型:1效果图,2实景图,3样板图,4户型图,5交通图
$result
[
"plan_images"
]
=
$this
->
gHousesImgModel
->
getHouseImages
(
$param
,
1
);
}
// 查询关注门店
if
(
$site_area
==
1
&&
$user_id
>
0
)
{
$attention
[
"user_id"
]
=
array
(
"eq"
,
$user_id
);
$attention
[
"house_id"
]
=
array
(
"eq"
,
$result
[
"id"
]);
$attention
[
"is_del"
]
=
array
(
"eq"
,
0
);
$attResult
=
$this
->
attentionModel
->
getAttentionByUserIdAndHouseId
(
$attention
);
if
(
count
(
$attResult
)
>
0
)
$result
[
"attention"
]
=
$attResult
[
0
][
"id"
];
}
// 查询成交报告中的提交的业态拼接到已入驻中
$bargainModel
=
new
OBargainModel
();
$str
=
$bargainModel
->
selectBargainListByHouseId
(
$result
[
"id"
]);
$result
[
"enter_num"
]
.=
$str
;
$verify
=
new
VerifyService
();
$agentId
=
$verify
->
getPanpartyAgentsByHouseId
(
$result
[
"id"
]);
$result
[
"panParty"
]
=
$agentId
;
$result
[
"head_portrait"
]
=
AGENTHEADERIMGURL
;
$result
[
'new_sign_rule'
]
=
"付
{
$result
[
'payment_month'
]
}
押
{
$result
[
'deposit_month'
]
}
,签订
{
$result
[
'age_limit'
]
}
年"
;
$result
[
'payment_deposit'
]
=
empty
(
$result
[
'payment_month'
])
?
""
:
"付
{
$result
[
'payment_month'
]
}
押
{
$result
[
'deposit_month'
]
}
"
;
$result
[
'age_limit'
]
=
empty
(
$result
[
'age_limit'
])
?
""
:
"签订
{
$result
[
'age_limit'
]
}
年"
;
$result
[
'address'
]
=
$result
[
'city'
]
.
$result
[
'disc'
]
.
$result
[
'internal_title'
];
//7151
#商铺视频
$s_house
=
new
HouseService
();
$result
[
'shop_videos'
]
=
$s_house
->
getHouseVideoList
(
$result
[
"id"
]);
$result
[
'shop_videos_length'
]
=
$s_house
->
getHouseVideoLength
();
$this
->
lookShopService_
->
addUserLookShop
((
int
)
$user_id
,(
int
)
$result
[
"id"
],
$type
);
return
$result
;
}
}
\ No newline at end of file
application/api_broker/service/LookShopService.php
View file @
6d7ea626
...
...
@@ -207,21 +207,25 @@ class LookShopService
/**
* @param int $user_id
* @param int $house_id
* @param int $type
* @return bool
*/
public
function
addUserLookShop
(
int
$user_id
,
int
$house_id
)
:
bool
public
function
addUserLookShop
(
int
$user_id
,
int
$house_id
,
int
$type
)
:
bool
{
$day
=
date
(
"Y-m-d"
,
time
());
$tModel
=
new
TLookShopUser
();
$params
[
"user_id"
]
=
$user_id
;
$params
[
"type"
]
=
$type
;
$params
[
"house_id"
]
=
$house_id
;
$params
[
"look_day"
]
=
$day
;
$result
=
$tModel
->
getList
(
$params
,
"a.id"
,
1
,
1
);
if
(
count
(
$result
)
>
0
){
$result
=
$tModel
->
getList
(
$params
,
"a.id"
,
1
,
1
);
if
(
count
(
$result
)
>
0
)
{
return
false
;
}
$arr
=
array
(
"user_id"
=>
$user_id
,
"type"
=>
$type
,
"house_id"
=>
$house_id
,
"look_day"
=>
$day
,
"create_time"
=>
date
(
"Y-m-d H:i:s"
,
time
()),
...
...
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