(with source code) node.js+mysql+Development and design of online store based on JavaScript

Development of Node.js Online Store

Summary

As the use of the Internet becomes more and more widespread, in the traditional business model, people are used to purchasing all kinds of daily commodities in various merchant stores. However, in the fast-paced new era, people may not be able to spare time to buy all kinds of goods, let alone patiently choose the goods they want. Therefore, designing an online shopping mall is not only to cater to the trend of e-commerce, but also a breakthrough in the traditional commodity sales industry, which can bring changes and opportunities to the traditional sales industry.

This system mainly provides users with a platform to purchase various commodities, and attracts many consumers to purchase through the price advantage, so as to realize normal operation. The system adopts an object-oriented development model for software development and hardware installation, which can well meet the needs of actual use, and improves the corresponding software installation and program coding. The system uses Mysql as the main storage unit for background data. , using software engineering principles and development methods, a management system built with node.js koa technology realizes all the functions of the system. The goal is to realize a sales-centered computer system and build a business system that organically combines user information and account numbers, and account number and order information.

Keywords: online shopping mall; online shopping; Node.js

Node. Development of JS online mall

ABSTRACT

With the more and more extensive use of the Internet, in the traditional business model, people are used to buying all kinds of daily goods from various stores. However, in the fast-paced new era, people may not be able to make time for buying all kinds of goods, let alone patiently choose the goods they want. Therefore, designing an online mall is not only to meet the general trend of e-commerce, but also a breakthrough in the traditional commodity sales industry, which can bring changes and opportunities to the traditional sales industry.

This system is mainly to provide users with a platform to buy all kinds of goods, attract many consumers to buy through price advantage, and realize normal operation. The system adopts the object-oriented development mode for software development and hardware erection, which can well meet the needs of practical use, and improve the corresponding software erection and program coding. The system adopts MySQL as the main storage unit of background data, applies the principles and development methods of software engineering, and adopts node JS koa technology to build a management system, to achieve all the functions of the system. The goal is to realize a sales centered computer system and build a business system with the organic combination of user information and account number, account number and order information.

Key words:E-Shop; Online shopping; Node. js

Table of contents

summary  

ABSTRACT

Chapter 1 Introduction

1.1 Research Background

1.2 Research Significance

1.3 System Objectives

1.4 Structure of this paper

Chapter 2 Introduction of Key Technologies

2.1 koa framework

2.2 Main functions of Vue.js

2.3 Introduction to MVVM pattern

2.4 Working principle of B/S system

2.5  Mysql database _

2.6 Advantages of koa framework 

2. 7Java Script running mode

Chapter 3 System Analysis

3.1 Feasibility analysis

3.1.1 Operation Feasibility

3.1.2 Technical Feasibility

3.1.3 Economic feasibility

3.2 Analysis of Functional Requirements

3.3 Use case analysis

3.4 Data Flow Analysis

3.5 Data Dictionary

Chapter 4 System Design

4.1 Structural Design

4.2 Functional Design

4.3 Database design

4.3.1 Conceptual Design

4.3.2 Logic Design

4.3.3 Table design

Chapter 5 System Detailed Design

5.1 Node.js EE connects to the database

5.2 Login module

5.3 Mall information module

5.4 Commodity Review Module _

5. 5 Purchase product module

5.6 System user management module

5.7 Mall management module

5.8 Mall information management module

5.9 Logistics distribution management module

Chapter 6 System Testing

6.1 Test purpose

6.2 Test Cases

Chapter 7 Conclusion

references

thank you 

  1.  introduction

1.1 Research Background

Various items are people's daily consumer goods, and the supply of items has an extremely important relationship with consumer demand. Social pressure has resulted in increasingly busy work and a stronger sense of time, simplifying affairs and facilitating consumption, making online sales gradually become the needs of socialized consumption. At the same time, due to the continuous improvement of people's living consumption quality, the consumption needs of various goods have changed from "quantity" to "quality", and the consumption and diversification of goods consumption have also become a kind of consumption demand.

Online shopping has shown a strong development momentum in today's developed countries, and it can be said to be a new force in promoting national economic growth. In contrast, online shopping in my country is still relatively lagging behind. However, after the development of recent years, more and more people realize the convenience of "ordering online and delivering goods to your door", and more and more people Also began to accept online shopping malls. According to CNNIC's "China Internet Hotspot Survey Report", 17.9% of Internet users in my country have experienced online shopping within half a year, and 29.6% of Internet users who have browsed shopping websites Over 90% of respondents who have had online shopping experience within half a year will continue to do online shopping in the future; 63.7% of netizens who have no shopping experience said they will try online shopping in the future.

