移动端回调
This commit is contained in:
@@ -31,7 +31,7 @@ class AuthController extends BaseController
|
|||||||
public function feishuScope(Request $request)
|
public function feishuScope(Request $request)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$result = (new AuthService())->feishuAuthorize($request->corp_abbr, $request->system_code);
|
$result = (new AuthService())->feishuAuthorize($request->corp_abbr, $request->system_code, $request->is_mob);
|
||||||
return $this->success($result);
|
return $this->success($result);
|
||||||
} catch (\Throwable $e) {
|
} catch (\Throwable $e) {
|
||||||
return $this->error($e->getMessage());
|
return $this->error($e->getMessage());
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ class CorpFeishuApp extends Model
|
|||||||
/**
|
/**
|
||||||
* 允许自动填充模型字段
|
* 允许自动填充模型字段
|
||||||
*/
|
*/
|
||||||
protected $fillable = ['id', 'corp_id', 'system_id', 'name', 'tenant_key', 'app_id', 'app_secret', 'base_uri', 'r_url', 'scopes', 'state', 'sort', 'status', 'created_at', 'updated_at'];
|
protected $fillable = ['id', 'corp_id', 'system_id', 'name', 'tenant_key', 'app_id', 'app_secret', 'base_uri', 'm_url', 'r_url', 'scopes', 'state', 'sort', 'status', 'created_at', 'updated_at'];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 不允许自动填充模型字段
|
* 不允许自动填充模型字段
|
||||||
|
|||||||
@@ -13,12 +13,12 @@ class AuthService
|
|||||||
/**
|
/**
|
||||||
* 飞书授权
|
* 飞书授权
|
||||||
*/
|
*/
|
||||||
public function feishuAuthorize(string $corpAbbr, string $systemCcode)
|
public function feishuAuthorize(string $corpAbbr, string $systemCcode, $mobile)
|
||||||
{
|
{
|
||||||
$logic = new AuthLogic();
|
$logic = new AuthLogic();
|
||||||
$certificate = $logic->feishuAppInfo($corpAbbr, $systemCcode);
|
$certificate = $logic->feishuAppInfo($corpAbbr, $systemCcode);
|
||||||
$feishu = new Feishu($certificate['app_id'], $certificate['app_secret'], $certificate['abbr']);
|
$feishu = new Feishu($certificate['app_id'], $certificate['app_secret'], $certificate['abbr']);
|
||||||
return ['auth_url' => $feishu->authorize($certificate)];
|
return ['auth_url' => $feishu->authorize($certificate, $mobile)];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -91,11 +91,11 @@ class Feishu
|
|||||||
/**
|
/**
|
||||||
* 授权
|
* 授权
|
||||||
*/
|
*/
|
||||||
public function authorize($certificate, $url = 'authen/v1/authorize')
|
public function authorize($certificate,$mobile, $url = 'authen/v1/authorize')
|
||||||
{
|
{
|
||||||
$arr = [
|
$arr = [
|
||||||
'app_id' => $certificate['app_id'],
|
'app_id' => $certificate['app_id'],
|
||||||
'redirect_uri' => $certificate['r_url'],
|
'redirect_uri' => $mobile == 1 ? $certificate['m_url'] : $certificate['r_url'],
|
||||||
'scope' => $certificate['scope'],
|
'scope' => $certificate['scope'],
|
||||||
'state' => $certificate['state']
|
'state' => $certificate['state']
|
||||||
];
|
];
|
||||||
|
|||||||
Reference in New Issue
Block a user