guozhaoshun před 6 roky
rodič
revize
a289b60a02

+ 33 - 30
rankin-user-service/src/main/java/cn/rankin/userservice/controller/QRCodeController.java

@@ -44,38 +44,41 @@ public class QRCodeController {
     public APIResult callback(@RequestParam("data") String data)
     {
 
-        Map<String, Object> requestMap = FastJsonUtils.stringToCollect(data);
-
-        boolean status = (boolean) requestMap.get("status");
-        Map<String, Object> dataMap = (Map<String, Object>) requestMap.get("data");
-
-
-        Map<String, Object> qrcodeMap = (Map<String, Object>) dataMap.get("qrcode");
-        String eid = (String) qrcodeMap.get("user");
-        long time = (long) qrcodeMap.get("time");
-
-        QRCode qrcode = new QRCode();
-        qrcode.setEid(eid);
-        //qrcode.setTime(new Date(time));
-
-        QRCode entity = qrcodeService.findFirst(qrcode);
-
-        if(null == entity){
-            log.error("qrcode/callback  error ,qrcode is null");
-            return APIResult.ok("扫码失败,未找到二维码信息");
-        }
-
-        if(status){
-            qrcodeCallback(eid, entity.getSimple(), dataMap);
-            entity.setStatus(2);
-            qrcodeService.update(entity);
-            return APIResult.ok("扫码成功");
-        }else{
-            entity.setStatus(1);
-            qrcodeService.update(entity);
+        try{
+            Map<String, Object> requestMap = FastJsonUtils.stringToCollect(data);
+
+            boolean status = (boolean) requestMap.get("status");
+            Map<String, Object> dataMap = (Map<String, Object>) requestMap.get("data");
+
+
+            Map<String, Object> qrcodeMap = (Map<String, Object>) dataMap.get("qrcode");
+            String eid = (String) qrcodeMap.get("user");
+            long time = (long) qrcodeMap.get("time");
+
+            QRCode qrcode = new QRCode();
+            qrcode.setEid(eid);
+            //qrcode.setTime(new Date(time));
+
+            QRCode entity = qrcodeService.findFirst(qrcode);
+
+            if(null == entity){
+                log.error("qrcode/callback  error ,qrcode is null");
+                return APIResult.ok("扫码失败,未找到二维码信息");
+            }
+
+            if(status){
+                qrcodeCallback(eid, entity.getSimple(), dataMap);
+                entity.setStatus(2);
+                qrcodeService.update(entity);
+                return APIResult.ok("扫码成功");
+            }else{
+                entity.setStatus(1);
+                qrcodeService.update(entity);
+                return APIResult.ok("扫码失败");
+            }
+        }catch(Exception e){
             return APIResult.ok("扫码失败");
         }
-
     }
 
     /**