💖💖作者:计算机毕业设计江挽 💙💙个人简介:曾长期从事计算机专业培训教学,本人也热爱上课教学,语言擅长Java、微信小程序、Python、Golang、安卓Android等,开发项目包括大数据、深度学习、网站、小程序、安卓、算法。平常会做一些项目定制化开发、代码讲解、答辩教学、文档编写、也懂一些降重方面的技巧。平常喜欢分享一些自己开发中遇到的问题的解决办法,也喜欢交流技术,大家有技术代码这一块的问题可以问我! 💛💛想说的话:感谢大家的关注与支持! 💜💜 网站实战项目 安卓/小程序实战项目 大数据实战项目 深度学习实战项目
基于微信小程序的精致护肤购物系统介绍
基于微信小程序的精致护肤购物系统是一个集成了前端小程序展示、后端数据处理和数据库存储的综合性电商平台。该系统采用SpringBoot框架作为后端核心架构,结合uni-app开发框架实现跨平台的微信小程序前端界面,通过MySQL数据库进行数据持久化存储。系统主要面向护肤产品消费者和商家,提供完整的购物流程体验,包括用户注册登录、商家入驻管理、产品分类展示、品牌信息维护、促销活动管理、产品详情浏览、互动论坛交流、举报监管机制、论坛分类管理、优惠券发放使用、系统后台管理、订单全流程跟踪等核心功能模块。整个系统采用C/S和B/S混合架构模式,通过微信小程序提供便捷的移动端购物体验,同时支持管理端的Web界面操作,实现了前后端分离的现代化开发模式,为用户提供流畅的护肤产品购买体验和商家提供高效的店铺运营管理工具。
基于微信小程序的精致护肤购物系统演示视频
基于微信小程序的精致护肤购物系统演示图片
基于微信小程序的精致护肤购物系统代码展示
import org.apache.spark.sql.SparkSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.*;
@RestController
@RequestMapping("/api")
public class CoreBusinessController {
@Autowired
private UserService userService;
@Autowired
private ProductService productService;
@Autowired
private OrderService orderService;
private SparkSession spark = SparkSession.builder().appName("SkinCareSystem").master("local[*]").getOrCreate();
@PostMapping("/user/login")
public Map<String, Object> userLogin(@RequestBody Map<String, String> loginData) {
Map<String, Object> result = new HashMap<>();
String username = loginData.get("username");
String password = loginData.get("password");
if (username == null || password == null || username.trim().isEmpty() || password.trim().isEmpty()) {
result.put("success", false);
result.put("message", "用户名和密码不能为空");
return result;
}
User user = userService.findByUsername(username);
if (user == null) {
result.put("success", false);
result.put("message", "用户不存在");
return result;
}
if (!passwordEncoder.matches(password, user.getPassword())) {
result.put("success", false);
result.put("message", "密码错误");
return result;
}
String token = jwtUtil.generateToken(user.getId(), user.getUsername());
user.setLastLoginTime(new Date());
userService.updateUser(user);
result.put("success", true);
result.put("token", token);
result.put("userInfo", user);
return result;
}
@GetMapping("/product/search")
public Map<String, Object> searchProducts(@RequestParam String keyword, @RequestParam(defaultValue = "1") int page, @RequestParam(defaultValue = "10") int size) {
Map<String, Object> result = new HashMap<>();
if (keyword == null || keyword.trim().isEmpty()) {
result.put("success", false);
result.put("message", "搜索关键词不能为空");
return result;
}
List<Product> products = productService.searchByKeyword(keyword.trim(), (page - 1) * size, size);
List<Map<String, Object>> productList = new ArrayList<>();
for (Product product : products) {
Map<String, Object> productMap = new HashMap<>();
productMap.put("id", product.getId());
productMap.put("name", product.getName());
productMap.put("price", product.getPrice());
productMap.put("description", product.getDescription());
productMap.put("imageUrl", product.getImageUrl());
productMap.put("brand", product.getBrand());
productMap.put("category", product.getCategory());
productMap.put("stock", product.getStock());
productList.add(productMap);
}
int totalCount = productService.countByKeyword(keyword.trim());
result.put("success", true);
result.put("products", productList);
result.put("totalCount", totalCount);
result.put("currentPage", page);
result.put("totalPages", (totalCount + size - 1) / size);
return result;
}
@PostMapping("/order/create")
public Map<String, Object> createOrder(@RequestBody Map<String, Object> orderData) {
Map<String, Object> result = new HashMap<>();
Integer userId = (Integer) orderData.get("userId");
List<Map<String, Object>> items = (List<Map<String, Object>>) orderData.get("items");
String address = (String) orderData.get("address");
if (userId == null || items == null || items.isEmpty() || address == null || address.trim().isEmpty()) {
result.put("success", false);
result.put("message", "订单信息不完整");
return result;
}
double totalAmount = 0.0;
List<OrderItem> orderItems = new ArrayList<>();
for (Map<String, Object> item : items) {
Integer productId = (Integer) item.get("productId");
Integer quantity = (Integer) item.get("quantity");
Product product = productService.findById(productId);
if (product == null || product.getStock() < quantity) {
result.put("success", false);
result.put("message", "商品库存不足: " + (product != null ? product.getName() : "未知商品"));
return result;
}
OrderItem orderItem = new OrderItem();
orderItem.setProductId(productId);
orderItem.setQuantity(quantity);
orderItem.setPrice(product.getPrice());
orderItem.setSubtotal(product.getPrice() * quantity);
orderItems.add(orderItem);
totalAmount += orderItem.getSubtotal();
product.setStock(product.getStock() - quantity);
productService.updateProduct(product);
}
Order order = new Order();
order.setUserId(userId);
order.setOrderNumber(generateOrderNumber());
order.setTotalAmount(totalAmount);
order.setAddress(address);
order.setStatus("待支付");
order.setCreateTime(new Date());
Order savedOrder = orderService.saveOrder(order);
for (OrderItem item : orderItems) {
item.setOrderId(savedOrder.getId());
orderService.saveOrderItem(item);
}
result.put("success", true);
result.put("orderId", savedOrder.getId());
result.put("orderNumber", savedOrder.getOrderNumber());
result.put("totalAmount", totalAmount);
return result;
}
}
基于微信小程序的精致护肤购物系统文档展示
💖💖作者:计算机毕业设计江挽 💙💙个人简介:曾长期从事计算机专业培训教学,本人也热爱上课教学,语言擅长Java、微信小程序、Python、Golang、安卓Android等,开发项目包括大数据、深度学习、网站、小程序、安卓、算法。平常会做一些项目定制化开发、代码讲解、答辩教学、文档编写、也懂一些降重方面的技巧。平常喜欢分享一些自己开发中遇到的问题的解决办法,也喜欢交流技术,大家有技术代码这一块的问题可以问我! 💛💛想说的话:感谢大家的关注与支持! 💜💜 网站实战项目 安卓/小程序实战项目 大数据实战项目 深度学习实战项目