Although my country's Internet is developing rapidly, the proportion of online shopping in my country is far from that of developed countries. The number of online shoppers has great potential for development and the market space is huge.

1.2 Research Significance

With the prosperity of the mobile Internet era today, the country has also released the "Internet +" strategy, which intends to use the Internet to transform various traditional industries. Through the use of information management systems and Internet platforms, the Internet and traditional industries will be deeply integrated and developed to achieve The effect of 1+1>2. The Internet strategy can be said to be the top priority of many strategies in the development of my country's current era. With the fast train of the Internet era, the digital information development of the chain shopping mall business can be said to be like a fish in water. China's computer network has been developed for decades, and the basic network has long been popularized in major cities. It can be said that Internet informatization has played a mainstay role in all aspects of retailing, life services, information services, etc.

In recent years, China's Internet has developed rapidly, and even surpassed most developed countries in the world, reaching the level of global leadership. The emergence of Zero Mobile Internet has rapidly transformed traditional industries. People can purchase food, clothing, skin care products, etc. through various online shopping malls. As the industry with the most contact with people in urban life today, online shopping malls are highly penetrated by the platforms of major Internet companies. Therefore, the development of "online shopping malls" studied in this paper should conform to the needs of the times.

1.3 System Objectives

For a typical database system, especially for a network system with a particularly large data flow such as an online shopping mall, it must meet the requirements of ease of use and flexible operation. The system should meet the following goals when designing

(1) It adopts the operation method of man-machine dialogue, the interface is beautiful and friendly, the information query is flexible and convenient, and the data storage is accurate, safe and reliable;

(2) Fully display all commodities, and can display the main commodities;

(3) It is convenient for customers to quickly search for product information;

(4) Users can modify their basic information at any time;

(5) Realize the function of placing an order;

(6) Customers can view their order information at any time;

(7) For the data entered by customers, the system conducts strict data inspection to eliminate human errors as much as possible;

(8) The system maximizes the ease of maintenance and operability;

(9) The system runs stably, safely and reliably.

1.4 Structure of this paper

The specific content of this paper includes: introduction, key technologies adopted by the system, system analysis, system design, system realization and system test. This paper emphatically describes the composition and structure of the system, expounds the design scheme, implementation method, development tools and related technologies of the system, and also analyzes the development process of some links. The system simulates the important modules of the system in a certain environment, which proves the usability and reliability of the system.

  1.  Key Technology Introduction

2.1 koa framework

Node.js is an asynchronous world. The official API supports the asynchronous programming model in the form of callback, which will bring many problems, such as: 1. The problem of callback nesting; 2. The callback may be called synchronously in the asynchronous function to return data. bring about inconsistency. In order to solve the above problems Koa appeared.

Koa was built by the original team of Express, and is committed to becoming a smaller, more expressive, and more robust web framework. Using koa to write web applications can avoid repeated and tedious nesting of callback functions, and greatly improve the efficiency of error handling. Koa does not bind any middleware in the kernel method, it only provides a lightweight and elegant function library, making it easy to write web applications. The development idea is similar to that of express, and the biggest feature is that it can avoid asynchronous nesting.

Ali is using the Koa framework internally, and has made some extensions and packages based on Koa. And developed an open source framework egg based on koa.

2.2 Main functions of Vue.js:

Vue.js is a progressive framework for building user interfaces. Unlike other heavyweight frameworks, Vue is designed with bottom-up incremental development. Vue's core library only focuses on the view layer, and is very easy to learn and integrate with other libraries or existing projects. On the other hand, Vue is fully capable of driving complex single-page applications developed with single-file components and libraries supported by the Vue ecosystem.

The goal of Vue.js is to enable responsive data binding and composed view components with the simplest API possible .

Vue.js itself is not a catch-all framework - it only focuses on the view layer. So it's very easy to learn, very easy to integrate with other libraries or existing projects. On the other hand, Vue.js can also power complex single-page applications when used with related tooling and supporting libraries.

2.3  Introduction to the MVVM pattern:

MVVM is shorthand for Model-View-ViewModel. It's essentially an improved version of MVC. MVVM is to abstract the state and behavior of the View in it, and let us separate the view UI from the business logic. Of course, ViewModel has already done these things for us. It can take out the data of Model and help deal with the business logic involved in View because of the need to display content. Microsoft's WPF brings new technical experience, such as Silverlight, audio , video , 3D , animation ..., which leads to more detailed and customizable software UI layer. At the same time, at the technical level, WPF also brings new features such as Binding, Dependency Property, Routed Events, Command, DataTemplate, and ControlTemplate. The origin of the MVVM (Model-View-ViewModel) framework is a new type of architectural framework developed and evolved from the application of the MVP (Model-View-Presenter) pattern combined with WPF . It is based on the original MVP framework and incorporates the new features of WPF to cope with the increasingly complex needs of customers.

