Skip to content

Commit

Permalink
feat 平台配置优化和通道认证调试功能
Browse files Browse the repository at this point in the history
  • Loading branch information
xxm1995 committed Sep 25, 2024
1 parent 3bfde81 commit 29029c8
Show file tree
Hide file tree
Showing 14 changed files with 337 additions and 42 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
"@vben/hooks": "workspace:*",
"@vue/shared": "^3.5.8",
"@vueuse/core": "^10.11.1",
"@vueuse/shared": "^10.11.1",
"@zxcvbn-ts/core": "^3.0.4",
"ant-design-vue": "^4.2.5",
"axios": "^1.7.7",
Expand Down
66 changes: 30 additions & 36 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions src/enums/daxpay/ChannelEnum.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,15 @@ export enum NotifyContentTypeEnum {
/** 支付订单变动通知 */
TRANSFER = 'transfer',
}

/**
* 通道认证状态
*/
export enum ChannelAuthStatusEnum {
/** 获取中 */
WAITING = 'waiting',
/** 获取成功 */
SUCCESS = 'success',
/** 数据不存在 */
NOT_EXIST = 'not_exist',
}
10 changes: 9 additions & 1 deletion src/views/daxpay/admin/config/platform/PlatformConfig.api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,14 @@ export function update(data: PlatformConfig) {
* 平台配置
*/
export interface PlatformConfig extends BaseEntity {
// 网关地址
// 网关服务地址
gatewayServiceUrl?: string
// 网关移动端是否为嵌入式
mobileEmbedded?: boolean
// 网关移动端地址
gatewayMobileUrl?: string
// 网关PC端是否为嵌入式
pcEmbedded?: boolean
// 网关PC端地址
gatewayPcUrl?: string
}
39 changes: 35 additions & 4 deletions src/views/daxpay/admin/config/platform/PlatformConfig.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,36 @@
placeholder="请输入网关地址"
/>
</a-form-item>
<a-form-item label="网关H5端部署方式" name="mobileEmbedded">
<a-switch
:disabled="!edit"
checked-children="嵌入"
un-checked-children="独立"
v-model:checked="form.mobileEmbedded"
/>
</a-form-item>
<a-form-item label="网关H5端地址" name="gatewayMobileUrl">
<a-input
:disabled="!edit"
v-model:value="form.gatewayMobileUrl"
placeholder="请输入网关H5端地址"
/>
</a-form-item>
<a-form-item label="网关PC端部署方式" name="pcEmbedded">
<a-switch
:disabled="!edit"
checked-children="嵌入"
un-checked-children="独立"
v-model:checked="form.pcEmbedded"
/>
</a-form-item>
<a-form-item label="网关PC端地址" name="gatewayPcUrl">
<a-input
:disabled="!edit"
v-model:value="form.gatewayPcUrl"
placeholder="请输入网关PC端地址"
/>
</a-form-item>
</a-form>
<div class="flex justify-center">
<a-button v-if="edit" @click="initData">取消</a-button>
Expand All @@ -42,11 +72,12 @@
const { createMessage } = useMessage()
const confirmLoading = ref(false)
const formRef = ref<FormInstance>()
const form = ref<PlatformConfig>({})
const form = ref<PlatformConfig>({
mobileEmbedded: false,
pcEmbedded: false,
})
const edit = ref<boolean>(false)
const rules = {
gatewayServiceUrl: [{ required: true, message: '请输入网关地址' }],
} as Record<string, Rule[]>
const rules = {} as Record<string, Rule[]>
onMounted(() => {
initData()
Expand Down
59 changes: 59 additions & 0 deletions src/views/daxpay/common/develop/auth/ChannelAuth.api.ts
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
}
Loading

0 comments on commit 29029c8

Please sign in to comment.