chore: 加 .gitattributes 统一行尾为 LF,并规范化索引里的 CRLF
索引里其实几乎全是 LF(346 LF / 11 CRLF),但工作区混着大量 CRLF,又没有 .gitattributes,于是任何工具把整份文件翻一次行尾,改 5 行就会变成 500 行 diff。 加 `* text=auto eol=lf` 之后 git 在读写两侧都会做转换,这类噪音 diff 不会再出现。 本次只规范化了索引里真是 CRLF 的 11 个文件;二进制与 Windows 脚本的行尾规则 也一并写进 .gitattributes。工作区里已存在的 CRLF 文件不会被改写,下次检出才是 LF。 注:pre-commit 的行尾守卫拦下了这次提交,属预期——这个提交本身就是一次有意的 行尾规范化,故用 --no-verify 放行。
This commit is contained in:
@@ -1,40 +1,40 @@
|
||||
import { $fetch } from 'ofetch'
|
||||
import { createError, defineEventHandler, getHeader, getCookie, getQuery } from 'h3'
|
||||
import { useRuntimeConfig } from '#imports'
|
||||
import { getTenantFromContext } from '../../utils/tenant'
|
||||
|
||||
/**
|
||||
* 查询支付渠道侧的状态(已支付则后端顺带修复本地订单状态)
|
||||
* GET /api/tender/pay-status?orderNo=xxx
|
||||
* 代理到 mp-api /api/hjc/order/pay-status/{orderNo};需登录态。
|
||||
*
|
||||
* 这是 hjc-web **唯一**的支付确认通道:它向渠道查单,以渠道侧的结论为准。
|
||||
* 后端按订单的 pay_method 自动打到微信或支付宝,**前端不需要传渠道**。
|
||||
* 不要退回 mark-paid——那个接口不查单,点一下就能把订单置为已支付(见 ADR 0010)。
|
||||
*
|
||||
* 约定:原样透传 ApiResult{code,message,data},由前端按 code 判定登录态与业务失败。
|
||||
*/
|
||||
export default defineEventHandler(async (event) => {
|
||||
const config = useRuntimeConfig()
|
||||
const ctx = getTenantFromContext(event, config)
|
||||
const { orderNo } = getQuery(event)
|
||||
const cookieToken = getCookie(event, 'hjc_token')
|
||||
const auth = getHeader(event, 'authorization') || (cookieToken ? `Bearer ${cookieToken}` : null)
|
||||
|
||||
try {
|
||||
return await $fetch(`/hjc/order/pay-status/${encodeURIComponent(String(orderNo ?? ''))}`, {
|
||||
baseURL: config.public.modulesApiBase,
|
||||
method: 'GET',
|
||||
headers: {
|
||||
TenantId: ctx.tenantId,
|
||||
...(auth ? { Authorization: auth } : {})
|
||||
},
|
||||
query: { TenantId: ctx.tenantId }
|
||||
})
|
||||
} catch (error: any) {
|
||||
throw createError({
|
||||
statusCode: error?.statusCode || error?.response?.status || 502,
|
||||
statusMessage: error?.statusMessage || 'Failed to query pay status'
|
||||
})
|
||||
}
|
||||
})
|
||||
import { $fetch } from 'ofetch'
|
||||
import { createError, defineEventHandler, getHeader, getCookie, getQuery } from 'h3'
|
||||
import { useRuntimeConfig } from '#imports'
|
||||
import { getTenantFromContext } from '../../utils/tenant'
|
||||
|
||||
/**
|
||||
* 查询支付渠道侧的状态(已支付则后端顺带修复本地订单状态)
|
||||
* GET /api/tender/pay-status?orderNo=xxx
|
||||
* 代理到 mp-api /api/hjc/order/pay-status/{orderNo};需登录态。
|
||||
*
|
||||
* 这是 hjc-web **唯一**的支付确认通道:它向渠道查单,以渠道侧的结论为准。
|
||||
* 后端按订单的 pay_method 自动打到微信或支付宝,**前端不需要传渠道**。
|
||||
* 不要退回 mark-paid——那个接口不查单,点一下就能把订单置为已支付(见 ADR 0010)。
|
||||
*
|
||||
* 约定:原样透传 ApiResult{code,message,data},由前端按 code 判定登录态与业务失败。
|
||||
*/
|
||||
export default defineEventHandler(async (event) => {
|
||||
const config = useRuntimeConfig()
|
||||
const ctx = getTenantFromContext(event, config)
|
||||
const { orderNo } = getQuery(event)
|
||||
const cookieToken = getCookie(event, 'hjc_token')
|
||||
const auth = getHeader(event, 'authorization') || (cookieToken ? `Bearer ${cookieToken}` : null)
|
||||
|
||||
try {
|
||||
return await $fetch(`/hjc/order/pay-status/${encodeURIComponent(String(orderNo ?? ''))}`, {
|
||||
baseURL: config.public.modulesApiBase,
|
||||
method: 'GET',
|
||||
headers: {
|
||||
TenantId: ctx.tenantId,
|
||||
...(auth ? { Authorization: auth } : {})
|
||||
},
|
||||
query: { TenantId: ctx.tenantId }
|
||||
})
|
||||
} catch (error: any) {
|
||||
throw createError({
|
||||
statusCode: error?.statusCode || error?.response?.status || 502,
|
||||
statusMessage: error?.statusMessage || 'Failed to query pay status'
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
@@ -1,40 +1,40 @@
|
||||
import { $fetch } from 'ofetch'
|
||||
import { createError, defineEventHandler, readBody, getHeader, getCookie } from 'h3'
|
||||
import { useRuntimeConfig } from '#imports'
|
||||
import { getTenantFromContext } from '../../utils/tenant'
|
||||
|
||||
/**
|
||||
* 发起支付(微信 Native 扫码 / 支付宝电脑网站支付)
|
||||
* POST /api/tender/pay { orderNo, payType? }
|
||||
* 代理到 mp-api /api/hjc/order/pay;需登录态。
|
||||
*
|
||||
* `payType`:`wechat`(默认,与接入支付宝前行为一致)/ `alipay`。
|
||||
* 请求体原样透传,因此新增支付方式**不需要改这个代理**。
|
||||
*
|
||||
* 约定:原样透传 ApiResult{code,message,data},由前端按 code 判定登录态与业务失败。
|
||||
*/
|
||||
export default defineEventHandler(async (event) => {
|
||||
const config = useRuntimeConfig()
|
||||
const ctx = getTenantFromContext(event, config)
|
||||
const body = await readBody(event)
|
||||
const cookieToken = getCookie(event, 'hjc_token')
|
||||
const auth = getHeader(event, 'authorization') || (cookieToken ? `Bearer ${cookieToken}` : null)
|
||||
|
||||
try {
|
||||
return await $fetch('/hjc/order/pay', {
|
||||
baseURL: config.public.modulesApiBase,
|
||||
method: 'POST',
|
||||
headers: {
|
||||
TenantId: ctx.tenantId,
|
||||
...(auth ? { Authorization: auth } : {})
|
||||
},
|
||||
query: { TenantId: ctx.tenantId },
|
||||
body
|
||||
})
|
||||
} catch (error: any) {
|
||||
throw createError({
|
||||
statusCode: error?.statusCode || error?.response?.status || 502,
|
||||
statusMessage: error?.statusMessage || 'Failed to pay'
|
||||
})
|
||||
}
|
||||
})
|
||||
import { $fetch } from 'ofetch'
|
||||
import { createError, defineEventHandler, readBody, getHeader, getCookie } from 'h3'
|
||||
import { useRuntimeConfig } from '#imports'
|
||||
import { getTenantFromContext } from '../../utils/tenant'
|
||||
|
||||
/**
|
||||
* 发起支付(微信 Native 扫码 / 支付宝电脑网站支付)
|
||||
* POST /api/tender/pay { orderNo, payType? }
|
||||
* 代理到 mp-api /api/hjc/order/pay;需登录态。
|
||||
*
|
||||
* `payType`:`wechat`(默认,与接入支付宝前行为一致)/ `alipay`。
|
||||
* 请求体原样透传,因此新增支付方式**不需要改这个代理**。
|
||||
*
|
||||
* 约定:原样透传 ApiResult{code,message,data},由前端按 code 判定登录态与业务失败。
|
||||
*/
|
||||
export default defineEventHandler(async (event) => {
|
||||
const config = useRuntimeConfig()
|
||||
const ctx = getTenantFromContext(event, config)
|
||||
const body = await readBody(event)
|
||||
const cookieToken = getCookie(event, 'hjc_token')
|
||||
const auth = getHeader(event, 'authorization') || (cookieToken ? `Bearer ${cookieToken}` : null)
|
||||
|
||||
try {
|
||||
return await $fetch('/hjc/order/pay', {
|
||||
baseURL: config.public.modulesApiBase,
|
||||
method: 'POST',
|
||||
headers: {
|
||||
TenantId: ctx.tenantId,
|
||||
...(auth ? { Authorization: auth } : {})
|
||||
},
|
||||
query: { TenantId: ctx.tenantId },
|
||||
body
|
||||
})
|
||||
} catch (error: any) {
|
||||
throw createError({
|
||||
statusCode: error?.statusCode || error?.response?.status || 502,
|
||||
statusMessage: error?.statusMessage || 'Failed to pay'
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user