完成h5前端微信分享功能

This commit is contained in:
xpecya 2024-12-09 17:29:30 +08:00
parent bcc17e7bd7
commit 1111efff6e
6 changed files with 5 additions and 6 deletions

View File

@ -22,7 +22,6 @@ import redis.clients.jedis.JedisPool;
import javax.annotation.PostConstruct; import javax.annotation.PostConstruct;
import java.net.URI; import java.net.URI;
import java.util.Map;
@RestController @RestController
@RequestMapping("/wechat") @RequestMapping("/wechat")
@ -37,17 +36,14 @@ public class WechatController {
private final URI accessTokenURI; private final URI accessTokenURI;
private final HttpService httpService; private final HttpService httpService;
private final String appId; private final String appId;
private final ObjectMapper objectMapper;
public WechatController(JedisPool jedisPool, public WechatController(JedisPool jedisPool,
@Value("${wechat.appId}") String appId, @Value("${wechat.appId}") String appId,
@Value("${wechat.secret}") String secret, @Value("${wechat.secret}") String secret,
HttpService httpService, HttpService httpService) {
ObjectMapper objectMapper) {
this.jedisPool = jedisPool; this.jedisPool = jedisPool;
this.httpService = httpService; this.httpService = httpService;
this.appId = appId; this.appId = appId;
this.objectMapper = objectMapper;
this.accessTokenURI = URI.create(String.format(ACCESS_TOKEN_URL_TEMPLATE, appId, secret)); this.accessTokenURI = URI.create(String.format(ACCESS_TOKEN_URL_TEMPLATE, appId, secret));
} }

View File

@ -5,6 +5,7 @@ import com.fasterxml.jackson.annotation.JsonProperty;
/** /**
* 微信access token返回值 * 微信access token返回值
*/ */
@SuppressWarnings("unused")
public class WechatAccessTokenDTO { public class WechatAccessTokenDTO {
@JsonProperty("errcode") @JsonProperty("errcode")

View File

@ -3,6 +3,7 @@ package com.jinrui.reference.mini.model.dto.wechat;
/** /**
* 微信分享DTO * 微信分享DTO
*/ */
@SuppressWarnings("unused")
public class WechatShareDTO { public class WechatShareDTO {
private String url; private String url;

View File

@ -2,6 +2,7 @@ package com.jinrui.reference.mini.model.dto.wechat;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
@SuppressWarnings("unused")
public class WechatTicketDTO { public class WechatTicketDTO {
@JsonProperty("errcode") @JsonProperty("errcode")

View File

@ -12,6 +12,7 @@ import java.util.UUID;
/** /**
* 微信AccessToken返回值 * 微信AccessToken返回值
*/ */
@SuppressWarnings("unused")
public class WechatVO { public class WechatVO {
private static final Logger log = LoggerFactory.getLogger(WechatVO.class); private static final Logger log = LoggerFactory.getLogger(WechatVO.class);

View File

@ -13,7 +13,6 @@ import org.springframework.web.client.RestTemplate;
import java.net.URI; import java.net.URI;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors;
@Service @Service
public class HttpService { public class HttpService {