Showing
11 changed files
with
193 additions
and
33 deletions
| ... | @@ -18,22 +18,22 @@ | ... | @@ -18,22 +18,22 @@ |
| 18 | 18 | ||
| 19 | ## API Table | 19 | ## API Table |
| 20 | 20 | ||
| 21 | -| group | description | method | URL | Detail | Auth | | 21 | +| group | description | method | URL | Detail | Auth | |
| 22 | -| ------- | --------------------------- | --------- | ----------------------- | -------- | --------- | | 22 | +| ------- | --------------------------------- | ------ | ----------------------- | -------- | --------- | |
| 23 | -| user | 유저 등록 | POST | api/user | 바로가기 | JWT Token | | 23 | +| user | 유저 등록 | POST | api/user | 바로가기 | JWT Token | |
| 24 | -| user | 유저 삭제 | DELETE | api/user:id | 바로가기 | JWT Token | | 24 | +| user | 유저 삭제 | DELETE | api/user:id | 바로가기 | JWT Token | |
| 25 | -| user | 특정 유저 조회 | GET | api/user:id | 바로가기 | None | | 25 | +| user | 특정 유저 조회 | GET | api/user:id | 바로가기 | None | |
| 26 | -| user | 전체 유저 조회 | GET | api/user | 바로가기 | JWT Token | | 26 | +| user | 전체 유저 조회 | GET | api/user | 바로가기 | JWT Token | |
| 27 | -| friend | 유저 친구 등록 | POST | api/friend | 바로가기 | JWT Token | | 27 | +| friend | 유저 친구 등록 | POST | api/friend | 바로가기 | JWT Token | |
| 28 | -| friend | 유저의 친구 조회 | GET | api/friend:id | 바로가기 | None | | 28 | +| friend | 유저의 친구 조회 | GET | api/friend:id | 바로가기 | None | |
| 29 | -| profile | 유저가 푼 문제 조회(백준) | GET | api/profile/solvedBJ:id | 바로가기 | None | | 29 | +| profile | 유저가 푼 문제 조회(백준) | GET | api/profile/solvedBJ:id | 바로가기 | None | |
| 30 | -| profile | 유저가 푼 문제 동기화(백준) | PATCH | api/profile/syncBJ | 바로가기 | None | | 30 | +| profile | 유저가 푼 문제 동기화(백준) | PATCH | api/profile/syncBJ | 바로가기 | None | |
| 31 | -| profile | 유저 정보 수정 | POST | api/profile/setprofile | 바로가기 | JWT TOKEN | | 31 | +| profile | 유저 정보 수정 | POST | api/profile/setprofile | 바로가기 | JWT TOKEN | |
| 32 | -| profile | 유저 정보 받아오기 | POST | api/profile/getprofile | 바로가기 | JWT | | 32 | +| profile | 유저 정보 받아오기 | POST | api/profile/getprofile | 바로가기 | JWT | |
| 33 | -| profile | 추천 문제 조회 | POST | api/profile/recommend | 바로가기 | None | | 33 | +| profile | 추천 문제 조회 | POST | api/profile/recommend | 바로가기 | None | |
| 34 | -| notify | 슬랙 메시지 전송 요청 | POST | api/notify/ | | 34 | +| notify | 슬랙 메시지 전송 요청 (성취여부) | POST | api/notify/goal | 바로가기 | Jwt Token | |
| 35 | -| slack | 바로가기 | Jwt Token | | 35 | +| notify | 슬랙 메시지 전송 요청 (문제 추천) | POST | api/notify/recommend | 바로가기 | None | |
| 36 | -| auth | 로그인 | POST | api/auth/login | 바로가기 | None | | 36 | +| auth | 로그인 | POST | api/auth/login | 바로가기 | None | |
| 37 | -| auth | 로그아웃 | POST | api/auth/logout | 바로가기 | JWT Token | | 37 | +| auth | 로그아웃 | POST | api/auth/logout | 바로가기 | JWT Token | |
| 38 | -| auth | 회원가입 | POST | api/auth/register | 바로가기 | None | | 38 | +| auth | 회원가입 | POST | api/auth/register | 바로가기 | None | |
| 39 | -| auth | 로그인 확인 | GET | api/auth/check | 바로가기 | None | | 39 | +| auth | 로그인 확인 | GET | api/auth/check | 바로가기 | None | | ... | ... |
| ... | @@ -1341,3 +1341,44 @@ | ... | @@ -1341,3 +1341,44 @@ |
| 1341 | ::ffff:127.0.0.1 - - [24/Jun/2020:15:41:51 +0000] "GET /api/auth/check HTTP/1.1" 200 55 "http://localhost:3000/setting" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.106 Safari/537.36 Edg/83.0.478.54" | 1341 | ::ffff:127.0.0.1 - - [24/Jun/2020:15:41:51 +0000] "GET /api/auth/check HTTP/1.1" 200 55 "http://localhost:3000/setting" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.106 Safari/537.36 Edg/83.0.478.54" |
| 1342 | ::ffff:127.0.0.1 - - [24/Jun/2020:15:41:51 +0000] "POST /api/profile/getprofile HTTP/1.1" 401 12 "http://localhost:3000/setting" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.106 Safari/537.36 Edg/83.0.478.54" | 1342 | ::ffff:127.0.0.1 - - [24/Jun/2020:15:41:51 +0000] "POST /api/profile/getprofile HTTP/1.1" 401 12 "http://localhost:3000/setting" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.106 Safari/537.36 Edg/83.0.478.54" |
| 1343 | ::ffff:127.0.0.1 - - [24/Jun/2020:15:41:51 +0000] "POST /api/profile/getprofile HTTP/1.1" 200 33293 "http://localhost:3000/setting" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.106 Safari/537.36 Edg/83.0.478.54" | 1343 | ::ffff:127.0.0.1 - - [24/Jun/2020:15:41:51 +0000] "POST /api/profile/getprofile HTTP/1.1" 200 33293 "http://localhost:3000/setting" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.106 Safari/537.36 Edg/83.0.478.54" |
| 1344 | +::1 - - [24/Jun/2020:16:47:20 +0000] "POST /api/notify/slack/goal HTTP/1.1" 404 9 "-" "PostmanRuntime/7.25.0" | ||
| 1345 | +::1 - - [24/Jun/2020:16:47:43 +0000] "POST /api/notify/slack/goal HTTP/1.1" 404 9 "-" "PostmanRuntime/7.25.0" | ||
| 1346 | +::1 - - [24/Jun/2020:16:48:07 +0000] "POST /api/notify/slack/goal HTTP/1.1" 404 9 "-" "PostmanRuntime/7.25.0" | ||
| 1347 | +::1 - - [24/Jun/2020:16:49:04 +0000] "POST /api/notify/slack/goal HTTP/1.1" 404 9 "-" "PostmanRuntime/7.25.0" | ||
| 1348 | +::1 - - [24/Jun/2020:16:50:59 +0000] "POST /api/notify/goal HTTP/1.1" 404 9 "-" "PostmanRuntime/7.25.0" | ||
| 1349 | +::1 - - [24/Jun/2020:16:52:40 +0000] "POST /api/slack/goal HTTP/1.1" 404 9 "-" "PostmanRuntime/7.25.0" | ||
| 1350 | +::ffff:127.0.0.1 - - [24/Jun/2020:16:52:55 +0000] "POST /api/slack/goal HTTP/1.1" 404 9 "-" "PostmanRuntime/7.25.0" | ||
| 1351 | +::1 - - [24/Jun/2020:16:54:01 +0000] "POST /api/slack/goal HTTP/1.1" 404 9 "-" "PostmanRuntime/7.25.0" | ||
| 1352 | +::1 - - [24/Jun/2020:16:54:14 +0000] "POST /api/slack/goal HTTP/1.1" 404 9 "-" "PostmanRuntime/7.25.0" | ||
| 1353 | +::1 - - [24/Jun/2020:16:54:28 +0000] "POST /api/slack/goal HTTP/1.1" 404 9 "-" "PostmanRuntime/7.25.0" | ||
| 1354 | +::1 - - [24/Jun/2020:16:56:14 +0000] "POST /api/slack/goal HTTP/1.1" 404 9 "-" "PostmanRuntime/7.25.0" | ||
| 1355 | +::1 - - [24/Jun/2020:16:56:33 +0000] "POST /api/profile/getprofile HTTP/1.1" 200 33293 "-" "PostmanRuntime/7.25.0" | ||
| 1356 | +::1 - - [24/Jun/2020:16:56:52 +0000] "POST /api/notify/slack/goal HTTP/1.1" 500 21 "-" "PostmanRuntime/7.25.0" | ||
| 1357 | +::1 - - [24/Jun/2020:16:57:18 +0000] "POST /api/notify/slack/goal HTTP/1.1" 500 21 "-" "PostmanRuntime/7.25.0" | ||
| 1358 | +::1 - - [24/Jun/2020:16:57:50 +0000] "POST /api/notify/slack/goal HTTP/1.1" 404 9 "-" "PostmanRuntime/7.25.0" | ||
| 1359 | +::1 - - [24/Jun/2020:17:00:04 +0000] "POST /api/notify/slack/goal HTTP/1.1" 404 9 "-" "PostmanRuntime/7.25.0" | ||
| 1360 | +::ffff:127.0.0.1 - - [24/Jun/2020:17:00:27 +0000] "POST /api/profile/getprofile HTTP/1.1" 200 33293 "http://localhost:3000/setting" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.106 Safari/537.36 Edg/83.0.478.54" | ||
| 1361 | +::ffff:127.0.0.1 - - [24/Jun/2020:17:00:29 +0000] "POST /api/profile/setprofile HTTP/1.1" 200 33293 "http://localhost:3000/setting" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.106 Safari/537.36 Edg/83.0.478.54" | ||
| 1362 | +::1 - - [24/Jun/2020:17:00:37 +0000] "POST /api/notify/slack/goal HTTP/1.1" 404 9 "-" "PostmanRuntime/7.25.0" | ||
| 1363 | +::1 - - [24/Jun/2020:17:01:46 +0000] "POST /api/notify/slack/goal HTTP/1.1" 404 9 "-" "PostmanRuntime/7.25.0" | ||
| 1364 | +::ffff:127.0.0.1 - - [24/Jun/2020:17:12:37 +0000] "POST /api/notify/slack/goal HTTP/1.1" 404 9 "-" "PostmanRuntime/7.25.0" | ||
| 1365 | +::1 - - [24/Jun/2020:17:13:17 +0000] "POST /api/notify/slack/goal HTTP/1.1" 404 9 "-" "PostmanRuntime/7.25.0" | ||
| 1366 | +::1 - - [24/Jun/2020:17:13:36 +0000] "POST /api/notify/slack/goal HTTP/1.1" 404 9 "-" "PostmanRuntime/7.25.0" | ||
| 1367 | +::1 - - [24/Jun/2020:17:14:19 +0000] "POST /api/notify/slack/goal HTTP/1.1" 404 9 "-" "PostmanRuntime/7.25.0" | ||
| 1368 | +::1 - - [24/Jun/2020:17:22:37 +0000] "POST /api/notify/slack/recommend HTTP/1.1" 404 9 "-" "PostmanRuntime/7.25.0" | ||
| 1369 | +::1 - - [24/Jun/2020:17:23:06 +0000] "POST /api/notify/slack/recommend HTTP/1.1" 404 9 "-" "PostmanRuntime/7.25.0" | ||
| 1370 | +::1 - - [24/Jun/2020:17:27:52 +0000] "POST /api/notify/slack/recommend HTTP/1.1" 404 9 "-" "PostmanRuntime/7.25.0" | ||
| 1371 | +::1 - - [24/Jun/2020:17:30:55 +0000] "POST /api/notify/slack/recommend HTTP/1.1" 404 9 "-" "PostmanRuntime/7.25.0" | ||
| 1372 | +::1 - - [24/Jun/2020:17:32:42 +0000] "POST /api/notify/slack/recommend HTTP/1.1" 404 9 "-" "PostmanRuntime/7.25.0" | ||
| 1373 | +::1 - - [24/Jun/2020:17:34:03 +0000] "POST /api/notify/slack/recommend HTTP/1.1" 404 9 "-" "PostmanRuntime/7.25.0" | ||
| 1374 | +::1 - - [24/Jun/2020:17:36:50 +0000] "POST /api/notify/slack/recommend HTTP/1.1" 404 9 "-" "PostmanRuntime/7.25.0" | ||
| 1375 | +::1 - - [24/Jun/2020:17:40:43 +0000] "POST /api/notify/slack/recommend HTTP/1.1" 500 21 "-" "PostmanRuntime/7.25.0" | ||
| 1376 | +::1 - - [24/Jun/2020:17:42:09 +0000] "POST /api/notify/slack/recommend HTTP/1.1" 404 9 "-" "PostmanRuntime/7.25.0" | ||
| 1377 | +::1 - - [24/Jun/2020:17:43:17 +0000] "POST /api/notify/slack/recommend HTTP/1.1" 404 9 "-" "PostmanRuntime/7.25.0" | ||
| 1378 | +::1 - - [24/Jun/2020:17:53:11 +0000] "POST /api/notify/slack/recommend HTTP/1.1" 404 9 "-" "PostmanRuntime/7.25.0" | ||
| 1379 | +::1 - - [24/Jun/2020:17:53:24 +0000] "POST /api/notify/slack/recommend HTTP/1.1" 404 9 "-" "PostmanRuntime/7.25.0" | ||
| 1380 | +::1 - - [24/Jun/2020:17:54:40 +0000] "POST /api/notify/slack/recommend HTTP/1.1" 404 9 "-" "PostmanRuntime/7.25.0" | ||
| 1381 | +::1 - - [24/Jun/2020:17:55:11 +0000] "POST /api/notify/slack/recommend HTTP/1.1" 404 9 "-" "PostmanRuntime/7.25.0" | ||
| 1382 | +::1 - - [24/Jun/2020:17:55:24 +0000] "POST /api/notify/slack/recommend HTTP/1.1" 404 9 "-" "PostmanRuntime/7.25.0" | ||
| 1383 | +::1 - - [24/Jun/2020:17:55:39 +0000] "POST /api/notify/slack/recommend HTTP/1.1" 404 9 "-" "PostmanRuntime/7.25.0" | ||
| 1384 | +::1 - - [24/Jun/2020:18:00:32 +0000] "POST /api/notify/slack/recommend HTTP/1.1" 500 21 "-" "PostmanRuntime/7.25.0" | ... | ... |
| ... | @@ -3,7 +3,7 @@ const api = new Router(); | ... | @@ -3,7 +3,7 @@ const api = new Router(); |
| 3 | 3 | ||
| 4 | const auth = require("./auth"); | 4 | const auth = require("./auth"); |
| 5 | const friend = require("./friend"); | 5 | const friend = require("./friend"); |
| 6 | -const notify = require("./profile"); | 6 | +const notify = require("./notify"); |
| 7 | const user = require("./user"); | 7 | const user = require("./user"); |
| 8 | const profile = require("./profile"); | 8 | const profile = require("./profile"); |
| 9 | 9 | ... | ... |
| 1 | const Router = require("koa-router"); | 1 | const Router = require("koa-router"); |
| 2 | const notify = new Router(); | 2 | const notify = new Router(); |
| 3 | - | 3 | +const slackCtrl = require("./slack.ctrl"); |
| 4 | -notify.post("/slack"); | 4 | +notify.post("/slack/goal", slackCtrl.slackGoal); |
| 5 | +notify.post("/slack/recommend", slackCtrl.slackRecommend); | ||
| 5 | 6 | ||
| 6 | module.exports = notify; | 7 | module.exports = notify; | ... | ... |
| 1 | +const Profile = require("../../models/profile"); | ||
| 2 | +const sendSlack = require("../../util/sendSlack"); | ||
| 3 | +const problem_set = require("../../data/problem_set"); | ||
| 4 | +const compareBJ = require("../../util/compareBJ"); | ||
| 5 | +/* | ||
| 6 | +POST api/notify/slack/goal | ||
| 7 | +{ | ||
| 8 | + username: "username" | ||
| 9 | +} | ||
| 10 | +*/ | ||
| 11 | +exports.slackGoal = async (ctx) => { | ||
| 12 | + try { | ||
| 13 | + const { username } = ctx.request.body; | ||
| 14 | + | ||
| 15 | + const profile = await Profile.findByUsername(username); | ||
| 16 | + if (!profile) { | ||
| 17 | + ctx.status = 401; | ||
| 18 | + return; | ||
| 19 | + } | ||
| 20 | + let slackURL = profile.getslackURL(); | ||
| 21 | + if (!slackURL) { | ||
| 22 | + ctx.status = 401; | ||
| 23 | + return; | ||
| 24 | + } | ||
| 25 | + let goalNum = profile.getgoalNum(); | ||
| 26 | + let todayNum = profile.getTodaySovled(); | ||
| 27 | + let message = ""; | ||
| 28 | + if (goalNum < todayNum) { | ||
| 29 | + message = | ||
| 30 | + "오늘의 목표 " + | ||
| 31 | + goalNum + | ||
| 32 | + "문제 중 " + | ||
| 33 | + todayNum + | ||
| 34 | + "문제를 풀었습니다." + | ||
| 35 | + "\n" + | ||
| 36 | + "잘하셨습니다!"; | ||
| 37 | + } else { | ||
| 38 | + message = | ||
| 39 | + "오늘의 목표 " + | ||
| 40 | + goalNum + | ||
| 41 | + "문제 중 " + | ||
| 42 | + todayNum + | ||
| 43 | + "문제를 풀었습니다." + | ||
| 44 | + "\n" + | ||
| 45 | + "분발하세요!"; | ||
| 46 | + } | ||
| 47 | + | ||
| 48 | + sendSlack.send(message, slackURL); | ||
| 49 | + } catch (e) { | ||
| 50 | + ctx.throw(500, e); | ||
| 51 | + } | ||
| 52 | +}; | ||
| 53 | + | ||
| 54 | +/* | ||
| 55 | +POST api/notify/slack/recommend | ||
| 56 | +{ | ||
| 57 | + username: "username" | ||
| 58 | +} | ||
| 59 | +*/ | ||
| 60 | +exports.slackRecommend = async (ctx) => { | ||
| 61 | + try { | ||
| 62 | + console.log("1"); | ||
| 63 | + const { username } = ctx.request.body; | ||
| 64 | + | ||
| 65 | + const profile = await Profile.findByUsername(username); | ||
| 66 | + if (!profile) { | ||
| 67 | + ctx.status = 401; | ||
| 68 | + return; | ||
| 69 | + } | ||
| 70 | + let slackURL = profile.getslackURL(); | ||
| 71 | + if (!slackURL) { | ||
| 72 | + ctx.status = 401; | ||
| 73 | + return; | ||
| 74 | + } | ||
| 75 | + let unsolved_data = compareBJ.compareBJ( | ||
| 76 | + profile.getBJdata(), | ||
| 77 | + problem_set.problem_set | ||
| 78 | + ); | ||
| 79 | + let recommendData = compareBJ.randomItem(unsolved_data); | ||
| 80 | + | ||
| 81 | + if (!recommendData) { | ||
| 82 | + ctx.status = 401; | ||
| 83 | + return; | ||
| 84 | + } | ||
| 85 | + let message = | ||
| 86 | + "오늘의 추천 문제는 " + | ||
| 87 | + recommendData.problem_number + | ||
| 88 | + "번 " + | ||
| 89 | + " <https://www.boj.kr/" + | ||
| 90 | + recommendData.problem_number + | ||
| 91 | + "|" + | ||
| 92 | + recommendData.problem_title + | ||
| 93 | + ">" + | ||
| 94 | + " 입니다."; | ||
| 95 | + sendSlack.send(message, slackURL); | ||
| 96 | + } catch (e) { | ||
| 97 | + ctx.throw(500, e); | ||
| 98 | + } | ||
| 99 | +}; |
This diff is collapsed. Click to expand it.
| ... | @@ -20,6 +20,17 @@ ProfileSchema.methods.getBJID = function () { | ... | @@ -20,6 +20,17 @@ ProfileSchema.methods.getBJID = function () { |
| 20 | ProfileSchema.methods.getBJdata = function () { | 20 | ProfileSchema.methods.getBJdata = function () { |
| 21 | return this.solvedBJ; | 21 | return this.solvedBJ; |
| 22 | }; | 22 | }; |
| 23 | +ProfileSchema.methods.getslackURL = function () { | ||
| 24 | + return this.slackWebHookURL; | ||
| 25 | +}; | ||
| 26 | +ProfileSchema.methods.getgoalNum = function () { | ||
| 27 | + return this.goalNum; | ||
| 28 | +}; | ||
| 29 | +ProfileSchema.methods.getTodaySovled = function () { | ||
| 30 | + if (this.solvedBJ_date) { | ||
| 31 | + return this.solvedBJ_date.presentNum; | ||
| 32 | + } | ||
| 33 | +}; | ||
| 23 | 34 | ||
| 24 | ProfileSchema.methods.serialize = function () { | 35 | ProfileSchema.methods.serialize = function () { |
| 25 | const data = this.toJSON(); | 36 | const data = this.toJSON(); | ... | ... |
| 1 | exports.compareBJ = function (solvedBJ_new, problem_set) { | 1 | exports.compareBJ = function (solvedBJ_new, problem_set) { |
| 2 | try { | 2 | try { |
| 3 | let new_obj = []; | 3 | let new_obj = []; |
| 4 | - for (let i = 0; i < solvedBJ_new.length; i++) { | 4 | + |
| 5 | - if (!problem_set.includes(String(solvedBJ_new[i].problem_number))) { | 5 | + for (let i = 0; i < problem_set.length; i++) { |
| 6 | - new_obj.push(solvedBJ_new[i]); | 6 | + let found = false; |
| 7 | + for (let j = 0; j < solvedBJ_new.length; j++) { | ||
| 8 | + if (solvedBJ_new[j].problem_number == problem_set[i].problem_number) { | ||
| 9 | + found = true; | ||
| 10 | + break; | ||
| 11 | + } | ||
| 12 | + } | ||
| 13 | + if (!found) { | ||
| 14 | + new_obj.push(problem_set[i]); | ||
| 7 | } | 15 | } |
| 8 | } | 16 | } |
| 17 | + console.log(new_obj); | ||
| 9 | return new_obj; | 18 | return new_obj; |
| 10 | } catch (e) { | 19 | } catch (e) { |
| 11 | console.log(e); | 20 | console.log(e); | ... | ... |
| 1 | const Slack = require("slack-node"); // 슬랙 모듈 사용 | 1 | const Slack = require("slack-node"); // 슬랙 모듈 사용 |
| 2 | 2 | ||
| 3 | +/* | ||
| 3 | const webhookUri = | 4 | const webhookUri = |
| 4 | - "https://hooks.slack.com/services/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"; // Webhook URL | 5 | + "https://hooks.slack.com/services/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"; // Webhook URL |
| 6 | +*/ | ||
| 5 | 7 | ||
| 6 | -const slack = new Slack(); | 8 | +exports.send = async (message, webhookUri) => { |
| 7 | -slack.setWebhook(webhookUri); | 9 | + const slack = new Slack(); |
| 8 | - | 10 | + slack.setWebhook(webhookUri); |
| 9 | -const send = async (message) => { | ||
| 10 | slack.webhook( | 11 | slack.webhook( |
| 11 | { | 12 | { |
| 12 | text: message, | 13 | text: message, |
| ... | @@ -16,5 +17,3 @@ const send = async (message) => { | ... | @@ -16,5 +17,3 @@ const send = async (message) => { |
| 16 | } | 17 | } |
| 17 | ); | 18 | ); |
| 18 | }; | 19 | }; |
| 19 | - | ||
| 20 | -send("hello"); | ... | ... |
| ... | @@ -8,7 +8,7 @@ const test = async (userid) => { | ... | @@ -8,7 +8,7 @@ const test = async (userid) => { |
| 8 | return_lst.push(lst[i].problem_number); | 8 | return_lst.push(lst[i].problem_number); |
| 9 | } | 9 | } |
| 10 | 10 | ||
| 11 | - var stringJson = JSON.stringify(return_lst) + "\n"; | 11 | + var stringJson = JSON.stringify(lst) + "\n"; |
| 12 | fs.open("test.json", "a", "666", function (err, id) { | 12 | fs.open("test.json", "a", "666", function (err, id) { |
| 13 | if (err) { | 13 | if (err) { |
| 14 | console.log("file open err!!"); | 14 | console.log("file open err!!"); | ... | ... |
This diff is collapsed. Click to expand it.
-
Please register or login to post a comment