Files
hhrs/common/http.api.js
T
jacobxu666 e836fb33c8 refactor: 登录改用 hhrs 专属接口地址,并收紧成功判定防假成功
1. http.api.js 登录/验证码地址切到 open-api/hhService/login、open-api/hhService/sendLoginVerifyCode(后端保留 /pingXiang 旧地址转发,旧包不受影响;新包需后端先部署)

2. isBizOk 收紧:无业务码时额外排除网关把 404/错误页包成 HTTP 200 的情况(实测未部署的新地址会返回 {data:{status:404,error:'Not Found'}} 且 errcode=0),避免又被判成成功

验证:7 组判定用例全通过(含 404 包 200、旧后端无 accessToken 等边界);HBuilderX 编译成功;浏览器实测新地址未部署时提示“登录失败”且不写入登录态,其余页面正常、无 JS 错误。
2026-09-15 10:24:50 +08:00

77 lines
3.0 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// xuchao: 怀化人社 H5 接口清单,与 docs/hhrs-api-doc.md 一一对应
// 基址由 common/http.interceptor.js 统一注入(common/config.js.baseUrl)
// 登录 / 云闪付入口
// xuchao: hhrs 专属登录端点(旧地址 open-api/pingXiang/* 由后端兼容层转发,已弃用)
const LoginUrl = 'open-api/hhService/login'
const SendVerifyCodeUrl = 'open-api/hhService/sendLoginVerifyCode'
const TokenDecodeUrl = 'open-api/hhService/tokenDecode'
// 门店(文旅场馆 typeId=1 / 商户折扣 typeId=2)
const StoreListUrl = 'mp-api/hhrsStore/list'
const StoreDetailUrl = 'mp-api/hhrsStore/detail'
// 权益包
const RightsListUrl = 'mp-api/hhrsRights/list'
const RightsDetailUrl = 'mp-api/hhrsRights/detail'
const EligibilityUrl = 'mp-api/hhrsRights/eligibility'
const AppointmentListUrl = 'mp-api/hhrsRights/appointment/list'
const CheckListUrl = 'mp-api/hhrsRights/check/list'
// 实名人脸认证(阿里云)
const InitFaceVerifyUrl = 'open-api/aliyun/face/initFaceVerify'
const DescribeFaceVerifyUrl = 'open-api/aliyun/face/describeFaceVerify'
// 中奖公示
const WinnerDatesUrl = 'mp-api/hhrsWinner/dates'
const WinnerListUrl = 'mp-api/hhrsWinner/list'
// 预约下单(智慧游卡包)
const AppointUrl = 'zhy-api/cardBag/appoint'
// 此处第二个参数vm,就是我们在页面使用的this
const install = (Vue, vm) => {
// 登录与凭证
const checkerLogin = (params = {}) => vm.$u.post(LoginUrl, params)
const sendLoginVerifyCode = (params = {}) => vm.$u.post(SendVerifyCodeUrl, params)
// xuchao: 云闪付入口 token 解码
const tokenDecode = (params = {}) => vm.$u.post(TokenDecodeUrl, params)
// 门店列表/详情
const getStoreList = (params = {}) => vm.$u.post(StoreListUrl, params)
const getStoreDetail = (params = {}) => vm.$u.post(StoreDetailUrl, params)
// 权益包
const getRightsList = (params = {}) => vm.$u.post(RightsListUrl, params)
const getRightsDetail = (params = {}) => vm.$u.post(RightsDetailUrl, params)
// xuchao: 注意 identityNo 会触发后端“被动认证”回写,仅在认证流程中传
const getEligibility = (params = {}) => vm.$u.post(EligibilityUrl, params)
const getAppointmentList = (params = {}) => vm.$u.post(AppointmentListUrl, params)
const getCheckList = (params = {}) => vm.$u.post(CheckListUrl, params)
const doAppoint = (params = {}) => vm.$u.post(AppointUrl, params)
// 人脸核身
const initFaceVerify = (params = {}) => vm.$u.post(InitFaceVerifyUrl, params)
const describeFaceVerify = (params = {}) => vm.$u.post(DescribeFaceVerifyUrl, params)
// 中奖名单
const getWinnerDates = (params = {}) => vm.$u.get(WinnerDatesUrl, params)
const getWinnerList = (params = {}) => vm.$u.post(WinnerListUrl, params)
vm.$u.api = {
checkerLogin,
sendLoginVerifyCode,
tokenDecode,
getStoreList,
getStoreDetail,
getRightsList,
getRightsDetail,
getEligibility,
getAppointmentList,
getCheckList,
doAppoint,
initFaceVerify,
describeFaceVerify,
getWinnerDates,
getWinnerList
}
}
export default {
install
}