Toggle navigation
Toggle navigation
This project
Loading...
Sign in
fe
/
yohobuy-node
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
1
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
041d8f6449f559a1501a941c62103ff6f91ddbf5
1 parent
35d71851
wwwguang
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
59 additions
and
30 deletions
apps/guang/controllers/index.js
apps/guang/models/guang-helper.js
apps/guang/models/guang-service.js
apps/guang/router.js
config/common.js
doraemon/middleware/htaccess/rules/www.js
apps/guang/controllers/index.js
View file @
041d8f6
...
...
@@ -39,7 +39,7 @@ exports.index = (req, res, next) => {
reqCtx
.
getArticleList
(
gender
,
type
,
uid
,
udid
,
page
,
''
,
''
,
pageSize
,
channel
,
true
),
reqCtx
.
getHotTags
(
page
,
pageSize
,
channel
,
isHotDegrade
),
reqCtx
.
getAds
(
channel
,
isAdDegrade
),
reqCtx
.
getRecoArticles
(
gender
,
1
,
10
,
channel
),
reqCtx
.
getRecoArticles
(
gender
,
1
,
10
),
headerModel
.
requestHeaderData
(
channel
),
reqCtx
.
getTopList
(
gender
,
uid
,
udid
,
page
,
true
)
]).
then
(
ret
=>
{
...
...
@@ -102,7 +102,7 @@ exports.tags = (req, res, next) => {
reqCtx
.
getArticleList
(
gender
,
0
,
uid
,
udid
,
page
,
query
,
''
,
pageSize
,
channel
,
true
),
reqCtx
.
getHotTags
(
1
,
20
,
channel
,
isHotDegrade
),
reqCtx
.
getAds
(
channel
,
isAdDegrade
),
reqCtx
.
getRecoArticles
(
gender
,
1
,
10
,
channel
),
reqCtx
.
getRecoArticles
(
gender
,
1
,
10
),
headerModel
.
requestHeaderData
(
channel
)
]).
then
(
ret
=>
{
...
...
@@ -162,7 +162,7 @@ exports.editor = (req, res, next) => {
reqCtx
.
getArticleList
(
gender
,
null
,
uid
,
udid
,
page
,
''
,
authorId
,
pageSize
,
channel
,
true
),
reqCtx
.
getHotTags
(
1
,
20
,
channel
,
isHotDegrade
),
reqCtx
.
getAds
(
channel
,
isAdDegrade
),
reqCtx
.
getRecoArticles
(
gender
,
1
,
10
,
channel
),
reqCtx
.
getRecoArticles
(
gender
,
1
,
10
),
headerModel
.
requestHeaderData
(
channel
)
]).
then
(
ret
=>
{
...
...
@@ -199,7 +199,7 @@ exports.editor = (req, res, next) => {
*/
exports
.
detail
=
(
req
,
res
,
next
)
=>
{
let
id
=
req
.
params
.
id
||
req
.
query
.
id
;
let
id
=
req
.
params
.
id
||
req
.
query
.
id
||
req
.
params
[
0
]
;
let
page
=
req
.
query
.
page
||
1
;
let
pageSize
=
req
.
query
.
pageSize
||
10
;
let
col
=
req
.
query
.
col
||
0
;
...
...
@@ -254,7 +254,7 @@ exports.detail = (req, res, next) => {
reqCtx
.
getArticleComments
(
udid
,
uid
,
id
,
page
,
pageSize
),
reqCtx
.
getArticleBaseInfo
(
id
,
uid
,
udid
),
reqCtx
.
getArticleRelateBrand
(
id
),
reqCtx
.
getRecoArticles
(
gender
,
1
,
10
,
channel
),
reqCtx
.
getRecoArticles
(
gender
,
1
,
10
),
reqCtx
.
getAds
(
channel
,
isAdDegrade
),
tdk
(
'article'
,
id
,
req
)
];
...
...
@@ -266,7 +266,7 @@ exports.detail = (req, res, next) => {
}
if
(
info
.
tag
)
{
promises
.
push
(
req
.
ctx
(
guangModel
).
getRelateArticleList
(
id
,
info
.
tag
,
2
,
channel
));
promises
.
push
(
req
.
ctx
(
guangModel
).
getRelateArticleList
(
id
,
info
.
tag
,
2
));
}
else
{
promises
.
push
({});
}
...
...
apps/guang/models/guang-helper.js
View file @
041d8f6
...
...
@@ -64,7 +64,7 @@ const getUdid = (req, res) => {
* @param type id 产品编号
* @return type url
*/
const
getArticleUrl
=
(
url
,
id
,
channel
)
=>
{
const
getArticleUrl
=
(
url
,
id
)
=>
{
/* 格式由url:{url:'aaa'} 更改为 url: 'aaa'
try {
...
...
@@ -79,13 +79,7 @@ const getArticleUrl = (url, id, channel) => {
return
url
;
}
let
param
=
{};
if
(
channel
)
{
param
.
channel
=
channel
;
}
return
helpers
.
urlFormat
(
`
/
$
{
id
}.
html
`
,
param
,
'guang'
);
return
helpers
.
urlFormat
(
`
/
guang
/
$
{
id
}.
html
`
);
};
const
getIndexSeo
=
(
params
,
tabs
)
=>
{
...
...
apps/guang/models/guang-service.js
View file @
041d8f6
...
...
@@ -128,7 +128,7 @@ module.exports = class extends global.yoho.BaseModel {
// isReco: articleData.is_recommended && Number(articleData.is_recommended) === 1 ? true : false,
url
:
+
articleData
.
category_id
===
9999
?
helpers
.
urlFormat
(
`
/
$
{
_
.
get
(
articleData
,
'product_list[0].product_skn'
,
0
)}.
html
`
,
null
,
'item'
)
:
ghelper
.
getArticleUrl
(
articleData
.
url
,
articleData
.
id
,
channel
),
ghelper
.
getArticleUrl
(
articleData
.
url
,
articleData
.
id
),
img
:
helpers
.
image
(
articleData
.
src
,
width
,
height
,
1
),
isSquareImg
:
isSquareImage
,
title
:
articleData
.
title
,
...
...
@@ -543,7 +543,7 @@ module.exports = class extends global.yoho.BaseModel {
/**
* 推荐文章
*/
getRecoArticles
(
gender
,
page
,
limit
,
channel
)
{
getRecoArticles
(
gender
,
page
,
limit
)
{
let
data
=
{
gender
:
gender
,
...
...
@@ -568,7 +568,7 @@ module.exports = class extends global.yoho.BaseModel {
let
it
=
res
.
data
[
i
];
let
reco
=
{
url
:
ghelper
.
getArticleUrl
(
it
.
url
,
it
.
id
,
channel
),
url
:
ghelper
.
getArticleUrl
(
it
.
url
,
it
.
id
),
title
:
it
.
title
};
...
...
@@ -962,7 +962,7 @@ module.exports = class extends global.yoho.BaseModel {
* @param bool $onlyUrl
* @return mixed
*/
getRelateArticleList
(
aid
,
tag
,
size
,
channel
)
{
getRelateArticleList
(
aid
,
tag
,
size
)
{
size
=
size
||
3
;
let
data
=
{
...
...
@@ -983,7 +983,7 @@ module.exports = class extends global.yoho.BaseModel {
if
(
res
&&
res
.
code
===
200
&&
res
.
data
)
{
return
_
.
map
(
res
.
data
,
it
=>
{
it
.
thumb
=
helpers
.
image
(
it
.
thumb
,
264
,
173
,
1
);
it
.
url
=
ghelper
.
getArticleUrl
(
it
.
url
,
it
.
id
,
channel
);
it
.
url
=
ghelper
.
getArticleUrl
(
it
.
url
,
it
.
id
);
return
it
;
});
}
...
...
apps/guang/router.js
View file @
041d8f6
...
...
@@ -14,6 +14,7 @@ const sitemap = require('../3party/controllers/sitemap');
router
.
get
([
'/'
,
'/index/index'
],
guangController
.
index
);
router
.
get
([
'/detail/:id'
,
'/info/index'
],
guangController
.
detail
);
// guang/info/index
router
.
get
(
/^
\/([\d]
+
)(
.*
)
/
,
guangController
.
detail
);
router
.
get
(
'/tags/index'
,
guangController
.
tags
);
router
.
get
(
'/Index/editor'
,
guangController
.
editor
);
...
...
config/common.js
View file @
041d8f6
...
...
@@ -17,12 +17,12 @@ module.exports = {
cookieDomain
:
'.yohobuy.com'
,
domains
:
{
// test3
singleApi
:
'http://api-test3.yohops.com:9999/'
,
api
:
'http://api-test3.yohops.com:9999/'
,
service
:
'http://service-test3.yohops.com:9999/'
,
serviceNotify
:
'http://service-test3.yohops.com:9999/'
,
global
:
'http://global-test-soa.yohops.com:9999/'
,
platformApi
:
'http://192.168.102.48:8088/'
,
// singleApi: 'http://api-test3.yohops.com:9999/',
// api: 'http://api-test3.yohops.com:9999/',
// service: 'http://service-test3.yohops.com:9999/',
// serviceNotify: 'http://service-test3.yohops.com:9999/',
// global: 'http://global-test-soa.yohops.com:9999/',
// platformApi: 'http://192.168.102.48:8088/',
// test2
// singleApi: 'http://api-test2.yohops.com:9999/',
...
...
@@ -41,10 +41,10 @@ module.exports = {
// platformApi: 'http://172.16.6.210:8088/',
// gray
// singleApi: 'http://single.gray.yohops.com/',
// api: 'http://api.gray.yohops.com/',
// service: 'http://service.gray.yohops.com/',
// platformApi: 'http://172.16.6.210:8088/',
singleApi
:
'http://single.gray.yohops.com/'
,
api
:
'http://api.gray.yohops.com/'
,
service
:
'http://service.gray.yohops.com/'
,
platformApi
:
'http://172.16.6.210:8088/'
,
// dev
// api: 'http://dev-api.yohops.com:9999/',
...
...
doraemon/middleware/htaccess/rules/www.js
View file @
041d8f6
...
...
@@ -96,6 +96,40 @@ module.exports = [
type
:
TYPE
.
redirect
,
origin
:
'/index.html'
,
target
:
helpers
.
urlFormat
(
'/'
)
}
},
// 逛
// 首页
{
type
:
TYPE
.
rewrite
,
origin
:
/^
\/
guang
\/(
boys|girls|kids|lifestyle
)(\/
*
)
$/
,
target
:
(
req
,
match
,
channel
)
=>
{
req
.
query
.
channel
=
channel
;
return
`
/
guang
/
?
chanel
=
$
{
channel
}
`
;
}
},
// 首页 + 类型
{
type
:
TYPE
.
rewrite
,
origin
:
/^
\/
guang
\/(
boys|girls|kids|lifestyle
)
-t
([\d]
+
)(\/
*
)
$/
,
target
:
(
req
,
match
,
channel
,
type
)
=>
{
req
.
query
.
channel
=
channel
;
req
.
query
.
type
=
type
;
return
`
/
guang
/
?
chanel
=
$
{
channel
}
&
type
=
$
{
type
}
`
;
}
},
// 列表页 + 类型 + 翻页
{
type
:
TYPE
.
rewrite
,
origin
:
/^
\/
guang
\/(
boys|girls|kids|lifestyle
)
-t
([\d]
+
)
-p
([\d]
+
)(\/
*
)
$/
,
target
:
(
req
,
match
,
channel
,
type
,
page
)
=>
{
req
.
query
.
channel
=
channel
;
req
.
query
.
type
=
type
;
req
.
query
.
page
=
page
;
return
`
/
guang
/
index
/
index
/
?
type
=
$
{
type
}
&
channel
=
$
{
page
}
`
;
}
}
];
...
...
Please
register
or
login
to post a comment