Showing
1 changed file
with
38 additions
and
10 deletions
@@ -3,7 +3,6 @@ | @@ -3,7 +3,6 @@ | ||
3 | * @Date: 2017-06-21 10:15:45 | 3 | * @Date: 2017-06-21 10:15:45 |
4 | * @Last Modified by: Targaryen | 4 | * @Last Modified by: Targaryen |
5 | */ | 5 | */ |
6 | -const api = global.yoho.API; | ||
7 | 6 | ||
8 | class BuyNowModel extends global.yoho.BaseModel { | 7 | class BuyNowModel extends global.yoho.BaseModel { |
9 | constructor(ctx) { | 8 | constructor(ctx) { |
@@ -15,13 +14,18 @@ class BuyNowModel extends global.yoho.BaseModel { | @@ -15,13 +14,18 @@ class BuyNowModel extends global.yoho.BaseModel { | ||
15 | * @param {*} params | 14 | * @param {*} params |
16 | */ | 15 | */ |
17 | countUsableCoupon(params) { | 16 | countUsableCoupon(params) { |
18 | - return api.post('', { | 17 | + return this.post({ |
18 | + data: { | ||
19 | method: 'app.Buynow.countUsableCoupon', | 19 | method: 'app.Buynow.countUsableCoupon', |
20 | uid: params.uid, | 20 | uid: params.uid, |
21 | product_sku: params.product_sku, | 21 | product_sku: params.product_sku, |
22 | sku_type: params.sku_type || 'I', | 22 | sku_type: params.sku_type || 'I', |
23 | buy_number: params.buy_number | 23 | buy_number: params.buy_number |
24 | - }, {cache: false}); | 24 | + }, |
25 | + param: { | ||
26 | + cache: false | ||
27 | + } | ||
28 | + }); | ||
25 | } | 29 | } |
26 | 30 | ||
27 | /** | 31 | /** |
@@ -29,7 +33,8 @@ class BuyNowModel extends global.yoho.BaseModel { | @@ -29,7 +33,8 @@ class BuyNowModel extends global.yoho.BaseModel { | ||
29 | * @param {*} params | 33 | * @param {*} params |
30 | */ | 34 | */ |
31 | listCoupon(params) { | 35 | listCoupon(params) { |
32 | - return api.post('', { | 36 | + return this.post({ |
37 | + data: { | ||
33 | method: 'app.Buynow.listCoupon', | 38 | method: 'app.Buynow.listCoupon', |
34 | uid: params.uid, | 39 | uid: params.uid, |
35 | product_sku: params.product_sku, | 40 | product_sku: params.product_sku, |
@@ -37,7 +42,9 @@ class BuyNowModel extends global.yoho.BaseModel { | @@ -37,7 +42,9 @@ class BuyNowModel extends global.yoho.BaseModel { | ||
37 | buy_number: params.buy_number, | 42 | buy_number: params.buy_number, |
38 | is_group_frees: params.is_group_frees, | 43 | is_group_frees: params.is_group_frees, |
39 | delivery_way: params.delivery_way | 44 | delivery_way: params.delivery_way |
40 | - }, {cache: false}); | 45 | + }, |
46 | + param: {cache: false} | ||
47 | + }); | ||
41 | } | 48 | } |
42 | 49 | ||
43 | /** | 50 | /** |
@@ -46,6 +53,7 @@ class BuyNowModel extends global.yoho.BaseModel { | @@ -46,6 +53,7 @@ class BuyNowModel extends global.yoho.BaseModel { | ||
46 | */ | 53 | */ |
47 | payment(params) { | 54 | payment(params) { |
48 | let finalParams = { | 55 | let finalParams = { |
56 | + data: { | ||
49 | method: 'app.Buynow.payment', | 57 | method: 'app.Buynow.payment', |
50 | uid: params.uid, | 58 | uid: params.uid, |
51 | product_sku: params.product_sku, | 59 | product_sku: params.product_sku, |
@@ -56,9 +64,13 @@ class BuyNowModel extends global.yoho.BaseModel { | @@ -56,9 +64,13 @@ class BuyNowModel extends global.yoho.BaseModel { | ||
56 | is_support_apple_pay: 'N', // H5 不支持 APPLE PAY | 64 | is_support_apple_pay: 'N', // H5 不支持 APPLE PAY |
57 | activity_id: params.activity_id || 0, | 65 | activity_id: params.activity_id || 0, |
58 | enable_red_envelopes: 0 // H5 不支持使用红包 | 66 | enable_red_envelopes: 0 // H5 不支持使用红包 |
67 | + }, | ||
68 | + param: { | ||
69 | + cache: false | ||
70 | + } | ||
59 | }; | 71 | }; |
60 | 72 | ||
61 | - return api.post('', finalParams, { cache: false }); | 73 | + return this.post(finalParams); |
62 | } | 74 | } |
63 | 75 | ||
64 | /** | 76 | /** |
@@ -95,7 +107,12 @@ class BuyNowModel extends global.yoho.BaseModel { | @@ -95,7 +107,12 @@ class BuyNowModel extends global.yoho.BaseModel { | ||
95 | finalParams.coupon_code = params.coupon_code; | 107 | finalParams.coupon_code = params.coupon_code; |
96 | } | 108 | } |
97 | 109 | ||
98 | - return api.post('', finalParams, {cache: false}); | 110 | + return this.post({ |
111 | + data: finalParams, | ||
112 | + param: { | ||
113 | + cache: false | ||
114 | + } | ||
115 | + }); | ||
99 | } | 116 | } |
100 | 117 | ||
101 | /** | 118 | /** |
@@ -182,11 +199,14 @@ class BuyNowModel extends global.yoho.BaseModel { | @@ -182,11 +199,14 @@ class BuyNowModel extends global.yoho.BaseModel { | ||
182 | finalParams.qhy_union = params.qhy_union; | 199 | finalParams.qhy_union = params.qhy_union; |
183 | } | 200 | } |
184 | 201 | ||
185 | - return api.post('', finalParams, { | 202 | + return this.post({ |
203 | + data: finalParams, | ||
204 | + param: { | ||
186 | headers: { | 205 | headers: { |
187 | 'X-Forwarded-For': params.ip || '', | 206 | 'X-Forwarded-For': params.ip || '', |
188 | 'User-Agent': params.userAgent | 207 | 'User-Agent': params.userAgent |
189 | } | 208 | } |
209 | + } | ||
190 | }); | 210 | }); |
191 | } | 211 | } |
192 | 212 | ||
@@ -206,7 +226,10 @@ class BuyNowModel extends global.yoho.BaseModel { | @@ -206,7 +226,10 @@ class BuyNowModel extends global.yoho.BaseModel { | ||
206 | if (params.coupon_code) { | 226 | if (params.coupon_code) { |
207 | finalParams.coupon_code = params.coupon_code; | 227 | finalParams.coupon_code = params.coupon_code; |
208 | } | 228 | } |
209 | - return api.post('', finalParams, {cache: false}); | 229 | + return this.post({ |
230 | + data: finalParams, | ||
231 | + param: {cache: false} | ||
232 | + }); | ||
210 | } | 233 | } |
211 | 234 | ||
212 | /** | 235 | /** |
@@ -226,7 +249,12 @@ class BuyNowModel extends global.yoho.BaseModel { | @@ -226,7 +249,12 @@ class BuyNowModel extends global.yoho.BaseModel { | ||
226 | finalParams.promotion_code = params.promotion_code; | 249 | finalParams.promotion_code = params.promotion_code; |
227 | } | 250 | } |
228 | 251 | ||
229 | - return api.post('', finalParams, {cache: false}); | 252 | + return this.post({ |
253 | + data: finalParams, | ||
254 | + param: { | ||
255 | + cache: false | ||
256 | + } | ||
257 | + }); | ||
230 | } | 258 | } |
231 | } | 259 | } |
232 | 260 |
-
Please register or login to post a comment