Authored by zhangxiaoru

guang param

@@ -4,7 +4,6 @@ @@ -4,7 +4,6 @@
4 * @date: 2016/09/07 4 * @date: 2016/09/07
5 */ 5 */
6 'use strict'; 6 'use strict';
7 -const api = global.yoho.API;  
8 7
9 8
10 module.exports = class extends global.yoho.BaseModel { 9 module.exports = class extends global.yoho.BaseModel {
@@ -33,6 +32,9 @@ module.exports = class extends global.yoho.BaseModel { @@ -33,6 +32,9 @@ module.exports = class extends global.yoho.BaseModel {
33 param.fav_id = id; 32 param.fav_id = id;
34 param.method = 'app.favorite.cancel'; 33 param.method = 'app.favorite.cancel';
35 } 34 }
36 - return api.post('', param); 35 + return this.post({
  36 + data: param,
  37 + api: global.yoho.API
  38 + });
37 } 39 }
38 }; 40 };
@@ -4,8 +4,6 @@ @@ -4,8 +4,6 @@
4 * @date: 2016/09/07 4 * @date: 2016/09/07
5 */ 5 */
6 'use strict'; 6 'use strict';
7 -const serviceAPI = global.yoho.ServiceAPI;  
8 -const api = global.yoho.API;  
9 7
10 module.exports = class extends global.yoho.BaseModel { 8 module.exports = class extends global.yoho.BaseModel {
11 constructor(ctx) { 9 constructor(ctx) {
@@ -26,9 +24,17 @@ module.exports = class extends global.yoho.BaseModel { @@ -26,9 +24,17 @@ module.exports = class extends global.yoho.BaseModel {
26 }; 24 };
27 25
28 if (opt === 'cancel') { 26 if (opt === 'cancel') {
29 - return serviceAPI.get('guang/api/v2/praise/cancel', param); 27 + return this.get({
  28 + url: 'guang/api/v2/praise/cancel',
  29 + data: param,
  30 + api: global.yoho.ServiceAPI
  31 + });
30 } else { 32 } else {
31 - return serviceAPI.get('guang/api/v2/praise/setPraise', param); 33 + return this.get({
  34 + url: 'guang/api/v2/praise/setPraise',
  35 + data: param,
  36 + api: global.yoho.ServiceAPI
  37 + });
32 } 38 }
33 } 39 }
34 40
@@ -46,9 +52,17 @@ module.exports = class extends global.yoho.BaseModel { @@ -46,9 +52,17 @@ module.exports = class extends global.yoho.BaseModel {
46 }; 52 };
47 53
48 if (opt === 'cancel') { 54 if (opt === 'cancel') {
49 - return serviceAPI.get('guang/api/v1/favorite/cancelFavorite', param); 55 + return this.get({
  56 + url: 'guang/api/v1/favorite/cancelFavorite',
  57 + data: param,
  58 + api: global.yoho.ServiceAPI
  59 + });
50 } else { 60 } else {
51 - return serviceAPI.get('guang/api/v1/favorite/setFavorite', param); 61 + return this.get({
  62 + url: 'guang/api/v1/favorite/setFavorite',
  63 + data: param,
  64 + api: global.yoho.ServiceAPI
  65 + });
52 } 66 }
53 } 67 }
54 68
@@ -73,9 +87,17 @@ module.exports = class extends global.yoho.BaseModel { @@ -73,9 +87,17 @@ module.exports = class extends global.yoho.BaseModel {
73 87
74 88
75 if (opt === 'ok') { 89 if (opt === 'ok') {
76 - return api.get('app.favorite.add', param); 90 + return this.get({
  91 + url: 'app.favorite.add',
  92 + data: param,
  93 + api: global.yoho.API
  94 + });
77 } else { 95 } else {
78 - return api.get('app.favorite.cancel', param); 96 + return this.get({
  97 + url: 'app.favorite.cancel',
  98 + data: param,
  99 + api: global.yoho.API
  100 + });
79 } 101 }
80 } 102 }
81 }; 103 };
@@ -66,8 +66,9 @@ module.exports = class extends global.yoho.BaseModel { @@ -66,8 +66,9 @@ module.exports = class extends global.yoho.BaseModel {
66 return this.get({ 66 return this.get({
67 url: 'guang/api/v3/plustar/getlist', 67 url: 'guang/api/v3/plustar/getlist',
68 data: param, 68 data: param,
69 - api: global.yoho.ServiceAPI  
70 - }, {cache: true}).then((result) => { 69 + api: global.yoho.ServiceAPI,
  70 + param: {cache: true}
  71 + }).then((result) => {
71 if (result && result.code === 200) { 72 if (result && result.code === 200) {
72 return this.formaData(result.data.data.list[0].data, gender); 73 return this.formaData(result.data.data.list[0].data, gender);
73 } else { 74 } else {
@@ -136,8 +137,9 @@ module.exports = class extends global.yoho.BaseModel { @@ -136,8 +137,9 @@ module.exports = class extends global.yoho.BaseModel {
136 order: 's_t_desc', 137 order: 's_t_desc',
137 page: 1 138 page: 1
138 }, 139 },
139 - api: global.yoho.API  
140 - }, {cache: true}).then((result) => { 140 + api: global.yoho.API,
  141 + param: {cache: true}
  142 + }).then((result) => {
141 143
142 if (result && result.code === 200) { 144 if (result && result.code === 200) {
143 145
@@ -316,8 +318,9 @@ module.exports = class extends global.yoho.BaseModel { @@ -316,8 +318,9 @@ module.exports = class extends global.yoho.BaseModel {
316 data: { 318 data: {
317 id: id 319 id: id
318 }, 320 },
319 - api: global.yoho.ServiceAPI  
320 - }, {cache: true}).then((result) => { 321 + api: global.yoho.ServiceAPI,
  322 + param: {cache: true}
  323 + }).then((result) => {
321 if (result && result.code === 200) { 324 if (result && result.code === 200) {
322 let list = result.data || []; 325 let list = result.data || [];
323 let jumpToApp; 326 let jumpToApp;
@@ -30,9 +30,10 @@ module.exports = class extends global.yoho.BaseModel { @@ -30,9 +30,10 @@ module.exports = class extends global.yoho.BaseModel {
30 content_code: contentCode[page], 30 content_code: contentCode[page],
31 platform: 'iphone' 31 platform: 'iphone'
32 }, 32 },
33 - api: global.yoho.ServiceAPI  
34 - }, { 33 + api: global.yoho.ServiceAPI,
  34 + param: {
35 cache: true 35 cache: true
  36 + }
36 }).then((result) => { 37 }).then((result) => {
37 if (result && result.code === 200) { 38 if (result && result.code === 200) {
38 return resourcesProcess(result.data); 39 return resourcesProcess(result.data);
@@ -172,9 +173,10 @@ module.exports = class extends global.yoho.BaseModel { @@ -172,9 +173,10 @@ module.exports = class extends global.yoho.BaseModel {
172 method: 'app.starClass.index', 173 method: 'app.starClass.index',
173 code: '8adc27fcf5676f356602889afcfd2a8e' 174 code: '8adc27fcf5676f356602889afcfd2a8e'
174 }, 175 },
175 - api: global.yoho.API  
176 - }, { 176 + api: global.yoho.API,
  177 + param: {
177 cache: true 178 cache: true
  179 + }
178 }).then((result) => { 180 }).then((result) => {
179 if (result && result.code === 200) { 181 if (result && result.code === 200) {
180 return this._processIndexData(result); 182 return this._processIndexData(result);
@@ -197,9 +199,10 @@ module.exports = class extends global.yoho.BaseModel { @@ -197,9 +199,10 @@ module.exports = class extends global.yoho.BaseModel {
197 size: 10, 199 size: 10,
198 uid: uid 200 uid: uid
199 }, 201 },
200 - api: global.yoho.API  
201 - }, { 202 + api: global.yoho.API,
  203 + param: {
202 cache: true 204 cache: true
  205 + }
203 }).then((result) => { 206 }).then((result) => {
204 if (result && result.code === 200) { 207 if (result && result.code === 200) {
205 if (params.page > result.data.totalPage) { 208 if (params.page > result.data.totalPage) {
@@ -251,9 +254,10 @@ module.exports = class extends global.yoho.BaseModel { @@ -251,9 +254,10 @@ module.exports = class extends global.yoho.BaseModel {
251 limit: '20', 254 limit: '20',
252 uid: uid 255 uid: uid
253 }, params), 256 }, params),
254 - api: global.yoho.ServiceAPI  
255 - }, { 257 + api: global.yoho.ServiceAPI,
  258 + param: {
256 cache: true 259 cache: true
  260 + }
257 }).then((result) => { 261 }).then((result) => {
258 if (result && result.code === 200) { 262 if (result && result.code === 200) {
259 return this._processGuangData(result.data.list.artList); 263 return this._processGuangData(result.data.list.artList);