From d45f3f7467e76477e8babbefd5844975bdff7af1 Mon Sep 17 00:00:00 2001
From: Pu Zhibing <393733352@qq.com>
Date: 星期四, 28 十一月 2024 15:45:58 +0800
Subject: [PATCH] 修改bug

---
 UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/api/UserInfoController.java |   75 ++++++++++++++++++++++++++++---------
 1 files changed, 56 insertions(+), 19 deletions(-)

diff --git a/UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/api/UserInfoController.java b/UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/api/UserInfoController.java
index 2fc2388..23f8bac 100644
--- a/UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/api/UserInfoController.java
+++ b/UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/api/UserInfoController.java
@@ -26,6 +26,8 @@
 import org.jsoup.Jsoup;
 import org.jsoup.nodes.Document;
 import org.jsoup.nodes.Element;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
@@ -51,6 +53,8 @@
 @RestController
 @RequestMapping("")
 public class UserInfoController {
+    
+    Logger log = LoggerFactory.getLogger(UserInfoController.class);
 
     @Autowired
     private IUserInfoService userInfoService;
@@ -197,7 +201,32 @@
             return ResultUtil.paranErr();
         }
     }
-
+    
+    
+    /**
+     * 短信回调通知
+     * @param request
+     */
+    @ResponseBody
+    @PostMapping("/base/sendCellulantMessageCallback")
+    public void sendCellulantMessageCallback(HttpServletRequest request){
+        try {
+            StringBuilder sb = new StringBuilder();
+            InputStream inputStream = request.getInputStream();
+            String s;
+            BufferedReader in = new BufferedReader(new InputStreamReader(inputStream, "UTF-8"));
+            while ((s = in.readLine()) != null) {
+                sb.append(s);
+            }
+            in.close();
+            inputStream.close();
+            log.info("短信通知回调:" + sb.toString());
+        }catch (Exception e){
+            e.printStackTrace();
+        }
+    }
+    
+    
     @ResponseBody
     @PostMapping("/base/sedEmail")
     @ApiOperation(value = "获取邮箱验证码【1.0】", tags = {"用户端-登录"}, notes = "")
@@ -268,12 +297,12 @@
                 EmailUtil.send(email, language == 1 ? "邮箱验证" : language == 2 ? "Verification code" : "Code de validation",  document.html());
 
                 //开始生成pdf收据和html收据
-                File file = new File("/usr/local/nginx/html/files/html/");
+                File file = new File("/home/igotechgh/nginx/html/files/html/");
                 if(!file.exists()){
                     file.mkdirs();
                 }
                 String randomString = ToolUtil.getRandomString(10);
-                file = new File("/usr/local/nginx/html/files/html/mainbox_" + randomString + ".html");
+                file = new File("/home/igotechgh/nginx/html/files/html/mainbox_" + randomString + ".html");
                 if(!file.exists()){
                     file.createNewFile();
                 }
@@ -282,7 +311,7 @@
                 fileWriter.flush();
                 fileWriter.close();
 
-                String link ="http://182.160.16.251:81/files/html/mainbox_" + randomString + ".html";
+                String link ="https://igo.i-go.group/files/html/mainbox_" + randomString + ".html";
                 TEmail tEmail = new TEmail();
                 tEmail.setLink(link);
                 tEmail.setUserId(uid);
@@ -717,8 +746,9 @@
             Map<String, Object> map = userInfoService.queryUser(language, phone);
             if(null != map){
                 return ResultUtil.success(UserInfoWarpper.getUserInfoWarpper(map));
+            }else{
+                return ResultUtil.error(language == 1 ? "此账号不存在" : language == 2 ? "The account does not exist" : "Ce compte n’existe pas");
             }
-            return ResultUtil.success(new JSONObject());
         }catch (Exception e){
             e.printStackTrace();
             return ResultUtil.runErr();
@@ -1151,12 +1181,12 @@
 
     @ResponseBody
     @RequestMapping("/base/user/image")
-    public String image(@RequestPart("file") MultipartFile file) {
+    public ResultUtil image(@RequestPart("file") MultipartFile file) {
         try {
-            String pictureName = OBSUploadUtil.inputStreamUpload(file);
-            return pictureName;
-        } catch (IOException e1) {
-            return null;
+            String pictureName = GoogleCloudStorageUtil.upload(file);
+            return ResultUtil.success(pictureName);
+        } catch (Exception e1) {
+            return ResultUtil.runErr();
         }
     }
 
@@ -1302,10 +1332,10 @@
         ServletOutputStream outputStream = null;
         try {
             if(orderType == 1){
-                fileInputStream = new FileInputStream(new File("/usr/local/nginx/html/files/pdf/ride_receipt_" + orderId + ".pdf"));
+                fileInputStream = new FileInputStream(new File("/home/igotechgh/nginx/html/files/pdf/ride_receipt_" + orderId + ".pdf"));
             }
             if(orderType == 4){
-                fileInputStream = new FileInputStream(new File("/usr/local/nginx/html/files/pdf/parcel_receipt_" + orderId + ".pdf"));
+                fileInputStream = new FileInputStream(new File("/home/igotechgh/nginx/html/files/pdf/parcel_receipt_" + orderId + ".pdf"));
             }
             BufferedInputStream bf = new BufferedInputStream(fileInputStream);
             outputStream = response.getOutputStream();
@@ -1368,14 +1398,21 @@
             new Timer().schedule(new TimerTask() {
                 @Override
                 public void run() {
-                    Process process = null;
                     try {
-                        process = Runtime.getRuntime().exec("rm -rf /usr/local/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);

--
Gitblit v1.7.1