测试微信登录
This commit is contained in:
+8
@@ -4,17 +4,25 @@ import lombok.extern.slf4j.Slf4j;
|
|||||||
import me.chanjar.weixin.cp.api.WxCpService;
|
import me.chanjar.weixin.cp.api.WxCpService;
|
||||||
import me.chanjar.weixin.cp.api.impl.WxCpServiceImpl;
|
import me.chanjar.weixin.cp.api.impl.WxCpServiceImpl;
|
||||||
import me.chanjar.weixin.cp.config.impl.WxCpDefaultConfigImpl;
|
import me.chanjar.weixin.cp.config.impl.WxCpDefaultConfigImpl;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.context.annotation.Scope;
|
||||||
|
|
||||||
@Configuration
|
@Configuration
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class WxCpConfigure {
|
public class WxCpConfigure {
|
||||||
|
|
||||||
|
@Value("${corpId}")
|
||||||
|
private String corpId;
|
||||||
|
private String farmAppid;
|
||||||
|
private String farmSecret;
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
|
@Scope("singleton")
|
||||||
public WxCpService wxCpService(){
|
public WxCpService wxCpService(){
|
||||||
|
|
||||||
|
log.info("333:{}",corpId);
|
||||||
WxCpDefaultConfigImpl config = new WxCpDefaultConfigImpl();
|
WxCpDefaultConfigImpl config = new WxCpDefaultConfigImpl();
|
||||||
|
|
||||||
config.setCorpId("wwb9f9734e8e124761");
|
config.setCorpId("wwb9f9734e8e124761");
|
||||||
|
|||||||
+6
@@ -29,6 +29,7 @@ import me.chanjar.weixin.common.error.WxErrorException;
|
|||||||
import me.chanjar.weixin.cp.api.WxCpService;
|
import me.chanjar.weixin.cp.api.WxCpService;
|
||||||
import me.chanjar.weixin.cp.bean.WxCpMaJsCode2SessionResult;
|
import me.chanjar.weixin.cp.bean.WxCpMaJsCode2SessionResult;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
@@ -65,6 +66,10 @@ public class AuthController {
|
|||||||
@Resource
|
@Resource
|
||||||
private WxCpService wxCpService;
|
private WxCpService wxCpService;
|
||||||
|
|
||||||
|
|
||||||
|
@Value("${farm_secret}")
|
||||||
|
private String farmSecret;
|
||||||
|
|
||||||
@PostMapping("/login")
|
@PostMapping("/login")
|
||||||
@ApiOperation("使用账号密码登录")
|
@ApiOperation("使用账号密码登录")
|
||||||
@OperateLog(enable = false) // 避免 Post 请求被记录操作日志
|
@OperateLog(enable = false) // 避免 Post 请求被记录操作日志
|
||||||
@@ -77,6 +82,7 @@ public class AuthController {
|
|||||||
@PostMapping("/loginByCp")
|
@PostMapping("/loginByCp")
|
||||||
@ApiOperation("微信小程序登录")
|
@ApiOperation("微信小程序登录")
|
||||||
public CommonResult<AuthLoginRespVO> loginByMxApp(String code) throws WxErrorException {
|
public CommonResult<AuthLoginRespVO> loginByMxApp(String code) throws WxErrorException {
|
||||||
|
log.info("farmSecret:{}",farmSecret);
|
||||||
// 企业微信登录
|
// 企业微信登录
|
||||||
CpUserDO cpuser;
|
CpUserDO cpuser;
|
||||||
if ("zhanyonghui".equals(code)){
|
if ("zhanyonghui".equals(code)){
|
||||||
|
|||||||
+1
-1
Submodule yudao-ui-admin updated: 8db432a763...940f54e876
Reference in New Issue
Block a user