package com.qianwen.smartman.modules.auth.endpoint;
|
|
import com.github.xiaoymin.knife4j.annotations.ApiSort;
|
import io.swagger.annotations.Api;
|
import io.swagger.annotations.ApiOperation;
|
import com.qianwen.smartman.common.cache.RegionCache;
|
import com.qianwen.core.log.annotation.ApiLog;
|
import com.qianwen.core.tenant.annotation.NonDS;
|
import com.qianwen.core.tool.api.R;
|
import com.qianwen.core.tool.support.Kv;
|
import com.qianwen.smartman.modules.auth.service.OuterAppScanService;
|
import com.qianwen.smartman.modules.sync.service.IDingSyncService;
|
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestParam;
|
import org.springframework.web.bind.annotation.RestController;
|
|
@RequestMapping({"blade-auth"})
|
@Api(value = "第三方应用扫码登录", tags = {"第三方应用扫码登录"})
|
@RestController
|
@NonDS
|
@ApiSort(RegionCache.VILLAGE_LEVEL)
|
public class OuterAppScanEndpoint {
|
private final IDingSyncService dingSyncService;
|
private final OuterAppScanService outerAppScanService;
|
|
public OuterAppScanEndpoint(final IDingSyncService dingSyncService, final OuterAppScanService outerAppScanService) {
|
this.dingSyncService = dingSyncService;
|
this.outerAppScanService = outerAppScanService;
|
}
|
|
@ApiLog("员工钉钉扫码登录回调接口")
|
@GetMapping({"/ding/token"})
|
@ApiOperation(value = "员工钉钉扫码登录回调接口", notes = "传入扫码回调code")
|
public R<Kv> token(@RequestParam("code") String code) {
|
String userId = this.dingSyncService.getDingUserId(code);
|
return this.outerAppScanService.loginByOuterUserId(userId);
|
}
|
|
@ApiLog("员工企业微信扫码登录回调接口")
|
@GetMapping({"/qy-wechat/token"})
|
@ApiOperation(value = "员工企业微信扫码登录回调接口", notes = "传入扫码授权code")
|
public R<Kv> scanLogin(@RequestParam("clientId") String clientId, @RequestParam("code") String authCode) {
|
return this.outerAppScanService.qyScanLogin(clientId, authCode);
|
}
|
}
|