From 90d61b2122cfc96779bb658ca6f28e86540de128 Mon Sep 17 00:00:00 2001 From: zhangzeli <123456> Date: 星期二, 18 一月 2022 09:54:50 +0800 Subject: [PATCH] bug --- xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/wx/IndexController.java | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 files changed, 52 insertions(+), 2 deletions(-) diff --git a/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/wx/IndexController.java b/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/wx/IndexController.java index 778059a..c7e2b16 100644 --- a/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/wx/IndexController.java +++ b/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/wx/IndexController.java @@ -67,7 +67,7 @@ String openid = SessionKeyOpenId.getStr("openid"); if(StrUtil.isEmpty(openid)){ - return ResultUtil.error(SessionKeyOpenId.toString()); + return ResultUtil.error("error寰俊:"+SessionKeyOpenId.toString()); } QueryWrapper<Customer> wrapper = new QueryWrapper<>(); @@ -76,6 +76,8 @@ if(one==null){ return ResultUtil.error(openid);//棣栨鐧婚檰闇�缁戝畾闆跺敭璁稿彲璇� }else { + one.setLoginNum(one.getLoginNum()+1); + iCustomerService.saveOrUpdate(one); return ResultUtil.data(one,"鐧诲綍鎴愬姛"); } } @@ -83,7 +85,7 @@ public static JSONObject getSessionKeyOrOpenId(String code){ //寰俊绔櫥褰昪ode String wxCode = code; - String requestUrl = "https://api.weixin.qq.com/sns/jscode2session?appid=wx0f10f6d253f3ee6b&secret=4d4cbc8da31a96559114ad693de70631&grant_type=authorization_code&js_code="+code; + String requestUrl = "https://api.weixin.qq.com/sns/jscode2session?appid=wx77c0d2c54010b7e4&secret=2282710e890670e916c189347d70a7c5&grant_type=authorization_code&js_code="+code; JSONObject jsonObject = JSONUtil.parseObj( HttpUtil.get(requestUrl)); return jsonObject; } @@ -94,6 +96,17 @@ @RequestMapping(value = "/bindWx", method = RequestMethod.POST) @ApiOperation(value = "寰俊缁戝畾闆跺敭璁稿彲璇�") public Object bindWx(String licence,String openId){ + QueryWrapper<Customer> wrapper2 = new QueryWrapper<>(); + wrapper2.eq("open_id",openId); + Customer c = iCustomerService.getOne(wrapper2); + if(c==null){ + + }else { + System.out.println(c.getOpenId()); + c.setOpenId(""); + iCustomerService.saveOrUpdate(c); + } + QueryWrapper<Customer> wrapper = new QueryWrapper<>(); wrapper.eq("licence",licence); Customer one = iCustomerService.getOne(wrapper); @@ -139,6 +152,9 @@ wrapper2.eq("customer_id",customerId); wrapper2.eq("send_date",format); OrderTask orderTask = iOrderTaskService.getOne(wrapper2); + if(orderTask==null){ + return ResultUtil.error("浠婃棩鏃犺鍗�"); + } String carId = orderTask.getCarId(); Car car = iCarService.getById(carId); String[] carids = new String[1]; @@ -164,6 +180,9 @@ @ApiOperation(value = "鍔犳补鍔╁姏") public Object likes(String customerId){ OrderTask order = getOrder(customerId); + if(order==null){ + ResultUtil.error("浠婃棩鏃犺鍗�"); + } order.setLikes(1); iOrderTaskService.saveOrUpdate(order); return ResultUtil.success("鍔╁姏鎴愬姛"); @@ -245,4 +264,35 @@ } return new ResultUtil<CustomerReceive>().setErrorMsg("鎿嶄綔澶辫触"); } + + //14.鑾峰彇绛炬敹浜哄垪琛� + @RequestMapping(value = "/getCustomerReceive", method = RequestMethod.GET) + @ApiOperation(value = "鑾峰彇绛炬敹浜�") + public Result<List<CustomerReceive>> getCustomerReceive(String customerId) { + PageVo page = new PageVo(); + page.setPageSize(30); + page.setPageNumber(1); + page.setOrder("desc"); + page.setSort("createTime"); + QueryWrapper<CustomerReceive> wrapper = new QueryWrapper<>(); + wrapper.eq("customer_id",customerId); + IPage<CustomerReceive> data = iCustomerReceiveService.page2(PageUtil.initMpPage(page),wrapper); + return new ResultUtil<List<CustomerReceive>>().setData(data.getRecords()); + } + + //15.鑾峰彇绛炬敹浜� + @RequestMapping(value = "/getCustomerReceiveById", method = RequestMethod.GET) + @ApiOperation(value = "鑾峰彇绛炬敹浜�") + public Result<CustomerReceive> getCustomerReceiveById(String customerReceiveId) { + CustomerReceive byId = iCustomerReceiveService.getById(customerReceiveId); + return new ResultUtil<CustomerReceive>().setData(byId); + } + + //16.鍒犻櫎鎺ヨ揣浜� + @RequestMapping(value = "/deleteReceive", method = RequestMethod.POST) + @ApiOperation(value = "鍒犻櫎鎺ヨ揣浜�") + public Object deleteReceive(String id) { + iCustomerReceiveService.removeById(id); + return ResultUtil.success("鍒犻櫎鎴愬姛"); + } } -- Gitblit v1.9.1