Procházet zdrojové kódy

token剔除代码修改

suxinghua před 4 roky
rodič
revize
be135abcd6

+ 1 - 0
YijiaRestful/pom.xml

@@ -90,6 +90,7 @@
                 <groupId>org.springframework.boot</groupId>
                 <artifactId>spring-boot-maven-plugin</artifactId>
             </plugin>
+
             <plugin>
                 <!--Mybatis-generator插件,用于自动生成Mapper和POJO-->
                 <groupId>org.mybatis.generator</groupId>

+ 2 - 2
YijiaRestful/src/main/java/com/platform/yijia/controller/PayOrderController.java

@@ -37,10 +37,10 @@ public class PayOrderController {
         appUserInfo.setUserType(payOrderRequest.getUserType());
         if(payOrderRequest.getUserType().equals("1")){
             //1 是公众号
-            appUserInfo.setBlogToken(payOrderRequest.getToken());
+            appUserInfo.setBlogOpenid(payOrderRequest.getToken());
         }else if(payOrderRequest.getUserType().equals("2")){
             //2是小程序
-            appUserInfo.setMinaToken(payOrderRequest.getToken());
+            appUserInfo.setMinaOpenid(payOrderRequest.getToken());
         }
         List<AppUserInfo> appUserInfoList =appUserInfoService.Authentication(appUserInfo);
         JSONObject resp = new JSONObject();

+ 17 - 16
YijiaRestful/src/main/java/com/platform/yijia/controller/StationController.java

@@ -206,30 +206,31 @@ public class StationController {
     @RequestMapping(value = "/stationOilGunList", method = RequestMethod.GET)
     @ResponseBody
    // public void stationOilGunList(@RequestParam StationRequest request,HttpServletResponse response){
-    public String stationOilGunList(@RequestParam String userType,String token,Integer stationId){
+//    public String stationOilGunList(@RequestParam String userType,String token,Integer stationId){
+      public String stationOilGunList(@RequestParam Integer stationId){
         Gson gson =new Gson();
         StationOilGun stationOilGun =new StationOilGun();
         //查询登录人是否存在
-        AppUserInfo appUserInfo =new AppUserInfo();
+//        AppUserInfo appUserInfo =new AppUserInfo();
         //订单类型 是小程序还是公众号
-        appUserInfo.setUserType(userType);
-        if(userType.equals("1")){
-            //1 是公众号
-            appUserInfo.setBlogToken(token);
-        }else if(userType.equals("2")){
-            //2是小程序
-            appUserInfo.setMinaToken(token);
-        }
-        List<AppUserInfo> appUserInfoList =appUserInfoService.Authentication(appUserInfo);
-        if(appUserInfoList!=null&&appUserInfoList.size()>0){
+//        appUserInfo.setUserType(userType);
+//        if(userType.equals("1")){
+//            //1 是公众号
+//            appUserInfo.setBlogToken(token);
+//        }else if(userType.equals("2")){
+//            //2是小程序
+//            appUserInfo.setMinaToken(token);
+//        }
+//        List<AppUserInfo> appUserInfoList =appUserInfoService.Authentication(appUserInfo);
+//        if(appUserInfoList!=null&&appUserInfoList.size()>0){
             //获取油站id根据油站号查询油站对应的所有油枪信息
             stationOilGun.setStationId(stationId);
             List<StationOilGun> stationOilGunList = stationOilGunService.stationOilGunList(stationOilGun);
             ResultData resultData=ResultData.success(stationOilGunList);
             return gson.toJson(resultData);
-        }else {
-            ResultData resultData=ResultData.error(CodeMsg.USER_NOT_EXSIST);
-            return gson.toJson(resultData);
-        }
+//        }else {
+//            ResultData resultData=ResultData.error(CodeMsg.USER_NOT_EXSIST);
+//            return gson.toJson(resultData);
+//        }
     }
 }

+ 11 - 9
YijiaRestful/src/main/java/com/platform/yijia/controller/WXLoginController.java

@@ -8,6 +8,7 @@ import com.platform.yijia.utils.ConstantUtil;
 import com.platform.yijia.utils.HttpClientUtil;
 import com.platform.yijia.utils.SignUtil;
 import org.apache.commons.lang3.StringUtils;
+import org.springframework.stereotype.Controller;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
@@ -26,9 +27,9 @@ import java.util.List;
  * @Description :
  **/
 
-@RestController
+@Controller
 @RequestMapping("/wxAuth")
-public class WxLoginController {
+public class WXLoginController {
 
     @Resource
     private AppUserInfoService appUserInfoService;
@@ -66,8 +67,8 @@ public class WxLoginController {
      * @param response
      * @throws IOException
      */
-    @RequestMapping("/login")
-    public String wxLogin(HttpServletResponse response)  throws ParseException {
+    @RequestMapping("/wxLogin")
+    public String wxLogin(HttpServletResponse response)  throws ParseException,IOException {
         //请求获取code的回调地址
         //用线上环境的域名或者用内网穿透,不能用ip
         String callBack = "http://www.onlyfido.top/wxAuth/callBack";//域名填你自己的
@@ -83,11 +84,10 @@ public class WxLoginController {
         } catch (UnsupportedEncodingException e) {
             e.printStackTrace();
         }
-
         System.out.println(url);
         //重定向
-       // response.sendRedirect(url);
-        return "redirect:" + url;
+//        response.sendRedirect(url);
+        return  "redirect:"+url;
     }
 
     /**
@@ -144,7 +144,9 @@ public class WxLoginController {
         }
         //此时已获取到userInfo,再根据业务进行处理
         System.out.println("请求获取userInfo:" + resultInfo);
-        return resultInfoObject.toString();
+        //跳转网页地址
+        System.out.println("跳转网页地址:" + "redirect:"+"http://www.onlyfido.top:27281/?openid="+resultObject.getString("openid"));
+        return "redirect:"+"http://www.onlyfido.top:27281/?openid="+resultObject.getString("openid");
     }
 
-}
+}

+ 2 - 2
YijiaRestful/src/main/java/com/platform/yijia/service/impl/AppUserInfoServiceImpl.java

@@ -24,9 +24,9 @@ public class AppUserInfoServiceImpl implements AppUserInfoService {
         AppUserInfoExample example =new AppUserInfoExample();
         example.or().andUserTypeEqualTo(appUserInfo.getUserType());
         if(appUserInfo.getUserType().equals("1")){
-            example.or().andBlogTokenEqualTo(appUserInfo.getBlogToken());
+            example.or().andBlogOpenidEqualTo(appUserInfo.getBlogToken());
         }else if(appUserInfo.getUserType().equals("2")){
-            example.or().andMinaTokenEqualTo(appUserInfo.getBlogToken());
+            example.or().andMinaOpenidEqualTo(appUserInfo.getBlogToken());
         }
         List<AppUserInfo> list= appUserInfoMapper.selectByExample(example);
         return list;

+ 2 - 2
YijiaRestful/src/main/java/com/platform/yijia/service/impl/PayOrderServiceImpl.java

@@ -85,8 +85,8 @@ public class PayOrderServiceImpl implements PayOrderService {
         //根据订单号查询返回列表,最好是返回对象
         List<PayOrder> payOrderList= payOrderMapper.selectByExample(example);
         //返回订单号
-        String ordno= payOrderList.get(0).getOrderNo();
-        return ordno;
+        ordNo= payOrderList.get(0).getOrderNo();
+        return ordNo;
     }
 
     /*