Authored by lea guo

yohood原价购接口调试

@@ -28,7 +28,7 @@ @@ -28,7 +28,7 @@
28 <view class="product_lucky_bg"> 28 <view class="product_lucky_bg">
29 <view class="product_lucky"> 29 <view class="product_lucky">
30 <text>原价</text> 30 <text>原价</text>
31 - <text class="price-info">{{product.price}}</text> 31 + <text class="price-info">{{product.lottery_price}}</text>
32 </view> 32 </view>
33 <view class="product_price"> 33 <view class="product_price">
34 <text>市场参考价</text> 34 <text>市场参考价</text>
@@ -231,7 +231,7 @@ Page( @@ -231,7 +231,7 @@ Page(
231 }, 231 },
232 232
233 _getMineCode() { 233 _getMineCode() {
234 - if (this.data.uid) { 234 + if (this.data.uid && this.data.actPrizeId) {
235 this.service 235 this.service
236 .fetchMyPrizeList({ 236 .fetchMyPrizeList({
237 uid: this.data.uid, 237 uid: this.data.uid,
@@ -324,13 +324,14 @@ Page( @@ -324,13 +324,14 @@ Page(
324 let params = { 324 let params = {
325 actPrizeId: this.data.actPrizeId, 325 actPrizeId: this.data.actPrizeId,
326 }; 326 };
327 -  
328 - return Promise.all([  
329 - this.service.getDetail(params),  
330 - this.service.getRecommend(params),  
331 - this.service.getRecentAvatars(params),  
332 - ])  
333 - .then(([r1, r2, r3]) => { 327 + const promises = [this.service.getYohoodDetail(params)];
  328 + if(this.data.actPrizeId) {
  329 + promises.push(this.service.getRecentAvatars(params))
  330 + }else {
  331 + promises.push(Promise.resolve({}))
  332 + }
  333 + return Promise.all(promises)
  334 + .then(([r1, r2]) => {
334 wx.hideLoading(); 335 wx.hideLoading();
335 if (r1.code === 200 && r1.data) { 336 if (r1.code === 200 && r1.data) {
336 let product = r1.data; 337 let product = r1.data;
@@ -349,8 +350,7 @@ Page( @@ -349,8 +350,7 @@ Page(
349 350
350 this.setData({ 351 this.setData({
351 product: product, 352 product: product,
352 - recommends: r2.code === 200 ? r2.data : [],  
353 - avatars: (r3.code === 200 ? r3.data : []).map(i => { 353 + avatars: (r2.code === 200 ? r2.data : []).map(i => {
354 i.user_name = wrapperName(i.user_name); 354 i.user_name = wrapperName(i.user_name);
355 i.user_thumb = formatImageUrl(i.user_thumb, 200, 200); 355 i.user_thumb = formatImageUrl(i.user_thumb, 200, 200);
356 return i; 356 return i;
@@ -6,8 +6,8 @@ import iconfSwitch from '../../../libs/switch'; @@ -6,8 +6,8 @@ import iconfSwitch from '../../../libs/switch';
6 import md5 from '../../../vendors/md5'; 6 import md5 from '../../../vendors/md5';
7 7
8 //注:g_sourceApiArry与g_toJavaApiArry的length要相等,且一一对应 8 //注:g_sourceApiArry与g_toJavaApiArry的length要相等,且一一对应
9 -const g_sourceApiArry = [ '/list', '/content', '/list/recommend', '/code/recent', '/list/mine', '/code/gain', '/code/mine' ];  
10 -const g_toJavaApiArry = [ 'app.yoluck.activityList', 'app.yoluck.getContent', 'app.yoluck.recommendList', 'app.yoluck.recent', 'app.yoluck.participationList', 'app.yoluck.getCode', 'app.yoluck.userCode' ]; 9 +const g_sourceApiArry = [ '/list', '/content', '/list/recommend', '/code/recent', '/list/mine', '/code/gain', '/code/mine','/yohood/content' ];
  10 +const g_toJavaApiArry = [ 'app.yoluck.activityList', 'app.yoluck.getContent', 'app.yoluck.recommendList', 'app.yoluck.recent', 'app.yoluck.participationList', 'app.yoluck.getCode', 'app.yoluck.userCode','app.yohood.getContent' ];
11 11
12 12
13 const app = getApp(); 13 const app = getApp();
@@ -32,7 +32,7 @@ class Service { @@ -32,7 +32,7 @@ class Service {
32 32
33 //适配服务器更换Java接口,开关控制是否切换 33 //适配服务器更换Java接口,开关控制是否切换
34 if (app.globalData.switch_javaApiEnable && pathIndex >= 0) { 34 if (app.globalData.switch_javaApiEnable && pathIndex >= 0) {
35 - if (result.data.list) { 35 + if (result.data&& result.data.list) {
36 let newList = Humps.decamelizeKeys(Object.values(result.data.list)); 36 let newList = Humps.decamelizeKeys(Object.values(result.data.list));
37 result.data.list = newList; 37 result.data.list = newList;
38 } else { 38 } else {
@@ -49,6 +49,23 @@ class ZeroSellService extends Service { @@ -49,6 +49,23 @@ class ZeroSellService extends Service {
49 }); 49 });
50 } 50 }
51 51
  52 + getYohoodDetail(data) {
  53 + return this._get('/yohood/content', data).then(result => {
  54 + if (result.code === 200) {
  55 + Object.keys(result.data).forEach(item => {
  56 + if (item === 'my_code_num') {
  57 + result.data['myCodeNum'] = result.data[item];
  58 + }
  59 + })
  60 + productTime(result.data)
  61 +
  62 + return result;
  63 + }
  64 +
  65 + return result;
  66 + });
  67 + }
  68 +
52 getRecommend(data) { 69 getRecommend(data) {
53 data.channel = 0 70 data.channel = 0
54 return this._get('/list/recommend', data).then(result => { 71 return this._get('/list/recommend', data).then(result => {
@@ -81,7 +81,7 @@ @@ -81,7 +81,7 @@
81 "id": 6, 81 "id": 6,
82 "name": "YOHOOD LOTTERY", 82 "name": "YOHOOD LOTTERY",
83 "pathName": "pages/zeroSell/originalPriceSell", 83 "pathName": "pages/zeroSell/originalPriceSell",
84 - "query": "actPrizeId=224", 84 + "query": "",
85 "scene": null 85 "scene": null
86 }, 86 },
87 { 87 {