2.4  B/S system working principle:

The B/S architecture adopts the working mode of browser request and server response.

Users can access information such as text, data, pictures, animation, video on demand and sound generated by the web server on the Internet through a browser;

And each web server can be connected with the database server in various ways, and a large amount of data is actually stored in the database server;

Download the program from the Web server to execute locally. If an instruction related to the database is encountered during the download process, the Web server will hand it over to the database server for interpretation and execution, and return it to the Web server, and the Web server will return it to the user. In this structure, many networks are connected together to form a huge network, that is, the global network. Each enterprise can build its own Internet on the basis of this structure.

In the B/S mode, the user requests access to many servers distributed on the network through the browser. The browser's request is processed by the server, and the processing result and corresponding information are returned to the browser. Other data Processing and requests are all completed by the Web Server. Through the frame structure and the browser embedded in the operating system, this structure has become the mainstream structure mode of today's software applications.

2.5 MySQL database

The language of Mysql is unstructured, and users can work on the data. MySQL gets a lot of attention for its speed, reliability, and adaptability. Most people agree that MySQL is the best choice for managing content when transactional processing is not required. And because the language and structure of Mysql are relatively simple, but the function and the amount of stored information are very powerful, it has been widely used.

The role of Mysql database in the programming process is very extensive, which brings convenience for users to query data. Because of its flexibility and powerful functions, the application of Mysql database only needs a small piece of code to realize a certain function, unlike other programs that need to write a large piece of code. Generally speaking, the language of Mysql database is relatively concise.

Data flow analysis is mainly a storage room for data storage, which is performed on a computer, not a storage room in reality. Data is stored in a fixed format rather than in disorder. Its definition is: it has a fixed format for a long time and can be shared and stored on the computer memory. Database management is mainly data storage, modification and addition, and the establishment of data tables. In order to ensure the normal operation of the system data, some capable processors can manage it without the need for professional people to handle it. The establishment of the data table can adjust the data in the data table, recombine and reconstruct the data to ensure the security of the data. Due to the powerful features of the database, the development of this system mainly uses Mysql to manage the data.

2.6 Advantages of koa framework

First of all, with the ability of promise and generator, the callback is discarded, which perfectly solves the problems of asynchronous composition and asynchronous exception capture.

Secondly, koa removes the built-in router, view and other functions in express, making the framework itself lighter. This design has the following advantages: 1. It is very simple to transplant various express middleware to koa; 2. The built-in functional parts in express may not be good, such as view, if you want to add your own view engine, you have to go deeper Hierarchical hacks, such as routers, do not have the best efficiency. Koa does not have these built in, which gives developers a lot of freedom, and developers can freely create more sophisticated and professional middleware.

2.7 JavaScript running mode

JavaScript is a high-level scripting language belonging to the network. It has been widely used in the development of Web applications. It is often used to add various dynamic functions to web pages and provide users with smoother and more beautiful browsing effects. Usually JavaScript scripts realize their own functions by embedding them in HTML

1.1 is an interpreted scripting language (code is not precompiled ).

1.2 is mainly used to add interactive behavior to HTML ( an application under the Standard Universal Markup Language ) page.

1.3 can be directly embedded in HTML pages, but written as a separate js file is conducive to the separation of structure and behavior .

1.4 Cross-platform feature, with the support of most browsers, it can run on multiple platforms (such as Windows , Linux , Mac , Android , iOS , etc.).

1.5 JavaScript scripting language, like other languages, has its own basic data types, expressions and arithmetic operators and the basic program framework of the program. JavaScript provides four basic data types and two special data types for processing data and text. Variables provide a place to store information, and expressions can complete more complex information processing.

  1.  system analysis

3.1 Feasibility analysis

The system is simple to operate and easy to understand. The online shopping mall is similar to the operation process of most e-commerce systems, which avoids the time and burden for users to learn to use the system.

3.1.1 Operation Feasibility

This system uses the popular development language, Node.js technology. At the same time, all information is displayed in the form of web pages, and the information in the system can be operated on the database in the background to achieve the effect of data update. Users only need to know basic computer operations or surf the Internet to use this system, and system administrators only need to know how to upload files and process text to operate and manage the background. The system layout is relatively simple, and the functional operation is not complicated, which fully meets the needs of the modern market. Therefore, the system is operationally feasible.

3.1.2 Technical Feasibility

This system uses Myeclipse10 development tools under the Windows7 development environment, and uses Mysql as the database management system to realize various functions of the system. Mysql is a master-slave database server, which is also the characteristic of a master-slave database server. The server itself focuses on data management and provides a consistent interface for client applications. It can improve the performance of the system and reduce its limitations.

