Compare commits

..

No commits in common. '27ec1f391ba358c8dbacb751a8d3bc94e1b94aed' and '881eafd6e6052746fade40b997c01306dd7a3eed' have entirely different histories.

@ -4,7 +4,6 @@ import cn.hutool.core.codec.Base64;
import cn.hutool.core.io.FileUtil;
import cn.hutool.core.io.IoUtil;
import cn.hutool.core.lang.UUID;
import cn.hutool.http.HttpUtil;
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.util.qccode.Base64Util;
@ -106,6 +105,7 @@ public class AppFileController {
@RequestMapping("/qrCode64Url")
@Operation(summary = "生成Url")
public CommonResult<String> qrCode64Url(@Valid String type) {
// 创建文件使用PNG扩展名因为QR码是以PNG格式生成的
return success( getString(type));

@ -1,6 +1,5 @@
package cn.iocoder.yudao.module.member.controller.app.user;
import cn.iocoder.yudao.framework.common.enums.UserTypeEnum;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.security.core.annotations.PreAuthenticated;
import cn.iocoder.yudao.module.member.controller.app.user.vo.*;
@ -9,7 +8,6 @@ import cn.iocoder.yudao.module.member.dal.dataobject.level.MemberLevelDO;
import cn.iocoder.yudao.module.member.dal.dataobject.user.MemberUserDO;
import cn.iocoder.yudao.module.member.service.level.MemberLevelService;
import cn.iocoder.yudao.module.member.service.user.MemberUserService;
import cn.iocoder.yudao.module.system.api.social.SocialClientApi;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
@ -33,8 +31,7 @@ public class AppMemberUserController {
private MemberUserService userService;
@Resource
private MemberLevelService levelService;
@Resource
private SocialClientApi socialClientApi;
@GetMapping("/get")
@Operation(summary = "获得基本信息")
@PreAuthenticated
@ -43,7 +40,6 @@ public class AppMemberUserController {
MemberLevelDO level = levelService.getLevel(user.getLevelId());
AppMemberUserInfoRespVO convert = MemberUserConvert.INSTANCE.convert(user, level);
convert.setId(getLoginUserId()+"");
convert.setUrlLink(socialClientApi.getWxUrlInfo(UserTypeEnum.MEMBER.getValue()).toString());
return success(convert);
}

@ -13,9 +13,6 @@ public class AppMemberUserInfoRespVO {
@Schema(description = "id")
private String id;
@Schema(description = "urlLink")
private String urlLink;
@Schema(description = "用户昵称", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋艿")
private String nickname;

@ -3,7 +3,6 @@ package cn.iocoder.yudao.module.member.service.auth;
import cn.hutool.core.lang.Assert;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.http.HttpUtil;
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
import cn.iocoder.yudao.framework.common.enums.TerminalEnum;
import cn.iocoder.yudao.framework.common.enums.UserTypeEnum;

@ -39,8 +39,4 @@ public interface SocialClientApi {
*/
SocialWxPhoneNumberInfoRespDTO getWxMaPhoneNumberInfo(Integer userType, String phoneCode);
Object getWxUrlInfo(Integer type) ;
}

@ -1,13 +1,11 @@
package cn.iocoder.yudao.module.system.api.social;
import cn.binarywang.wx.miniapp.bean.WxMaPhoneNumberInfo;
import cn.hutool.http.HttpUtil;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.module.system.api.social.dto.SocialWxJsapiSignatureRespDTO;
import cn.iocoder.yudao.module.system.api.social.dto.SocialWxPhoneNumberInfoRespDTO;
import cn.iocoder.yudao.module.system.service.social.SocialClientService;
import me.chanjar.weixin.common.bean.WxJsapiSignature;
import me.chanjar.weixin.common.error.WxErrorException;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
@ -42,9 +40,4 @@ public class SocialClientApiImpl implements SocialClientApi {
return BeanUtils.toBean(info, SocialWxPhoneNumberInfoRespDTO.class);
}
@Override
public Object getWxUrlInfo(Integer type) {
return socialClientService.getWxUrlInfo(type);
}
}

@ -2,14 +2,12 @@ package cn.iocoder.yudao.module.system.service.social;
import cn.binarywang.wx.miniapp.bean.WxMaPhoneNumberInfo;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.system.api.social.dto.SocialWxPhoneNumberInfoRespDTO;
import cn.iocoder.yudao.module.system.controller.admin.socail.vo.client.SocialClientPageReqVO;
import cn.iocoder.yudao.module.system.controller.admin.socail.vo.client.SocialClientSaveReqVO;
import cn.iocoder.yudao.module.system.dal.dataobject.social.SocialClientDO;
import cn.iocoder.yudao.module.system.enums.social.SocialTypeEnum;
import com.xingyuv.jushauth.model.AuthUser;
import me.chanjar.weixin.common.bean.WxJsapiSignature;
import me.chanjar.weixin.common.error.WxErrorException;
import javax.validation.Valid;
@ -103,5 +101,4 @@ public interface SocialClientService {
*/
PageResult<SocialClientDO> getSocialClientPage(SocialClientPageReqVO pageReqVO);
Object getWxUrlInfo(Integer type);
}

@ -8,16 +8,11 @@ import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.lang.Assert;
import cn.hutool.core.util.ObjUtil;
import cn.hutool.core.util.ReflectUtil;
import cn.hutool.http.HttpUtil;
import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
import cn.iocoder.yudao.framework.common.enums.UserTypeEnum;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.cache.CacheUtils;
import cn.iocoder.yudao.framework.common.util.http.HttpUtils;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.module.system.api.social.dto.SocialWxPhoneNumberInfoRespDTO;
import cn.iocoder.yudao.module.system.controller.admin.socail.vo.client.SocialClientPageReqVO;
import cn.iocoder.yudao.module.system.controller.admin.socail.vo.client.SocialClientSaveReqVO;
import cn.iocoder.yudao.module.system.dal.dataobject.social.SocialClientDO;
@ -52,7 +47,6 @@ import java.util.Objects;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.framework.common.util.json.JsonUtils.toJsonString;
import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.*;
/**
@ -342,38 +336,4 @@ public class SocialClientServiceImpl implements SocialClientService {
return socialClientMapper.selectPage(pageReqVO);
}
@Override
public Object getWxUrlInfo(Integer type) {
WxMaService wxMaService1 = getWxMaService(type);
String accessTokenUrl = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=%s&secret=%s";
accessTokenUrl = String.format(accessTokenUrl, wxMaService1.getWxMaConfig().getAppid(), wxMaService1.getWxMaConfig().getSecret());
String accessToken = HttpUtil.post(accessTokenUrl, "");
JSONObject token = JSONUtil.parseObj(accessToken);
if (token.get("errcode") != null) {
throw new RuntimeException("获取微信小程序access_token失败");
}
/*
{
"path": "packageC/temporary/temporary",
"query": "'a=123'",
"env_version": "develop"
}
{"errcode":0,"errmsg":"ok","url_link":"https:\/\/wxaurl.cn\/OeiPo041PJe"}
*/
JSONObject jsonObject = new JSONObject();
jsonObject.putOnce("path", "pages/index/index");
jsonObject.putOnce("query", "r="+getLoginUserId());
jsonObject.putOnce("env_version", "develop");
String result = HttpUtil.post("https://api.weixin.qq.com/wxa/generate_urllink?access_token=ACCESS_TOKEN".replace("ACCESS_TOKEN", token.getStr("access_token")), jsonObject.toString());
JSONObject rfurl = JSONUtil.parseObj(result);
if (rfurl.get("errcode") != null&& rfurl.getInt("errcode") != 0) {
throw new RuntimeException("获取微信小程序url失败");
}
return rfurl.get("url_link");
//HttpUtil.post("https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=%s&secret=%s");
// https://api.weixin.qq.com/wxa/generate_urllink?access_token=ACCESS_TOKEN
}
}

Loading…
Cancel
Save