Scoring applet based on WeChat applet

Contact at the end of the article to obtain the source code

Development language: Java

Framework: ssm

JDK version: JDK1.8

Server: tomcat7

Database: mysql 5.7/8.0

Database tool: Navicat11

Development software: eclipse/myeclipse/idea

Maven package: Maven3.3.9

Browser: Google Chrome

Small program framework: uniapp

Small program development software: HBuilder X

Small program running software: WeChat developer

1. Introduction 

The social development is changing with each passing day, and the use of computer applications to realize the data management function is considered to be very complete. However, with the advent of the mobile Internet, the processing of information is no longer subject to geographical restrictions, and the processing of information is timely and efficient, which is loved by people. Therefore, major Internet manufacturers are aiming at the trend of mobile Internet to carry out major layouts. After years of great waves, various mobile operating systems have been launched, and the current market share is the highest. Wechat applets, this time we developed a set of scoring applets There are two roles of administrator and user. Administrator functions include personal center, user management, product classification management, product information management, scoring information management, message feedback management, and system management. Users can register and log in on the mini program side, can search and view product information, can comment, rate and save product information, and can also see their own comments, messages and replies. The scoring applet server uses the website background developed in Java to receive and process the json data imported from the WeChat applet. The database uses the mysql database as data storage. In this way, users can use it conveniently and quickly, and all business processes are performed through the same background, and the background can be deployed according to the amount of concurrency, and hardware and software can be used to cooperate, satisfying the interactive processing of data, and allowing users to store data more efficiently. Safe, more convenient to get data. 

2. System function structure design 

On the basis of the determined function modules of the administrator, each function of the administrator is designed, and the detailed modules of the administrator function are determined. The drawn administrator function structure is shown in the figure below.

3. Realization of WeChat mini-program functions

3.1 Homepage 

After the WeChat applet enters the correct account password, it will enter the homepage display interface by default. The home page mainly includes product information recommendations and the following navigation as the main components. 

3.2 Product information 

Users can click on the product information in the navigation bar below to see the product information interface, and can click on the category on the left to view or search. 

3.3 Product Rating

When the user clicks on the product information, there is a rating button below, and the rating can be scored after clicking. The rating needs to be selected before submission. 

3.4 mine 

The main thing in my account is to log out. Click the small gear to choose to log out of the current account. You can also click My Collection Management to see all the information in your favorites. 

Fourth, the administrator background function realization 

4.1 User Management 

This page allows administrators to manage user data, and administrators can add, modify, delete, and query user information.

4.2 Product Information Management 

This page allows administrators to manage product information data. The product information management page is shown in the figure below. This page mainly implements the addition, query and refresh operations of product information. 

4.3 Product classification

This page displays product classification information, and the product classification page is shown in the figure below. This page mainly allows administrators to query, add, modify, and delete operations on product categories. 

4.4 Rating Information 

This page displays scoring information. See the scoring information page below. Administrators can query, view, modify, and delete user rating information. 

5. Part of the core code

5.1 Main code of login system

/**
	 * 登录
	 */
	@IgnoreAuth
	@RequestMapping(value = "/login")
	public R login(String username, String password, String captcha, HttpServletRequest request) {
		YonghuEntity user = yonghuService.selectOne(new EntityWrapper<YonghuEntity>().eq("yonghuzhanghao", username));
		if(user==null || !user.getMima().equals(password)) {
			return R.error("账号或密码不正确");
		}
		
		String token = tokenService.generateToken(user.getId(), username,"yonghu",  "用户" );
		return R.ok().put("token", token);
	}

5.2 Upload file key code

@RequestMapping("/upload")
	public R upload(@RequestParam("file") MultipartFile file,String type) throws Exception {
		if (file.isEmpty()) {
			throw new EIException("上传文件不能为空");
		}
		String fileExt = file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".")+1);
		File path = new File(ResourceUtils.getURL("classpath:static").getPath());
		if(!path.exists()) {
		    path = new File("");
		}
		File upload = new File(path.getAbsolutePath(),"/upload/");
		if(!upload.exists()) {
		    upload.mkdirs();
		}
		String fileName = new Date().getTime()+"."+fileExt;
		File dest = new File(upload.getAbsolutePath()+"/"+fileName);
		file.transferTo(dest);
		/**
  		 * 如果使用idea或者eclipse重启项目,发现之前上传的图片或者文件丢失,将下面一行代码注释打开
   		 * 请将以下的"D:\\springbootq33sd\\src\\main\\resources\\static\\upload"替换成你本地项目的upload路径,
 		 * 并且项目路径不能存在中文、空格等特殊字符
 		 */
//		FileUtils.copyFile(dest, new File("D:\\springbootq33sd\\src\\main\\resources\\static\\upload"+"/"+fileName)); /**修改了路径以后请将该行最前面的//注释去掉**/
		if(StringUtils.isNotBlank(type) && type.equals("1")) {
			ConfigEntity configEntity = configService.selectOne(new EntityWrapper<ConfigEntity>().eq("name", "faceFile"));
			if(configEntity==null) {
				configEntity = new ConfigEntity();
				configEntity.setName("faceFile");
				configEntity.setValue(fileName);
			} else {
				configEntity.setValue(fileName);
			}
			configService.insertOrUpdate(configEntity);
		}
		return R.ok().put("file", fileName);
	}

Guess you like

Origin blog.csdn.net/qq_61827376/article/details/129130401