3.1.3 Economic feasibility

This system is an online shopping mall. Customers can buy goods directly in the shopping mall. At the same time, the price of the computer is very low, but the performance has made great progress. The development of this system can effectively improve work efficiency, reduce management costs, save management expenses, and bring a qualitative leap to the work efficiency of enterprises. Therefore, this system is completely feasible economically.

3.2 Analysis of Functional Requirements

Through this system, merchants save investment in trading venues, service quality, maintenance store miscellaneous expenses, etc., thereby reducing prices; on the part of buyers, not only saves time and cost, but also reduces purchase costs, and can "shop around Three "freely select cost-effective products. Accelerate the speed of transactions and currency circulation, which in turn promotes economic growth.

According to the requirements of the conditions, the system structure is mainly composed of two major users. One is the user and the other is the administrator user.

1 User login and identity requirements       

Verify user information for buyers, admins, etc.

2 Functional requirements for sales of this system (for buyers and users)

Users are allowed to complain about the problems of the products online.

Allow users to review items.

Allow users to query product information.

Allows users to manage purchase orders.

Automatically generate orders.

The user pays for the order online.

Select the product, make a purchase, and fill in the shipping address, contact number and other information.

3 system management function requirements (for administrator users)

Management of user orders (delete, modify, query).

Management of mall centers (delete, modify, query).

Management of the mall list (delete, modify, query).

Management of logistics information (adding, deleting, modifying commodity categories).

3.3 Use case analysis

1. The administrator is mainly responsible for system management, mall management, commodity order management, user information management, logistics distribution management, and accounting information management. The following figure describes the use case of the administrator.

 

                                                      Figure 3-1 Administrator use case diagram

2. Users mainly use the online purchase service of the system. The following figure shows the user use case diagram.

 

                                                         Figure 3-2 User use case diagram

3.4 Data Flow Analysis

The design of the data flow diagram is mainly due to the fact that the current function of the system has not yet been determined. It is possible to describe the functional content that may be used first, and to learn from the user information such as "what data the system receives from the outside world" and "what data the system sends to the outside world". Design a data flow diagram based on the answers given by the user.

The following is the 0-layer data flow diagram of the system. System users are divided into administrators and ordinary users.

    

 

Figure 3-4 System data flow diagram (layer 0)

The following figure shows the data flow diagram of the system layer 1.

 

                                                          Figure 3-5 System data flow diagram (layer 1)

The data flow diagram on the second layer of the online shopping mall mainly reflects the principle of interaction between the operations and data corresponding to each functional module in detail. And it shows in more detail the data flow direction of each role's operation on the functional modules, so that developers can understand the development direction of the system and can develop a system model more accurately.

The product information maintenance is refined to obtain the second-layer data flow chart of product information management, as shown in the figure below.     

 

Figure 3-6 Commodity management data flow diagram (2 layers)

Refine the order information management to obtain the second-layer data flow chart of order information management, as shown in the figure below.

 

Figure 3-7 Order management data flow diagram (2 layers)

3.5 Data Dictionary

1. Data storage description

The following table describes the data flow, data source, data destination and data flow of user information.

Table 3-1 User information description

data flow

User Info

data stream source

User information table and user detailed information table in Mysql database

where the data goes

System interface, user information management interface

data stream composition

Username, user password, adding time, serial number

The following table describes the data flow, data source, data destination, and data flow of order information.

Table 3-2 Description of order information

data flow

order information

data stream source

Order table and order details table in Mysql database

where the data goes

User order interface, order management interface

data stream composition

User ID, order ID, product ID, order time, order amount

The following table describes the data flow, data source, data destination, and data flow entries of commodity management.

Table 3-3 Product Information Description

data flow

product information

data stream source

Commodity table and commodity category table in Mysql database

where the data goes

Product query interface, product details interface, purchase order interface, product management interface

data stream composition

Product name, product price, inventory quantity, product category

2. Data processing description

The following table describes the user authentication process by entering the user name and password, and the returned information will be displayed on the interface after the authentication is successful.

Table 3-4 User Authentication

Handling Logical Names

user authentication

brief description

Check the legitimacy of the entered information

input stream

username+password

process

According to the entered user name and password, retrieve the user and display the query information

output stream

user information, product information

The following table describes how to query product information by product name after the user successfully logs in to the system, and display the data on the interface according to the returned data after the query.

Table 3-5 Commodity Information Query

Handling Logical Names

Commodity information inquiry

brief description

Check the legitimacy of the entered information

input stream

Product name or product number or product category

process

Users who have successfully logged in can query the products the user needs through the product name, and can also query the user's orders and comments.

