Authored by zhangxiaoru

guang brand-list plusstar

1 'use strict'; 1 'use strict';
2 -const api = global.yoho.API;  
3 -const serviceAPI = global.yoho.ServiceAPI;  
4 const _ = require('lodash'); 2 const _ = require('lodash');
5 const helpers = global.yoho.helpers; 3 const helpers = global.yoho.helpers;
6 4
@@ -104,11 +102,13 @@ module.exports = class extends global.yoho.BaseModel { @@ -104,11 +102,13 @@ module.exports = class extends global.yoho.BaseModel {
104 _getChannelData(params) { 102 _getChannelData(params) {
105 let gender = params - 1 || 0; 103 let gender = params - 1 || 0;
106 104
107 - return api.get('', {  
108 - method: 'app.blk.getAllChannels'  
109 - }, {  
110 - cache: true,  
111 - code: 200 105 + return this.get({
  106 + data: {method: 'app.blk.getAllChannels'},
  107 + api: global.yoho.API,
  108 + param: {
  109 + cache: true,
  110 + code: 200
  111 + }
112 }).then(result => { 112 }).then(result => {
113 let channel = []; 113 let channel = [];
114 114
@@ -135,11 +135,14 @@ module.exports = class extends global.yoho.BaseModel { @@ -135,11 +135,14 @@ module.exports = class extends global.yoho.BaseModel {
135 if (!contentCode) { 135 if (!contentCode) {
136 return []; 136 return [];
137 } 137 }
138 - return serviceAPI.get('operations/api/v5/resource/get', {  
139 - content_code: contentCode  
140 - }, {  
141 - cache: true,  
142 - code: 200 138 + return this.get({
  139 + url: 'operations/api/v5/resource/get',
  140 + data: {content_code: contentCode},
  141 + api: global.yoho.ServiceAPI,
  142 + param: {
  143 + cache: true,
  144 + code: 200
  145 + }
143 }).then(result => { 146 }).then(result => {
144 return result && result.data ? result.data : []; 147 return result && result.data ? result.data : [];
145 }); 148 });
@@ -148,13 +151,16 @@ module.exports = class extends global.yoho.BaseModel { @@ -148,13 +151,16 @@ module.exports = class extends global.yoho.BaseModel {
148 _getBrandListOriginData(channel) { 151 _getBrandListOriginData(channel) {
149 let finalResult = {}; 152 let finalResult = {};
150 153
151 - return api.get('', {  
152 - method: 'app.brand.newBrandList',  
153 - yh_channel: yhChannel[channel].channel,  
154 - app_type: 1  
155 - }, {  
156 - code: 200,  
157 - cache: true 154 + return this.get({
  155 + data: {
  156 + method: 'app.brand.newBrandList',
  157 + yh_channel: yhChannel[channel].channel,
  158 + app_type: 1
  159 + },
  160 + params: {
  161 + code: 200,
  162 + cache: true
  163 + }
158 }).then(result => { 164 }).then(result => {
159 if (result.data && result.data.all_list) { 165 if (result.data && result.data.all_list) {
160 return Object.assign(finalResult, this.handleBrandList(result.data.all_list)); 166 return Object.assign(finalResult, this.handleBrandList(result.data.all_list));
@@ -218,11 +224,14 @@ module.exports = class extends global.yoho.BaseModel { @@ -218,11 +224,14 @@ module.exports = class extends global.yoho.BaseModel {
218 } 224 }
219 225
220 _getCateData(channel, appType) { 226 _getCateData(channel, appType) {
221 - return api.get('', {  
222 - method: 'app.sort.get',  
223 - app_type: 1  
224 - }, {  
225 - cache: true 227 + return this.get({
  228 + data: {
  229 + method: 'app.sort.get',
  230 + app_type: 1
  231 + },
  232 + param: {
  233 + cache: true
  234 + }
226 }).then((result) => { 235 }).then((result) => {
227 if (!result.code || result.code !== 200 || !result.data) { 236 if (!result.code || result.code !== 200 || !result.data) {
228 return []; 237 return [];
@@ -19,9 +19,8 @@ module.exports = class extends global.yoho.BaseModel { @@ -19,9 +19,8 @@ module.exports = class extends global.yoho.BaseModel {
19 method: 'app.blk.getAllChannels', 19 method: 'app.blk.getAllChannels',
20 app_type: params.app_type 20 app_type: params.app_type
21 }, 21 },
22 - api: global.yoho.API  
23 - }, {  
24 - cache: true 22 + api: global.yoho.API,
  23 + param: {cache: true}
25 }).then(result => { 24 }).then(result => {
26 let data = {channel: []}; 25 let data = {channel: []};
27 26
@@ -63,9 +62,8 @@ module.exports = class extends global.yoho.BaseModel { @@ -63,9 +62,8 @@ module.exports = class extends global.yoho.BaseModel {
63 page: param.page, 62 page: param.page,
64 limit: param.limit 63 limit: param.limit
65 }, 64 },
66 - api: global.yoho.API  
67 - }, {  
68 - cache: true 65 + api: global.yoho.API,
  66 + param: {cache: true}
69 }).then(result => { 67 }).then(result => {
70 let data = {}; 68 let data = {};
71 69
@@ -108,9 +106,8 @@ module.exports = class extends global.yoho.BaseModel { @@ -108,9 +106,8 @@ module.exports = class extends global.yoho.BaseModel {
108 return this.get({ 106 return this.get({
109 url: 'operations/api/v5/resource/get', 107 url: 'operations/api/v5/resource/get',
110 data: params, 108 data: params,
111 - api: global.yoho.ServiceAPI  
112 - }, {  
113 - cache: true 109 + api: global.yoho.ServiceAPI,
  110 + param: {cache: true}
114 }).then(result => { 111 }).then(result => {
115 let data = { 112 let data = {
116 goods: {}, 113 goods: {},