Git Product home page Git Product logo

shorturl's Introduction

短网址生成器

演示地址

http://t.haojima.net/

原理

  • 转短码:
  • 1、根据自增主键id前面补0,如:00000123
  • 2、倒转32100000
  • 3、把倒转后的十进制转六十二进制(乱序后)
  • 解析短码:
  • 1、六十二进制转十进制,得到如:32100000
  • 2、倒转00000123,得到123
  • 3、根据123作为主键去数据库查询映射对象

注意

由于NET Core(2.1)还是没有System.Drawing程序集,图片二维码等操作只有通过第三方编写的组件如ZKWeb.System.Drawing,但是在Linux环境需要依赖libgdiplus组件。

效果图

default

数据表结构

SET FOREIGN_KEY_CHECKS=0;

-- ----------------------------
-- Table structure for ShortURLs
-- ----------------------------
DROP TABLE IF EXISTS `ShortURLs`;
CREATE TABLE `ShortURLs` (
  `Id` int(11) NOT NULL AUTO_INCREMENT,
  `ShortURL` varchar(255) NOT NULL,
  `Url` varchar(255) NOT NULL,
  `CreationTime` datetime NOT NULL,
  `LastModificationTime` datetime NOT NULL,
  `AccessNumber` int(11) NOT NULL DEFAULT '0',
  PRIMARY KEY (`Id`)
) ENGINE=InnoDB AUTO_INCREMENT=230 DEFAULT CHARSET=utf8;
SET FOREIGN_KEY_CHECKS=1;

shorturl's People

Contributors

zhaopeiym avatar

Watchers

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