output stream

User order information, purchase order information

The following table describes how administrator users can manage logistics distribution after successfully logging in to the system.

Table 3-6 Logistics distribution

Handling Logical Names

Logistics

brief description

Check the legitimacy of the entered information

input stream

Logistics

process

The administrator user who has successfully logged in can add a piece of logistics distribution data to the database.

output stream

Logistics information, logistics status

The following table describes that after the administrator user successfully logs in to the system, purchases goods, fills in the order consignee, delivery address, contact number, etc., and after generating the purchase order, re-query the order form, and the returned order data is displayed on the interface.

Table 3-7 Order generation

Handling Logical Names

order generation

brief description

Check the legitimacy of the entered information

input stream

order information

process

Users who log in successfully add an order information data to the database.

output stream

order information

  1.  system design

4.1 Structural Design

The design of this system is based on Node.js technology + Mysql database + Tomcat server, Myeclipse10 is used as the development tool, and Photoshop CS6 technology is used to beautify the webpage, supplemented by CSS technology. The roles used in this system are mainly system administrators and ordinary users. The system is divided into foreground and background. The foreground is mainly used for product display and purchase, and the background is used for management of mall information and order information. Log in to the front desk of the system to browse and search information on various commodities. Users can place orders for the commodities they need. Users can check whether the order has been confirmed by the administrator. After the order is generated, it means that the user has successfully purchased. When placing an order, you can also collect the product and make a product complaint. At the same time, the user can modify personal information and view the order logistics and distribution; log in to the system background as an administrator to perform product maintenance, order maintenance, and logistics distribution management.

The system function structure diagram is shown below.

           

 

Figure 4-1 System function structure diagram     

4.2 Functional Design

1.用户登录模块:确保用户注册信息的真实度是提高系统效率和盈利的重要因素。真实的用户才能带来价值,注册是保证真实用户使用系统主要业务的第一步,通过对用户注册信息的审核,可防止机器注册。使用现如今较为流行的管理员进行账号激活的验证方式,对用户注册信息进行过滤,未激活用户信息将不能使用系统主要功能。

如下图所示为用户登录流程图。

 

                                                     图4-2用户登录流程图

2.商品浏览模块:没有登录的用户和登录的用户都可以在系统前台进行商品浏览,用户可以查看商品的详细信息和选择相应的商品类别进行该类别下的商品查看,用户还可以通过商品名称的关键字进行搜索。

如下图所示为商品浏览流程图。

 

图4-3商品浏览流程图

3.订单管理模块:用户购买商品后,填写收货地址、收货人、电话等信息,生成订单信息,管理员可以审核订单,删除、修改订单,对订单信息进行相应的商品发货。 

如下图所示为订单管理流程图。

 

                                                       图4-4订单管理流程图                                                                      

4.商品管理模块

系统管理员可以对商品信息进行增、删、改、查的操作。

5.用户管理模块

系统管理员可以对用户信息进行增、删、改、查的操作。

6.订单模块

用户对个人添加至购买订单里面的商品进行增删改查等操作。

4.3数据库设计

4.3.1概念设计

本系统的E-R图表现了系统中各个实体之间的联系,经过分析,系统的实体有商品、商城、订单、物流配送、用户等。

商品订单的实体图如下图所示。

 

图4-6商品订单实体图

商品类别实体图如下图所示。

 

图4-7商品类别信息实体图

用户信息实体图如下图所示。

 

图4-8用户信息实体图

物流配送的实体图如下图所示。

 

图4-9物流配送实体图

系统总体的实体图如下图所示。

 

                                                             图4-10系统E-R图

4.3.2逻辑设计

Allusers表是系统用户的信息表,存储系统用户真实姓名、性别、年龄、电话、地址、备注、编号、姓名、用户密码以及其相对应的密码等相关信息。

Dingdan表是订单信息表,存储用户的订单的相关信息,其中包括编号、订单号、金额、订单内容、用户名、姓名、手机号码、添加时间、是否审核等相关信息。

yonghuzhuce表是用户注册信息表,存储用户的注册信息,其中包括编号、用户名、密码、姓名、性别、出生年月、QQ、邮箱、电话、头像、等相关信息。

shangpinxinxi表是商品信息表,存储商品内容的信息,其中包括编号、商品编号、商品名称、类别、价格、发布人、图片、简介、添加时间等相关信息。

wuliuxinxi表是物流配送表,存储用户订单的物流配送信息,其中包括物流号、物品名称、发货地址、物流状态、收货地址、收货用户、物流状态、用户签收等相关信息。

4.3.3表设计

    数据库表设计:经过前期的需求分析、可执行分析、数据流分析等各个流程分析,结合软件工程的高内聚、低耦合规则,并考虑到以后的程序功能扩展,设计如下几张表

