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
870b5fbe
Commit
870b5fbe
authored
Nov 23, 2018
by
zhuwei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
2
parent
7de523c6
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
64 additions
and
758 deletions
+64
-758
SpreadUser.php
application/api_broker/controller/SpreadUser.php
+64
-758
No files found.
application/api_broker/controller/SpreadUser.php
View file @
870b5fbe
<?php
<?php
namespace
app\api_broker\controller
;
namespace
app\api_broker\controller
;
use
app\api_broker\extend\Basic
;
use
app\api_broker\service\LookShopService
;
use
app\api_broker\service\VerifyService
;
use
app\api_broker\service\VipService
;
use
app\index\service\HouseService
;
use
app\model\AAgents
;
use
app\model\ACollectHouse
;
use
app\model\AttentionModel
;
use
app\model\GBusinessDistrict
;
use
app\model\GHouses
;
use
app\model\GHousesExt
;
use
app\model\GHousesFollowUp
;
use
app\model\GHousesImgs
;
use
app\model\GHousesToAgents
;
use
app\model\OBargainModel
;
use
app\model\Regions
;
use
think\Log
;
/**
/**
* Created by PhpStorm.
* Created by PhpStorm.
* User : zw
* User: zhuwei
* Date : 2018/2/26
* Date: 2018-11-21
* Time : 10:36
* Time: 10:43:58
* Intro:
*/
*/
class
Shop
extends
Basic
{
private
$gHousesModel
;
private
$gHousesImgModel
;
private
$attentionModel
;
private
$lookShopService_
;
function
__construct
(
$request
=
null
)
{
parent
::
__construct
(
$request
);
$this
->
gHousesModel
=
new
GHouses
();
$this
->
gHousesImgModel
=
new
GHousesImgs
();
$this
->
attentionModel
=
new
AttentionModel
();
$this
->
lookShopService_
=
new
LookShopService
();
}
/**
* 查询商品列表 b c端公用
* @return \think\Response
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public
function
getShopList
()
{
header
(
'Access-Control-Allow-Origin:*'
);
$params
=
$this
->
params
;
/* $params = array(
"site_area" => 4, //来源 1c首页 2c搜索 3b首页 4b搜索 5b报备
// "title" => "vv", //1,2 external_title ,3,4internal_title
"house_id" => 4,
"is_carefully_chosen" => 0, //精选商铺--0否1是
"shop_type" => 0, //商铺类型(0商场,1街铺)
"address" => "111",
"disc" => "黄浦区",
"business_id" => 11,
"industry_type" => "休闲娱乐",
"shop_area_start" => 45,//面积起始范围 街铺start和end面积一样
"shop_area_end" => 65,//面积结束范围
"rent_price_start" => 1000,//租金 rent_price
"rent_price_end" => 10000,//租金
"shop_sign" => "临近地铁,临近地铁2",
"agent_id" => 630, //添加经纪人id
"status" => 1, //1上架or2下架
"start_time" => "2018-05-25",
"end_time" => "2018-05-30",
"landlord_phone" => "17621970093",
//新增于180919
"p_district_name" => "一部",
"p_store_name" => "门店",
"p_agent_name" => "张三",
//是否对C端显示 181009
"is_show" => 0,//0是1否显示在c端用户
"is_exclusive_type" => 0,//是否独家0否1是
"is_lock" => 0,//是否锁盘0否1是
"pageNo" => 1,
"pageSize" => 15
);*/
$conditions
=
[];
if
(
empty
(
$params
[
'site_area'
]))
{
return
$this
->
response
(
"101"
,
"请求来源不能为空"
);
}
if
(
$params
[
'site_area'
]
==
1
||
$params
[
'site_area'
]
==
2
)
{
$field
=
"id,external_title as title,external_address as address,city,disc,business_district_id,status,industry_type
,shop_area_start,shop_area_end,shop_type,residue_num,shop_sign,is_carefully_chosen,rent_type,rent_price,is_exclusive_type"
;
}
else
{
// $field = "id,internal_title as title,internal_address as address,city,disc,business_district_id,status,industry_type
$field
=
"id,internal_title as title,internal_address as address,city,disc,business_district_id,status,industry_type
,shop_area_start,shop_area_end,shop_type,residue_num,shop_sign,is_carefully_chosen,rent_type,rent_price,is_lock
,is_exclusive_type,is_vip"
;
if
(
empty
(
$params
[
"city"
])){
$conditions
[
"city"
]
=
trim
(
$this
->
city
);
}
else
{
$conditions
[
"city"
]
=
$params
[
"city"
];
}
}
$pageNo
=
empty
(
$params
[
'pageNo'
])
?
1
:
$params
[
'pageNo'
];
$pageSize
=
empty
(
$params
[
'pageSize'
])
?
15
:
$params
[
'pageSize'
];
//c端查对外的名字 b端查对内的名字
if
(
isset
(
$params
[
'title'
])
&&
$params
[
'site_area'
]
==
1
||
$params
[
'site_area'
]
==
2
)
{
$conditions
[
'external_title'
]
=
array
(
"like"
,
"%"
.
trim
(
$params
[
'title'
])
.
"%"
);
}
else
if
(
isset
(
$params
[
'title'
]))
{
$conditions
[
'internal_title'
]
=
array
(
"like"
,
"%"
.
trim
(
$params
[
'title'
])
.
"%"
);
}
//c端查对外的名字 b端查对内的名字
if
(
isset
(
$params
[
'address'
])
&&
$params
[
'site_area'
]
==
1
||
$params
[
'site_area'
]
==
2
)
{
$conditions
[
'external_address'
]
=
array
(
"like"
,
"%"
.
trim
(
$params
[
'address'
])
.
"%"
);
}
else
if
(
isset
(
$params
[
'address'
]))
{
$conditions
[
'internal_address'
]
=
array
(
"like"
,
"%"
.
trim
(
$params
[
'address'
])
.
"%"
);
}
if
(
isset
(
$params
[
'start_time'
])
&&
isset
(
$params
[
'end_time'
]))
{
$start_time
=
date
(
'Y-m-d H:i:s'
,
$params
[
'start_time'
]);
$end_time
=
date
(
'Y-m-d H:i:s'
,
$params
[
'end_time'
]);
$conditions
[
'create_time'
]
=
array
(
'between'
,
array
(
$start_time
,
$end_time
));
}
$order_
=
""
;
$spTagArr
=
array
();
switch
(
$params
[
'site_area'
])
{
case
1
:
case
3
:
if
(
isset
(
$params
[
'is_carefully_chosen'
])
&&
$params
[
'is_carefully_chosen'
]
==
1
)
{
$conditions
[
'is_carefully_chosen'
]
=
array
(
'eq'
,
$params
[
'is_carefully_chosen'
]);
$order_
=
"home_page_sort desc, id desc"
;
}
break
;
case
2
:
case
4
:
case
5
:
if
(
isset
(
$params
[
'disc'
]))
{
//区域
$conditions
[
'disc'
]
=
array
(
'eq'
,
trim
(
$params
[
'disc'
]));
}
if
(
!
empty
(
$params
[
'business_id'
]))
{
//商圈
$conditions
[
'business_district_id'
]
=
array
(
'eq'
,
trim
(
$params
[
'business_id'
]));
}
if
(
isset
(
$params
[
'industry_type'
]))
{
//业态
$conditions
[
'industry_type'
]
=
array
(
'like'
,
"%"
.
trim
(
$params
[
'industry_type'
])
.
"%"
);
}
if
(
isset
(
$params
[
'shop_type'
]))
{
//商铺类型
$conditions
[
'shop_type'
]
=
array
(
"eq"
,
$params
[
'shop_type'
]);
}
if
(
isset
(
$params
[
'is_show'
]))
{
//是否对c端显示
$conditions
[
'is_show'
]
=
array
(
"eq"
,
$params
[
'is_show'
]);
}
if
(
isset
(
$params
[
'is_exclusive_type'
]))
{
//是否独家0否1是
$conditions
[
'is_exclusive_type'
]
=
array
(
"eq"
,
$params
[
'is_exclusive_type'
]);
}
if
(
isset
(
$params
[
'is_lock'
]))
{
//是否锁盘0否1是
$conditions
[
'is_lock'
]
=
array
(
"eq"
,
$params
[
'is_lock'
]);
}
//我的商铺 代表我是盘方的商铺
if
(
isset
(
$params
[
'agent_id'
]))
{
$verifyService
=
new
VerifyService
();
$ids
=
$verifyService
->
getPanpartyByAgentId
(
$params
[
'agent_id'
]);
//$conditions['upload_id'] = array( "eq", $params['agent_id'] );
$conditions
[
'id'
]
=
array
(
"in"
,
$ids
);
}
$area_start
=
isset
(
$params
[
'shop_area_start'
])
?
$params
[
'shop_area_start'
]
:
-
1
;
$area_end
=
isset
(
$params
[
'shop_area_end'
])
?
$params
[
'shop_area_end'
]
:
-
1
;
if
(
$area_start
>=
0
&&
$area_end
>=
0
)
{
//面积
$conditions
[
'shop_area_start'
]
=
array
(
'between'
,
array
(
$area_start
,
$area_end
));
$conditions
[
'shop_area_end'
]
=
array
(
'between'
,
array
(
$area_start
,
$area_end
));
}
else
if
(
$area_start
>=
0
&&
$area_end
<
0
)
{
//100米以上不用传结束面积
$conditions
[
'shop_area_start'
]
=
array
(
'egt'
,
$area_start
);
$conditions
[
'shop_area_end'
]
=
array
(
'egt'
,
$area_start
);
}
$price_start
=
isset
(
$params
[
'rent_price_start'
])
?
$params
[
'rent_price_start'
]
:
-
1
;
$price_end
=
isset
(
$params
[
'rent_price_end'
])
?
$params
[
'rent_price_end'
]
:
-
1
;
if
(
$price_start
>=
0
&&
$price_end
>=
0
)
{
//金额
$conditions
[
'rent_price'
]
=
array
(
'between'
,
array
(
$price_start
*
100
,
$price_end
*
100
));
}
else
if
(
$price_start
>=
0
&&
$price_end
<
0
)
{
$conditions
[
'rent_price'
]
=
array
(
'egt'
,
$price_start
*
100
);
}
if
(
isset
(
$params
[
'shop_sign'
])
&&
$params
[
'shop_sign'
]
!=
"全部"
)
{
//商铺标签
$shopTagsArr
=
array_filter
(
explode
(
','
,
$params
[
'shop_sign'
]));
if
(
count
(
$shopTagsArr
)
==
1
)
{
$spTagArr
[
'shop_sign'
]
=
array
(
'like'
,
"%"
.
trim
(
$shopTagsArr
[
0
])
.
"%"
);
}
else
{
foreach
(
$shopTagsArr
as
$key
=>
$val
)
{
$spTagArr
[
'shop_sign'
][]
=
array
(
'like'
,
"%"
.
trim
(
$val
)
.
"%"
);
}
}
}
$order_
=
"status asc,id desc"
;
break
;
default
:
return
$this
->
response
(
"101"
,
"请求数据异常"
);
}
if
(
!
empty
(
$conditions
))
{
$conditions
[
'status'
]
=
array
(
'eq'
,
1
);
//只显示上架
if
(
$params
[
'site_area'
]
==
1
||
$params
[
'site_area'
]
==
2
)
{
$conditions
[
'is_show'
]
=
array
(
'eq'
,
0
);
//c端只显示可显示的楼盘
}
elseif
(
$params
[
"site_area"
]
==
4
)
{
$conditions
[
'status'
]
=
!
empty
(
$params
[
'status'
])
?
$params
[
'status'
]
:
array
(
'in'
,
"1,2"
);
//b端搜索显示上架下架的
}
}
$houseIds
=
""
;
if
(
isset
(
$params
[
'house_id'
]))
{
$houseIds
=
$params
[
'house_id'
];
}
elseif
(
isset
(
$params
[
'landlord_phone'
]))
{
$houseIds
=
$this
->
returnHouseId
(
$params
[
'landlord_phone'
]);
if
(
empty
(
$houseIds
))
{
return
$this
->
response
(
"200"
,
"此条件没有找到数据"
);
}
}
elseif
(
isset
(
$params
[
'p_district_name'
])
||
isset
(
$params
[
'p_store_name'
])
||
isset
(
$params
[
'p_agent_name'
]))
{
$p_district_name
=
empty
(
$params
[
'p_district_name'
])
?
""
:
$params
[
'p_district_name'
];
$p_store_name
=
empty
(
$params
[
'p_store_name'
])
?
""
:
$params
[
'p_store_name'
];
$p_agent_name
=
empty
(
$params
[
'p_agent_name'
])
?
""
:
$params
[
'p_agent_name'
];
$houseIds
=
$this
->
returnHouseIdByPanParty
(
$p_district_name
,
$p_store_name
,
$p_agent_name
);
if
(
empty
(
$houseIds
))
{
return
$this
->
response
(
"200"
,
"此条件没有找到数据"
);
}
}
if
(
!
empty
(
$houseIds
))
{
$conditions
[
'id'
]
=
array
(
"in"
,
$houseIds
);
}
//如果有传经纪人id则代表我的商铺不区分状态
if
(
isset
(
$params
[
'agent_id'
]))
{
unset
(
$conditions
[
"city"
]);
//$conditions['status'] = array( 'in', "1,2" ); //只显示上架或下架的
$conditions
[
'status'
]
=
!
empty
(
$params
[
'status'
])
?
$params
[
'status'
]
:
array
(
'in'
,
"1,2"
);
//只显示上架或下架的
}
$result
=
$this
->
gHousesModel
->
getHousesList
(
$pageNo
,
$pageSize
,
$order_
,
$field
,
$conditions
,
$spTagArr
);
//获取图片信息
foreach
(
$result
as
$key
=>
$val
)
{
$result
[
$key
][
"api_path"
]
=
CK_IMG_URL
.
'images/'
;
$result
[
$key
][
"rent_price"
]
=
$val
[
"rent_price"
]
*
0.01
;
$result
[
$key
][
"title"
]
=
$val
[
"disc"
]
.
$result
[
$key
][
"title"
];
$param
[
"house_id"
]
=
$val
[
"id"
];
$param
[
"img_type"
]
=
1
;
//默认主图
$result
[
$key
][
"images"
]
=
$this
->
gHousesImgModel
->
getHouseImages
(
$param
,
1
);
if
(
$params
[
"site_area"
]
==
3
||
$params
[
"site_area"
]
==
4
)
{
$isLook
=
$this
->
lookShopService_
->
isLooked
(
$this
->
agentId
,
$val
[
"id"
]);
$result
[
$key
][
"is_look"
]
=
$isLook
;
}
//锁盘后,盘方、独家方、有权限的可以查看
$result
[
$key
][
"look_lock"
]
=
0
;
if
(
isset
(
$val
[
'is_lock'
])
&&
$val
[
'is_lock'
]
==
1
)
{
$vip
=
new
VipService
();
if
(
!
$vip
->
vip
(
$this
->
agentId
,
'index/lockHouse'
))
{
$result
[
$key
][
"look_lock"
]
=
1
;
}
$m_agent
=
new
GHousesToAgents
();
$agent_where
[
'a.agents_id'
]
=
$this
->
agentId
;
$agent_where
[
'a.type'
]
=
[
'in'
,
'2,3'
];
$agent_where
[
'a.houses_id'
]
=
$val
[
'id'
];
$agent_where
[
'a.is_del'
]
=
0
;
$agent_data
=
$m_agent
->
getAgentsHouseField
(
'a.id'
,
$agent_where
);
foreach
(
$agent_data
as
$vvv
)
{
if
(
$vvv
>
0
)
{
$result
[
$key
][
"look_lock"
]
=
1
;
}
}
}
}
if
(
empty
(
$result
))
{
use
app\api_broker\extend\Basic
;
return
$this
->
response
(
"200"
,
"此条件没有找到数据"
)
;
use
app\model\USpreadUser
;
}
use
think\Request
;
return
$this
->
response
(
"200"
,
'request success'
,
$result
);
class
SpreadUser
extends
Basic
}
{
/**
protected
$uSpreadUser
;
* 返回楼盘id
* @param $landlord_phone
* @return string
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
private
function
returnHouseId
(
$landlord_phone
)
{
$houseExtModel
=
new
GHousesExt
();
$houseIds
=
$houseExtModel
->
getHouseId
(
$landlord_phone
);
$ids
=
""
;
if
(
count
(
$houseIds
)
>
0
)
{
foreach
(
$houseIds
as
$item
)
{
$ids
.=
$item
[
"house_id"
]
.
","
;
}
$ids
=
rtrim
(
$ids
,
","
);
}
return
$ids
;
}
/**
public
function
__construct
(
$request
=
null
)
* 返回盘方楼盘id
* @param $p_district_name
* @param $p_store_name
* @param $p_agent_name
* @return false|null|\PDOStatement|string|\think\Collection
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
private
function
returnHouseIdByPanParty
(
$p_district_name
,
$p_store_name
,
$p_agent_name
)
{
{
$agentModel
=
new
AAgents
();
parent
::
__construct
(
$request
);
$params
=
[];
$this
->
uSpreadUser
=
new
USpreadUser
();
if
(
$p_district_name
)
{
$params
[
"c.district_name"
]
=
array
(
"like"
,
"%"
.
trim
(
$p_district_name
)
.
"%"
);
}
if
(
$p_store_name
)
{
$params
[
"b.store_name"
]
=
array
(
"like"
,
"%"
.
trim
(
$p_store_name
)
.
"%"
);
}
if
(
$p_agent_name
)
{
$params
[
"a.name"
]
=
array
(
"like"
,
"%"
.
trim
(
$p_agent_name
)
.
"%"
);
}
$ids
=
""
;
if
(
empty
(
$params
))
{
return
$ids
;
}
$agentArr
=
$agentModel
->
getAgentsInfoByShop
(
"a.id"
,
$params
);
$agentIds
=
""
;
if
(
count
(
$agentArr
)
<
1
)
{
return
$ids
;
}
else
{
foreach
(
$agentArr
as
$item
)
{
$agentIds
.=
$item
[
"id"
]
.
","
;
}
$agentIds
=
rtrim
(
$agentIds
,
","
);
}
$verifyService
=
new
VerifyService
();
$selectParams
=
array
(
"in"
,
$agentIds
);
$houseIds
=
$verifyService
->
getPanpartyByAgentId
(
$selectParams
);
if
(
$houseIds
)
{
$ids
=
$houseIds
;
}
return
$ids
;
}
}
/**
/**
*
楼盘详情
*
推广手机号码记录
*
@return \think\Response
*
User: 朱伟
*
@throws \think\db\exception\DataNotFoundException
*
Date: 2018-11-21
*
@throws \think\db\exception\ModelNotFoundException
*
Time: 10:43:58
*
@throws \think\exception\DbException
*
http://showdoc.tonglianjituan.com/index.php?s=/1&page_id=686
*/
*/
public
function
getShopDetail
()
public
function
addSpreadUser
(){
{
header
(
'Access-Control-Allow-Origin:*'
);
$params
=
$this
->
params
;
$params
=
$this
->
params
;
/* $params = array(
$params
[
"ip"
]
=
$this
->
getUserIp
();
"id" => 3084,
"site_area" => 3, //1.c端 3.b端 4.pc端
"user_id" => 2 //if c端 用户登录后传入user_id
);*/
$conditions
=
[];
if
(
empty
(
$params
[
'id'
]))
{
return
$this
->
response
(
"101"
,
"详情id不能为空"
);
}
if
(
empty
(
$params
[
'site_area'
]))
{
return
$this
->
response
(
"101"
,
"请求来源错误"
);
}
if
(
$params
[
'site_area'
]
==
3
)
{
// $field = "a.id,a.internal_title as title,a.internal_address as address,a.city,a.disc,a.business_district_id,a.status,
$field
=
"a.id,a.internal_title as title,a.internal_address as address,a.city,a.disc,a.business_district_id,a.status,
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,
a.rent_price,a.management_fee,a.slotting_fee,a.total,a.market_area,a.is_has_gas,a.file_path,a.longitude,a.latitude,
b.enter_num,b.internal_item_advantage as item_advantage,b.sign_rule,b.do_business_date, b.opening_date,b.traffic,
b.auditorium,b.tiny_brochure_url,b.start_business_date,a.upload_id,b.fee_rule,b.landlord_remark,a.create_time,b.landlord_phone,
a.is_show,a.is_exclusive_type,a.update_time,a.external_title,a.external_address,b.external_item_advantage,b.agent_start_time,b.agent_end_time"
;
$conditions
[
'a.status'
]
=
array
(
"neq"
,
3
);
}
else
{
//$field = "a.id,a.internal_title,a.internal_address,a.external_title,a.external_address,
$field
=
"a.id,a.internal_title,a.internal_address,a.external_title,a.external_address,
a.city,a.disc,a.business_district_id,a.status,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, a.rent_price,a.management_fee,a.slotting_fee,
a.total,a.market_area,a.is_has_gas,a.file_path,a.longitude,a.latitude,a.is_show,a.is_exclusive_type,
b.enter_num,b.internal_item_advantage as item_advantage, b.sign_rule,b.do_business_date, b.opening_date,b.traffic,
b.auditorium,b.tiny_brochure_url,b.start_business_date,a.upload_id,b.fee_rule,b.landlord_remark,a.create_time,b.landlord_phone
,a.update_time,b.agent_start_time,b.agent_end_time,b.internal_item_advantage,b.external_item_advantage"
;
$conditions
[
'a.status'
]
=
array
(
"neq"
,
3
);
}
$conditions
[
'a.id'
]
=
array
(
"eq"
,
$params
[
"id"
]);
$field
.=
',b.age_limit,b.payment_month,b.deposit_month,b.external_slotting_fee,c.agents_id, b.area_width,b.depth,
b.electric_quantity,b.voltage,b.exhaust_fume,b.running_water,b.downriver,b.business_scope,b.decoration,b.source
,b.rim_mating,b.section,b.crowd,b.other,a.is_lock,b.project_name,a.is_vip'
;
$result
=
$this
->
gHousesModel
->
getHouseDetailById
(
$field
,
$conditions
);
if
(
count
(
$result
)
<=
0
)
{
return
$this
->
response
(
"101"
,
'此楼盘不存在'
);
}
if
(
$result
[
"start_business_date"
]
==
"0000-00-00 00:00:00"
||
empty
(
$result
[
"start_business_date"
]))
{
/*$params = array(
$result
[
"start_business_date"
]
=
""
;
"type" => 1,
}
else
{
"phone" => 18112347152,
$result
[
"start_business_date"
]
=
date
(
"Y-m-d"
,
strtotime
(
$result
[
"start_business_date"
]));
"ip" => $params["ip"]
}
);*/
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
;
}
$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
(
$params
[
'site_area'
]
==
3
||
$params
[
"site_area"
]
==
4
)
{
$is_show_landlord
=
1
;
if
(
$result
[
'is_vip'
]
==
1
)
{
$house_service
=
new
HouseService
();
$is_show_landlord
=
$house_service
->
checkLandlordShow
(
$this
->
agentId
,
$result
[
'id'
]);
}
if
(
$is_show_landlord
)
{
$result
[
'landlord_phone'
]
=
json_decode
(
$result
[
'landlord_phone'
],
true
);
$result
[
'is_show_landlord'
]
=
1
;
}
else
{
$result
[
'landlord_phone'
]
=
[[
'name'
=>
''
,
'phone'
=>
''
]];
$result
[
'is_show_landlord'
]
=
0
;
}
// $result['create_time'] = date('Y-m-d', strtotime($result['create_time']));
}
if
(
$params
[
'site_area'
]
==
4
)
{
//封面图
$param
[
"img_type"
]
=
1
;
$cover_plan
=
$this
->
gHousesImgModel
->
getHouseImages
(
$param
,
15
);
$result
[
"cover_plan"
]
=
$cover_plan
[
0
];
}
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
;
// 计数开始
if
(
$params
[
"site_area"
]
==
3
||
$params
[
"site_area"
]
==
4
&&
$result
)
{
$lookShopArr
=
$this
->
lookShopService_
->
countLookShopNum
((
int
)
$this
->
agentId
,
(
int
)
$params
[
"id"
]);
//判断看铺数量是否上限
if
(
$lookShopArr
)
{
if
(
$lookShopArr
[
"residue_num"
]
==
0
&&
!
$lookShopArr
[
"isExist"
]
&&
!
$lookShopArr
[
"isPanParty"
])
{
Log
::
record
(
'info ----countLookShopNum------121113-'
,
"info"
);
return
$this
->
response
(
"102"
,
"您今天的看铺数量已达上限!"
);
}
$result
[
"lookShopArr"
]
=
$lookShopArr
;
}
//上传人
$m_agent
=
new
AAgents
();
$upload_data
=
$m_agent
->
getAgentById
(
'name,phone'
,
[
'agent_id'
=>
$result
[
'upload_id'
]]);
$result
[
'upload_user'
]
=
$upload_data
[
0
][
'name'
]
.
'-'
.
$upload_data
[
0
][
'phone'
];
//独家方
if
(
$result
[
'is_exclusive_type'
]
==
1
)
{
$m_house_agent
=
new
GHousesToAgents
();
$where_house
[
'is_del'
]
=
0
;
$where_house
[
'type'
]
=
3
;
$where_house
[
'houses_id'
]
=
$result
[
'id'
];
$house_agent_data
=
$m_house_agent
->
getAgentsByHouseId
(
'name,phone'
,
$where_house
);
$result
[
'exclusive_user'
]
=
$house_agent_data
[
0
][
'name'
];
$result
[
'exclusive_phone'
]
=
$house_agent_data
[
0
][
'phone'
];
}
}
//是否被收藏
if
(
!
isset
(
$params
[
"phone"
])
or
!
isset
(
$params
[
"ip"
]))
{
$result
[
"is_collect"
]
=
2
;
return
$this
->
response
(
"101"
,
"请求参数错误"
);
if
(
$params
[
'site_area'
]
==
3
)
{
//先判断是否已经存在数据
$field
=
'id,status'
;
$get_params
[
'agents_id'
]
=
$params
[
"user_id"
];
//实际就是agents_id,前端之前传错了,将错就错
$get_params
[
'house_id'
]
=
$params
[
"id"
];
$collect_house
=
new
ACollectHouse
();
$res
=
$collect_house
->
getCollectHouse
(
$field
,
$get_params
);
if
(
$res
&&
(
$res
[
0
][
'status'
]
==
1
))
{
//如果存在
$result
[
"is_collect"
]
=
1
;
}
$vip_services
=
new
VipService
();
$result
[
'is_can_edit'
]
=
$vip_services
->
vip
(
$params
[
'user_id'
],
'index/houseEdit'
);
}
$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'
]
}
年"
;
return
$this
->
response
(
"200"
,
'request success'
,
$result
);
}
/**
* 新增和编辑商铺
*
* @return \think\Response
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public
function
edit
()
{
$result
[
'code'
]
=
200
;
$result
[
'msg'
]
=
''
;
$result_data
=
[];
if
(
$this
->
request
->
isPost
())
{
$house
=
new
HouseService
();
$data
=
$house
->
addHouse
(
$this
->
params
,
$this
->
agentId
,
1
);
if
(
$data
[
'status'
]
==
'successful'
)
{
$result_data
[
'house_id'
]
=
$data
[
'data'
][
'house_id'
];
$result_data
[
'internal_title'
]
=
$data
[
'data'
][
'internal_title'
];
$result
[
'msg'
]
=
'新增或编辑成功'
;
}
else
{
$result
[
'code'
]
=
101
;
$result
[
'msg'
]
=
$data
[
'msg'
];
}
}
else
{
if
(
empty
(
$this
->
params
[
'id'
]))
{
$result
[
'code'
]
=
101
;
$result
[
'msg'
]
=
'Id is null'
;
}
else
{
//获取商铺详情
$result_data
=
$this
->
gHousesModel
->
getHouseById
(
$this
->
params
[
'id'
],
1
);
}
}
}
return
$this
->
response
(
$result
[
'code'
],
$result
[
'msg'
],
$result_data
);
//先判断是否已经存在数据
}
$field
=
'phone,ip,create_time'
;
$where
[
'ip'
]
=
$params
[
"ip"
];
/**
$where_or
[
'phone'
]
=
$params
[
"phone"
];
* 新增和编辑商铺
*
* @return \think\Response
*/
public
function
editV2
()
{
return
$this
->
response
(
101
,
'请升级至最新版本'
);
}
/**
$res
=
$this
->
uSpreadUser
->
getSpreadUser
(
$field
,
$where
,
$where_or
);
* 上传商铺图片
*
* @return \think\Response
*/
public
function
uploadHouseFile
()
{
$data
[
'status'
]
=
101
;
$data
[
'msg'
]
=
''
;
$data
[
'data'
]
=
''
;
$file
=
request
()
->
file
(
'file'
);
if
(
$res
){
//如果存在
if
(
$file
)
{
if
(
$res
[
0
][
'phone'
]
==
$params
[
"phone"
]){
$path
=
ROOT_PATH
.
'public'
.
DS
.
'resource'
.
DS
.
'lib'
.
DS
.
'Attachments'
.
DS
.
'images'
;
return
$this
->
response
(
"101"
,
"手机号已存在"
);
$info
=
$file
->
validate
([
'size'
=>
1024000
,
'ext'
=>
'jpg,png'
])
->
move
(
$path
);
}
elseif
((
$res
[
0
][
'ip'
]
==
$params
[
"ip"
])
and
((
time
()
-
strtotime
(
$res
[
0
][
'create_time'
]))
<
(
60
*
30
))){
if
(
$info
)
{
return
$this
->
response
(
"101"
,
"30分钟内不允许重复提交"
);
$img_path
=
$info
->
getSaveName
();
//生成的图片路径
$data
[
'img_type'
]
=
$this
->
params
[
'img_type'
];
$data
[
'img_name'
]
=
$img_path
;
$img
=
new
GHousesImgs
();
$img
->
addHouseImg
(
$data
,
$this
->
params
[
'house_id'
]);
$data
[
'status'
]
=
200
;
$data
[
'msg'
]
=
'上传成功'
;
$data
[
'data'
]
=
[
'file_name'
=>
CK_IMG_URL
.
'images'
.
DS
.
$img_path
,
'save_path'
=>
$img_path
];
}
else
{
// 上传失败获取错误信息
$data
[
'msg'
]
=
$file
->
getError
();
}
}
}
else
{
$data
[
'msg'
]
=
'没有该文件'
;
}
return
$this
->
response
(
$data
[
'status'
],
$data
[
'msg'
],
$data
[
'data'
]);
}
/**
* 删除图片
*
* @return \think\Response
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public
function
delHouseFile
()
{
$data
[
'status'
]
=
101
;
$data
[
'msg'
]
=
''
;
$data
[
'data'
]
=
''
;
if
(
empty
(
$this
->
params
[
'save_path'
])
||
empty
(
$this
->
params
[
'house_id'
]))
{
return
$this
->
response
(
$data
[
'status'
],
'Save_path or id house_id is null'
,
$data
[
'data'
]);
}
}
$img
=
new
GHousesImgs
();
$insert
[
"phone"
]
=
$params
[
'phone'
];
$id
=
$img
->
getHouseImagesInfo
(
'id'
,
[
$insert
[
"ip"
]
=
$params
[
'ip'
];
'house_id'
=>
$this
->
params
[
'house_id'
],
$insert
[
"type"
]
=
$params
[
'type'
];
'img_name'
=>
$this
->
params
[
'save_path'
],
$res
=
$this
->
uSpreadUser
->
saveSpreadUser
(
$insert
);
//int(1)
'img_status'
=>
0
if
(
$res
)
{
]);
return
$this
->
response
(
"200"
,
"成功"
);
if
(
empty
(
$id
[
'id'
]))
{
$data
[
'msg'
]
=
'没有该文件'
;
}
else
{
}
else
{
$path
=
ROOT_PATH
.
'public'
.
DS
.
'resource'
.
DS
.
'lib'
.
DS
.
'Attachments'
.
DS
.
'Images/'
;
return
$this
->
response
(
"101"
,
"失败"
);
@
unlink
(
$path
.
$this
->
params
[
'save_path'
]);
$img
->
editData
([
'img_status'
=>
1
],
$id
[
'id'
],
'id'
);
$data
[
'status'
]
=
200
;
}
}
return
$this
->
response
(
$data
[
'status'
],
$data
[
'msg'
],
$data
[
'data'
]);
}
}
/**
* 获取省市区数据
*
* @return \think\Response
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public
function
getAddress
()
{
header
(
'Access-Control-Allow-Origin:*'
);
$regions
=
new
Regions
();
$data
=
$regions
->
getRegionsCity
();
return
$this
->
response
(
200
,
''
,
$data
);
}
/**
/**
* 获取省市区
* 获取用户提交IP
*
* @return string
* @return \think\Response
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
*/
public
function
getRegions
()
public
function
getUserIp
()
{
{
//strcasecmp 比较两个字符,不区分大小写。返回0,>0,<0。
header
(
'Access-Control-Allow-Origin:*'
);
if
(
getenv
(
'HTTP_CLIENT_IP'
)
&&
strcasecmp
(
getenv
(
'HTTP_CLIENT_IP'
),
'unknown'
))
{
$regions
=
new
Regions
();
$ip
=
getenv
(
'HTTP_CLIENT_IP'
);
$data
=
$regions
->
getRegions
(
$this
->
params
[
'code'
],
$this
->
params
[
'parent_code'
]);
}
elseif
(
getenv
(
'HTTP_X_FORWARDED_FOR'
)
&&
strcasecmp
(
getenv
(
'HTTP_X_FORWARDED_FOR'
),
'unknown'
))
{
return
$this
->
response
(
200
,
''
,
$data
);
$ip
=
getenv
(
'HTTP_X_FORWARDED_FOR'
);
}
elseif
(
getenv
(
'REMOTE_ADDR'
)
&&
strcasecmp
(
getenv
(
'REMOTE_ADDR'
),
'unknown'
))
{
$ip
=
getenv
(
'REMOTE_ADDR'
);
}
elseif
(
isset
(
$_SERVER
[
'REMOTE_ADDR'
])
&&
$_SERVER
[
'REMOTE_ADDR'
]
&&
strcasecmp
(
$_SERVER
[
'REMOTE_ADDR'
],
'unknown'
))
{
$ip
=
$_SERVER
[
'REMOTE_ADDR'
];
}
$res
=
preg_match
(
'/[\d\.]{7,15}/'
,
$ip
,
$matches
)
?
$matches
[
0
]
:
''
;
return
$res
;
}
}
/**
public
function
getVolume
(){
* 新增店铺跟进
$data
[
'shop_num'
]
=
32789
;
* @return \think\Response
$data
[
'volume_last_week'
]
=
32789
;;
* @throws \think\db\exception\DataNotFoundException
return
$this
->
response
(
"200"
,
"成功"
,
$data
);
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public
function
addShopFollowUp
()
{
header
(
'Access-Control-Allow-Origin:*'
);
$params
=
$this
->
params
;
/* $params = array(
"house_id" => 1,
"follow_up_info"=>"123123131",
"agent_id"=>1,
"agent_name"=>"2324",
"agent_phone"=>"13766166616",
);*/
if
(
!
isset
(
$params
[
"house_id"
])
||
!
isset
(
$params
[
"follow_up_info"
])
||
!
isset
(
$params
[
"agent_id"
])
||
!
isset
(
$params
[
"agent_name"
])
||
!
isset
(
$params
[
"agent_phone"
]))
{
return
$this
->
response
(
"101"
,
"请求参数错误"
);
}
$result
=
$this
->
gHousesModel
->
getHouseInfo
(
'province,city,disc'
,
[
'id'
=>
$params
[
"house_id"
]]);
if
(
$result
)
{
$params
[
'province'
]
=
$result
[
0
][
'province'
]
?
$result
[
0
][
'province'
]
:
'上海市'
;
$params
[
'city'
]
=
$result
[
0
][
'city'
]
?
$result
[
0
][
'city'
]
:
'上海市'
;
$params
[
'disc'
]
=
$result
[
0
][
'disc'
]
?
$result
[
0
][
'disc'
]
:
'黄浦区'
;
}
$follow_up_model
=
new
GHousesFollowUp
();
$id
=
$follow_up_model
->
addHousesFollowUp
(
$params
);
if
(
$id
>
0
)
{
return
$this
->
response
(
"200"
,
"request success"
,
[
"id"
=>
$id
]);
}
else
{
return
$this
->
response
(
"200"
,
"request error"
);
}
}
}
/**
}
* 获取全部商圈列表
\ No newline at end of file
*
* @return \think\Response
*/
public
function
getBusinessAll
()
{
$code
=
200
;
$msg
=
''
;
$where
[
'is_del'
]
=
0
;
$where
[
'status'
]
=
0
;
if
(
$this
->
params
[
'name'
]
!=
NULL
)
{
$where
[
'name'
]
=
[
'LIKE'
,
'%'
.
$this
->
params
[
'name'
]
.
'%'
];
}
if
(
!
empty
(
$this
->
params
[
'province'
]))
{
$where
[
'province'
]
=
$this
->
params
[
'province'
];
}
if
(
empty
(
$this
->
params
[
'city'
]))
{
$where
[
'city'
]
=
'上海市'
;
}
else
{
$where
[
'city'
]
=
$this
->
params
[
'city'
];
}
if
(
!
empty
(
$this
->
params
[
'disc'
]))
{
$where
[
'disc'
]
=
$this
->
params
[
'disc'
];
}
$fields
=
'id,name,province,city,disc,status,create_time'
;
try
{
$auth_group
=
New
GBusinessDistrict
();
$data
=
$auth_group
->
getList
(
1
,
1000
,
'id desc'
,
$fields
,
$where
);
}
catch
(
\Exception
$e
)
{
$code
=
101
;
$msg
=
$e
->
getMessage
();
$data
=
[];
}
return
$this
->
response
(
$code
,
$msg
,
$data
);
}
}
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