Pārlūkot izejas kodu

二期 管家小程序 bug

suntianwu 3 gadi atpakaļ
vecāks
revīzija
8b6321e6f7

+ 5 - 6
src/main/java/com/care/client/controller/MemberApiController.java

@@ -2,7 +2,6 @@ package com.care.client.controller;
 
 import cn.hutool.core.bean.BeanUtil;
 import cn.hutool.core.date.DateUtil;
-import com.care.client.service.AbstractPassportService;
 import com.care.client.service.PassportService;
 import com.care.client.service.PinanbaoMemberInfoService;
 import com.care.client.vo.MemberInfoVO;
@@ -11,7 +10,6 @@ import com.care.common.service.CareMemberInfoService;
 import com.care.common.util.Result;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
-import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
 import javax.annotation.Resource;
@@ -35,8 +33,7 @@ public class MemberApiController {
 
     @Resource
     private PassportService passportService;
-    @Autowired
-    private AbstractPassportService abstractPassportService;
+
 
     @ApiOperation(value = "获取基本信息", notes = "获取用户基本信息")
     @PostMapping("detail/info")
@@ -56,8 +53,10 @@ public class MemberApiController {
                                          @RequestBody MemberInfoVO vo){
         try {
             MemberInfoVO current = passportService.checkToken(token);
-            CareMemberInfo member = careMemberInfoService.detailByPhone(current.getPhone());
-            vo.setId(member.getId());
+            if(current == null) {
+                return Result.error("修改失败!");
+            }
+            vo.setId(current.getId());
             if(this.pinanbaoMemberInfoService.updateMyMemberInfo(vo)){
                 return  Result.success("修改成功!");
             } else {

+ 5 - 4
src/main/java/com/care/keeper/controller/KeeperMemberApiController.java

@@ -2,8 +2,6 @@ package com.care.keeper.controller;
 
 import cn.hutool.core.bean.BeanUtil;
 import cn.hutool.core.collection.CollUtil;
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.care.client.vo.MemberInfoVO;
 import com.care.common.entity.*;
 import com.care.common.service.*;
 import com.care.common.util.Result;
@@ -17,7 +15,6 @@ import io.swagger.annotations.ApiOperation;
 import org.springframework.web.bind.annotation.*;
 
 import javax.annotation.Resource;
-import java.util.ArrayList;
 import java.util.List;
 
 /**
@@ -42,7 +39,6 @@ public class KeeperMemberApiController {
 
     @Resource
     private CareStationService careStationService;
-
     @Resource
     private KeeperInfoApiService keeperInfoApiService;
 
@@ -74,6 +70,11 @@ public class KeeperMemberApiController {
     public Result<Object> updateMyInfo(@RequestHeader("token") String token,
                                              @RequestBody KeeperInfoVO vo){
         try {
+            KeeperInfoVO current = keeperPassportService.checkToken(token);
+            if(current == null ){
+                return Result.error("修改失败!");
+            }
+            vo.setId(current.getId());
             if(this.keeperInfoApiService.updateMyInfo(vo)){
                 return  Result.success("修改成功!");
             } else {