| ¶Ô±ÈÐÂÎļþ |
| | |
| | | { |
| | | // ä½¿ç¨ IntelliSense äºè§£ç¸å
³å±æ§ã |
| | | // æ¬å以æ¥çç°æå±æ§çæè¿°ã |
| | | // 欲äºè§£æ´å¤ä¿¡æ¯ï¼è¯·è®¿é®: https://go.microsoft.com/fwlink/?linkid=830387 |
| | | "version": "0.2.0", |
| | | "configurations": [ |
| | | { |
| | | "type": "java", |
| | | "name": "Current File", |
| | | "request": "launch", |
| | | "mainClass": "${file}" |
| | | }, |
| | | { |
| | | "type": "java", |
| | | "name": "AdminApplication", |
| | | "request": "launch", |
| | | "mainClass": "com.doumee.AdminApplication", |
| | | "projectName": "dmmall_admin" |
| | | }, |
| | | { |
| | | "type": "java", |
| | | "name": "CodeGenerator", |
| | | "request": "launch", |
| | | "mainClass": "com.doumee.core.utils.CodeGenerator", |
| | | "projectName": "dmmall_service" |
| | | }, |
| | | { |
| | | "type": "java", |
| | | "name": "CodeVerifyUtils", |
| | | "request": "launch", |
| | | "mainClass": "com.doumee.core.utils.CodeVerifyUtils", |
| | | "projectName": "dmmall_service" |
| | | }, |
| | | { |
| | | "type": "java", |
| | | "name": "Constants", |
| | | "request": "launch", |
| | | "mainClass": "com.doumee.core.utils.Constants", |
| | | "projectName": "dmmall_service" |
| | | }, |
| | | { |
| | | "type": "java", |
| | | "name": "DateUtil", |
| | | "request": "launch", |
| | | "mainClass": "com.doumee.core.utils.DateUtil", |
| | | "projectName": "dmmall_service" |
| | | }, |
| | | { |
| | | "type": "java", |
| | | "name": "GeneratePicUtil", |
| | | "request": "launch", |
| | | "mainClass": "com.doumee.core.utils.GeneratePicUtil", |
| | | "projectName": "dmmall_service" |
| | | }, |
| | | { |
| | | "type": "java", |
| | | "name": "HttpsUtil", |
| | | "request": "launch", |
| | | "mainClass": "com.doumee.core.utils.HttpsUtil", |
| | | "projectName": "dmmall_service" |
| | | }, |
| | | { |
| | | "type": "java", |
| | | "name": "PinYinUtil", |
| | | "request": "launch", |
| | | "mainClass": "com.doumee.core.utils.PinYinUtil", |
| | | "projectName": "dmmall_service" |
| | | }, |
| | | { |
| | | "type": "java", |
| | | "name": "ALiYunUtil", |
| | | "request": "launch", |
| | | "mainClass": "com.doumee.core.utils.aliyun.ALiYunUtil", |
| | | "projectName": "dmmall_service" |
| | | }, |
| | | { |
| | | "type": "java", |
| | | "name": "InterfaceApplication", |
| | | "request": "launch", |
| | | "mainClass": "com.doumee.InterfaceApplication", |
| | | "projectName": "dmmall_web" |
| | | } |
| | | ] |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | { |
| | | "java.compile.nullAnalysis.mode": "disabled" |
| | | } |
| | |
| | | * @return Integer |
| | | */ |
| | | Integer create(Activity activity); |
| | | |
| | | /** |
| | | * 主é®å é¤ |
| | | * |
| | |
| | | import com.doumee.dao.web.request.UpdateMemberRequest; |
| | | import com.doumee.dao.web.request.WxPhoneRequest; |
| | | import com.doumee.dao.web.response.AccountResponse; |
| | | import me.chanjar.weixin.common.error.WxErrorException; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import java.math.BigDecimal; |
| | |
| | | * @param code |
| | | * @return |
| | | */ |
| | | AccountResponse wxLogin(String code); |
| | | AccountResponse wxLogin(String code) throws WxErrorException; |
| | | |
| | | |
| | | AccountResponse wxLoginTest( Integer memberId); |
| | |
| | | package com.doumee.service.business.impl; |
| | | |
| | | import com.doumee.core.model.PageData; |
| | | import com.doumee.core.model.PageWrap; |
| | | import com.doumee.core.utils.Constants; |
| | | import com.doumee.core.model.PageWrap; |
| | | import com.doumee.core.utils.Utils; |
| | | import com.doumee.dao.business.GoodsorderDetailMapper; |
| | | import com.doumee.dao.business.PlanorderDetailMapper; |
| | |
| | | |
| | | |
| | | @Override |
| | | public AccountResponse wxLogin(String code){ |
| | | try { |
| | | //è·åå¾®ä¿¡æææ°æ® |
| | | WxMaJscode2SessionResult session = WxMiniConfig.wxMaService.getUserService().getSessionInfo(code); |
| | | String openId = session.getOpenid(); |
| | | if (com.baomidou.mybatisplus.core.toolkit.StringUtils.isBlank(openId)) { |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"è·åopenid失败ï¼è¯·è系管çå"); |
| | | } |
| | | Member member = memberMapper.selectOne(new QueryWrapper<Member>().lambda().eq(Member::getOpenId, openId) |
| | | .eq(Member::getIsdeleted,Constants.ZERO).eq(Member::getStatus,Constants.ZERO) |
| | | .last(" limit 1")); |
| | | AccountResponse accountResponse = new AccountResponse(); |
| | | if(Objects.nonNull(member)){ |
| | | memberMapper.updateById(member); |
| | | member.setImgFullUrl(StringUtils.isNotBlank(member.getImgurl())?systemDictDataBiz.queryByCode(Constants.OSS,Constants.RESOURCE_PATH).getCode()+ |
| | | systemDictDataBiz.queryByCode(Constants.OSS,Constants.MEMBER_FILE).getCode()+member.getImgurl():null); |
| | | String token = JwtTokenUtil.generateTokenForRedis(member.getId(), Constants.ZERO, JSONObject.toJSONString(member), redisTemplate); |
| | | accountResponse.setToken(token); |
| | | accountResponse.setOpenid(openId); |
| | | accountResponse.setMember(member); |
| | | }else{ |
| | | accountResponse.setOpenid(openId); |
| | | } |
| | | return accountResponse; |
| | | } catch (WxErrorException e) { |
| | | e.printStackTrace(); |
| | | public AccountResponse wxLogin(String code) throws WxErrorException { |
| | | WxMaJscode2SessionResult session = WxMiniConfig.wxMaService.getUserService().getSessionInfo(code); |
| | | String openId = session.getOpenid(); |
| | | if (com.baomidou.mybatisplus.core.toolkit.StringUtils.isBlank(openId)) { |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"è·åopenid失败ï¼è¯·è系管çå"); |
| | | } |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"微信ç»å½å¼å¸¸ï¼è¯·è系管çå"); |
| | | Member member = memberMapper.selectOne(new QueryWrapper<Member>().lambda() |
| | | .eq(Member::getOpenId, openId) |
| | | .eq(Member::getIsdeleted,Constants.ZERO) |
| | | .eq(Member::getStatus,Constants.ZERO) |
| | | .last(" limit 1")); |
| | | |
| | | AccountResponse accountResponse = new AccountResponse(); |
| | | if(Objects.nonNull(member)){ |
| | | String ossPath = systemDictDataBiz.queryByCode(Constants.OSS,Constants.RESOURCE_PATH).getCode(); |
| | | String memberPath = systemDictDataBiz.queryByCode(Constants.OSS,Constants.MEMBER_FILE).getCode(); |
| | | if(StringUtils.isNotBlank(member.getImgurl())){ |
| | | member.setImgFullUrl(ossPath + memberPath + member.getImgurl()); |
| | | } |
| | | String token = JwtTokenUtil.generateTokenForRedis(member.getId(), Constants.ZERO, JSONObject.toJSONString(member), redisTemplate); |
| | | accountResponse.setToken(token); |
| | | accountResponse.setOpenid(openId); |
| | | accountResponse.setMember(member); |
| | | }else{ |
| | | accountResponse.setOpenid(openId); |
| | | } |
| | | return accountResponse; |
| | | } |
| | | |
| | | |
| | |
| | | import io.swagger.models.auth.In; |
| | | import lombok.extern.java.Log; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import me.chanjar.weixin.common.error.WxErrorException; |
| | | |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(paramType = "query", dataType = "String", name = "code", value = "微信code", required = true) |
| | | }) |
| | | public ApiResponse<AccountResponse> wxLogin(@RequestParam String code) { |
| | | public ApiResponse<AccountResponse> wxLogin(@RequestParam String code) throws WxErrorException { |
| | | return ApiResponse.success(memberService.wxLogin(code)); |
| | | } |
| | | |