|
@@ -5,7 +5,9 @@ import com.alibaba.fastjson.JSON;
|
|
|
import com.sxtvs.open.api.odata.dto.RedirectDto;
|
|
|
import com.sxtvs.open.api.odata.dto.weibo.WeiboCallbackDto;
|
|
|
import com.sxtvs.open.api.odata.dto.wx.WxApiCreatePreAuthCodeResponse;
|
|
|
+import com.sxtvs.open.api.odata.entity.WxTicket;
|
|
|
import com.sxtvs.open.api.odata.service.OauthService;
|
|
|
+import com.sxtvs.open.api.odata.service.WxTicketService;
|
|
|
import com.sxtvs.open.api.odata.wxutil.WxCrypt;
|
|
|
import com.sxtvs.open.api.odata.wxutil.WxXmlUtil;
|
|
|
import com.sxtvs.open.core.advice.NoAPIResponse;
|
|
@@ -20,6 +22,8 @@ import org.springframework.web.bind.annotation.RequestBody;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
+import java.util.Date;
|
|
|
+
|
|
|
@RestController
|
|
|
@RequestMapping("oauth")
|
|
|
public class OauthRestController {
|
|
@@ -33,9 +37,9 @@ public class OauthRestController {
|
|
|
@Autowired
|
|
|
private OauthService oauthService;
|
|
|
|
|
|
- @RequestMapping("weixin/auth")
|
|
|
+ @RequestMapping("weixin/auth/v2")
|
|
|
@NoAPIResponse
|
|
|
- public String auth(@RequestBody String body) {
|
|
|
+ public String authV2(@RequestBody String body) {
|
|
|
logger.info("body", body, "key", "oauth/weixin/auth");
|
|
|
var encrypt = WxXmlUtil.getEncrypt(body);
|
|
|
logger.debug("data", encrypt);
|
|
@@ -47,6 +51,23 @@ public class OauthRestController {
|
|
|
return "success";
|
|
|
}
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private WxTicketService wxTicketService;
|
|
|
+
|
|
|
+ @RequestMapping("weixin/auth")
|
|
|
+ @NoAPIResponse
|
|
|
+ public String auth(@RequestBody String body) {
|
|
|
+ logger.info("body {} ", body);
|
|
|
+ String xml = WxCrypt.decrypt(WxXmlUtil.getEncrypt(body));
|
|
|
+ String componentVerifyTicket = WxXmlUtil.getComponentVerifyTicket(xml);
|
|
|
+ WxTicket wxTicket = new WxTicket();
|
|
|
+ wxTicket.setId(1);
|
|
|
+ wxTicket.setTicket(componentVerifyTicket);
|
|
|
+ wxTicket.setUpdateTime(new Date());
|
|
|
+ wxTicketService.updateById(wxTicket);
|
|
|
+ return "success";
|
|
|
+ }
|
|
|
+
|
|
|
@RequestMapping("douyin/code")
|
|
|
@LoginRequired
|
|
|
public RedirectDto douyinQrCode() {
|