• Stars
    star
    160
  • Rank 234,703 (Top 5 %)
  • Language
    Go
  • Created almost 8 years ago
  • Updated over 5 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Querys train schedule use the origin command line tools

Sourcegraph

#Querys train schedule use the origin command line tools

###output(train schedule)

###output(left tricket)

###output(update)

###output(transfer query)

###dependence

  1. ASCLL TABLE Writer it is for generate ascii table on termial and use below command to install

###Create table

CREATE TABLE `station_lat_lgt` (
  `id` bigint(20) NOT NULL AUTO_INCREMENT,
  `station` varchar(10) DEFAULT NULL,
  `latitude` varchar(30) DEFAULT NULL,
  `longitude` varchar(30) DEFAULT NULL,
  `insert_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8;

CREATE TABLE `train_list` (
  `id` bigint(20) NOT NULL AUTO_INCREMENT,
  `code` varchar(10) DEFAULT NULL,
  `train_no` varchar(30) DEFAULT NULL,
  `there` varchar(30) DEFAULT NULL,
  `home` varchar(30) DEFAULT NULL,
  `depart_date` date NOT NULL,
  `insert_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=265205 DEFAULT CHARSET=utf8;

###Databse database name is 12306 go-home will auto create that.

###Config file

###this file is for config connect of mysql

type = "mysql"      // maybe you like use other database just change this type
host = "127.0.0.1"  // replace your host
port = 3306         // replace your port
user = root         // replace your user name
pass = digitalx168  //replace your password
databaseName = "12306" 
isCreate = false

###How to get started? you should download project to path of yourself and then go build or go install, after that just run it!

go get github.com/JingDa-open-source-community/go-home
or you can use Makefile
cd yourpath/github.com/JingDa-open-source-community/go-home
make

go-home train d332 2017-02-25

go-home left 上海 永修 2017-03-03

// update mysql data
go-home update

###log

  1. Add depart date parameter when query train schedule. If you use a command like go-home train k502 2017-01-22, default value is tody, so above command equal go-home k502 2017-01-22 In fact you should use a command like go-home train k502 2017-01-27 to query someday's plan that you want to know.
  2. Support query left tricket go througth api of 12306
  3. Support user update local data by "update" option
  4. Support go get
  5. Support both ansi in window console and cygwinn&&mysys terminal
  6. Support transfer query

###Contact

Wechat: convertxy

QQ: 2698380951

Email: [email protected]