Toggle navigation
Toggle navigation
This project
Loading...
Sign in
fe
/
yohobuywap-node
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
0
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Email Patches
Plain Diff
Browse Files
Authored by
郭成尧
8 years ago
Commit
2b3e9ac5a284ba526e5cb6648044bddc5563a52d
1 parent
0f836d67
logger-data-verify
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
35 additions
and
10 deletions
apps/cart/controllers/index.js
apps/cart/models/count.js
apps/home/models/index.js
apps/product/models/popular-shop.js
doraemon/middleware/error-handler.js
apps/cart/controllers/index.js
View file @
2b3e9ac
...
...
@@ -156,7 +156,8 @@ const add = (req, res, next) => {
return
indexModel
.
addToCart
(
productSku
,
buyNumber
,
goodsType
,
isEdit
,
promotionId
,
uid
,
shoppingKey
).
then
(
data
=>
{
if
(
!
shoppingKey
&&
_
.
has
(
data
,
'data.shopping_key'
))
{
res
.
cookie
(
'_SPK'
,
data
.
data
.
shopping_key
,
{
expires
:
new
Date
(
Date
.
now
()
+
86400
*
360
)
expires
:
new
Date
(
Date
.
now
()
+
86400
*
360
),
domain
:
'.m.yohobuy.com'
});
}
data
?
res
.
json
(
data
)
:
res
.
status
(
400
).
json
({
...
...
apps/cart/models/count.js
View file @
2b3e9ac
...
...
@@ -3,12 +3,27 @@
const
api
=
global
.
yoho
.
API
;
const
cartCount
=
(
uid
,
shoppingKey
)
=>
{
let
params
=
{
method
:
'app.Shopping.count'
};
return
api
.
get
(
''
,
{
method
:
'app.Shopping.count'
,
uid
:
uid
,
shopping_key
:
shoppingKey
}).
then
((
result
)
=>
{
if
(
!
uid
&&
!
shoppingKey
)
{
return
Promise
.
resolve
({});
}
if
(
uid
)
{
Object
.
assign
(
params
,
{
uid
:
uid
});
}
if
(
shoppingKey
)
{
Object
.
assign
(
params
,
{
shopping_key
:
shoppingKey
});
}
return
api
.
get
(
''
,
params
).
then
((
result
)
=>
{
return
result
;
});
};
...
...
apps/home/models/index.js
View file @
2b3e9ac
...
...
@@ -28,7 +28,7 @@ const _userData = (params) => {
code
:
200
});
}
else
{
return
false
;
return
Promise
.
resolve
({})
;
}
};
...
...
apps/product/models/popular-shop.js
View file @
2b3e9ac
...
...
@@ -82,12 +82,19 @@ exports.getShopCategory = (shopId, channel) => {
* 店铺收藏数量
*/
exports
.
favCount
=
(
shopId
,
uid
,
channel
,
udid
)
=>
{
return
singleAPI
.
get
(
'favorite'
,
{
let
finalParams
=
{
method
:
'app.favorite.queryFavoriteCountByShopIds'
,
favIds
:
shopId
,
type
:
'shop'
,
udid
:
udid
,
uid
:
uid
,
physical_channel
:
yhChannel
[
channel
],
});
};
if
(
uid
)
{
Object
.
assign
(
finalParams
,
{
uid
:
uid
});
}
return
singleAPI
.
get
(
'favorite'
,
finalParams
);
};
...
...
doraemon/middleware/error-handler.js
View file @
2b3e9ac
...
...
@@ -51,6 +51,8 @@ exports.serverError = () => {
forceNoCache
(
res
);
if
(
err
&&
err
.
code
===
401
)
{
logger
.
error
(
`
401
error
info
:
client_type
=
$
{
req
.
query
.
client_type
},
req
.
user
=
$
{
JSON
.
stringify
(
req
.
user
)},
req
.
query
=
$
{
JSON
.
stringify
(
req
.
query
)},
cookies
=
$
{
JSON
.
stringify
(
req
.
cookies
)}
`
);
// eslint-disable-line
if
(
req
.
xhr
)
{
return
res
.
status
(
401
).
json
(
err
);
}
else
if
(
req
.
yoho
.
isApp
)
{
...
...
Please
register
or
login
to post a comment