Let's analyze which pages the mall site has, and then decompose the interfaces required for each page.
10.1 Mall site page structure analysis
Typical mall sites usually include the following pages:
10.1.1 Main page types
- Home- Display the latest products, hot products, recommended products, promotional activities, etc.
- Product category page- Display product lists by category
- Product details page- Display detailed information of a single product
- Shopping cart page- Shopping cart page where users select products
- Order confirmation page- Page to confirm order information
- Order payment page- Page to complete order payment
- Personal Center Page- User personal information and order management
- Order Details Page- View detailed information of a single order
- My Orders Page- User Order List
- Shipping Address Page- Manage User Shipping Address
- Product Search Page- Search Product Results Page
- Promotion Page- Coupons, flash sales and other promotion pages
- User-related pages- Login, registration, personal center, etc.
10.2 Detailed API interfaces required for each page
10.2.1 Homepage
The mall homepage is the most important page, usually containing a variety of content displays.
Main interface call:
Get product list(
/api/archive/list){ "moduleId": 2, // 商品模块ID "limit": 10, "page": 1, "order": "created_time desc" }- Purpose: Get the latest product list
- Parameter: moduleId=2 (Product module ID is 2), limit (number of items per page), page (page number), order (sort method)
Get Recommended Products(
/api/archive/list){ "moduleId": 2, // 商品模块ID "flag": "c", // 推荐商品 "limit": 5 }- Purpose: Get the recommended product list
- Parameters: flag(recommendation identifier), limit(number)
Get Hot Products(
/api/archive/list){ "moduleId": 2, // 商品模块ID "order": "views desc", "limit": 5 }- Purpose: Get the most clicked product
- Parameters: order(By view count sorting), limit(Quantity)
Get product category list(
/api/category/list){ "moduleId": 2, // 商品模块ID "limit": 10 }- Used to get all product categories for navigation menu
Get product tag list(
/api/tag/list){ "type": "list", "limit": 20 }- Purpose: Get hot tags for tag cloud
Get System Settings(
/api/setting/system)- Used to get mall title, description, keywords and other basic information
Get Home Page Settings(
/api/setting/index)- Purpose: Get the specific configuration information of the homepage
Get navigation list(
/api/nav/list)- Purpose: Get the website navigation menu
Get Banner list(
/api/banner/list)- Purpose: Get the homepage carousel image
Get promotional event information(
/api/setting/system)- Purpose: Get promotional activity configuration information
Get coupon list(
/api/coupon/codes){ "limit": 5 }- Purpose: Get available coupon list
10.2.2 Product category page
The product category page displays the product list under a specific category.
Main interface call:
Get category details(
/api/category/detail){ "id": 1 }- Purpose: Get the current category information
- Parameter: id (category ID) or filename (category alias)
Get product list under category(
/api/archive/list){ "moduleId": 2, // 商品模块ID "categoryId": 1, "limit": 10, "page": 1 }- Purpose: Get product list under the category
- Parameters: categoryId (Category ID), limit (Number of items per page), page (Page number)
Get the list of subcategories(
/api/category/list){ "parentId": 1, "limit": 10 }- Purpose: Get the subcategories of the current category
- Parameter: parentId (Parent Category ID)
Get System Settings(
/api/setting/system)- Purpose: Get basic website information
Get product category list(
/api/category/list)- Purpose: Get all categories, used for sidebar navigation
Get filter conditions(
/api/archive/list){ "moduleId": 2, // 商品模块ID "categoryId": 1, "type": "filter" }- Purpose: Get filter conditions under the current category
10.2.3 Product detail page
The product detail page displays complete information about a single product.
Main interface call:
Get product details(
/api/archive/detail){ "id": 1 }- Purpose: Get detailed product content
- Parameter: id(Product ID) or filename(Product Alias)
Get product parameters(
/api/archive/params){ "id": 1, "sorted": true }- Purpose: Get custom product parameters
- Parameter: id(Product ID), sorted(Return format)
Get product SKU information(
/api/archive/sku){ "id": 1 }- Purpose: Get product SKU specifications
- Parameter: id(Product ID)
Get the previous product(
/api/archive/prev){ "id": 1 }- Purpose: Get information about the previous product
Get the next product(
/api/archive/next){ "id": 1 }- Purpose: Get information about the next product
Get related products(
/api/archive/list){ "type": "related", "limit": 5, "id": 1 }- Purpose: Get other products in the same category
- Parameters: type=“related”(type of related products), limit(数量), id(current product)
List product comments(
/api/comment/list){ "archive_id": 1, "limit": 10, "page": 1 }- Purpose: List product comments
- Parameters: archive_id(Product ID), limit(Quantity per page), page(Page number)
Check collection status(
/api/favorite/check){ "archive_id": 1 }- Purpose: Check if the current user has favorited the product
- Authentication required
Get System Settings(
/api/setting/system)- Purpose: Get basic website information
Get the number of items in the shopping cart(
/api/cart/list)- Purpose: Get the number of items in the current user's shopping cart
- Authentication required
10.2.4 Shopping Cart Page
The shopping cart page displays the products selected by the user.
Main interface call:
Get shopping cart list(
/api/cart/list)- Purpose: Get the current user's shopping cart product list
- Authentication required
Update shopping cart item quantity(
/api/cart/update){ "id": 1, "quantity": 2 }- Purpose: Update the quantity of a specific product in the shopping cart
- Parameter: id(Cart item ID), quantity(Quantity)
- Authentication required
Remove item from shopping cart(
/api/cart/remove){ "id": 1 }- Purpose: Remove an item from the shopping cart
- Parameter: id(Cart item ID)
- Authentication required
Get System Settings(
/api/setting/system)- Purpose: Get basic website information
Get coupon list(
/api/coupon/codes)- Purpose: Get available coupon list
- Authentication required
Order Confirmation Page 10.2.5
The order confirmation page is used to confirm order information.
Main interface call:
Get shopping cart list(
/api/cart/list)- Purpose: Get the current user's shopping cart product list
- Authentication required
Get delivery address list(
/api/order/addresses)- Purpose: Get the user's delivery address list
- Authentication required
Get default delivery address(
/api/order/address)- Purpose: Get the user's default delivery address
- Authentication required
Get product settlement information(
/api/orders/checkout){ "cart_ids": [1, 2, 3] }- Purpose: Get the settlement information of the product (price, shipping fee, etc.)
- Parameter: cart_ids (list of shopping cart item IDs)
- Authentication required
Get coupon list(
/api/coupon/codes)- Purpose: Get available coupon list
- Authentication required
Get System Settings(
/api/setting/system)- Purpose: Get basic website information
Order Payment Page 10.2.6
The order payment page is used to complete the order payment.
Main interface call:
create order(
/api/order/create){ "address_id": 1, "coupon_id": 2, "remark": "订单备注", "cart_ids": [1, 2, 3] }- Purpose: Create a new order
- Parameter: address_id(Shipping Address ID), coupon_id(Coupon ID), remark(Note), cart_ids(List of Shopping Cart Item IDs)
- Authentication required
get order details(
/api/order/detail){ "order_id": "202211232209080046" }- Purpose: Get order details
- Parameter: order_id (Order ID)
- Authentication required
Order payment(
/api/order/payment){ "order_id": "202211232209080046", "pay_way": "alipay" }- Purpose: Initiate order payment
- Parameters: id(Order ID), payment_method(Payment Method)
- Authentication required
Get System Settings(
/api/setting/system)- Purpose: Get basic website information
10.2.7 Personal Center Page
The personal center page displays the user's personal information and order management.
Main interface call:
Get user details(
/api/user/detail)- Use: Get current user details
- Authentication required
Get the user's order list(
/api/orders){ "limit": 5, "page": 1 }- Purpose: Get the user's order list
- Parameters: limit (number of items per page), page (page number)
- Authentication required
Get user favorite list(
/api/favorite/list){ "limit": 5, "page": 1 }- Purpose: Get the list of user's favorite products
- Parameters: limit (number of items per page), page (page number)
- Authentication required
Get User Wish List(
/api/wishlist)- Purpose: Get the user's wish list
- Authentication required
Get the user's shipping address list(
/api/order/addresses)- Purpose: Get the list of user shipping addresses
- Authentication required
Retrieve the list of comments made by the user(
/api/comment/list){ "user_id": 1, "limit": 5, "page": 1 }- Purpose: Retrieve the comments posted by the user
- Parameters: user_id (User ID), limit (number of items per page), page (page number)
- Authentication required
Get System Settings(
/api/setting/system)- Purpose: Get basic website information
10.2.8 Order Details Page
The order details page displays the details of a single order.
Main interface call:
get order details(
/api/order/detail){ "order_id": "202211232209080046" }- Purpose: Retrieve order details
- Parameter: order_id (Order ID)
- Authentication required
Get System Settings(
/api/setting/system)- Purpose: Get basic website information
Get Order Review(
/api/review/list){ "order_id": "202211232209080046" }- Purpose: Retrieve reviews of order items
- Parameter: order_id (Order ID)
- Authentication required
10.2.9 My Order Page
My Order Page displays all user orders.
Main interface call:
Get the user's order list(
/api/orders){ "limit": 10, "page": 1, "status": "paid" }- Purpose: Get the user's order list
- Parameters: limit (number of items per page), page (page number), status (order status)
- Authentication required
cancel order(
/api/order/cancel){ "order_id": "202211232209080046" }- Purpose: Cancel order
- Parameter: order_id (Order ID)
- Authentication required
Complete order(
/api/order/finished){ "order_id": "202211232209080046" }- Purpose: Complete order
- Parameter: order_id (Order ID)
- Authentication required
Get System Settings(
/api/setting/system)- Purpose: Get basic website information
10.2.10 Shipping Address Page
The shipping address page is used to manage the user's shipping addresses.
Main interface call:
Get delivery address list(
/api/order/addresses)- Purpose: Get the list of user shipping addresses
- Authentication required
Save Shipping Address(
/api/order/address){ "name": "收货人姓名", "phone": "收货人电话", "province": "省份", "city": "城市", "country": "区域", "address": "详细地址", "is_default": 1 }- Purpose: Save Shipping Address
- Parameter: name (Name), phone (Phone), province (Province), city (City), country (Area), address (Detailed Address), is_default (Is Default)
- Authentication required
Get System Settings(
/api/setting/system)- Purpose: Get basic website information
10.2.11 Product Search Page
The product search page displays products related to the search keywords.
Main interface call:
Product Search List(
/api/archive/list){ "moduleId": 2, // 商品模块ID "q": "关键词", "limit": 10, "page": 1 }- Purpose: Search for products containing keywords.
- Parameters: q(search keywords), limit(number of items per page), page(page number)
Get hot search(
/api/archive/list){ "moduleId": 2, // 商品模块ID "order": "views desc", "limit": 10 }- Purpose: Get popular search content
Get search suggestions(
/api/archive/list){ "moduleId": 2, // 商品模块ID "q": "关键词前缀", "limit": 5 }- Purpose: Get search suggestions
Get System Settings(
/api/setting/system)- Purpose: Get basic website information
10.2.12 Promotion Page
Promotion page shows coupons, flash sales, and other promotional activities.
Main interface call:
Get coupon list(
/api/coupon/codes){ "limit": 10, "page": 1 }- Purpose: Get the list of coupons
- Parameters: limit (number of items per page), page (page number)
Get a valid coupon list(
/api/coupon/valid)- Purpose: Get the list of current valid coupons
Get coupon code(
/api/coupon/code){ "id": 1 }- Purpose: Get coupon code
- Parameter: id (coupon ID)
- Authentication required
Get flash sale products(
/api/archive/list){ "moduleId": 2, // 商品模块ID "flag": "s", // 秒杀标识 "limit": 10, "page": 1 }- Purpose: Get flash sale product list
Get System Settings(
/api/setting/system)- Purpose: Get basic website information
10.2.13 User-related pages
10.2.13.1 Login Page
Main interface call:
- User Login(
/api/login){ "user_name": "用户名", "password": "密码" }- Purpose: User Login Authentication
- Parameters: user_name (username), password (password), email (email), phone (phone number)
10.2.13.2 Registration Page
Main interface call:
User Registration(
/api/register){ "user_name": "用户名", "password": "密码", "email": "邮箱", "captcha_id": "验证码ID", "captcha": "验证码" }- Purpose: New User Registration
- Parameters: user_name (Username), password (Password), email (Email), captcha (Captcha)
Get verification code(
/api/captcha)- Use: Get image verification code
Send email verification(
/api/verify/email){ "email": "邮箱地址" }- Use: Send email verification code
10.2.13.3 Personal Center Page
Main interface call:
Get user details(
/api/user/detail)- Use: Get current user details
- Authentication required
Update user information(
/api/user/update){ "real_name": "真实姓名", "email": "邮箱" }- Purpose: Update user information
- Authentication required
Update user avatar(
/api/user/avatar)- Purpose: Update user avatar
- Authentication required
Update User Password(
/api/user/password){ "old_password": "旧密码", "password": "新密码" }- Purpose: Update User Password
- Authentication required
Reset user password(
/api/user/password/reset){ "email": "邮箱", "password": "新密码", "token": "验证token", "code": "验证码" }- Purpose: Reset user password
10.3 Page loading process example
For example, on the product detail page, describe the complete API call process:
10.3.1 Page initialization
- Get product details
- Increase product page views (through subsequent requests or server processing)
- Get product SKU information
10.3.2 Sidebar content loading
- Get previous/next product
- Get related product recommendations
- Get the list of popular products
Comment area loading 10.3.3
- List product comments
- If the user is logged in, get the user's favorite status for the current product
10.3.4 Shopping cart function
- Get the number of items in the shopping cart (if the user is logged in)
- Add to cart (requires authentication)
10.3.5 Interaction features
- Post Comment (requires authentication)
- Favorite/Unfavorite (requires authentication)
- Like Comment (requires authentication)
10.4 Common page composition calls
10.4.1 Home + Category Page Combination
// 并行请求多个接口
Promise.all([
fetch('/api/archive/list', { params: { moduleId: 2, limit: 10, page: 1 } }),
fetch('/api/category/list', { params: { moduleId: 2, limit: 10 } }),
fetch('/api/tag/list', { params: { type: 'list', limit: 20 } }),
fetch('/api/setting/system'),
fetch('/api/coupon/codes', { params: { limit: 5 } })
]).then(responses => {
// 处理所有响应数据
const [products, categories, tags, settings, coupons] = responses;
// 渲染页面
});
10.4.2 Full Call of Product Detail Page
// 串行或并行调用多个接口
const productId = 1;
Promise.all([
fetch(`/api/archive/detail`, { params: { id: productId } }),
fetch(`/api/archive/params`, { params: { id: productId } }),
fetch(`/api/archive/sku`, { params: { id: productId } }),
fetch(`/api/archive/prev`, { params: { id: productId } }),
fetch(`/api/archive/next`, { params: { id: productId } }),
fetch(`/api/comment/list`, { params: { archive_id: productId, limit: 10 } }),
fetch(`/api/setting/system`)
]).then(responses => {
const [product, params, sku, prev, next, comments, settings] = responses;
// 组合数据并渲染页面
});
10.4.3 Full Call of Order Confirmation Page
// 订单确认页面的API调用
const cartIds = [1, 2, 3];
Promise.all([
fetch('/api/cart/list'),
fetch('/api/order/addresses'),
fetch('/api/orders/checkout', { params: { cart_ids: cartIds } }),
fetch('/api/coupon/codes'),
fetch('/api/setting/system')
]).then(responses => {
const [cart, addresses, checkout, coupons, settings] = responses;
// 组合数据并渲染页面
});
It can be seen that a complete e-commerce site needs to call multiple API interfaces to build various pages, developers can choose the appropriate interface combination according to actual needs to realize rich e-commerce functions.
Conclusion
By following this guide, you can systematically understand and use the AnQiCMS API, from basic concepts to advanced usage, and gradually master the usage of the interface.It is recommended to learn step by step according to the guide and practice with actual projects.