Authored by zhangxiaoru

channel

... ... @@ -6,8 +6,6 @@
'use strict';
var api = global.yoho.API;
const service = global.yoho.ServiceAPI;
const helpers = global.yoho.helpers;
// const utils = '../../../utils';
... ... @@ -34,20 +32,24 @@ module.exports = class extends global.yoho.BaseModel {
* 获取频道接口
*/
_packageAd(params) {
return service.get('/operations/api/v5/resource/get', {
content_code: params.contentCode,
gender: 1,
limit: 1000,
page: 1
return this.get({
url: '/operations/api/v5/resource/get',
data: {
content_code: params.contentCode,
gender: 1,
limit: 1000,
page: 1
},
api: global.yoho.ServiceAPI
}, {
cache: true
});
}
_packageList(channel) {
return api.get('', {
method: 'app.brand.allBrandList',
yh_channel: channel
return this.get({
data: {method: 'app.brand.allBrandList', yh_channel: channel},
api: global.yoho.API
}, {
cache: true,
code: 200
... ... @@ -240,10 +242,12 @@ module.exports = class extends global.yoho.BaseModel {
* @return array
*/
getBrandForSearch(channel) {
return api.get('', {
method: 'app.brand.allBrandList',
yh_channel: channel || 1
return this.get({
data: {
method: 'app.brand.allBrandList',
yh_channel: channel || 1
},
api: global.yoho.API
}, {
cache: true,
code: 200
... ... @@ -261,11 +265,13 @@ module.exports = class extends global.yoho.BaseModel {
* @return array
*/
branchSearchHistory(params) {
return api.get('', {
method: 'app.search.hotBrandRecords',
uid: params.uid,
records: params.records || ''
return this.get({
data: {
method: 'app.search.hotBrandRecords',
uid: params.uid,
records: params.records || ''
},
api: global.yoho.API
}, {
code: 200
}).then(result => {
... ... @@ -277,12 +283,13 @@ module.exports = class extends global.yoho.BaseModel {
addSearchHistory(param) {
return api.get('', {
method: 'app.search.hotBrandRecords',
uid: param.uid,
records: param.records
return this.get({
data: {
method: 'app.search.hotBrandRecords',
uid: param.uid,
records: param.records
},
api: global.yoho.API
}, {
code: 200
});
... ... @@ -294,9 +301,9 @@ module.exports = class extends global.yoho.BaseModel {
* @return array
*/
branchSearchHot() {
return api.get('', {
method: 'app.search.hotBrands'
return this.get({
data: {method: 'app.search.hotBrands'},
api: global.yoho.API
}, {
cache: true,
code: 200
... ... @@ -314,7 +321,7 @@ module.exports = class extends global.yoho.BaseModel {
* @return array
*/
branchSearch(params) {
return api.all([
return Promise.all([
this.getBrandForSearch(params.channel),
... ... @@ -410,10 +417,12 @@ module.exports = class extends global.yoho.BaseModel {
delBrandSearchHistory(param) {
return api.get('', {
method: 'app.search.clearHotBrandRecords',
uid: param.uid
return this.get({
data: {
method: 'app.search.clearHotBrandRecords',
uid: param.uid
},
api: global.yoho.API
}, {
code: 200
}).then(result => {
... ...
... ... @@ -5,7 +5,6 @@
*/
'use strict';
const _ = require('lodash');
const api = global.yoho.API;
const helpers = global.yoho.helpers;
const utils = require('../../../utils');
... ... @@ -71,8 +70,9 @@ module.exports = class extends global.yoho.BaseModel {
}
getCateData(channel) {
return api.get('', {
method: 'app.sort.get'
return this.get({
data: {method: 'app.sort.get'},
api: global.yoho.API
}, {
cache: true
}).then((result) => {
... ...
... ... @@ -7,8 +7,8 @@
const utils = '../../../utils';
const contentCodeConfig = require('../../../config/content-code');
const _ = require('lodash');
const api = global.yoho.ServiceAPI;
const API = global.yoho.API;
// const api = global.yoho.ServiceAPI;
// const API = global.yoho.API;
const logger = global.yoho.logger;
const resourcesProcess = require(`${utils}/resources-process`);
... ... @@ -134,7 +134,11 @@ module.exports = class extends global.yoho.BaseModel {
params.new_device = true;
return api.get('operations/api/v5/resource/home', params, {
return this.get({
url: 'operations/api/v5/resource/home',
data: params,
api: global.yoho.ServiceAPI
}, {
cache: true
}).then(result => {
if (result && result.code === 200 && result.data && result.data.list) {
... ... @@ -159,7 +163,10 @@ module.exports = class extends global.yoho.BaseModel {
_getLeftNav(choosed) {
choosed = choosed || 'all';
return api.get('operations/api/v6/category/getCategory', {}, {
return this.get({
url: 'operations/api/v6/category/getCategory',
api: global.yoho.ServiceAPI
}, {
cache: true
}).then(result => {
// console.log(result)
... ... @@ -188,9 +195,12 @@ module.exports = class extends global.yoho.BaseModel {
delete params.gender;
}
return API.get('', _.assign({
method: 'app.search.getTerms'
}, params), {
return this.get({
data: _.assign({
method: 'app.search.getTerms'
}, params),
api: global.yoho.API
}, {
cache: true
}).then((result) => {
if (result && result.code === 200) {
... ... @@ -207,7 +217,10 @@ module.exports = class extends global.yoho.BaseModel {
* @return {[type]}
*/
_getChannelList() {
return api.get('operations/api/v5/entrance/getEntrance', {}, {
return this.get({
url: 'operations/api/v5/entrance/getEntrance',
api: global.yoho.ServiceAPI
}, {
cache: true
}).then((result) => {
if (result && result.code === 200) {
... ... @@ -253,8 +266,10 @@ module.exports = class extends global.yoho.BaseModel {
* @return {[type]}
*/
_getChannelBg() {
return api.get('operations/api/v5/resource/get', {
content_code: contentCode.index
return this.get({
url: 'operations/api/v5/resource/get',
data: {content_code: contentCode.index},
api: global.yoho.ServiceAPI
}, {
cache: true
}).then(result => {
... ... @@ -308,8 +323,10 @@ module.exports = class extends global.yoho.BaseModel {
gender = gender || 'boys';
if (gender === 'boys' || gender === 'girls') {
return api.get('operations/api/v5/resource/get', {
content_code: bottomBannerCode[gender] // eslint-disable-line
return this.get({
url: 'operations/api/v5/resource/get',
data: {content_code: bottomBannerCode[gender]}, // eslint-disable-line
api: global.yoho.ServiceAPI
}, {
cache: true
});
... ... @@ -325,10 +342,13 @@ module.exports = class extends global.yoho.BaseModel {
* 获取店铺推荐收藏和人数
*/
shopRecom(params) {
return API.get('', {
method: 'app.shops.floorNewInfo',
shop_ids: params.shopIds,
uid: params.uid,
return this.get({
data: {
method: 'app.shops.floorNewInfo',
shop_ids: params.shopIds,
uid: params.uid,
},
api: global.yoho.API
});
}
};
... ...
... ... @@ -15,8 +15,9 @@ module.exports = class extends global.yoho.BaseModel {
}
getResourceData(code) {
return service.get('operations/api/v5/resource/get', {
content_code: code
return this.get({
url: 'operations/api/v5/resource/get',
data: {content_code: code},
}, {
cache: true,
code: 200
... ...