-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
337 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
import { defHttp } from '@/utils/http/axios' | ||
import { Result } from '#/axios' | ||
import { MchEntity } from '#/web' | ||
|
||
/** | ||
* 获取授权链接 | ||
*/ | ||
export function generateAuthUrl(params: GenerateAuthUrlParam) { | ||
return defHttp.post<Result<AuthUrlResult>>({ | ||
url: '/assist/channel/auth/generateAuthUrl', | ||
data: params, | ||
}) | ||
} | ||
|
||
/** | ||
* 通过查询码获取认证结果 | ||
*/ | ||
export function queryAuthResult(queryCode) { | ||
return defHttp.get<Result<AuthResult>>({ | ||
url: '/assist/channel/auth/queryAuthResult', | ||
params: { | ||
queryCode, | ||
}, | ||
}) | ||
} | ||
|
||
/** | ||
* 授权链接和查询标识返回类 | ||
*/ | ||
export interface AuthUrlResult { | ||
// 授权链接 | ||
authUrl?: string | ||
// 查询标识 | ||
queryCode?: boolean | ||
} | ||
|
||
/** | ||
* 生成授权链接参数 | ||
*/ | ||
export interface GenerateAuthUrlParam extends MchEntity { | ||
// 通道 | ||
channel?: string | ||
// 自定义授权重定向地址 | ||
authRedirectUrl?: string | ||
} | ||
|
||
/** | ||
* 认证结果 | ||
*/ | ||
export interface AuthResult { | ||
// OpenId | ||
openId?: string | ||
// 用户ID | ||
userId?: string | ||
// AccessToken | ||
accessToken?: string | ||
// 状态 | ||
status?: string | ||
} |
Oops, something went wrong.