Compare View
Commits (3)
Changes
Showing 2 changed files Side-by-side Diff
gateway/pull.js
... | ... | @@ -8,15 +8,15 @@ const matrix = require('../matrix'); |
8 | 8 | |
9 | 9 | var partner; |
10 | 10 | |
11 | -function init(options) { | |
12 | - partner = options.partner; | |
13 | - | |
14 | - initMatrix(); | |
15 | - | |
16 | - setInterval(pullTask, config.pull_interval_ms || 1000); | |
11 | +function setPartner(_partner) { | |
12 | + partner = _partner; | |
17 | 13 | } |
18 | 14 | |
19 | 15 | function pullTask() { |
16 | + if (!partner) { | |
17 | + return; | |
18 | + } | |
19 | + | |
20 | 20 | let options = { |
21 | 21 | url: config.pull_url.task.replace('<CORE_APIKEY>', config.core_apikey), |
22 | 22 | qs: { |
... | ... | @@ -80,7 +80,7 @@ function report(data) { |
80 | 80 | message: data.message, |
81 | 81 | handler: config.handler_name, |
82 | 82 | sn: data.sn, |
83 | - supplier_price: data.supplier_price | |
83 | + amount: data.amount | |
84 | 84 | } |
85 | 85 | } |
86 | 86 | |
... | ... | @@ -141,7 +141,10 @@ function getRemoteProduct(product) { |
141 | 141 | return remoteProduct || product; |
142 | 142 | } |
143 | 143 | |
144 | -exports.init = init; | |
144 | +initMatrix(); | |
145 | +setInterval(pullTask, config.pull_interval_ms || 1000); | |
146 | + | |
147 | +exports.setPartner = setPartner; | |
145 | 148 | exports.isPaused = isPaused; |
146 | 149 | exports.pause = pause; |
147 | 150 | exports.resume = resume; |