测试微信登录

This commit is contained in:
2022-05-23 14:14:36 +08:00
parent e9d29ef2df
commit 73877d675a
3 changed files with 15 additions and 1 deletions
@@ -29,6 +29,7 @@ import me.chanjar.weixin.common.error.WxErrorException;
import me.chanjar.weixin.cp.api.WxCpService;
import me.chanjar.weixin.cp.bean.WxCpMaJsCode2SessionResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
@@ -65,6 +66,10 @@ public class AuthController {
@Resource
private WxCpService wxCpService;
@Value("${farm_secret}")
private String farmSecret;
@PostMapping("/login")
@ApiOperation("使用账号密码登录")
@OperateLog(enable = false) // 避免 Post 请求被记录操作日志
@@ -77,6 +82,7 @@ public class AuthController {
@PostMapping("/loginByCp")
@ApiOperation("微信小程序登录")
public CommonResult<AuthLoginRespVO> loginByMxApp(String code) throws WxErrorException {
log.info("farmSecret:{}",farmSecret);
// 企业微信登录
CpUserDO cpuser;
if ("zhanyonghui".equals(code)){