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
fdb7c606
Commit
fdb7c606
authored
Aug 13, 2018
by
clone
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bug
parent
c54d990c
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
246 additions
and
91 deletions
+246
-91
Location.php
application/api/controller/Location.php
+53
-0
Shop.php
application/api/controller/Shop.php
+159
-85
Basic.php
application/api/extend/Basic.php
+26
-1
RegisterValidate.php
application/api/validate/RegisterValidate.php
+6
-2
route.php
application/route.php
+2
-3
No files found.
application/api/controller/Location.php
0 → 100644
View file @
fdb7c606
<?php
namespace
app\api\controller
;
use
app\api\extend\Basic
;
use
app\extra\RedisExt
;
/**
* Created by PhpStorm.
* User : zw
* Date : 2018/8/13
* Time : 11:31
* Intro:
*/
class
Location
extends
Basic
{
private
$redis_
;
const
CITY_USER
=
"user_city_"
;
public
function
__construct
(
$request
=
null
)
{
parent
::
__construct
(
$request
);
$this
->
redis_
=
RedisExt
::
getRedis
();
}
public
function
saveSiteCity
()
{
$params
=
$this
->
params
;
/* $params = array(
"user_id" => 1,
"city" => "上海市"
);*/
$checkResult
=
$this
->
validate
(
$params
,
"RegisterValidate.saveSiteCityVerify"
);
if
(
true
!==
$checkResult
)
{
return
$this
->
response
(
"101"
,
$checkResult
);
}
$city
=
"上海市"
;
$user_id
=
$params
[
"user_id"
];
if
(
$params
[
"city"
]
==
"杭州市"
||
$params
[
"city"
]
==
"杭州"
)
{
$city
=
"杭州市"
;
}
if
(
$this
->
redis_
)
{
$this
->
redis_
->
set
(
self
::
CITY_USER
.
$user_id
,
$city
);
}
else
{
return
$this
->
response
(
"101"
,
"redis service not found"
);
}
return
$this
->
response
(
"200"
,
"success"
,
[]);
}
}
\ No newline at end of file
application/api/controller/Shop.php
View file @
fdb7c606
...
...
@@ -10,11 +10,15 @@ namespace app\api\controller;
* Intro: 获取商铺list
*/
use
app\api\extend\Basic
;
use
app\api_broker\service\LookShopService
;
use
app\model\AttentionModel
;
use
app\model\GHouses
;
use
app\model\GHousesImgs
;
use
app\model\GLabels
;
use
app\model\HouseImgs
;
use
app\model\HouseInfos
;
use
app\model\Labels
;
use
app\model\OBargainModel
;
use
app\model\OMarchInModel
;
use
app\model\Regions
;
...
...
@@ -25,6 +29,10 @@ class Shop extends Basic
protected
$labels
;
protected
$attentionModel
;
private
$gHousesModel
;
private
$gHousesImgModel
;
private
$lookShopService_
;
function
__construct
(
$request
=
null
)
{
parent
::
__construct
(
$request
);
...
...
@@ -32,124 +40,152 @@ class Shop extends Basic
$this
->
dbImg
=
new
HouseImgs
();
$this
->
labels
=
new
GLabels
();
$this
->
attentionModel
=
new
AttentionModel
();
$this
->
gHousesModel
=
new
GHouses
();
$this
->
gHousesImgModel
=
new
GHousesImgs
();
$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 = array(
"site_area" => 2, //来源 1首页 2搜索
"title" => "尚美",
"carefully_chosen" => 0, //精选商铺--0是1否
"shangpu_type" => 0, //商铺类型(0商场,1街铺)
$params
=
$this
->
params
;
/*$params = array(
"site_area" => 4, //来源 1c首页 2c搜索
// "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" => "黄浦区",
"yetai" => "休闲娱乐",
"area_start" => 45,//面积起始范围 room_area2
"area_end" => 65,//面积结束范围
"money_start" => 1000,//租金 price2
"money_end" => 10000,//租金
"shangpu_tags" => "临近地铁,临近地铁2",
"pageNo" => "1",
"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",
"pageNo" => 1,
"pageSize" => 15
);*/
$params
=
$this
->
params
;
$field
=
"a.id,a.agent_id,a.title,a.address,a.city,disc,a.disccircles,a.sales,a.yetai,a.room_area,a.room_area2,
a.shangpu_type,a.is_test,a.room_num_left,a.shangpu_tags,a.carefully_chosen,a.price,a.rent_type,b.foreign_name,b.address_detail_c,
b.foreign_advantage"
;
$conditions
=
[];
if
(
empty
(
$params
[
'site_area'
]))
{
return
$this
->
response
(
"101"
,
"请求来源不能为空"
);
}
$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"
;
$pageNo
=
empty
(
$params
[
'pageNo'
])
?
1
:
$params
[
'pageNo'
];
$pageSize
=
empty
(
$params
[
'pageSize'
])
?
15
:
$params
[
'pageSize'
];
//c端查对外的名字 b端查对内的名字
if
(
isset
(
$params
[
'title'
]))
{
$conditions
[
'b.foreign_name'
]
=
array
(
"like"
,
"%"
.
trim
(
$params
[
'title'
])
.
"%"
);
$conditions
[
'external_title'
]
=
array
(
"like"
,
"%"
.
trim
(
$params
[
'title'
])
.
"%"
);
}
//c端查对外的名字 b端查对内的名字
if
(
isset
(
$params
[
'address'
]))
{
$conditions
[
'external_address'
]
=
array
(
"like"
,
"%"
.
trim
(
$params
[
'address'
])
.
"%"
);
}
if
(
isset
(
$params
[
'house_id'
]))
{
$conditions
[
'id'
]
=
array
(
"eq"
,
$params
[
'house_id'
]
);
}
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
:
if
(
isset
(
$params
[
'carefully_chosen'
])
&&
$params
[
'carefully_chosen'
]
==
0
)
{
$conditions
[
'a.carefully_chosen'
]
=
array
(
'eq'
,
$params
[
'carefully_chosen'
]
);
$order_
=
"a.rate1 desc, a.id desc"
;
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
:
if
(
isset
(
$params
[
'disc'
]))
{
//区域
$conditions
[
'
a.
disc'
]
=
array
(
'eq'
,
trim
(
$params
[
'disc'
])
);
$conditions
[
'disc'
]
=
array
(
'eq'
,
trim
(
$params
[
'disc'
])
);
}
if
(
isset
(
$params
[
'
yetai
'
]))
{
//业态
$conditions
[
'
a.yetai'
]
=
array
(
'like'
,
"%"
.
trim
(
$params
[
'yetai
'
])
.
"%"
);
if
(
isset
(
$params
[
'
industry_type
'
]))
{
//业态
$conditions
[
'
industry_type'
]
=
array
(
'like'
,
"%"
.
trim
(
$params
[
'industry_type
'
])
.
"%"
);
}
if
(
isset
(
$params
[
'sh
angpu
_type'
]))
{
//商铺类型
$conditions
[
'
a.shangpu_type'
]
=
array
(
"eq"
,
$params
[
'shangpu
_type'
]
);
if
(
isset
(
$params
[
'sh
op
_type'
]))
{
//商铺类型
$conditions
[
'
shop_type'
]
=
array
(
"eq"
,
$params
[
'shop
_type'
]
);
}
//面积 room_area最小面积 room_area2最大面积 参考老版本
//面积 room_area最小面积 room_area2最大面积 参考老版本
if
(
isset
(
$params
[
'area_start'
])
&&
isset
(
$params
[
'area_end'
]))
{
$conditions
[
'a.room_area'
]
=
array
(
'between'
,
array
(
$params
[
'area_start'
],
$params
[
'area_end'
]
)
);
//街铺只有一个room_area
if
(
$params
[
'shangpu_type'
]
==
0
)
{
$conditions
[
'a.room_area2'
]
=
array
(
'between'
,
array
(
$params
[
'area_start'
],
$params
[
'area_end'
]
)
);
}
}
else
if
(
isset
(
$params
[
'area_start'
])
&&
!
isset
(
$params
[
'area_end'
]))
{
//100米以上不用传结束面积
$conditions
[
'a.room_area'
]
=
array
(
'egt'
,
$params
[
'area_start'
]
);
if
(
$params
[
'shangpu_type'
]
==
0
)
{
$conditions
[
'a.room_area2'
]
=
array
(
'egt'
,
$params
[
'area_start'
]
);
}
}
$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
);
}
if
(
isset
(
$params
[
'money_start'
])
&&
isset
(
$params
[
'money_end'
]))
{
//面积
$conditions
[
'a.price'
]
=
array
(
'between'
,
array
(
$params
[
'money_start'
],
$params
[
'money_end'
]
)
);
}
else
if
(
isset
(
$params
[
'money_start'
])
&&
!
isset
(
$params
[
'money_end'
]))
{
$conditions
[
'a.price'
]
=
array
(
'egt'
,
$params
[
'money_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
[
'sh
angpu_tags'
])
&&
$params
[
'shangpu_tags
'
]
!=
"全部"
)
{
//商铺标签
$sh
angpuTagsArr
=
array_filter
(
explode
(
','
,
$params
[
'shangpu_tags
'
]));
if
(
count
(
$sh
angpu
TagsArr
)
==
1
)
{
$spTagArr
[
'
a.shangpu_tags'
]
=
array
(
'like'
,
"%"
.
trim
(
$shangpu
TagsArr
[
0
])
.
"%"
);
if
(
isset
(
$params
[
'sh
op_sign'
])
&&
$params
[
'shop_sign
'
]
!=
"全部"
)
{
//商铺标签
$sh
opTagsArr
=
array_filter
(
explode
(
','
,
$params
[
'shop_sign
'
]));
if
(
count
(
$sh
op
TagsArr
)
==
1
)
{
$spTagArr
[
'
shop_sign'
]
=
array
(
'like'
,
"%"
.
trim
(
$shop
TagsArr
[
0
])
.
"%"
);
}
else
{
foreach
(
$sh
angpu
TagsArr
as
$key
=>
$val
)
{
$spTagArr
[
'
a.shangpu_tags
'
][]
=
array
(
'like'
,
"%"
.
trim
(
$val
)
.
"%"
);
foreach
(
$sh
op
TagsArr
as
$key
=>
$val
)
{
$spTagArr
[
'
shop_sign
'
][]
=
array
(
'like'
,
"%"
.
trim
(
$val
)
.
"%"
);
}
}
}
$order_
=
"
a.
id desc"
;
$order_
=
"
status asc,
id desc"
;
break
;
default
:
$this
->
response
(
"101"
,
"请求数据异常"
);
return
$this
->
response
(
"101"
,
"请求数据异常"
);
}
if
(
!
empty
(
$conditions
))
{
//todo 测试数据?
$conditions
[
'a.id'
]
=
array
(
'<>'
,
16
);
//todo sales下架字段并没用处 根据room_num_left剩余铺数来判断 为0 表示下架
$conditions
[
'a.room_num_left'
]
=
array
(
'<>'
,
0
);
$conditions
[
'a.show_all'
]
=
array
(
'eq'
,
0
);
//只显示公开的楼盘
}
$conditions
[
'status'
]
=
array
(
'eq'
,
1
);
//只显示上架
$conditions
[
'is_show'
]
=
array
(
'eq'
,
0
);
//c端只显示可显示的楼盘
$result
=
$this
->
db
->
getHouseInfoList
(
$pageNo
,
$pageSize
,
$order_
,
$field
,
$conditions
,
$spTagArr
);
}
$result
=
$this
->
gHousesModel
->
getHousesList
(
$pageNo
,
$pageSize
,
$order_
,
$field
,
$conditions
,
$spTagArr
);
//获取图片信息
foreach
(
$result
as
$key
=>
$val
)
{
$result
[
$key
][
"api_path"
]
=
IMG_PATH
;
$result
[
$key
][
"api_path"
]
=
CK_IMG_URL
.
'images/'
;
$result
[
$key
][
"rent_price"
]
=
$val
[
"rent_price"
]
*
0.01
;
$param
[
"house_id"
]
=
$val
[
"id"
];
$param
[
"imgtype"
]
=
1
;
//默认主图
$result
[
$key
][
"images"
]
=
$this
->
dbImg
->
getHouseImages
(
$param
,
1
);
$result
[
$key
][
'title'
]
=
$val
[
'foreign_name'
];
$result
[
$key
][
'address'
]
=
$val
[
'address_detail_c'
];
$param
[
"img_type"
]
=
1
;
//默认主图
$result
[
$key
][
"images"
]
=
$this
->
gHousesImgModel
->
getHouseImages
(
$param
,
1
);
}
if
(
empty
(
$result
))
{
return
$this
->
response
(
"200"
,
"此条件没有找到数据"
);
}
...
...
@@ -157,56 +193,94 @@ class Shop extends Basic
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
getShopDetail
()
{
return
$this
->
response
(
"101"
,
"请更新到新版本"
);
header
(
'Access-Control-Allow-Origin:*'
);
/* $params = array(
"id" => 3084,
"site_area" => 3, //1.c端 3.b端 4.pc端
//"user_id" => 2 //if c端 用户登录后传入user_id
);*/
$params
=
$this
->
params
;
$field
=
"a.id,a.management_fee,a.title,a.address,a.city,a.room_area,a.room_area2,a.business_area,a.disc,a.disccircles,
a.sales,a.slotting_fee,a.transfer_fee, a.yetai,a.room_area2,a.shangpu_type,a.is_test,a.sellingpoint,a.singn_rule,
a.business_date,a.start_business_date,a.opentime,a.has_gas,a.traffic,a.has_moved,a.room_num_left,a.room_num_total,
a.shangpu_tags,a.carefully_chosen,a.price,a.dish,a.file_path,a.rent_type,b.foreign_name,b.address_detail_c,
b.foreign_advantage"
;
$conditions
=
[];
if
(
empty
(
$params
[
'id'
]))
{
return
$this
->
response
(
"101"
,
"详情id不能为空"
);
}
if
(
empty
(
$params
[
'site_area'
]))
{
return
$this
->
response
(
"101"
,
"请求来源错误"
);
}
$conditions
[
'a.id'
]
=
array
(
"eq"
,
$params
[
"id"
]
);
$conditions
[
'a.show_all'
]
=
array
(
'eq'
,
0
);
//只显示公开楼盘
$result
=
$this
->
db
->
getHouseDetails
(
$field
,
$conditions
);
$field
=
"a.id,a.external_title as title,a.external_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.external_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,b.fee_rule,b.age_limit,b.payment_month,b.deposit_month,b.external_slotting_fee"
;
$conditions
[
'a.status'
]
=
array
(
"eq"
,
1
);
$conditions
[
'a.is_show'
]
=
array
(
'eq'
,
0
);
//c端只显示公开楼盘
$result
[
"api_path"
]
=
IMG_PATH
;
$conditions
[
'a.id'
]
=
array
(
"eq"
,
$params
[
"id"
]
);
$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"
]))
{
$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
;
}
$result
[
"api_path"
]
=
CK_IMG_URL
.
'images/'
;
$param
[
"house_id"
]
=
$params
[
'id'
];
//todo 这里的是否要更改成b端后台上传的类型
$param
[
"img
type"
]
=
2
;
$result
[
"images"
]
=
$this
->
dbImg
->
getHouseImages
(
$param
,
15
);
$param
[
"img
type"
]
=
3
;
//图片类型:1列表页封面图,2详情页轮播图,3楼层平面图,4独家合同,5,删除
$result
[
"plan_images"
]
=
$this
->
dbImg
->
getHouseImages
(
$param
,
4
);
$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
[
'
room_num_left
'
]
==
0
)
{
if
(
$result
[
'
status
'
]
==
0
)
{
return
$this
->
response
(
"101"
,
'此楼盘已下架'
);
}
//todo 查询关注门店
if
(
isset
(
$this
->
userId
))
{
$attention
[
"user_id"
]
=
array
(
"eq"
,
$
this
->
userId
);
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
);
;
$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
;
$result
[
'new_sign_rule'
]
=
"付
{
$result
[
'payment_month'
]
}
押
{
$result
[
'deposit_month'
]
}
,签订
{
$result
[
'age_limit'
]
}
年"
;
return
$this
->
response
(
"200"
,
'request success'
,
$result
);
}
/**
* 搜索页搜索条件
* @return \think\Response
...
...
application/api/extend/Basic.php
View file @
fdb7c606
...
...
@@ -9,8 +9,10 @@ namespace app\api\extend;
* Time: 9:35
* 基类
*/
use
app\extra\RedisExt
;
use
app\model\Users
;
use
think\Controller
;
use
think\Exception
;
use
think\Request
;
use
think\Response
;
use
Qiniu
;
...
...
@@ -27,6 +29,8 @@ class Basic extends Controller
public
$params
;
public
$user_city
;
protected
$authToken
;
/**
...
...
@@ -97,7 +101,7 @@ class Basic extends Controller
$this
->
userNick
=
isset
(
$result
->
data
->
userNick
)
?
$result
->
data
->
userNick
:
""
;
$this
->
timeStamp_
=
$result
->
timeStamp_
;
}
$this
->
getCity
(
$this
->
userId
);
$requestPath
=
$this
->
request
->
routeInfo
()[
"rule"
][
0
]
.
"/"
.
$this
->
request
->
routeInfo
()[
"rule"
][
1
];
//过滤掉不需要验证token的接口
if
(
!
in_array
(
trim
(
$requestPath
),
$this
->
filterVerify
))
{
...
...
@@ -105,6 +109,27 @@ class Basic extends Controller
}
}
/**
* 默认城市选择
* @param $agentId
*/
public
function
getCity
(
$userId
)
{
try
{
$redis_
=
RedisExt
::
getRedis
();
if
(
$redis_
)
{
$city
=
$redis_
->
get
(
"user_city_"
.
$userId
);
$this
->
user_city
=
empty
(
$city
)
?
"上海市"
:
$city
;
}
else
{
$this
->
user_city
=
"上海市"
;
}
}
catch
(
Exception
$exception
)
{
$this
->
user_city
=
"上海市"
;
}
}
/**
* token 验证
*/
...
...
application/api/validate/RegisterValidate.php
View file @
fdb7c606
...
...
@@ -20,6 +20,7 @@ class RegisterValidate extends Validate
'code'
=>
'require|number'
,
'device_id'
=>
'require'
,
'phone'
=>
[
'regex'
=>
'/^((13[0-9])|(14[0-9])|(15[0-9])|(18[0-9])|(16[0-9])|(17[0-9])|(19[0-9]))\\d{8}$/i'
],
'city'
=>
'require'
,
];
protected
$message
=
[
...
...
@@ -32,13 +33,15 @@ class RegisterValidate extends Validate
'phone.regex'
=>
'手机号格式不正确'
,
'device_id.require'
=>
'设备id不能为空'
,
'code.require'
=>
'code为必填字段'
,
'code.number'
=>
'code只能为数字'
'code.number'
=>
'code只能为数字'
,
'city.require'
=>
'city为必填字段'
,
];
protected
$scene
=
[
'verify'
=>
[
'phone'
,
'device_id'
],
'register'
=>
[
'phone'
,
'device_id'
,
'code'
],
'removeBind'
=>
[
'user_id'
,
'buyer_id'
],
'bind'
=>
[
'wx_union_id'
,
'phone'
],
'bind'
=>
[
'wx_union_id'
,
'phone'
],
'saveSiteCityVerify'
=>
[
'user_id'
,
'city'
],
];
}
\ No newline at end of file
application/route.php
View file @
fdb7c606
...
...
@@ -242,7 +242,6 @@ Route::group('index', [
'performanceInfo'
=>
[
'index/PerformanceInfo/performanceInfo'
,
[
'method'
=>
'post|get'
]
],
//业绩明细
'getTaxesById'
=>
[
'index/Finance/getTaxesById'
,
[
'method'
=>
'POST|GET'
]
],
//财务结单
'financeUpdateLog'
=>
[
'index/Finance/financeUpdateLog'
,
[
'method'
=>
'POST|GET'
]
],
//财务结单
'noticeIndex'
=>
[
'index/notice/index'
,
[
'method'
=>
'GET'
]
],
//公告列表
...
...
@@ -273,7 +272,6 @@ Route::group('index', [
'myCollectionShopList'
=>
[
'index/myCollectionShop/myCollectionShopList'
,
[
'method'
=>
'POST|GET'
]
],
//我收藏的客户liu
'lookShopIndex'
=>
[
'index/LookShop/lookShopIndex'
,
[
'method'
=>
'GET'
]
],
//商铺查看日志
...
...
@@ -282,7 +280,6 @@ Route::group('index', [
'selectIndividualPerformance'
=>
[
'index/Performance/selectIndividualPerformance'
,
[
'method'
=>
'POST|GET'
]
],
//个人业绩排行 朱伟 2018-07-31
]);
...
...
@@ -358,6 +355,8 @@ Route::group('api', [
'removeBind'
=>
[
'api/Register/removeBinding'
,
[
'method'
=>
'POST|GET'
]
],
'bindingWx'
=>
[
'api/Register/bindingWx'
,
[
'method'
=>
'POST'
]
],
//绑定微信
'saveSiteCity'
=>
[
'api/Location/saveSiteCity'
,
[
'method'
=>
'POST|GET'
]
],
//保存默认城市选择 c端
]);
...
...
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