-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 529e39b
Showing
11 changed files
with
635 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
node_modules/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
// Use IntelliSense to learn about possible Node.js debug attributes. | ||
// Hover to view descriptions of existing attributes. | ||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"type": "node", | ||
"request": "launch", | ||
"name": "Launch Program", | ||
"program": "${file}" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
[{"date":"2017/08/23(三)","sport":"田徑","place":"臺北田徑場","hasTicket":true,"url":"https://tickets.2017.taipei//ticket/area/17_TPE_02/2340"},{"date":"2017/08/24(四)","sport":"田徑","place":"臺北田徑場","hasTicket":true,"url":"https://tickets.2017.taipei//ticket/area/17_TPE_02/2416"},{"date":"2017/08/25(五)","sport":"田徑","place":"臺北田徑場","hasTicket":true,"url":"https://tickets.2017.taipei//ticket/area/17_TPE_02/2417"},{"date":"2017/08/26(六)","sport":"田徑","place":"臺北田徑場","hasTicket":true,"url":"https://tickets.2017.taipei//ticket/area/17_TPE_02/2418"},{"date":"2017/08/27(日)","sport":"田徑","place":"臺北田徑場","hasTicket":true,"url":"https://tickets.2017.taipei//ticket/area/17_TPE_02/2419"},{"date":"2017/08/28(一)","sport":"田徑","place":"臺北田徑場","hasTicket":true,"url":"https://tickets.2017.taipei//ticket/area/17_TPE_02/2420"},{"date":"2017/08/23(三)","sport":"棒球","place":"新北市新莊棒球場","hasTicket":true,"url":"https://tickets.2017.taipei//ticket/area/17_TPE_04/2431"},{"date":"2017/08/25(五)","sport":"棒球","place":"臺北市天母棒球場","hasTicket":true,"url":"https://tickets.2017.taipei//ticket/area/17_TPE_04/2432"},{"date":"2017/08/25(五)","sport":"棒球","place":"新北市新莊棒球場","hasTicket":true,"url":"https://tickets.2017.taipei//ticket/area/17_TPE_04/2433"},{"date":"2017/08/26(六)","sport":"棒球","place":"新北市新莊棒球場","hasTicket":true,"url":"https://tickets.2017.taipei//ticket/area/17_TPE_04/2435"},{"date":"2017/08/27(日)","sport":"棒球","place":"新北市新莊棒球場","hasTicket":true,"url":"https://tickets.2017.taipei//ticket/area/17_TPE_04/2436"},{"date":"2017/08/28(一)","sport":"棒球","place":"新北市新莊棒球場","hasTicket":true,"url":"https://tickets.2017.taipei//ticket/area/17_TPE_04/2438"},{"date":"2017/08/23(三)","sport":"籃球","place":"新竹市立體育館","hasTicket":true,"url":"https://tickets.2017.taipei//ticket/area/17_TPE_05/2451"},{"date":"2017/08/23(三)","sport":"籃球","place":"臺北市立大學天母校區體育館","hasTicket":true,"url":"https://tickets.2017.taipei//ticket/area/17_TPE_05/2452"},{"date":"2017/08/23(三)","sport":"籃球","place":"臺北和平籃球館","hasTicket":true,"url":"https://tickets.2017.taipei//ticket/area/17_TPE_05/2453"},{"date":"2017/08/24(四)","sport":"籃球","place":"新竹市立體育館","hasTicket":true,"url":"https://tickets.2017.taipei//ticket/area/17_TPE_05/2455"},{"date":"2017/08/24(四)","sport":"籃球","place":"臺北市立大學天母校區體育館","hasTicket":true,"url":"https://tickets.2017.taipei//ticket/area/17_TPE_05/2456"},{"date":"2017/08/24(四)","sport":"籃球","place":"臺北和平籃球館","hasTicket":true,"url":"https://tickets.2017.taipei//ticket/area/17_TPE_05/2457"},{"date":"2017/08/25(五)","sport":"籃球","place":"臺北小巨蛋","hasTicket":true,"url":"https://tickets.2017.taipei//ticket/area/17_TPE_05/2458"},{"date":"2017/08/25(五)","sport":"籃球","place":"臺北市立大學天母校區體育館","hasTicket":true,"url":"https://tickets.2017.taipei//ticket/area/17_TPE_05/2460"},{"date":"2017/08/25(五)","sport":"籃球","place":"臺北和平籃球館","hasTicket":true,"url":"https://tickets.2017.taipei//ticket/area/17_TPE_05/2461"},{"date":"2017/08/26(六)","sport":"籃球","place":"臺北小巨蛋","hasTicket":true,"url":"https://tickets.2017.taipei//ticket/area/17_TPE_05/2462"},{"date":"2017/08/26(六)","sport":"籃球","place":"臺北和平籃球館","hasTicket":true,"url":"https://tickets.2017.taipei//ticket/area/17_TPE_05/2463"},{"date":"2017/08/27(日)","sport":"籃球","place":"臺北市立大學天母校區體育館","hasTicket":true,"url":"https://tickets.2017.taipei//ticket/area/17_TPE_05/2466"},{"date":"2017/08/28(一)","sport":"籃球","place":"臺北小巨蛋","hasTicket":true,"url":"https://tickets.2017.taipei//ticket/area/17_TPE_05/2468"},{"date":"2017/08/28(一)","sport":"籃球","place":"新竹市立體育館","hasTicket":true,"url":"https://tickets.2017.taipei//ticket/area/17_TPE_05/2469"},{"date":"2017/08/28(一)","sport":"籃球","place":"臺北市立大學天母校區體育館","hasTicket":true,"url":"https://tickets.2017.taipei//ticket/area/17_TPE_05/2470"},{"date":"2017/08/28(一)","sport":"籃球","place":"臺北和平籃球館","hasTicket":true,"url":"https://tickets.2017.taipei//ticket/area/17_TPE_05/2471"},{"date":"2017/08/29(二)","sport":"籃球","place":"新竹市立體育館","hasTicket":true,"url":"https://tickets.2017.taipei//ticket/area/17_TPE_05/2473"},{"date":"2017/08/29(二)","sport":"籃球","place":"臺北市立大學天母校區體育館","hasTicket":true,"url":"https://tickets.2017.taipei//ticket/area/17_TPE_05/2474"},{"date":"2017/08/29(二)","sport":"籃球","place":"臺北和平籃球館","hasTicket":true,"url":"https://tickets.2017.taipei//ticket/area/17_TPE_05/2923"},{"date":"2017/08/23(三)","sport":"足球","place":"新北市新莊田徑場","hasTicket":true,"url":"https://tickets.2017.taipei//ticket/area/17_TPE_08/2507"},{"date":"2017/08/23(三)","sport":"足球","place":"長庚大學田徑場","hasTicket":true,"url":"https://tickets.2017.taipei//ticket/area/17_TPE_08/2508"},{"date":"2017/08/24(四)","sport":"足球","place":"輔仁大學體育場","hasTicket":true,"url":"https://tickets.2017.taipei//ticket/area/17_TPE_08/2510"},{"date":"2017/08/24(四)","sport":"足球","place":"新北市新莊田徑場","hasTicket":true,"url":"https://tickets.2017.taipei//ticket/area/17_TPE_08/2511"},{"date":"2017/08/24(四)","sport":"足球","place":"長庚大學田徑場","hasTicket":true,"url":"https://tickets.2017.taipei//ticket/area/17_TPE_08/2512"},{"date":"2017/08/24(四)","sport":"足球","place":"新竹縣第二運動場","hasTicket":true,"url":"https://tickets.2017.taipei//ticket/area/17_TPE_08/2513"},{"date":"2017/08/25(五)","sport":"足球","place":"輔仁大學體育場","hasTicket":true,"url":"https://tickets.2017.taipei//ticket/area/17_TPE_08/2514"},{"date":"2017/08/25(五)","sport":"足球","place":"新北市新莊田徑場","hasTicket":true,"url":"https://tickets.2017.taipei//ticket/area/17_TPE_08/2515"},{"date":"2017/08/25(五)","sport":"足球","place":"長庚大學田徑場","hasTicket":true,"url":"https://tickets.2017.taipei//ticket/area/17_TPE_08/2516"},{"date":"2017/08/26(六)","sport":"足球","place":"輔仁大學體育場","hasTicket":true,"url":"https://tickets.2017.taipei//ticket/area/17_TPE_08/2518"},{"date":"2017/08/26(六)","sport":"足球","place":"新北市新莊田徑場","hasTicket":true,"url":"https://tickets.2017.taipei//ticket/area/17_TPE_08/2519"},{"date":"2017/08/26(六)","sport":"足球","place":"長庚大學田徑場","hasTicket":true,"url":"https://tickets.2017.taipei//ticket/area/17_TPE_08/2520"},{"date":"2017/08/27(日)","sport":"足球","place":"輔仁大學體育場","hasTicket":true,"url":"https://tickets.2017.taipei//ticket/area/17_TPE_08/2522"},{"date":"2017/08/27(日)","sport":"足球","place":"新北市新莊田徑場","hasTicket":true,"url":"https://tickets.2017.taipei//ticket/area/17_TPE_08/2523"},{"date":"2017/08/27(日)","sport":"足球","place":"長庚大學田徑場","hasTicket":true,"url":"https://tickets.2017.taipei//ticket/area/17_TPE_08/2524"},{"date":"2017/08/28(一)","sport":"足球","place":"輔仁大學體育場","hasTicket":true,"url":"https://tickets.2017.taipei//ticket/area/17_TPE_08/2526"},{"date":"2017/08/28(一)","sport":"足球","place":"新北市新莊田徑場","hasTicket":true,"url":"https://tickets.2017.taipei//ticket/area/17_TPE_08/2527"},{"date":"2017/08/28(一)","sport":"足球","place":"新竹縣第二運動場","hasTicket":true,"url":"https://tickets.2017.taipei//ticket/area/17_TPE_08/2528"},{"date":"2017/08/28(一)","sport":"足球","place":"長庚大學田徑場","hasTicket":true,"url":"https://tickets.2017.taipei//ticket/area/17_TPE_08/2529"},{"date":"2017/08/29(二)","sport":"足球","place":"新北市新莊田徑場","hasTicket":true,"url":"https://tickets.2017.taipei//ticket/area/17_TPE_08/2531"},{"date":"2017/08/29(二)","sport":"足球","place":"新竹縣第二運動場","hasTicket":true,"url":"https://tickets.2017.taipei//ticket/area/17_TPE_08/2924"},{"date":"2017/08/29(二)","sport":"足球","place":"長庚大學田徑場","hasTicket":true,"url":"https://tickets.2017.taipei//ticket/area/17_TPE_08/2925"},{"date":"2017/08/24(四)","sport":"高爾夫","place":"揚昇高爾夫鄉村俱樂部","hasTicket":true,"url":"https://tickets.2017.taipei//ticket/area/17_TPE_09/2347"},{"date":"2017/08/25(五)","sport":"高爾夫","place":"揚昇高爾夫鄉村俱樂部","hasTicket":true,"url":"https://tickets.2017.taipei//ticket/area/17_TPE_09/2532"},{"date":"2017/08/26(六)","sport":"高爾夫","place":"揚昇高爾夫鄉村俱樂部","hasTicket":true,"url":"https://tickets.2017.taipei//ticket/area/17_TPE_09/2533"},{"date":"2017/08/27(日)","sport":"高爾夫","place":"揚昇高爾夫鄉村俱樂部","hasTicket":true,"url":"https://tickets.2017.taipei//ticket/area/17_TPE_09/2534"},{"date":"2017/08/23(三)","sport":"柔道","place":"新竹縣體育館","hasTicket":true,"url":"https://tickets.2017.taipei//ticket/area/17_TPE_12/2543"},{"date":"2017/08/24(四)","sport":"柔道","place":"新竹縣體育館","hasTicket":true,"url":"https://tickets.2017.taipei//ticket/area/17_TPE_12/2544"},{"date":"2017/08/23(三)","sport":"游泳","place":"國立體育大學綜合體育館","hasTicket":true,"url":"https://tickets.2017.taipei//ticket/area/17_TPE_14/2552"},{"date":"2017/08/24(四)","sport":"游泳","place":"國立體育大學綜合體育館","hasTicket":true,"url":"https://tickets.2017.taipei//ticket/area/17_TPE_14/2553"},{"date":"2017/08/23(三)","sport":"桌球","place":"新北市新莊體育館","hasTicket":true,"url":"https://tickets.2017.taipei//ticket/area/17_TPE_15/2647"},{"date":"2017/08/24(四)","sport":"桌球","place":"新北市新莊體育館","hasTicket":true,"url":"https://tickets.2017.taipei//ticket/area/17_TPE_15/2648"},{"date":"2017/08/23(三)","sport":"跆拳道","place":"桃園市立體育館","hasTicket":true,"url":"https://tickets.2017.taipei//ticket/area/17_TPE_16/2566"},{"date":"2017/08/24(四)","sport":"跆拳道","place":"桃園市立體育館","hasTicket":true,"url":"https://tickets.2017.taipei//ticket/area/17_TPE_16/2567"},{"date":"2017/08/25(五)","sport":"跆拳道","place":"桃園市立體育館","hasTicket":true,"url":"https://tickets.2017.taipei//ticket/area/17_TPE_16/2568"},{"date":"2017/08/23(三)","sport":"網球","place":"臺北市網球中心","hasTicket":true,"url":"https://tickets.2017.taipei//ticket/area/17_TPE_17/2571"},{"date":"2017/08/24(四)","sport":"網球","place":"臺北市網球中心","hasTicket":true,"url":"https://tickets.2017.taipei//ticket/area/17_TPE_17/2572"},{"date":"2017/08/25(五)","sport":"網球","place":"臺北市網球中心","hasTicket":true,"url":"https://tickets.2017.taipei//ticket/area/17_TPE_17/2573"},{"date":"2017/08/24(四)","sport":"排球","place":"中國文化大學體育館","hasTicket":true,"url":"https://tickets.2017.taipei//ticket/area/17_TPE_18/2953"},{"date":"2017/08/24(四)","sport":"排球","place":"國立清華大學體育館","hasTicket":true,"url":"https://tickets.2017.taipei//ticket/area/17_TPE_18/2955"},{"date":"2017/08/25(五)","sport":"排球","place":"中國文化大學體育館","hasTicket":true,"url":"https://tickets.2017.taipei//ticket/area/17_TPE_18/2957"},{"date":"2017/08/28(一)","sport":"排球","place":"中國文化大學體育館","hasTicket":true,"url":"https://tickets.2017.taipei//ticket/area/17_TPE_18/2969"},{"date":"2017/08/28(一)","sport":"排球","place":"國立清華大學體育館","hasTicket":true,"url":"https://tickets.2017.taipei//ticket/area/17_TPE_18/2971"},{"date":"2017/08/29(二)","sport":"排球","place":"國立清華大學體育館","hasTicket":true,"url":"https://tickets.2017.taipei//ticket/area/17_TPE_18/2975"},{"date":"2017/08/26(六)","sport":"武術","place":"新竹縣體育館","hasTicket":true,"url":"https://tickets.2017.taipei//ticket/area/17_TPE_21/2359"},{"date":"2017/08/27(日)","sport":"武術","place":"新竹縣體育館","hasTicket":true,"url":"https://tickets.2017.taipei//ticket/area/17_TPE_21/2639"},{"date":"2017/08/28(一)","sport":"武術","place":"新竹縣體育館","hasTicket":true,"url":"https://tickets.2017.taipei//ticket/area/17_TPE_21/2640"},{"date":"2017/08/29(二)","sport":"武術","place":"新竹縣體育館","hasTicket":true,"url":"https://tickets.2017.taipei//ticket/area/17_TPE_21/2641"}] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"dependencies": { | ||
"cheerio": "^1.0.0-rc.2", | ||
"express": "^4.15.4", | ||
"fs-extra": "^4.0.1", | ||
"isomorphic-fetch": "^2.2.1" | ||
}, | ||
"scripts": { | ||
"start": "node server.js" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
|
||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<meta http-equiv="X-UA-Compatible" content="ie=edge"> | ||
<title>Universiade Ticket</title> | ||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta/css/bootstrap.min.css" integrity="sha384-/Y6pD6FV/Vv2HJnA6t+vslU6fwYXjCFtcEpHbNJ0lyAFsXTsjBbfaDjzALeQsN6M" | ||
crossorigin="anonymous"> | ||
</head> | ||
|
||
<body> | ||
<nav class="navbar navbar-expand-md navbar-dark bg-dark mb-4"> | ||
<a class="navbar-brand" href="#">Universiade Ticket Checker</a> | ||
</nav> | ||
|
||
<div class="container" id="app"> | ||
<!-- <form class="form-inline card-body"> | ||
<label class="mr-sm-2" for="inlineFormCustomSelect">時間</label> | ||
<select class="custom-select mb-2 mr-sm-2 mb-sm-0" id="inlineFormCustomSelect" v-model="selectedDate" @change="filterData(selectedDate, 'date')"> | ||
<option disabled value="">Please select one</option> | ||
<option v-for="(val, date) in dates" v-bind:value="date"> | ||
{{ date }} | ||
</option> | ||
</select> | ||
<label class="mr-sm-2" for="inlineFormCustomSelect">地點</label> | ||
<select class="custom-select mb-2 mr-sm-2 mb-sm-0" id="inlineFormCustomSelect" v-model="selectedPlace" @change=""> | ||
<option disabled value="">Please select one</option> | ||
<option v-for="(val, place) in places" v-bind:value="place"> | ||
{{ place }} | ||
</option> | ||
</select> | ||
<label class="mr-sm-2" for="inlineFormCustomSelect">運動</label> | ||
<select class="custom-select mb-2 mr-sm-2 mb-sm-0" id="inlineFormCustomSelect" v-model="selectedSport" @change=""> | ||
<option disabled value="">Please select one</option> | ||
<option v-for="(val, sport) in sports" v-bind:value="sport"> | ||
{{ sport }} | ||
</option> | ||
</select> | ||
</form> --> | ||
<!-- Example row of columns --> | ||
<section class="card" v-for="(sportStatus, key) in ticketStatus"> | ||
<div class="card-body"> | ||
<h3>{{key}}</h3> | ||
<div class="row"> | ||
<div class="col-md-3" v-for="status in sportStatus"> | ||
<p> | ||
<div>{{status.date}}</div>{{status.place}}</p> | ||
<p><a class="btn btn-primary" :href="status.url" role="button">購票</a></p> | ||
</div> | ||
</div> | ||
</div> | ||
</section> | ||
<hr> | ||
|
||
<footer> | ||
<p>© <a href="https://www.paddingleft.com">created by Sing</a></p> | ||
</footer> | ||
</div> | ||
<!-- /container --> | ||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> | ||
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.11.0/umd/popper.min.js" integrity="sha384-b/U6ypiBEHpOf/4+1nzFpr53nxSS+GLCkfwBdFNTxtclqqenISfwAzpKaMNFNmj4" | ||
crossorigin="anonymous"></script> | ||
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta/js/bootstrap.min.js" integrity="sha384-h0AbiXch4ZDo7tp9hKZ4TsHbi047NrKGLO3SEJAg45jXxnGIfYzk4Si90RDIqNm1" | ||
crossorigin="anonymous"></script> | ||
<script src="https://cdn.jsdelivr.net/lodash/4.17.4/lodash.min.js"></script> | ||
<script src="https://unpkg.com/vue"></script> | ||
<script src="main.js"></script> | ||
</body> | ||
|
||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
var app = new Vue({ | ||
el: '#app', | ||
data: { | ||
ticketStatus: {}, | ||
filteredTicketStatus: {}, | ||
sports: {}, | ||
places: {}, | ||
dates: {}, | ||
selectedPlace: '', | ||
selectedSport: '', | ||
selectedDate: '' | ||
}, | ||
created: function () { | ||
var self = this; | ||
$.get('/api/ticketStatus').then(function (json) { | ||
self.ticketStatus = _.groupBy(json, 'sport'); | ||
json.forEach(function (status) { | ||
self.sports[status.sport] = true; | ||
self.places[status.place] = true; | ||
self.dates[status.date] = true; | ||
}) | ||
}) | ||
}, | ||
method: { | ||
filterData: function () { | ||
// this. | ||
} | ||
} | ||
}) |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
const express = require('express') | ||
const serveStatic = require('serve-static') | ||
const path = require('path') | ||
const {getAllTicketStatus } = require('./ticket'); | ||
const app = express() | ||
|
||
app.get('/api/ticketstatus', (req, res, next) => { | ||
res.sendFile(path.join(__dirname, 'dist', 'ticketStatus.json')) | ||
}) | ||
|
||
app.use(express.static(path.join(__dirname, 'public'))); | ||
|
||
const port = process.env.PORT || 8080; | ||
app.listen(port, function () { | ||
console.log('app running on port', port); | ||
}) | ||
console.log(`app listen on ${port}`) | ||
|
||
setInterval(async () => { | ||
console.time('[Scheduler] getAllTicketStatus'); | ||
await getAllTicketStatus() | ||
console.timeEnd('[Scheduler] getAllTicketStatus'); | ||
}, 3600000) |
Oops, something went wrong.