Giter VIP home page Giter VIP logo

fast-qrcode's Introduction

快速扫码服务端


用于B/S架构快速部署手机扫码功能

Github Actions

特点

  • 二维码数据预生成,提升请求响应时延
  • 内置缓存,极简部署

安装

# 将文件上传至服务器
# 解压文件
tar -zxvf fast-qrcode_v1.0.0_linux_amd64.tar.gz -C /opt

# 创建配置文件夹
mkdir -p /etc/fast-qrcode/

# 移动配置文件
mv /opt/default.conf /etc/fast-qrcode/default.conf

# 配置文件可执行
chmod +x /opt/fast-qrcode

创建Service文件

vim /etc/systemd/system/fast-qrcode.service

#文件内容
[Unit]
Description=Fast QRScan Service
After=network.target

[Service]
Type=simple
User=root
Restart=on-failure
RestartSec=5s
ExecStart=/opt/fast-qrcode -c /etc/fast-qrcode/default.conf

[Install]
WantedBy=multi-user.target

启动服务:systemctl start fast-qrcode

停止服务:systemctl stop fast-qrcode

设置自启:systemctl enable fast-qrcode

接口说明

1. 测量接口

GET /actuator/:metric

metric取值

  • cache - 监控内部缓存运行情况

EntryCount the number of items currently in the cache.

EvacuateCount is a metric indicating the number of times an eviction occurred.

ExpiredCount is a metric indicating the number of times an expire occurred.

HitCount is a metric that returns number of times a key was found in the cache.

HitRate is the ratio of hits over lookups.

LookupCount is a metric that returns the number of times a lookup for a given key occurred.

MissCount is a metric that returns the number of times a miss occurred in the cache.

OverwriteCount indicates the number of times entries have been overriden.

r 返回值: 0 正常,-1 异常

{
  "EntryCount": 272,                          
  "EvacuateCount": 0,
  "ExpiredCount": 10,
  "HitCount": 7156,
  "HitRate": 0.8909362549800797,
  "LookupCount": 8032,
  "MissCount": 876,
  "OverwriteCount": 819,
  "r": 0
}
  • create - 创建扫码请求计数器
  • lookup - 轮询查找扫码结果计数器
  • submit - 提交扫码结果计数器
  • notify - 一次扫码通知计数器

2. 服务存活探测接口

GET /ping

用于测量服务存活状态,正常返回值:

{
  "message": "pong"
}

3. 创建扫码请求接口

GET /create

4. 轮询扫码结果接口

GET /lookup/:uuid

5. 提交扫码结果接口

POST /submit/:uuid

6. 通知扫码动作接口

POST /notify/:uuid

fast-qrcode's People

Contributors

ynqjwsm avatar

Stargazers

 avatar  avatar

Watchers

James Cloos avatar  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.