提交 6a65e6a9 authored 作者: xinjunguo's avatar xinjunguo

--no commit message

上级 85e4f488
......@@ -53,7 +53,7 @@ public class SmsController {
//必填:短信签名-可在短信控制台中找到
request.setSignName(SmsConfig.signName);
//必填:短信模板-可在短信控制台中找到
request.setTemplateCode(SmsEnum.getName(smsForm.getType()));
request.setTemplateCode("SMS_187742235");
//可选:模板中的变量替换JSON串,如模板内容为"亲爱的${name},您的验证码为${code}"时,此处的值为
request.setTemplateParam("{'name':'"+smsForm.getName()+"', 'code':'"+smsForm.getCode()+"'}");
......
......@@ -8,9 +8,9 @@ public class SmsConfig {
public static String domain = "dysmsapi.aliyuncs.com";
// TODO 此处需要替换成开发者自己的AK(在阿里云访问控制台寻找)
public static String accessKeyId = "LTAIEvKzhAFYvN8T";
public static String accessKeySecret = "lE7dkXvPEBDMyoar2uX2zrzOD6QUuR";
public static String accessKeyId = "LTAI4Fbem4wa7sFHxk1m2vy2";
public static String accessKeySecret = "1KcvFFHnv2bnWpLSMe41EwZ9PSAFwo";
//必填:短信签名-可在短信控制台中找到
public static String signName="北京中软启信技术有限公司";
public static String signName="中国市场出版社";
}
......@@ -96,5 +96,28 @@ public class WeChatLoginXcxController {
}
return CallBack.success(unionId);
}
@ApiOperation(value = "获取分享二维码", notes = "获取分享二维码")
@GetMapping(RequestPath.QR)
public CallBack<String> getQr(HttpServletRequest request) throws Exception{
String appid="appid="+WeChatLoginXcxConfig.APPID;
String secret="&secret="+WeChatLoginXcxConfig.SECRET;
String param=appid+secret;
String result=HttpsUtils.sendGet(WeChatLoginXcxConfig.ACCESSTOKEN, param);
JSONObject object = (JSONObject)JSON.parse(result);
//判断接口是否调用成功
if(object.containsKey("errcode")){
throw new BaseException(ResponseCodeEnum.EXCEPTION.getCode(),object.get("errcode").toString());
}
String access_token = object.get("access_token").toString();
String res = HttpsUtils.sendGet(WeChatLoginXcxConfig.QR, "access_token="+access_token);
JSONObject ob = (JSONObject)JSON.parse(res);
//判断接口是否调用成功
if(object.containsKey("errcode")){
throw new BaseException(ResponseCodeEnum.EXCEPTION.getCode(),object.get("errcode").toString());
}
String path = object.get("path").toString();
return CallBack.success(path);
}
}
......@@ -16,6 +16,11 @@ public class WeChatLoginXcxConfig {
public final static String CODE2SESSION="https://api.weixin.qq.com/sns/jscode2session";
//回调域
public final static String REDIRECTURI="zgsccbs.com";
// 微信小程序获取ACCESSTOKEN
public final static String ACCESSTOKEN="https://api.weixin.qq.com/cgi-bin/token";
public final static String QR="https://api.weixin.qq.com/wxa/getwxacode";
public static String getParam(String code) {
String appid="appid="+WeChatLoginXcxConfig.APPID;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论