Second Kill System API Interface Design Manual
1 Introduction
1.1 Purpose of writing
The project adopts the technology of front-end and back-end separation. The purpose of writing the system manual is to better clarify the system functions and carry out standardized development. At the same time, it is an important reference document for front-end and back-end integration and post-project acceptance.
1.2 Background
This API interface design manual describes the seckill system.
2 Summary
2.1 Unified output parameters
Table 2-1 Response parameter information
Whether the parameter name type must be described. code int is the status code msg String is the return prompt data T is no return information
Note: T is generic means any type
2.2 Interfaces that must be logged in to access
Table 2-2 Log in to access the interface
Interface name description/miaosha/do_miaosha seckill function
2.3 Error return code list
Table 2-3 Error return code list
code msg 500100 Server exception 500101 Parameter verification exception: %s 500210 Session does not exist or has expired 500211 Login password cannot be empty 500212 Phone number cannot be empty 500213 Phone number format error 500214 Phone number does not exist 500215 Password error 500216 Verification code is Empty 500217 Verification code error 500500 The product has been sold in seconds 500501 Can not be repeated in seconds
Note: The backend of %s will be filled automatically, and the frontend receives a complete string such as: "Parameter verification exception: The mobile phone number format is incorrect"
3 User Interface
3.1 User login
Access: /login/do_login
Description: User login
Checksum: session
Method: get/post
Table 3-1 User login Request parameters
Whether the parameter name type must be described mobile String is the mobile phone number password String is the password verifyInput String no verification code ifyzm int no whether verification code is required
Note: when ifyzm is 0, you need to fill in the verification code, when ifyzm is 1, you don't need to fill in the verification code
Table 3-2 User login response parameters
Whether the parameter name type must be described code int is the status code msg String is the return prompt data boolean is whether the login is successful
After the login is successful, the token will be returned and recorded in the cookie
4 commodity interface
4.1 Product list interface
Interface: /goods/to_list
Description: Product list
Checksum: session
Method: get/post
Requst does not need to pass in parameters, returns product list information, and transfers data through Model to goodsList
Table 4-1 Product List Response Parameters
Whether the parameter name type must describe goodsList List<GoodsVo> is the product list information goods. goodsName String is the product name goods. goodsImg String is the product photo goods. goodsPrice Double is the product price goods. miaoshaPrice Double is the flash sale price goods. stockCount Integer is the stock goods .id Long is the product id
4.2 Product Details Interface
Interface: /goods/to_detail/{goodsId}
Description: product details
Checksum: session
Method: get/post
Table 4-2 Product Details Request Parameters
Whether the parameter name type must describe goodsId long is the product id
Return product details information, and transfer data through Model to goods
Table 4-3 Product Details Response Parameters
Whether the parameter name type must describe goods.startDate Date is the seckill start time goods. goodsName String is the product name goods. goodsImg String is the product photo goods. goodsPrice Double is the original price of goods. miaoshaPrice Double is the seckill price of goods. stockCount Integer is the stock goods .id Long is the product id miaoshaStatus int is the second kill status remainSeconds int is the second kill countdown (s)
Note: The seckill status: 0 means it has not started yet, 1 means it is in progress, and 2 means the seckill is over
5 seckill interface
5.1 spike
Access: /miaosha/ do_miaosha
Description: spike
Checksum: session
Method: get/post
Table 5-1 Product Details Request Parameters
Whether the parameter name type must describe goodsId long is the product id
Return the order information and product information after the seckill is over, and transfer the goods and orderInfo data through the Model
Table 5-2 User login response parameters
Whether the parameter name type must describe goods. goodsName String is the product name goods. goodsImg String is the product photo orderInfo.goodsPrice Double is the order price orderInfo.createDate Date is the order time orderInfo.status Integer is the order status
Note: Order status: 0 unpaid, 1 awaiting shipment, 2 shipped, 3 received, 4 refunded, 5 completed