名称

类型

长度

不是null

主键

注释

member_user_id

int

11

会员用户ID

member_name

varchar

64

会员姓名

member_gender

varchar

64

会员性别

member_number

varchar

64

会员编号

examine_state

varchar

16

审核状态

recommend

int

11

智能推荐

user_id

int

11

用户ID

create_time

datetime

0

创建时间

update_time

timestamp

0

更新时间

名称

类型

长度

不是null

主键

注释

shopping_mall_id

int

11

商城ID

remarks

varchar

64

备注

hits

int

11

点击数

recommend

int

11

智能推荐

cart_title

varchar

125

标题

cart_img

text

0

封面图

cart_description

varchar

255

描述

cart_price_ago

double

8

原价

cart_price

double

8

卖价

cart_inventory

int

11

商品库存

cart_type

varchar

64

商品分类:

cart_content

longtext

0

正文

cart_img_1

text

0

主图1:

cart_img_2

text

0

主图2:

cart_img_3

text

0

主图3:

cart_img_4

text

0

主图4:

cart_img_5

text

0

主图5:

create_time

datetime

0

创建时间

update_time

timestamp

0

更新时间

名称

类型

长度

不是null

主键

注释

order_id

int

11

订单ID:

order_number

varchar

64

订单号:

goods_id

mediumint

8

商品id

title

varchar

32

商品标题:

img

varchar

255

商品图片:

price

double

10

价格:

price_ago

double

10

原价:

num

int

8

数量:

price_count

double

8

总价:

norms

varchar

255

规格:

type

varchar

64

商品分类:

contact_name

varchar

32

联系人姓名:

contact_email

varchar

125

联系人邮箱:

contact_phone

varchar

11

联系人手机:

contact_address

varchar

255

收件地址:

postal_code

varchar

9

邮政编码:

user_id

int

10

买家ID:

merchant_id

mediumint

8

商家ID:

create_time

timestamp

0

创建时间:

update_time

timestamp

0

更新时间:

description

varchar

255

描述

state

varchar

16

订单状态

名称

类型

长度

不是null

主键

注释

logistics_distribution_id

int

11

物流配送ID

logistics_number

varchar

64

物流号

item_name

varchar

64

物品名称

item_quantity

int

11

物品数量

shipping_address_

varchar

64

发货地址

receiving_address

varchar

64

收货地址

receiving_user

int

11

收货用户

user_mobile_number

varchar

64

用户手机号

logistics_status

varchar

64

物流状态

user_sign_in

varchar

64

用户签收

recommend

int

11

智能推荐

create_time

datetime

0

创建时间

update_time

timestamp

0

更新时间

名称

类型

长度

不是null

主键

注释

type_id

int

11

商品分类ID:

father_id

smallint

5

上级分类ID

name

varchar

255

商品名称:

desc

varchar

255

描述:

icon

varchar

255

图标:

source_table

varchar

255

来源表:

source_field

varchar

255

来源字段:

create_time

timestamp

0

创建时间:

update_time

timestamp

0

更新时间:

名称

类型

长度

不是null

主键

注释

accounting_information_id

int

11

帐务信息ID

trade_name

varchar

64

商品名称

today_sales

int

11

本日销量

sales_amount

int

11

销售金额

bookkeeping_date

date

0

记账日期

recommend

int

11

智能推荐

create_time

datetime

0

创建时间

update_time

timestamp

0

更新时间


  1.  系统详细设计

5.1登录模块

本系统主要的用户有系统管理员、用户,一个系统最基本的功能就是登录功能,本系统可以进行系统登录的角色有用户、管理员,用户对应前台登录界面,管理员对应后台登录界面,首先进入登录页,输入用户名和密码,然后提交至服务端进行数据库数据验证,通过Node.jsEE逻辑代码判断数据库是否存在用户输入的这一个记录,如果存在,则判断用户身份,如果是用户,则进入用户前台,如果是管理员用户,则进入系统主页,并把用户对象存放在session中,如果不存在这样一条记录,则返回登录界面。

登录界面如下所示。

 

                                                              图5-1前台登录界面

 

                                                               图5-3用户注册界面

5.3商城资讯模块

系统为用户提供商城资讯推荐,方便用户浏览推荐信息。在shangchenzixunlist.jsp实现商城资讯列表的展示,用户点击浏览,通过推荐id传递值,找到数据表的该商城资讯信息。

如下图所示为商城资讯界面。

 

                                                    图5-4商城资讯界面

5.4商品评论模块

系统提供商品评论功能,在pinglunadd.jsp实现商品的评论,添加评论后,存入数据库的评论表。管理员管理商品的评论信息。

