feat: 修复环境的问题

This commit is contained in:
2026-01-06 11:46:15 +08:00
parent ae2fb40d72
commit 972c777177
8 changed files with 44 additions and 12 deletions

View File

@@ -1,5 +1,5 @@
{
"appid": "wx23f86d809ae80259",
"appid": "wx5e79df5996572539",
"compileType": "miniprogram",
"libVersion": "3.8.10",
"packOptions": {

View File

@@ -200,6 +200,7 @@ function main() {
console.log("\n🎉 所有文件更新完成!");
console.log(`💡 已切换到 ${CLIENT_CONFIGS[clientName].name} 客户端配置`);
console.log("💡 提示: 请检查文件内容确认更新正确");
console.log("\n💡 版本升级: 请到request/api/config.js文件中更新versionValue版本号\n");
} else {
console.log("\n❌ 部分文件更新失败,请检查错误信息");
process.exit(1);

View File

@@ -5,11 +5,14 @@ import { refreshToken } from "@/hooks/useGoLogin";
import { getAccessToken } from "@/constant/token";
onLaunch(async () => {
await getEvnUrl({ versionValue: "1.0.3" });
/// 获取环境配置
await getEvnUrl();
/// 获取token
const token = getAccessToken();
if (token) {
/// 刷新token
refreshToken();
}
});
@@ -21,6 +24,7 @@ onShow(() => {
onHide(() => {
console.log("App Hide");
});
</script>
<style lang="scss">

View File

@@ -12,7 +12,7 @@ import rawConfigs from '../../client-configs.json' with { type: 'json' };
export const CLIENT_CONFIGS = rawConfigs;
// 获取当前用户端配置
export const getCurrentConfig = () => CLIENT_CONFIGS.duohua;
export const getCurrentConfig = () => CLIENT_CONFIGS.zhinian;
export const clientId = getCurrentConfig().clientId;
export const appId = getCurrentConfig().appId;
@@ -42,4 +42,4 @@ export const currentClientType = () => {
};
// 环境配置 - 智念客户端使用测试环境,其他客户端使用生产环境
export const isProd = currentClientType() !== ClientType.ZHINIAN;
export const isZhiNian = currentClientType() === ClientType.ZHINIAN;

View File

@@ -60,7 +60,7 @@
wx23f86d809ae80259
*/
"mp-weixin": {
"appid": "wx23f86d809ae80259",
"appid": "wx5e79df5996572539",
"setting": {
"urlCheck": false,
"minified": true

View File

@@ -1,10 +1,25 @@
import request from "../base/request";
import { isProd } from "@/constant/base";
import { isZhiNian } from "@/constant/base";
import { useAppStore } from "@/store";
import { devUrl, proUrl, wssDevUrl } from "../base/baseUrl";
/// 版本号, 每次发版本前增加
const versionValue = "1.0.3";
// 获取服务地址
const getEvnUrl = async (args) => {
const res = await request.post("https://biz.nianxx.cn/hotelBiz/mainScene/getServiceUrl", args)
const getEvnUrl = async () => {
/// 智念客户端不需要获取环境地址
if (isZhiNian) {
const appStore = useAppStore();
appStore.setServerConfig({
baseUrl: devUrl, // 服务器基础地址
wssUrl: wssDevUrl, // 服务器wss地址
});
return;
}
const apiUrl = proUrl + "/hotelBiz/mainScene/getServiceUrl";
const res = await request.post(apiUrl, { versionValue: versionValue });
if (res && res.code == 0 && res.data) {
const appStore = useAppStore();
appStore.setServerConfig(res.data);

View File

@@ -1 +1,12 @@
/// 生产环境基础地址
export const proUrl = "https://biz.nianxx.cn";
/// 生产环境服务器wss地址
export const wssProUrl = "wss://biz.nianxx.cn/ingress/agent/ws/chat";
/// 服务器基础地址
export const devUrl = "https://onefeel.brother7.cn/ingress";
/// 测试服务器wss地址
export const wssDevUrl = "wss://onefeel.brother7.cn/ingress/agent/ws/chat";

View File

@@ -1,4 +1,5 @@
import { defineStore } from "pinia";
import { devUrl, wssDevUrl } from "../../request/base/baseUrl";
export const useAppStore = defineStore("app", {
state() {
@@ -6,10 +7,10 @@ export const useAppStore = defineStore("app", {
title: "",
sceneId: "", // 分身场景id
previewImageData: [], // 预览图片数据
serverConfig: {
baseUrl: "https://onefeel.brother7.cn/ingress", // 服务器基础地址
wssUrl: "wss://onefeel.brother7.cn/ingress/agent/ws/chat", // 服务器ws地址
}, // 服务器配置
serverConfig: { // 服务器配置
baseUrl: devUrl, // 服务器基础地址
wssUrl: wssDevUrl, // 服务器ws地址
},
};
},
getters: {},