|
|
@ -8,11 +8,16 @@ import cn.hutool.core.bean.BeanUtil;
|
|
|
|
import cn.hutool.core.lang.Assert;
|
|
|
|
import cn.hutool.core.lang.Assert;
|
|
|
|
import cn.hutool.core.util.ObjUtil;
|
|
|
|
import cn.hutool.core.util.ObjUtil;
|
|
|
|
import cn.hutool.core.util.ReflectUtil;
|
|
|
|
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.CommonStatusEnum;
|
|
|
|
|
|
|
|
import cn.iocoder.yudao.framework.common.enums.UserTypeEnum;
|
|
|
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
|
|
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
|
|
|
import cn.iocoder.yudao.framework.common.util.cache.CacheUtils;
|
|
|
|
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.http.HttpUtils;
|
|
|
|
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
|
|
|
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.SocialClientPageReqVO;
|
|
|
|
import cn.iocoder.yudao.module.system.controller.admin.socail.vo.client.SocialClientSaveReqVO;
|
|
|
|
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.dal.dataobject.social.SocialClientDO;
|
|
|
@ -47,6 +52,7 @@ import java.util.Objects;
|
|
|
|
|
|
|
|
|
|
|
|
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
|
|
|
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.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.*;
|
|
|
|
import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.*;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
@ -336,4 +342,37 @@ public class SocialClientServiceImpl implements SocialClientService {
|
|
|
|
return socialClientMapper.selectPage(pageReqVO);
|
|
|
|
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", "packageC/temporary/temporary");
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|