Commit ce84539c750d1c1f57c1ea910f2ee2448ca58426
1 parent
e45082dc
Exists in
master
and in
1 other branch
update gen file
Showing
5 changed files
with
136 additions
and
50 deletions
Show diff stats
app.js
@@ -391,28 +391,28 @@ app.post('/privilege/v1/history/delete', require('./privilege').deleteCustomer); | @@ -391,28 +391,28 @@ app.post('/privilege/v1/history/delete', require('./privilege').deleteCustomer); | ||
391 | 391 | ||
392 | app.post('/v1/MVP/enq/getMobileOfferInventory/', require('./true').getMobileOfferInventory); | 392 | app.post('/v1/MVP/enq/getMobileOfferInventory/', require('./true').getMobileOfferInventory); |
393 | 393 | ||
394 | - app.get('/api/random/leader', function (req, res) { | ||
395 | - const months = ["เกมส์", "โน๊ต setup", "โน๊ต วัศรุต", "แบงค์", "มอส", "ปิ๊ค", "เต้นพอไม่ต้องตื่น", "เปา", "นัท", "kik", "new", "ann","na", "boky", "eve", "miki", "pla", "sugar"]; | ||
396 | - // const months = [ "ann"]; | 394 | +app.get('/api/random/leader', function (req, res) { |
395 | +const months = ["เกมส์", "โน๊ต setup", "โน๊ต วัศรุต", "แบงค์", "มอส", "ปิ๊ค", "เต้นพอไม่ต้องตื่น", "เปา", "นัท", "kik", "new", "ann","na", "boky", "eve", "miki", "pla", "sugar"]; | ||
396 | +// const months = [ "ann"]; | ||
397 | 397 | ||
398 | 398 | ||
399 | - let object={} | ||
400 | - for(var i=0; i<100; i++) { | ||
401 | - const random = Math.floor(Math.random() * months.length); | ||
402 | - // console.log(random, months[random]); | ||
403 | - if(object[months[random]]) { | ||
404 | - object[months[random]] = object[months[random]] + 1; | ||
405 | - } else { | ||
406 | - object[months[random]] = 1 | ||
407 | - } | 399 | +let object={} |
400 | +for(var i=0; i<100; i++) { | ||
401 | + const random = Math.floor(Math.random() * months.length); | ||
402 | + // console.log(random, months[random]); | ||
403 | + if(object[months[random]]) { | ||
404 | + object[months[random]] = object[months[random]] + 1; | ||
405 | + } else { | ||
406 | + object[months[random]] = 1 | ||
408 | } | 407 | } |
408 | +} | ||
409 | 409 | ||
410 | - | ||
411 | - console.log(object); | ||
412 | 410 | ||
413 | - res.send(object); | ||
414 | - }) | 411 | +console.log(object); |
412 | + | ||
413 | +res.send(object); | ||
414 | +}) | ||
415 | 415 | ||
416 | - | 416 | +app.get('/linenoti', require('./line').lineNoti) |
417 | 417 | ||
418 | app.listen(port, () => console.log('app listening on port ' + port + '!')) | 418 | app.listen(port, () => console.log('app listening on port ' + port + '!')) |
419 | \ No newline at end of file | 419 | \ No newline at end of file |
apple.js
@@ -157,6 +157,6 @@ module.exports.verifyReceipt = async (req, res) => { | @@ -157,6 +157,6 @@ module.exports.verifyReceipt = async (req, res) => { | ||
157 | retrySuccess -= 1 | 157 | retrySuccess -= 1 |
158 | res.send(responseError) | 158 | res.send(responseError) |
159 | } else { | 159 | } else { |
160 | - res.send(response) | 160 | + res.send(responseError) |
161 | } | 161 | } |
162 | } | 162 | } |
@@ -0,0 +1,32 @@ | @@ -0,0 +1,32 @@ | ||
1 | +var fs = require('fs').promises; | ||
2 | + | ||
3 | +function genFile() { | ||
4 | + let content = '000010000112022030S2300420300001AWM001000604' | ||
5 | + let thisFile = '' | ||
6 | + for(let i = 30000; i <= 100000; i++) { | ||
7 | + if(i%200 == 0 || i == 30000) { | ||
8 | + thisFile = getFileName(i) | ||
9 | + console.log(thisFile) | ||
10 | + } | ||
11 | + if(i == 100000) { | ||
12 | + console.log("9999" + paddy(i,6) + content); | ||
13 | + continue | ||
14 | + } | ||
15 | + console.log("99999" + paddy(i,5) + content); | ||
16 | + } | ||
17 | +} | ||
18 | + | ||
19 | +function getFileName(i) { | ||
20 | + if(i+200 == 100000) { | ||
21 | + return "99999" + paddy(i+1,5) + "-" + paddy(i+200,6) + ".inv" | ||
22 | + } | ||
23 | + return "99999" + paddy(i+1,5) + "-" + paddy(i+200,5) + ".inv" | ||
24 | +} | ||
25 | + | ||
26 | +function paddy(num, padlen, padchar) { | ||
27 | + var pad_char = typeof padchar !== 'undefined' ? padchar : '0'; | ||
28 | + var pad = new Array(1 + padlen).join(pad_char); | ||
29 | + return (pad + num).slice(-pad.length); | ||
30 | +} | ||
31 | + | ||
32 | +genFile() | ||
0 | \ No newline at end of file | 33 | \ No newline at end of file |
@@ -0,0 +1,33 @@ | @@ -0,0 +1,33 @@ | ||
1 | +var unirest = require('unirest'); | ||
2 | +var mongo = require('mongodb') | ||
3 | + | ||
4 | +module.exports.lineNoti = async (req, res) => { | ||
5 | + console.log('===== POST lineNoti =====') | ||
6 | + console.log('url', req.originalUrl); | ||
7 | + console.log('headers', req.headers); | ||
8 | + console.log('query', req.query); | ||
9 | + console.log('params', req.params); | ||
10 | + console.log('body', req.body); | ||
11 | + | ||
12 | + unirest.post('https://notify-bot.line.me/oauth/token') | ||
13 | + .form({ | ||
14 | + grant_type: 'authorization_code', | ||
15 | + code: req.query.code, | ||
16 | + redirect_uri: 'http://127.0.0.1:3002/linenoti', | ||
17 | + client_id: 'VZ79ZR2Xtc15nZKQexT3sI', | ||
18 | + client_secret: 'lsqqZr6B2PJXrpjgNbw4DFr88DJYoFrFSQ5VTPlICaW' | ||
19 | + }) | ||
20 | + .end(function (response) { | ||
21 | + console.log(response.body); | ||
22 | + unirest.post('https://notify-api.line.me/api/notify') | ||
23 | + .headers({ | ||
24 | + Authorization: `Bearer ${response.body.access_token}` | ||
25 | + }) | ||
26 | + .form({ | ||
27 | + message: `token:${response.body.access_token},state:${req.query.state}` | ||
28 | + }).end(function (response) { | ||
29 | + res.status(304).redirect(response.body) | ||
30 | + }); | ||
31 | + }); | ||
32 | + | ||
33 | +} | ||
0 | \ No newline at end of file | 34 | \ No newline at end of file |
loadtest.js
@@ -10,44 +10,65 @@ function statusCallback(error, result, latency) { | @@ -10,44 +10,65 @@ function statusCallback(error, result, latency) { | ||
10 | } | 10 | } |
11 | } | 11 | } |
12 | 12 | ||
13 | +// const options = { | ||
14 | +// url: 'http://127.0.0.1:5001/api/v3/mpay/billingonbehalf/reserveAndChargeVolume.json', | ||
15 | +// maxRequests: 10000, | ||
16 | +// requestsPerSecond: 100, | ||
17 | +// headers : { | ||
18 | +// "Content-Type":"application/json", | ||
19 | +// "x-app":"partnerId=30163; ptsAppKeyName=PICO|Browser|1.0.0", | ||
20 | +// "x-tid":"SACF-300519siwkxkw7du", | ||
21 | +// "X-Public-Id":"sgltest7@corp.ais900dev.org", | ||
22 | +// "X-Private-Id":"NI5smn3wWpoPX1ma2jbPiE8hK4QcDqHR1582013702233" | ||
23 | +// }, | ||
24 | +// method: "POST", | ||
25 | +// body : { | ||
26 | +// "endUserIdentifier":"66932019877", | ||
27 | +// "volume":"0", | ||
28 | +// "out_trade_no":"nw424bc0bb690c73518a762a2d1a339d7f_COINS12000_20190219095515", | ||
29 | +// "subject":"Purchased 12000 coins.", | ||
30 | +// "pay_time":"2020-03-24 20:20:20", | ||
31 | +// "device_id":"90c73518a762a2d1a339d7f", | ||
32 | +// "buyer_pay_fee":"Paid by user", | ||
33 | +// "coupon_fee":"20", | ||
34 | +// "terminal_type":"IOS", | ||
35 | +// "billingText":"test", | ||
36 | +// "parameters":{ | ||
37 | +// "amount":"0", | ||
38 | +// "serviceNumber":"35000900022", | ||
39 | +// "serviceType":"Download", | ||
40 | +// "transactionID":"50609152601999918991", | ||
41 | +// "currency":"THB", | ||
42 | +// "taxDev":"0", | ||
43 | +// "productCode":"Purchased 12000 coins that can be spent on weapons.", | ||
44 | +// "productInfo":"COINS12000", | ||
45 | +// "merchantContact":"MerchantContactTest", | ||
46 | +// "cct":"0", | ||
47 | +// "expireDate":"20200523142045", | ||
48 | +// "senderName":"Huawei" | ||
49 | +// } | ||
50 | +// }, | ||
51 | +// contentType : "application/json", | ||
52 | +// statusCallback: statusCallback | ||
53 | +// }; | ||
54 | + | ||
13 | const options = { | 55 | const options = { |
14 | - url: 'http://127.0.0.1:5001/api/v3/mpay/billingonbehalf/reserveAndChargeVolume.json', | ||
15 | - maxRequests: 10000, | ||
16 | - requestsPerSecond: 100, | 56 | + url: 'http://127.0.0.1:4000/point/v1/deleteCustomer', |
57 | + maxRequests: 2, | ||
58 | + requestsPerSecond: 2, | ||
17 | headers : { | 59 | headers : { |
18 | "Content-Type":"application/json", | 60 | "Content-Type":"application/json", |
19 | - "x-app":"partnerId=30163; ptsAppKeyName=PICO|Browser|1.0.0", | ||
20 | - "x-tid":"SACF-300519siwkxkw7du", | ||
21 | - "X-Public-Id":"sgltest7@corp.ais900dev.org", | ||
22 | - "X-Private-Id":"NI5smn3wWpoPX1ma2jbPiE8hK4QcDqHR1582013702233" | 61 | + "x-app-id":"partnerId=30163; ptsAppKeyName=PICO|Browser|1.0.0", |
62 | + "x-transaction-id":"SACF-300519siwkxkw7du", | ||
63 | + "accessToken":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoxLCJuYW1lIjoidGVzdG5hbWUiLCJsYXN0bmFtZSI6InRlc3RsYXNuYW1lIiwiZW1haWwiOiJ0ZXN0QGdtYWlsLmNvbSIsInVzZXJuYW1lIjoiQURtaW4xMjM0IiwiaWF0IjoxNTk3MTE4MjM5fQ.PbZphEffSy6nBPhDzFneE1LtMWy6YpRumo8sjacjAEs", | ||
64 | + "X-Tid":"NI5smn3wWpoPX1ma2jbPiE8hK4QcDqHR1582013702233" | ||
23 | }, | 65 | }, |
24 | method: "POST", | 66 | method: "POST", |
25 | body : { | 67 | body : { |
26 | - "endUserIdentifier":"66932019877", | ||
27 | - "volume":"0", | ||
28 | - "out_trade_no":"nw424bc0bb690c73518a762a2d1a339d7f_COINS12000_20190219095515", | ||
29 | - "subject":"Purchased 12000 coins.", | ||
30 | - "pay_time":"2020-03-24 20:20:20", | ||
31 | - "device_id":"90c73518a762a2d1a339d7f", | ||
32 | - "buyer_pay_fee":"Paid by user", | ||
33 | - "coupon_fee":"20", | ||
34 | - "terminal_type":"IOS", | ||
35 | - "billingText":"test", | ||
36 | - "parameters":{ | ||
37 | - "amount":"0", | ||
38 | - "serviceNumber":"35000900022", | ||
39 | - "serviceType":"Download", | ||
40 | - "transactionID":"50609152601999918991", | ||
41 | - "currency":"THB", | ||
42 | - "taxDev":"0", | ||
43 | - "productCode":"Purchased 12000 coins that can be spent on weapons.", | ||
44 | - "productInfo":"COINS12000", | ||
45 | - "merchantContact":"MerchantContactTest", | ||
46 | - "cct":"0", | ||
47 | - "expireDate":"20200523142045", | ||
48 | - "senderName":"Huawei" | ||
49 | - } | ||
50 | - }, | 68 | + "enterpriseId": "ent0002", |
69 | + "userIdType": "0", | ||
70 | + "userIdData": "2020-P2-3000111@email_password" | ||
71 | + }, | ||
51 | contentType : "application/json", | 72 | contentType : "application/json", |
52 | statusCallback: statusCallback | 73 | statusCallback: statusCallback |
53 | }; | 74 | }; |