Giter Club home page Giter Club logo

statutory-holidays's Introduction

statutory-holidays

基于 Redis 构建的节假日 API

1. 设计(redis 数据结构)

table One

key value type 说明
ch_name_list 中文节假日列表 List "元旦","春节","清明节","劳动节","端午节","中秋节","国庆节"

table two

key value type 说明
en_name_list 英文节假日列表 List "New Year\'s Day","Spring Festival","Tomb-sweeping Day","Labour Day","Dragon Boat Festival","Mid-autumn Festival","National Day"

table three

key value type 说明
history_holidays_map 节假日集合 hash key 2019:0 value "2018/12/30~2019/01/01"

2. 如何操作?

根据设计,如何通过年份获取到当年的节假日信息?

  • 根据设计,将数据导入到 redis 中
  • 根据 history_holidays_map, 可以获取到 keys 或者 values
  • 根据 keys (2019:0, 2019 表示年,0 表示当年的第一个法定节假日)
  • 根据 values(2018/12/30~2019/01/01, 2018/12/30 表示起始时间,2019/01/01 表示结束时间)

即可获取到当年的节假日安排

3. 如何访问?

http://localhost:8080/v1/api/holiday/holidays?year=2019

4. 其他?

先本地启动 redis 服务。

其他接口:


// 使用HSCAN 获取某年的节假日

GET /v1/api/holiday/years/:year

// 统计某年的节假日总天数

GET /v1/api/holiday/holidays/counts/:year

statutory-holidays's People

Contributors

xieweixie avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.