Case 095: Design and implementation of online novel system based on WeChat applet

Get the source code at the end of the article

Development language: Java

Framework: SSM

JDK version: JDK1.8

Database: mysql 5.7

Development software: eclipse/myeclipse/idea

Maven package: Maven3.5.4

Mini program framework: uniapp

Mini program development software: HBuilder X

Mini program running software: WeChat developer

Table of contents

Preface

System display

Administrator server function module

User WeChat function module

Code

Login function implementation code

Registration function implementation code

Password reset function implementation code

Modify the information function implementation code

Delete information function implementation code

Save information function implementation code


Preface

With the development of society and the advancement of science and technology, Internet technology is becoming more and more popular. Online novels have gradually become popular among the people and have gradually entered the use of every user. Online novels have the advantages of convenience, fast speed, high efficiency, and low cost. Therefore, it makes sense to build an operating system that meets your own requirements.

This article starts from the functional requirements of administrators and users. The functional modules in the online novel applet are mainly to implement the administrator server; home page, personal center, user management, book classification management, book information management, message board management, and system management. User WeChat: Home page, book information, book information, mine. After careful and careful research, careful preparation and planning, the final test was successful and the system can be used normally. The analysis function adjustment is combined with the actual needs of the implementation of the online novel applet, and the online novel applet that combines WeChat developers, Java technology, and mysql database is discussed.


System display

Administrator server function module

The administrator can click on the background management and enter the page to enter the user name, password, and role to log in and perform corresponding operations.

 

Administrators can click Login Management and enter the page to view the home page, personal center, user management, book classification management, book information management, message board management, system management and other functional modules, and perform corresponding operations.

 

Personal center, the administrator operates the personal center to fill in the original password, new password, confirm password and add, delete, modify and view. Modify operations.

 

User management: Through user management, the administrator can obtain the user name, name, gender, avatar, contact number, etc. and perform details, deletion, and modification operations.

 

Book classification management: Administrators can add books and other information through the book classification list, and perform details, deletions, and modifications.

 

Book information management: Through book information management, administrators can obtain book number, book name, category, author, publisher, total chapters, word count, book content and other information and perform detailed, delete, and modify operations.

System management; this page is the management interface for book information and carousel images. Administrators can publish book information, manage carousel images on the home page, and perform details, deletions, and modifications on this page.

 

User WeChat function module

User registration and login. The user fills in the username, password, name, gender, and contact number on the registration page to log in. If the information is correct, enter the login page and fill in the username and password to log in.

 

 

Users who log in to the homepage can view the homepage, book information, book information, mine, etc. 

 

Personal information, users can view username, password, name, gender, avatar, contact number and other information in personal information and perform details, deletion, and modification operations. 

 

Book information, users can view, collect, and search on the book information page, and submit as needed 

 


Code

Login function implementation code

@IgnoreAuth
	@PostMapping(value = "/login")
	public R login(String username, String password, String captcha, HttpServletRequest request) {
		UserEntity user = userService.selectOne(new EntityWrapper<UserEntity>().eq("username", username));
		if(user==null || !user.getPassword().equals(password)) {
			return R.error("账号或密码不正确");
		}
		String token = tokenService.generateToken(user.getId(),username, "users", user.getRole());
		return R.ok().put("token", token);
	}

Registration function implementation code

@IgnoreAuth
	@PostMapping(value = "/register")
	public R register(@RequestBody UserEntity user){
//    	ValidatorUtils.validateEntity(user);
    	if(userService.selectOne(new EntityWrapper<UserEntity>().eq("username", user.getUsername())) !=null) {
    		return R.error("用户已存在");
    	}
        userService.insert(user);
        return R.ok();
    }

Password reset function implementation code

@IgnoreAuth
	@RequestMapping(value = "/resetPass")
    public R resetPass(String username, HttpServletRequest request){
    	UserEntity user = userService.selectOne(new EntityWrapper<UserEntity>().eq("username", username));
    	if(user==null) {
    		return R.error("账号不存在");
    	}
    	user.setPassword("123456");
        userService.update(user,null);
        return R.ok("密码已重置为:123456");
    }

Modify the information function implementation code

 @RequestMapping("/update")
    public R update(@RequestBody UserEntity user){
//        ValidatorUtils.validateEntity(user);
    	UserEntity u = userService.selectOne(new EntityWrapper<UserEntity>().eq("username", user.getUsername()));
    	if(u!=null && u.getId()!=user.getId() && u.getUsername().equals(user.getUsername())) {
    		return R.error("用户名已存在。");
    	}
        userService.updateById(user);//全部更新
        return R.ok();
    }

Delete information function implementation code

@RequestMapping("/delete")
    public R delete(@RequestBody Long[] ids){
        userService.deleteBatchIds(Arrays.asList(ids));
        return R.ok();
    }

Save information function implementation code

@PostMapping("/save")
    public R save(@RequestBody UserEntity user){
//    	ValidatorUtils.validateEntity(user);
    	if(userService.selectOne(new EntityWrapper<UserEntity>().eq("username", user.getUsername())) !=null) {
    		return R.error("用户已存在");
    	}
        userService.insert(user);
        return R.ok();
    }

Guess you like

Origin blog.csdn.net/2301_79727522/article/details/135429210