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
Plain Diff
Browse Files
Authored by
毕凯
8 years ago
Commit
505e08c91f972f26e70e477850021318e99b2716
2 parents
a217fcbf
55827727
Merge branch 'feature/ctx' into 'feature/contextMod'
Feature/ctx See merge request
!878
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
116 additions
and
47 deletions
apps/guang/models/detail.js
apps/guang/models/index.js
config/common.js
apps/guang/models/detail.js
View file @
505e08c
...
...
@@ -5,7 +5,6 @@
*/
'use strict'
;
const
serviceAPI
=
global
.
yoho
.
ServiceAPI
;
const
api
=
global
.
yoho
.
API
;
const
_
=
require
(
'lodash'
);
const
helpers
=
global
.
yoho
.
helpers
;
...
...
@@ -74,9 +73,12 @@ class DetailModel extends global.yoho.BaseModel {
_getLeftNav
(
choosed
)
{
choosed
=
choosed
||
'all'
;
return
serviceAPI
.
get
(
'operations/api/v6/category/getCategory'
,
{},
{
return
this
.
get
({
api
:
serviceAPI
,
url
:
'operations/api/v6/category/getCategory'
,
param
:
{
cache
:
true
}
}).
then
(
result
=>
{
if
(
result
&&
result
.
code
===
200
)
{
...
...
@@ -86,8 +88,12 @@ class DetailModel extends global.yoho.BaseModel {
}
_getShareData
(
id
)
{
return
serviceAPI
.
get
(
'guang/api/v6/share/guang'
,
{
return
this
.
get
({
api
:
serviceAPI
,
url
:
'guang/api/v6/share/guang'
,
data
:
{
id
:
id
}
}).
then
(
result
=>
{
if
(
result
&&
result
.
code
===
200
)
{
...
...
@@ -101,10 +107,15 @@ class DetailModel extends global.yoho.BaseModel {
* @param {*} articleId
*/
_getArticle
(
articleId
)
{
return
serviceAPI
.
get
(
`
$
{
URI_PACKAGE_ARTICLE
}
getArticle
`
,
{
return
this
.
get
({
api
:
serviceAPI
,
url
:
`
$
{
URI_PACKAGE_ARTICLE
}
getArticle
`
,
data
:
{
article_id
:
articleId
},
{
},
param
:
{
cache
:
true
}
});
}
...
...
@@ -113,10 +124,15 @@ class DetailModel extends global.yoho.BaseModel {
* @param {*} authorId
*/
_getAuthor
(
authorId
)
{
return
serviceAPI
.
get
(
`
$
{
URI_PACKAGE_AUTHOR
}
getAuthor
`
,
{
return
this
.
get
({
api
:
serviceAPI
,
url
:
`
$
{
URI_PACKAGE_AUTHOR
}
getAuthor
`
,
data
:
{
author_id
:
authorId
},
{
},
param
:
{
cache
:
true
}
});
}
...
...
@@ -125,10 +141,15 @@ class DetailModel extends global.yoho.BaseModel {
* @param {*} articleId
*/
_getArticleContent
(
articleId
)
{
return
serviceAPI
.
get
(
`
$
{
URI_PACKAGE_ARTICLE
}
getArticleContent
`
,
{
return
this
.
get
({
api
:
serviceAPI
,
url
:
`
$
{
URI_PACKAGE_ARTICLE
}
getArticleContent
`
,
data
:
{
article_id
:
articleId
},
{
},
param
:
{
cache
:
true
}
});
}
...
...
@@ -137,10 +158,15 @@ class DetailModel extends global.yoho.BaseModel {
* @param {*} articleId
*/
_getBrand
(
articleId
)
{
return
serviceAPI
.
get
(
`
$
{
URI_PACKAGE_ARTICLE
}
getBrand
`
,
{
return
this
.
get
({
api
:
serviceAPI
,
url
:
`
$
{
URI_PACKAGE_ARTICLE
}
getBrand
`
,
data
:
{
article_id
:
articleId
},
{
},
param
:
{
cache
:
true
}
});
}
...
...
@@ -150,13 +176,18 @@ class DetailModel extends global.yoho.BaseModel {
* @param {*} tag
*/
_getOtherArticle
(
articleId
,
tag
)
{
return
serviceAPI
.
get
(
`
$
{
URI_PACKAGE_ARTICLE
}
getOtherArticle
`
,
{
return
this
.
get
({
api
:
serviceAPI
,
url
:
`
$
{
URI_PACKAGE_ARTICLE
}
getOtherArticle
`
,
data
:
{
article_id
:
articleId
,
tags
:
tag
,
offset
:
0
,
limit
:
3
},
{
},
param
:
{
cache
:
true
}
});
}
...
...
@@ -164,10 +195,12 @@ class DetailModel extends global.yoho.BaseModel {
* APP 获取微信模块
*/
_getSingleTemplateWechat
()
{
return
api
.
get
(
''
,
{
return
this
.
get
({
data
:
{
method
:
'app.resources.getSingleTemplate'
,
module
:
'wechat'
,
key
:
'guang_detail_wechat'
}
});
}
...
...
@@ -320,13 +353,16 @@ class DetailModel extends global.yoho.BaseModel {
* @return {[object]}
*/
intro
(
id
)
{
let
param
=
{
return
this
.
get
({
api
:
serviceAPI
,
url
:
`
$
{
URI_PACKAGE_ARTICLE
}
getArticleContent
`
,
data
:
{
article_id
:
id
,
client_type
:
'h5'
};
return
serviceAPI
.
get
(
`
$
{
URI_PACKAGE_ARTICLE
}
getArticleContent
`
,
param
,
{
},
param
:
{
cache
:
true
}
});
}
...
...
@@ -338,16 +374,16 @@ class DetailModel extends global.yoho.BaseModel {
productInfoBySkns
(
sknString
)
{
let
limit
=
sknString
&&
sknString
.
split
(
','
).
length
;
// 调用搜索接口
let
param
=
{
return
this
.
get
({
data
:
{
method
:
'app.search.recomandLi'
,
query
:
sknString
,
order
:
's_t_desc'
,
limit
:
limit
||
1
};
return
api
.
get
(
''
,
param
,
{
},
param
:
{
cache
:
true
}
}).
then
(
result
=>
{
return
_
.
get
(
result
,
'data.product_list'
,
[]);
});
...
...
@@ -357,11 +393,15 @@ class DetailModel extends global.yoho.BaseModel {
* 获取文章评论列表
*/
comments
(
params
)
{
return
serviceAPI
.
get
(
`
$
{
URI_PACKAGE_COMMENTS
}
getList
`
,
{
return
this
.
get
({
api
:
serviceAPI
,
url
:
`
$
{
URI_PACKAGE_COMMENTS
}
getList
`
,
data
:
{
article_id
:
params
.
article_id
,
page
:
params
.
page
,
limit
:
params
.
limit
||
20
,
udid
:
params
.
udid
}
}).
then
(
result
=>
{
return
_
.
get
(
result
,
'data.list'
,
[]);
});
...
...
@@ -372,11 +412,15 @@ class DetailModel extends global.yoho.BaseModel {
* @param {*} params
*/
commentsTotal
(
params
)
{
return
serviceAPI
.
get
(
`
$
{
URI_PACKAGE_COMMENTS
}
getList
`
,
{
return
this
.
get
({
api
:
serviceAPI
,
url
:
`
$
{
URI_PACKAGE_COMMENTS
}
getList
`
,
data
:
{
article_id
:
params
.
article_id
,
page
:
1
,
limit
:
1
,
udid
:
params
.
udid
}
}).
then
(
result
=>
{
return
_
.
get
(
result
,
'data.total'
,
0
);
});
...
...
@@ -387,10 +431,14 @@ class DetailModel extends global.yoho.BaseModel {
* @param {*} params
*/
getArticlePraiseAndFavor
(
params
)
{
return
serviceAPI
.
get
(
`
$
{
URI_PACKAGE_PRAISE
}
getArticlePraiseAndFavor
`
,
{
return
this
.
get
({
api
:
serviceAPI
,
url
:
`
$
{
URI_PACKAGE_PRAISE
}
getArticlePraiseAndFavor
`
,
data
:
{
uid
:
params
.
uid
,
id
:
params
.
id
,
udid
:
params
.
udid
}
}).
then
(
result
=>
{
return
_
.
get
(
result
,
'data'
,
{});
});
...
...
apps/guang/models/index.js
View file @
505e08c
...
...
@@ -22,10 +22,15 @@ class IndexModel extends global.yoho.BaseModel {
* @return {[object]}
*/
getAuthor
(
id
)
{
return
serviceAPI
.
get
(
'guang/service/v1/author/getAuthor'
,
{
return
this
.
get
({
api
:
serviceAPI
,
url
:
'guang/service/v1/author/getAuthor'
,
data
:
{
author_id
:
id
},
{
},
param
:
{
cache
:
true
}
}).
then
((
result
)
=>
{
if
(
result
&&
result
.
code
===
200
)
{
return
result
;
...
...
@@ -50,7 +55,10 @@ class IndexModel extends global.yoho.BaseModel {
* @return {[array]}
*/
getArticleList
(
gender
,
sortId
,
uid
,
udid
,
page
,
tag
,
authorId
,
limit
,
useCache
)
{
let
param
=
{
return
this
.
get
({
api
:
serviceAPI
,
url
:
'guang/api/v2/article/getList'
,
data
:
{
page
:
page
||
1
,
uid
:
uid
||
0
,
udid
:
udid
||
''
,
...
...
@@ -59,10 +67,10 @@ class IndexModel extends global.yoho.BaseModel {
tag
:
tag
,
author_id
:
authorId
,
limit
:
4
};
return
serviceAPI
.
get
(
'guang/api/v2/article/getList'
,
param
,
{
},
param
:
{
cache
:
useCache
}
}).
then
((
result
)
=>
{
if
(
result
&&
result
.
code
===
200
)
{
return
result
;
...
...
@@ -305,7 +313,11 @@ class IndexModel extends global.yoho.BaseModel {
});
}
return
serviceAPI
.
get
(
'guang/api/v6/article/getSimpleArticleList'
,
params
);
return
this
.
get
({
api
:
serviceAPI
,
url
:
'guang/api/v6/article/getSimpleArticleList'
,
data
:
params
});
}
/**
...
...
@@ -315,10 +327,14 @@ class IndexModel extends global.yoho.BaseModel {
*/
getDynamicDataById
(
id
,
uid
,
udid
)
{
return
serviceAPI
.
get
(
'guang/api/v6/article/getArticlePraiseAndFavor'
,
{
return
this
.
get
({
api
:
serviceAPI
,
url
:
'guang/api/v6/article/getArticlePraiseAndFavor'
,
data
:
{
id
:
id
,
uid
:
uid
,
udid
:
udid
}
});
}
...
...
@@ -327,8 +343,12 @@ class IndexModel extends global.yoho.BaseModel {
* @param {*} params
*/
_getTopArticles
(
params
)
{
return
serviceAPI
.
get
(
'guang/api/v6/article/getTopList'
,
{
return
this
.
get
({
api
:
serviceAPI
,
url
:
'guang/api/v6/article/getTopList'
,
data
:
{
gender
:
params
.
gender
}
});
}
...
...
@@ -336,11 +356,13 @@ class IndexModel extends global.yoho.BaseModel {
* 逛分类
*/
_category
()
{
return
serviceAPI
.
get
(
'/guang/api/v1/category/get'
,
{
},
{
return
this
.
get
({
api
:
serviceAPI
,
url
:
'/guang/api/v1/category/get'
,
param
:
{
cache
:
true
,
code
:
200
}
});
}
...
...
@@ -348,7 +370,10 @@ class IndexModel extends global.yoho.BaseModel {
* 逛内容列表
*/
_article
(
param
)
{
return
serviceAPI
.
get
(
'/guang/api/v2/article/getList'
,
{
return
this
.
get
({
api
:
serviceAPI
,
url
:
'/guang/api/v2/article/getList'
,
data
:
{
gender
:
param
.
gender
,
page
:
param
.
page
||
1
,
uid
:
param
.
uid
,
...
...
@@ -356,16 +381,12 @@ class IndexModel extends global.yoho.BaseModel {
sort_id
:
param
.
type
||
0
,
tag
:
param
.
tag
?
param
.
tag
:
null
,
limit
:
4
// author_id: param.authorId ? param.authorId : null,
// limit: param.limit ? param.limit : null
},
{
},
param
:
{
cache
:
true
,
code
:
200
}
}).
then
(
result
=>
{
return
result
;
});
}
}
...
...
config/common.js
View file @
505e08c
...
...
@@ -24,7 +24,7 @@ const domains = {
module
.
exports
=
{
app
:
'h5'
,
appVersion
:
'6.0.
1
'
,
// 调用api的版本
appVersion
:
'6.0.
2
'
,
// 调用api的版本
port
:
6001
,
siteUrl
:
'//m.yohobuy.com'
,
assetUrl
:
'//127.0.0.1:5001'
,
...
...
Please
register
or
login
to post a comment