Compare commits

...

7 Commits

Author SHA1 Message Date
44b64aa9df 更新 cart_order.html 2024-01-18 22:07:15 +08:00
97ad9f1bbb 更新 cart_agreement.html 2024-01-18 22:07:12 +08:00
25d2148d8e 更新 cart.html 2024-01-18 22:07:10 +08:00
37e942c0c9 更新 UserService.java 2024-01-18 22:07:07 +08:00
429a2c6f9e 更新 UserController.java 2024-01-18 22:07:05 +08:00
7a7c2e85e3 更新 CartPageController.java 2024-01-18 22:07:02 +08:00
84206e653d 更新 UserInfoService.java 2024-01-18 21:27:47 +08:00
7 changed files with 19 additions and 10 deletions

View File

@@ -22,7 +22,7 @@ public class CartPageController {
} }
@GetMapping("/cart_oder_success") @GetMapping("/cart_order_success")
public String cartOrderSuccessPage() { public String cartOrderSuccessPage() {
return "cart_order_success"; return "cart_order_success";
} }

View File

@@ -51,6 +51,7 @@ public class UserController {
@PostMapping("/user/update") @PostMapping("/user/update")
public ServerResponseEntity<Boolean> updatePassword(@RequestBody PasswordData passwordData) { public ServerResponseEntity<Boolean> updatePassword(@RequestBody PasswordData passwordData) {
logger.info("request passwordData: {}",passwordData);
if(passwordData != null){ if(passwordData != null){
boolean isSuccess = userService.updateUserPasswordByUserId(passwordData); boolean isSuccess = userService.updateUserPasswordByUserId(passwordData);
if (isSuccess) { if (isSuccess) {

View File

@@ -1,7 +1,9 @@
package com.gao.finalhw.service; package com.gao.finalhw.service;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.gao.finalhw.controller.UserController; import com.gao.finalhw.controller.UserController;
import com.gao.finalhw.mapper.UserInfoMapper; import com.gao.finalhw.mapper.UserInfoMapper;
import com.gao.finalhw.model.Orders;
import com.gao.finalhw.model.UserInfo; import com.gao.finalhw.model.UserInfo;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@@ -15,7 +17,10 @@ public class UserInfoService {
UserInfoMapper userInfoMapper; UserInfoMapper userInfoMapper;
public UserInfo getUserInfo(int id){ public UserInfo getUserInfo(int id){
UserInfo result = userInfoMapper.selectById(id); logger.info("id: {}",id);
QueryWrapper<UserInfo> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("user_id", id);
UserInfo result = userInfoMapper.selectOne(queryWrapper);
logger.info("select user info result: {}",result); logger.info("select user info result: {}",result);
return result; return result;

View File

@@ -36,7 +36,9 @@ public class UserService {
public boolean updateUserPasswordByUserId(PasswordData passwordData) { public boolean updateUserPasswordByUserId(PasswordData passwordData) {
String currentPassword = queryPasswordByUserId(passwordData.getUserId()); String currentPassword = queryPasswordByUserId(passwordData.getUserId());
if (currentPassword == passwordData.getOldPassword()) { logger.info("currentPassword: {}, oldPassword: {}.",currentPassword,passwordData.getOldPassword());
if (currentPassword.equals(passwordData.getOldPassword())) {
logger.info("start update password.");
UpdateWrapper<User> updateWrapper = new UpdateWrapper<>(); UpdateWrapper<User> updateWrapper = new UpdateWrapper<>();
updateWrapper.eq("user_id", passwordData.getUserId()) updateWrapper.eq("user_id", passwordData.getUserId())
.set("password", passwordData.getNewPassword()); .set("password", passwordData.getNewPassword());

View File

@@ -52,9 +52,7 @@
function toPay() { function toPay() {
var nu = '1'; var nu = '1';
window.location = "/cart_agreement";
window.location = "cart_agreement.html";
} }
</script> </script>
<!--内容--> <!--内容-->

View File

@@ -58,12 +58,14 @@
var nu = '1'; var nu = '1';
if (check()) { if (check()) {
$("#aspnetForm").submit(); // $("#aspnetForm").submit();
window.location.href = "/cart_order";
} }
} }
$(function() { $(function() {
$("#aspnetForm").attr("action", "/cart_order"); $("#aspnetForm").attr("action", "/cart_order");
// window.location.href = "/cart_order";
}); });
</script> </script>
<!--真爱协议中的内容--> <!--真爱协议中的内容-->

View File

@@ -179,15 +179,16 @@
//check //check
if ($(".shop_adress-top:not(:last) :radio:checked").length == 0) { if ($(".shop_adress-top:not(:last) :radio:checked").length == 0) {
alert("请先选择一个地址。"); alert("请先选择一个地址。");
return;
} }
var nu = '1'; var nu = '1';
$("#aspnetForm").submit(); // $("#aspnetForm").submit();
window.location.href = "/cart_order_success";
} }
$(function() { $(function() {
$("#aspnetForm").attr("action", "/cart_order_success"); // window.location.href = "/cart_order_success";
// $("#aspnetForm").attr("action", "/cart_order_success");
}); });
</script> </script>
<!--内容--> <!--内容-->