Pu Zhibing
2025-02-11 51b190f22aa8751bd9fbe5229ab5546facdef632
UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/api/UserInfoController.java
@@ -6,6 +6,7 @@
import com.google.code.kaptcha.Constants;
import com.stylefeng.guns.core.common.constant.JwtConstants;
import com.stylefeng.guns.core.common.exception.InvalidKaptchaException;
import com.stylefeng.guns.core.shiro.ShiroKit;
import com.stylefeng.guns.core.support.HttpKit;
import com.stylefeng.guns.core.util.ToolUtil;
import com.stylefeng.guns.modular.system.model.BankCard;
@@ -89,6 +90,8 @@
    
    @Autowired
    private FleetEngineUtil fleetEngineUtil;
    private String salt = "&a.s";
@@ -1181,12 +1184,12 @@
    @ResponseBody
    @RequestMapping("/base/user/image")
    public String image(@RequestPart("file") MultipartFile file) {
    public ResultUtil image(@RequestPart("file") MultipartFile file) {
        try {
            String pictureName = GoogleCloudStorageUtil.upload(file);
            return pictureName;
            return ResultUtil.success(pictureName);
        } catch (Exception e1) {
            return null;
            return ResultUtil.runErr();
        }
    }
@@ -1398,14 +1401,21 @@
            new Timer().schedule(new TimerTask() {
                @Override
                public void run() {
                    Process process = null;
                    try {
                        process = Runtime.getRuntime().exec("sudo rm -rf /home/igotechgh/nginx/html/files/audio/" + fileName + ".mp3");
                    } catch (IOException e) {
                        throw new RuntimeException(e);
                    }
                    if (process != null) {
                        process.destroy();
                        // 使用Runtime执行命令
                        Process process = Runtime.getRuntime().exec("sudo rm -rf /home/igotechgh/nginx/html/files/audio/" + fileName + ".mp3");
                        // 读取命令的输出
                        BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream()));
                        String line;
                        while ((line = reader.readLine()) != null) {
                            System.out.println(line);
                        }
                        // 等待命令执行完成
                        process.waitFor();
                        // 关闭流
                        reader.close();
                    } catch (IOException | InterruptedException e) {
                        e.printStackTrace();
                    }
                }
            }, 30000);
@@ -1414,4 +1424,21 @@
            throw new RuntimeException(e);
        }
    }
    @PostMapping("/base/user/delUserInfo")
    public ResultUtil delUserInfo(String username, String password){
        UserInfo userInfo = userInfoService.selectOne(new EntityWrapper<UserInfo>().eq("phone", username)
                .ne("flag", 3));
        if(null == userInfo){
            return ResultUtil.error("Invalid account");
        }
        if(!ShiroKit.md5(password, salt).equals(userInfo.getPassWord())){
            return ResultUtil.error("Wrong password");
        }
        userInfo.setFlag(3);
        userInfoService.updateById(userInfo);
        return ResultUtil.success();
    }
}