chore: 初始开源发布
iotlcm-app:小程序端 + 用户端服务。 - app/:uni-app 小程序前端(基于 unibest,MIT) - 微信 AppID → YOUR_WX_APPID,uni-app AppID → __UNI__YOURAPPID - 内网后端地址 → admin.iotlcm.example.com - 应用标题与 unibest 模板 README 重写(保留上游致谢与 MIT 声明) - server/:GoFrame 用户端服务(基于 XiuAdmin,Apache-2.0) - module xiuadmin → git.5iot.com/iotlcm-public/iotlcm-app(360 文件) - 支付回调地址 → app.iotlcm.example.com,商户名与应用名泛化 - 真实手机号 → 合法 11 位编造号(保留号段前 3 位 + 后 4 位) - 依赖号码尾部的断言同步更新 - 补 server/LICENSE(Apache-2.0) - 移除内部资产:CI 触发器 - 补根 README,LF 行尾 + .gitattributes 已知:TestSysDept_RefreshDeptAncestors 在源仓同一提交上同样失败,属既有缺陷。
This commit is contained in:
@@ -0,0 +1,203 @@
|
||||
import type {
|
||||
AllocateBatchPrepareParams,
|
||||
AllocateBatchRes,
|
||||
AllocateBatchSubmitParams,
|
||||
AllocateTargetListParams,
|
||||
AllocateTargetListRes,
|
||||
BindCardParams,
|
||||
CardLifecycleParams,
|
||||
CardLifecycleRes,
|
||||
CardLifecycleStatusParams,
|
||||
CardListParams,
|
||||
CardListRes,
|
||||
CardRecognitionRes,
|
||||
CardQueryRes,
|
||||
ChangePrepareParams,
|
||||
ChangePrepareRes,
|
||||
ChangeSubmitParams,
|
||||
ChangeSubmitRes,
|
||||
PackageDetailRes,
|
||||
PackageListParams,
|
||||
PackageListRes,
|
||||
PublicPackageDetailParams,
|
||||
PublicQueryCardParams,
|
||||
RenewBatchPrepareParams,
|
||||
RenewBatchSubmitParams,
|
||||
RenewPrepareParams,
|
||||
RenewPrepareRes,
|
||||
RenewSubmitParams,
|
||||
RenewSubmitRes,
|
||||
RestartCardParams,
|
||||
RestartCardRes,
|
||||
} from './types/card'
|
||||
import { http } from '@/http/http'
|
||||
import { getEnvBaseUrl } from '@/utils/index'
|
||||
|
||||
const CARD_REQUEST_OPTIONS = {
|
||||
timeout: 15000,
|
||||
hideErrorToast: true,
|
||||
} as const
|
||||
|
||||
export type {
|
||||
AllocateBatchRes,
|
||||
AllocateTarget,
|
||||
AppCard,
|
||||
AppPackage,
|
||||
AppRenewOption,
|
||||
CardLifecycleRes,
|
||||
ChangePackageOption,
|
||||
ChangePrepareRes,
|
||||
ChangeSubmitRes,
|
||||
RenewPackageOption,
|
||||
RenewPrepareRes,
|
||||
RenewSubmitRes,
|
||||
} from './types/card'
|
||||
|
||||
export function publicQueryCard(data: PublicQueryCardParams) {
|
||||
return http.post<CardQueryRes>('/card/public-query', data, undefined, undefined, CARD_REQUEST_OPTIONS)
|
||||
}
|
||||
|
||||
export function recognizeCardImage(filePath: string) {
|
||||
return new Promise<CardRecognitionRes>((resolve, reject) => {
|
||||
uni.uploadFile({
|
||||
url: `${getEnvBaseUrl()}/card/recognize`,
|
||||
filePath,
|
||||
name: 'file',
|
||||
timeout: 30000,
|
||||
success: (response) => {
|
||||
let payload: { code?: number, message?: string, data?: CardRecognitionRes }
|
||||
try {
|
||||
payload = JSON.parse(String(response.data || '{}'))
|
||||
}
|
||||
catch {
|
||||
reject({ message: '图片识别响应格式错误' })
|
||||
return
|
||||
}
|
||||
|
||||
if (response.statusCode < 200 || response.statusCode >= 300 || Number(payload.code) !== 0) {
|
||||
reject({ message: payload.message || '图片识别失败' })
|
||||
return
|
||||
}
|
||||
resolve(payload.data || {
|
||||
code: 'RECOGNITION_FAILED',
|
||||
message: '图片识别结果为空',
|
||||
cardType: 'iccid',
|
||||
cardValue: '',
|
||||
confidence: 0,
|
||||
candidates: [],
|
||||
})
|
||||
},
|
||||
fail: (error) => {
|
||||
reject({ message: error.errMsg || '图片上传失败,请检查网络后重试' })
|
||||
},
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
export function getCardList(params: CardListParams) {
|
||||
return http.get<CardListRes>('/card/list', params, undefined, CARD_REQUEST_OPTIONS)
|
||||
}
|
||||
|
||||
export function getPackageList(params: PackageListParams) {
|
||||
return http.get<PackageListRes>('/card/package-list', params, undefined, CARD_REQUEST_OPTIONS)
|
||||
}
|
||||
|
||||
export function publicPackageDetail(data: PublicPackageDetailParams) {
|
||||
return http.post<PackageDetailRes>(
|
||||
'/card/public-package-detail',
|
||||
data,
|
||||
undefined,
|
||||
undefined,
|
||||
CARD_REQUEST_OPTIONS,
|
||||
)
|
||||
}
|
||||
|
||||
export function getCardDetail(cardValue: string) {
|
||||
return http.get<CardQueryRes>('/card/detail', { cardValue }, undefined, CARD_REQUEST_OPTIONS)
|
||||
}
|
||||
|
||||
export function bindCard(data: BindCardParams) {
|
||||
return http.post<CardQueryRes>('/card/bind', data, undefined, undefined, CARD_REQUEST_OPTIONS)
|
||||
}
|
||||
|
||||
export function restartCard(data: RestartCardParams) {
|
||||
return http.post<RestartCardRes>('/card/restart', data, undefined, undefined, CARD_REQUEST_OPTIONS)
|
||||
}
|
||||
|
||||
export function stopCard(data: RestartCardParams) {
|
||||
return http.post<CardLifecycleRes>('/card/stop', data, undefined, undefined, CARD_REQUEST_OPTIONS)
|
||||
}
|
||||
|
||||
export function startCard(data: RestartCardParams) {
|
||||
return http.post<CardLifecycleRes>('/card/start', data, undefined, undefined, CARD_REQUEST_OPTIONS)
|
||||
}
|
||||
|
||||
export function startDataService(data: RestartCardParams) {
|
||||
return lifecycleBatchSubmit({ cardValue: data.cardValue, operation: 'dataStart', remark: data.remark })
|
||||
}
|
||||
|
||||
export function stopDataService(data: RestartCardParams) {
|
||||
return lifecycleBatchSubmit({ cardValue: data.cardValue, operation: 'dataStop', remark: data.remark })
|
||||
}
|
||||
|
||||
export function lifecycleBatchSubmit(data: CardLifecycleParams) {
|
||||
return http.post<CardLifecycleRes>(
|
||||
'/card/lifecycle-batch-submit',
|
||||
data,
|
||||
undefined,
|
||||
undefined,
|
||||
CARD_REQUEST_OPTIONS,
|
||||
)
|
||||
}
|
||||
|
||||
export function lifecycleBatchStatus(data: CardLifecycleStatusParams) {
|
||||
return http.get<CardLifecycleRes>('/card/lifecycle-batch-status', data, undefined, CARD_REQUEST_OPTIONS)
|
||||
}
|
||||
|
||||
export function renewPrepare(data: RenewPrepareParams) {
|
||||
return http.post<RenewPrepareRes>('/card/renew-prepare', data, undefined, undefined, CARD_REQUEST_OPTIONS)
|
||||
}
|
||||
|
||||
export function renewBatchPrepare(data: RenewBatchPrepareParams) {
|
||||
return http.post<RenewPrepareRes>('/card/renew-batch-prepare', data, undefined, undefined, CARD_REQUEST_OPTIONS)
|
||||
}
|
||||
|
||||
export function renewSubmit(data: RenewSubmitParams) {
|
||||
return http.post<RenewSubmitRes>('/card/renew-submit', data, undefined, undefined, CARD_REQUEST_OPTIONS)
|
||||
}
|
||||
|
||||
export function renewBatchSubmit(data: RenewBatchSubmitParams) {
|
||||
return http.post<RenewSubmitRes>('/card/renew-batch-submit', data, undefined, undefined, CARD_REQUEST_OPTIONS)
|
||||
}
|
||||
|
||||
export function getAllocateTargets(params: AllocateTargetListParams) {
|
||||
return http.get<AllocateTargetListRes>('/card/allocate-targets', params, undefined, CARD_REQUEST_OPTIONS)
|
||||
}
|
||||
|
||||
export function allocateBatchPrepare(data: AllocateBatchPrepareParams) {
|
||||
return http.post<AllocateBatchRes>(
|
||||
'/card/allocate-batch-prepare',
|
||||
data,
|
||||
undefined,
|
||||
undefined,
|
||||
CARD_REQUEST_OPTIONS,
|
||||
)
|
||||
}
|
||||
|
||||
export function allocateBatchSubmit(data: AllocateBatchSubmitParams) {
|
||||
return http.post<AllocateBatchRes>(
|
||||
'/card/allocate-batch-submit',
|
||||
data,
|
||||
undefined,
|
||||
undefined,
|
||||
CARD_REQUEST_OPTIONS,
|
||||
)
|
||||
}
|
||||
|
||||
export function changePrepare(data: ChangePrepareParams) {
|
||||
return http.post<ChangePrepareRes>('/card/change-prepare', data, undefined, undefined, CARD_REQUEST_OPTIONS)
|
||||
}
|
||||
|
||||
export function changeSubmit(data: ChangeSubmitParams) {
|
||||
return http.post<ChangeSubmitRes>('/card/change-submit', data, undefined, undefined, CARD_REQUEST_OPTIONS)
|
||||
}
|
||||
Reference in New Issue
Block a user