|
|
@@ -9,6 +9,7 @@ import cn.hutool.http.ssl.SSLSocketFactoryBuilder;
|
|
|
import cn.hutool.json.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
+import com.cyksj.common.constant.Constant;
|
|
|
import com.cyksj.common.exception.BusinessRuntimeException;
|
|
|
import com.cyksj.common.util.*;
|
|
|
import com.cyksj.config.BaseWeChatConfig;
|
|
|
@@ -19,9 +20,11 @@ import com.cyksj.mapper.WxAppMapper;
|
|
|
import com.cyksj.mapper.channel.ShopConfigMapper;
|
|
|
import com.cyksj.model.dto.*;
|
|
|
import com.cyksj.model.entity.ShopConfig;
|
|
|
+import com.cyksj.model.entity.SysConfig;
|
|
|
import com.cyksj.model.entity.WxApp;
|
|
|
import com.cyksj.model.response.WxGzhQrCodeTicketRep;
|
|
|
import com.cyksj.redis.RedisService;
|
|
|
+import com.cyksj.service.sys.SysConfigService;
|
|
|
import com.cyksj.service.wechat.WeChatService;
|
|
|
import com.cyksj.service.wechat.WxMpAccountOps;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
@@ -65,6 +68,8 @@ public class WeChatServiceImpl implements WeChatService {
|
|
|
|
|
|
private final RedisService redisService;
|
|
|
|
|
|
+ private final SysConfigService sysConfigService;
|
|
|
+
|
|
|
@Override
|
|
|
public String createUrl(String state, String redirectUrl) {
|
|
|
return createUrl(state,redirectUrl,weChatConfig.getAppid(), WeChatAuthRedirectUrl.BASE.getScope());
|
|
|
@@ -478,7 +483,16 @@ public class WeChatServiceImpl implements WeChatService {
|
|
|
|
|
|
@Override
|
|
|
public WxGzhQrCodeTicketRep getWxGzhQrCode(Long sharedId, Integer dsType, Long popularizeId, String loginPhone) throws Exception {
|
|
|
- String gzhQrCodeUrl = String.format("https://api.weixin.qq.com/cgi-bin/qrcode/create?access_token=%s", this.getAccessToken());
|
|
|
+ SysConfig sysConfig = sysConfigService.getOne(Wrappers.lambdaQuery(SysConfig.class)
|
|
|
+ .eq(SysConfig::getSysKey, Constant.QR_CODE_WX_APP_ID).last("limit 1"));
|
|
|
+ String appid = null;
|
|
|
+ if (sysConfig != null) {
|
|
|
+ String sysValue = sysConfig.getSysValue();
|
|
|
+ if (StrUtil.isNotBlank(sysValue)) {
|
|
|
+ appid = sysValue;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ String gzhQrCodeUrl = String.format("https://api.weixin.qq.com/cgi-bin/qrcode/create?access_token=%s", this.getAccessToken(appid));
|
|
|
//scene_str:场景值ID(字符串形式的ID),字符串类型,长度限制为1到64
|
|
|
String scene_str = RandomUtil.randomString(16);
|
|
|
int expireTime = 60;
|