如下图所示为评论的部分界面。

 

                                                         图5-5评论界面

5.5购买商品模块

用户在浏览商品后,登录系统前台,进行商品购买,将商品添加至购买车,在个人后台可以查看购买车里面的商品,确定商品之后可以生成订单,然后支付。

如下图所示为购买商品的部分界面。

 

                                                         图5-6购买商品界面

5.6系统用户管理模块

过去传统的手工登记管理系统人员信息很不方便,也很容易造成数据出错,所以本系统需要一个可以管理登记人员信息的功能,管理员登入系统,可以添加新的管理员用户,删除现有的管理员,也可以对自己的密码和管理员用户的密码进行修改。修改密码是经过跟数据库的原来的密码字段的数据进行判断,如果输入两次的新密码一致,则更新密码这属性对应的一条数据。

如下图所示为系统用户管理的部分界面。

 

                                                       图5-7系统用户管理界面

5.7商城管理模块

用户在系统前台浏览商城,管理员登录系统后,可以对添加、删除、修改商城信息,系统前台的商城信息时随系统后台变化而变化的。

商城管理的界面如下图所示。

 

                                                      图5-8商城管理界面

5.8商城资讯管理模块

如下图所示为商城资讯管理界面。

 

                                                      图5-9商城资讯管理界面

5.9物流配送管理模块

管理人员可以对物流配送进行发布管理的操作,这些操作将在物流配送管理界面进行。

如下图为物流配送管理界面。

 

                                                          图5-10物流配送管理界面

 

  1.  系统测试

6.1测试目的

该系统能够完成商城资讯浏览、商品购买,物流配送管理,账务信息管理,用户管理等功能,做到所开发的系统操作简单,尽量使系统操作不受用户对电脑知识水平的限制,符合系统可维护性,由于系统涉及的信息比较广,数据库中的数据需定期修改,系统可利用的空间及性能也随之下降,为了使系统更好地运转,系统可以对系统数据及一些简单的功能进行独立的维护及调整;符合系统开放性要求,该系统能够在开放的硬件体系结构中运行,并且能与其他系统顺利连接。

6.2测试用例

1.注册测试

表6-1注册测试用例

字段名称

描述

测试项

首页注册功能测试

输入数据

1、输入正确的邮箱、用户名、密码、确认密码、以及验证码之后点击“注册”按钮

2、输入错误的用户名或密码、邮箱、验证码等,单击“注册”按钮

3、不输入邮箱、用户名、密码、确认密码、以及验证码之后点击“注册”按钮

预计输出数据

1、用户能正确注册账号,成功插入数据库用户的账户资料,提示注册成功。

2、无法注册用户信息,注册失败。

3、无法注册用户信息,注册失败。

使用上述测试用例对前台首页注册界面进行测试,当在输入正确的邮箱、用户名、密码、确认密码、以及验证码之后,系统将弹出注册成功信息提示对话框。

使用上述测试用例对前台首页注册界面进行测试,当在输入错误的用户名或密码、邮箱、验证码之后,系统将提示错误。

使用上述测试用例对前台首页注册界面进行测试,当在不输入用户名、密码、邮箱、验证码之后,点击注册按钮。

2.登录界面进行测试 

表6-2登录测试用例

测试项

首页登录功能测试

输入数据

1、输入正确的用户名和密码,单击“登录”按钮

2、输入错误的用户名和密码,单击“登录”按钮

3、不输入用户名和密码,单击“登录”按钮

预计输出数据

1、数据库中存在的用户能正确登录,。结果弹出主界面。

2、错误的或者无效用户登录,登录系统失败。

3、输入用户名或密码信息为空,登录系统失败。

3.商品管理进行测试 

名称:用户管理测试        目的:测试商品管理界面 

内容:口令的输入,合法性检查,合理性检查,界面的显示控制。 

下表描述了商品表中目前所存在的记录。

表6-5商品表预存数据

    商品名

商品类别

商品价格

商品状态

A

A

389

上架

B

B

249

上架

C

C

322

下架

D

D

168

上架

添加时应注意事项:

管理员添加商品时必须添加已存在的商品类别,若该商品不属于现有的所有类别,则应该先添加商品类别。

下表描述了添加商品进行测试的用例,主要是为了防止添加商品时出现异常和存在的漏洞。

表6-6添加商品测试用例

输入

输出

商品名

商品价格

商品图片

   空

参数错误

参数错误

请选择上传图片

A

1

a.jpg

添加成功

4.购买商品测试 

名称:购买商品测试        目的:测试购买商品界面 

内容:口令的输入,合法性检查,合理性检查,界面的显示控制。 

下表描述了购买商品的测试用例,防止购买时出错。

