一个简单,易用的票务系统
- Ruby 2.1.x
- Rails 4.2.x
- PostgreSQL
- Bootstrap 3.2
- Redis
- Rspec
POST
{
collection_id: '2',
timestamp: "2014-11-13T11:25:56+08:00", #符合ISO8601
user_email: "chzsh1995@gmail.com",
user_cucId: "201408223005",
token: "#{Digest::MD5.hexdigest(timestamp + user_email + user_cucId + Rails.application.secrets.secret_key_base[7...21])}"
}
success:
{
status: 200,
content: {
admission: "#{@event.short_name}-#{@collection.id.to_s.rjust(4,'0')}-#{id.to_s.rjust(4, '0')}",
cucId: "201408223005"
secret: "#{Digest::MD5.hexdigest(admission + cucId + Rails.application.secrets.secret_key_base[23...27])}"
}
}
failure:
{
status: 304,
content: {
reason: "limited" #抢光了
}
}
GET
{
admission: 057,
cucId: "201408223005"
token: "#{Digest::MD5.hexdigest(admission + cucId + Rails.application.secrets.secret_key_base[23...27])}"
}
success:
{
status: 200,
content: {
admission: 057,
user: {
cucId: "201408223005",
email: "chzsh1995@gmail.com"
}
}
failure:
{
status: 401,
content: {
reason: "wrong_token" #验票错误
}
}