Code Monkey home page Code Monkey logo

redeem_code's Introduction

兑换码生成与销毁服务

业务背景

    生成业务中很多需要 生成随机兑换码 的使用场景。兑换码用于用户兑换、使用范畴。所以兑换码需要有唯一性
    不同的业务中,兑换码的生命周期不同。有的业务,从兑换码诞生开始,从始至终保持唯一;而部分业务,兑换码在用户已经使用后,其
实是可以再次生成的。兑换码一般与 订单 绑定,绑定后兑换码生命周期随着订单走。订单已经兑换后,旧的兑换码可以用到新生成的订单中。
这种方式 尤其适用于 较短的兑换码业务。
    本服务用于 生成唯一兑换码 场景。

服务结构

基于 Thrift 服务端
基于 Redis 存储

使用方式

  • 配置与启动

      conf 文件夹中 存放 配置文件    
      例如 config.py   config_debug.py  可根据启动方式选择配置文件
      
      运行: cd bin & python server.py debug 
    
  • 使用

      thrift 调用 
      create_codes 生成兑换码 具体参数见 thrift 文件
      get_code 与 get_codes  均从 生成的库中 随机获取兑换码返回
      code_redeem 销毁兑换码
    

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.