表6-7购买商品测试用例

输入

输出

用户ID

商品ID

商品数量

11

1

1

购买商品成功

22

电视

请填写商品数量

33

电视

a

购买失败

用户购买商品时,首先判断商品数量是否小于库存,若超出库存数量,则提示商品数量不足。

  1.  结论

经过这几个月的设计和开发,“基于Node.js的网上商城”已经完成了,其功能符合设计需求,能够完成用户的注册、在线购买、订单管理、物流配送管理和订单审核、用户管理、信息维护、查询等功能。经过最后的使用,证明系统完全具有可行性与可扩充性。

在系统的分析阶段,主要是分析系统的需求,理解系统要完成的基本功能,找出系统的用例(Use Case)和角色(Actor),画出系统的用例模型图,用例模型是此后系统建模的基础。在用例的基础上分析顺序图和协作图,得到系统的所有对象,然后建立对象模型。抽象出系统的类,并将系统中联系紧密的类划分为若干个包,画出包图。有了这些基础,就可以将系统划分为小单元功能模块。

整个过程中,我必须认可UML统一建模语言,它让我很清晰的知道自己想做什么,想实现什么,对系统后面的代码编写起到决定性的帮助,同时经过本次系统的设计与实现,让我积累了很多经验,提高了编写程序的能力,为以后的学习和工作打下了坚实的基础。

由于时间有限,本系统还有待继续完善和改进,因此需要进一步进行分析和修改,以使其更加完善! 

参考文献

  1. 王江霖,黄彩霞,樊旭龙.基于Springboot框架的网络资源共享平台的研究与实现[J].电脑知识与技术,2021,17(28):76-78.
  2. 曹华山.Springboot框架在Web应用开发中的设计与实现[J].无线互联科技,2021,18(11):108-109.
  3. 程红琳. 网上商城品目扩容效果几何[N]. 中国政府采购报,2021-05-18(005).
  4. 马君峰, 农产品自营网上商城智慧平台V1.0. 甘肃省,甘肃科博科技咨询有限责任公司,2021-02-01.

[5]王娟.基于Android系统的手机网上商城设计与实现[J].电子技术与软件工程,2021(03):43-44.

[6]韩己峰.综合性网上商城引领山东政府采购驶入高速路[J].中国政府采购,2020(12):39-41.

[7]袁江琛.基于MVC框架网上商城的设计与实现[J].信息与电脑(理论版),2020,32(20):126-128.

[8]袁江琛.Ajax+jQuery在网上商城购物车模块中的设计与实现[J].电脑编程技巧与维护,2020(10):34-35+68.

[9]王柯梦,王瑞平.基于B2C网上商城前台系统数据库设计与实现[J].广西质量监督导报,2020(09):70-71.

[10]薄志强. 基于Springboot框架的网上商城系统的设计与实现[D].西安电子科技大学,2020..

[11]张浩. 基于网上商城服务对话系统的研究与实现[D].黑龙江大学,2020.

[12]孙建英.分布式、集中式、区块链技术在网上商城中的应用[J].商场现代化,2020(01):13-15.

[13]李颖,方浪,武瑞婵.“Free-Try”虚拟试衣在网上商城中的实现[J].襄阳职业技术学院学报,2019,18(06):64-66.

[14]王一凡. 基于MOT的云南移动网上商城O2O手机营销策略优化研究[D].云南大学,2019.

[15]布祉颖.论B2C和O2O的进口零食营销的模式——关于零始科技有限公司的零始网研究[J].现代妇女(下旬),2018(12):75-76.

[16]老潘,花椰菜.零食控的购物车[J].宠物世界(狗迷),2018(12):50-55.

致 谢

大学的学习生活总是感觉短暂的,总感到知识还没有学够,但大学毕业就在我们面前,即毕业设计即将的结束,意味着我们的大学生涯即将结束。毕业设计是我们在大学所学知识的一次总结,更是对我们过去所学知识的提炼和升华,通过毕业设计,我们认识到大学学习过程中还有那些知识没有掌握,那些知识需要我们进入深入研究。这次毕业设计让我学到了很多新的知识,研究了一些新的以前自己不熟悉的领域,使我处理问题的能力得到了一定的提升,同时也为今后的继续深造或踏入社会大门提供了很好的锻炼机会。

I have also been frustrated, lost, and wanted to give up, but because of your tireless encouragement and support, I persisted. Here I want to say "thank you" to my teachers and classmates. Because our knowledge is limited, there will inevitably be some mistakes and deficiencies in this article, please correct me.

Please pay attention to like + private message blogger, get the source code of the project for free

Guess you like

Origin blog.csdn.net/ID3461074420/article/details/131659528