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
85a6abd0
Commit
85a6abd0
authored
Dec 18, 2017
by
clone
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
token验证
parent
b58e3f06
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
39 additions
and
15 deletions
+39
-15
AttentionShop.php
application/api/controller/AttentionShop.php
+2
-0
Shop.php
application/api/controller/Shop.php
+3
-0
Basic.php
application/api/extend/Basic.php
+12
-8
AttentionModel.php
application/model/AttentionModel.php
+21
-6
user.js
public/resource/js/user.js
+1
-1
No files found.
application/api/controller/AttentionShop.php
View file @
85a6abd0
...
...
@@ -85,4 +85,5 @@ class AttentionShop extends Basic
}
}
\ No newline at end of file
application/api/controller/Shop.php
View file @
85a6abd0
...
...
@@ -167,6 +167,9 @@ class Shop extends Basic
return
$this
->
response
(
"101"
,
'此楼盘已下架'
);
}
//todo 查询关注门店
/* $attention["user_id"] =
getAttentionByUserIdAndHouseId($attention);*/
return
$this
->
response
(
"200"
,
'request success'
,
$result
);
}
...
...
application/api/extend/Basic.php
View file @
85a6abd0
...
...
@@ -65,10 +65,21 @@ class Basic extends Controller
}
elseif
(
strtoupper
(
$this
->
request
->
method
())
===
"POST"
)
{
$this
->
params
=
$this
->
request
->
param
()
!=
null
?
$this
->
request
->
param
()
:
null
;
}
if
(
isset
(
$this
->
params
[
'AuthToken'
]))
{
$jwt
=
new
\Firebase\JWT\JWT
();
$this
->
authToken
=
$this
->
params
[
'AuthToken'
];
$result
=
$jwt
->
decode
(
$this
->
authToken
,
config
(
'jwt_key'
),
array
(
'HS256'
));
//解码token
$this
->
userId
=
$result
->
data
->
id
;
$this
->
phone
=
$result
->
data
->
phone
;
$this
->
userNick
=
$result
->
data
->
userNick
;
$this
->
timeStamp_
=
$result
->
timeStamp_
;
}
$requestPath
=
$this
->
request
->
routeInfo
()[
"rule"
][
0
]
.
"/"
.
$this
->
request
->
routeInfo
()[
"rule"
][
1
];
//过滤掉不需要验证token的接口
if
(
!
in_array
(
trim
(
$requestPath
),
$this
->
filterVerify
))
{
//
$this->tokenVerify();
$this
->
tokenVerify
();
}
}
...
...
@@ -81,13 +92,6 @@ class Basic extends Controller
echo
json_encode
(
array
(
"code"
=>
"101"
,
"msg"
=>
"AuthToken不能为空!"
,
"data"
=>
[],
"type"
=>
"json"
));
exit
;
}
$jwt
=
new
\Firebase\JWT\JWT
();
$this
->
authToken
=
$this
->
params
[
'AuthToken'
];
$result
=
$jwt
->
decode
(
$this
->
authToken
,
config
(
'jwt_key'
),
array
(
'HS256'
));
//解码token
$this
->
userId
=
$result
->
data
->
id
;
$this
->
phone
=
$result
->
data
->
phone
;
$this
->
userNick
=
$result
->
data
->
userNick
;
$this
->
timeStamp_
=
$result
->
timeStamp_
;
$this
->
verifyUserInfo
();
$this
->
verifyTime
();
}
...
...
application/model/AttentionModel.php
View file @
85a6abd0
...
...
@@ -20,7 +20,8 @@ class AttentionModel extends Model
* @param $params
* @return array
*/
public
function
addOrUpdateAttentionShop
(
$params
){
public
function
addOrUpdateAttentionShop
(
$params
)
{
$arr
=
array
();
if
(
isset
(
$params
[
'user_id'
]))
{
...
...
@@ -66,17 +67,31 @@ class AttentionModel extends Model
* @param $param
* @return false|\PDOStatement|string|\think\Collection
*/
public
function
myAttentionList
(
$pageNo
=
1
,
$pageSize
=
15
,
$order_
=
'id desc'
,
$field
,
$param
){
public
function
myAttentionList
(
$pageNo
=
1
,
$pageSize
=
15
,
$order_
=
'id desc'
,
$field
,
$param
)
{
$params
[
"a.user_id"
]
=
$param
[
"user_id"
];
$params
[
"b.room_num_left"
]
=
array
(
"<>"
,
0
);
//剩余数为0 的商品不显示
$params
[
"b.show_all"
]
=
array
(
"eq"
,
0
);
//只显示公开的楼盘
return
$this
->
field
(
$field
)
$params
[
"b.room_num_left"
]
=
array
(
"<>"
,
0
);
//剩余数为0 的商品不显示
$params
[
"b.show_all"
]
=
array
(
"eq"
,
0
);
//只显示公开的楼盘
return
$this
->
field
(
$field
)
->
alias
(
"a"
)
->
join
(
'houseinfos b'
,
'a.house_id = b.id'
,
'LEFT'
)
->
join
(
'houseinfos b'
,
'a.house_id = b.id'
,
'LEFT'
)
->
where
(
$params
)
->
order
(
$order_
)
->
limit
(
$pageSize
)
->
page
(
$pageNo
)
->
select
();
}
/**
*根据userId和楼盘id获取是否关注此商铺
* @param $params
* @return mixed
*/
public
function
getAttentionByUserIdAndHouseId
(
$params
)
{
return
$this
->
find
(
"id"
)
->
where
(
$params
)
->
limit
(
1
)
->
select
()[
0
];
}
}
public/resource/js/user.js
View file @
85a6abd0
define
([
'doT'
,
'text!temp/user_templ
e
te_tpl.html'
,
'ckfinder'
,
'ckfinderStart'
,
'css!style/user.css'
,
"datetimepicker"
],
function
(
doT
,
template
)
{
define
([
'doT'
,
'text!temp/user_templ
a
te_tpl.html'
,
'ckfinder'
,
'ckfinderStart'
,
'css!style/user.css'
,
"datetimepicker"
],
function
(
doT
,
template
)
{
var
user
=
{
urls
:
''
,
init
:
function
()
{
...
...
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