Commit eb03ed87 by 李伟康

fix(database): 修复数据库路径配置问题

- 修正了sqlite数据库路径设置,使用_doc作为存储目录
- 更新了数据库文件路径格式为_doc/{name}.db
- 注释了原有的路径获取逻辑避免重复初始化
- 移除了冗余的路径配置代码
1 parent 0820532f
...@@ -10,7 +10,7 @@ class SQLite { ...@@ -10,7 +10,7 @@ class SQLite {
this.size = size || 50 * 1024 * 1024 // 50MB this.size = size || 50 * 1024 * 1024 // 50MB
this.db = null this.db = null
//注意: //注意:
this.dbPath = null // 存储数据库的完整路径 this.dbPath = `_doc/${name}.db` // 存储数据库的完整路径
// 初始化该数据库的队列(如果不存在) // 初始化该数据库的队列(如果不存在)
if (!SQLite._queues[name]) { if (!SQLite._queues[name]) {
SQLite._queues[name] = new TaskQueue(`SQLite:${name}`) SQLite._queues[name] = new TaskQueue(`SQLite:${name}`)
...@@ -25,15 +25,15 @@ class SQLite { ...@@ -25,15 +25,15 @@ class SQLite {
async init() { async init() {
// 如果已经有路径,直接使用 // 如果已经有路径,直接使用
if (this.dbPath) { // if (this.dbPath) {
uni.$logger?.local?.info(`[SQLite] 使用已有路径: ${this.dbPath}`) uni.$logger?.local?.info(`[SQLite] 使用已有路径: ${this.dbPath}`)
return this.openDatabase() return this.openDatabase()
} // }
// 获取当前文档目录路径 // 获取当前文档目录路径
const rootPath = await PathUtils.getFilePath() // const rootPath = await PathUtils.getFilePath()
this.dbPath = `${rootPath}${this.name}.db` // this.dbPath = `${rootPath}${this.name}.db`
uni.$logger?.local?.info(`[SQLite] 数据库路径已确定: ${this.dbPath}`) // uni.$logger?.local?.info(`[SQLite] 数据库路径已确定: ${this.dbPath}`)
return this.openDatabase() // return this.openDatabase()
} }
/** /**
......
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
"name" : "展业助手", "name" : "展业助手",
"appid" : "__UNI__D3BD3DF", "appid" : "__UNI__D3BD3DF",
"description" : "", "description" : "",
"versionName" : "2.22.1", "versionName" : "2.22.2",
"versionCode" : 2221, "versionCode" : 2222,
"transformPx" : false, "transformPx" : false,
"sassImplementationName" : "node-sass", "sassImplementationName" : "node-sass",
/* 5+App特有相关 */ /* 5+App特有相关 */
......
...@@ -40,6 +40,9 @@ export default { ...@@ -40,6 +40,9 @@ export default {
// 代理权限检查 // 代理权限检查
async isPermission(hintText) { async isPermission(hintText) {
return await this.recordService.isPermission(hintText) return await this.recordService.isPermission(hintText)
},
updateCustomerInfo(data){
this.recordService.updateCustomerInfo(data)
} }
} }
} }
...@@ -273,11 +273,11 @@ export default { ...@@ -273,11 +273,11 @@ export default {
this.customerInfo = Object.assign(this.customerInfo, newval) this.customerInfo = Object.assign(this.customerInfo, newval)
if (newval.carModel) { if (newval.carModel) {
this.pageParams.carInfo = { this.pageParams.carInfo = {
carChildsBrandId: newval.carChildsBrandId, carChildsBrandId: newval.carBrandId,
carChildsBrandName: newval.carChildsBrandName, carChildsBrandName: newval.carBrand,
carBrandId: newval.carBrandId, carBrandId: newval.oneCarBrandId,
carBrand: newval.carBrand, carBrand: newval.oneCarBrand,
id: newval.carSeriesId, id: newval.carModelId,
name: newval.carModel name: newval.carModel
} }
} }
......
...@@ -340,6 +340,7 @@ export default { ...@@ -340,6 +340,7 @@ export default {
this.customerType = -1 this.customerType = -1
this.clearHistory(); this.clearHistory();
this.recording = false this.recording = false
this.setReceptionStatus(-1);
this.$refs.home.$refs.leftBox.getMessageInfo() this.$refs.home.$refs.leftBox.getMessageInfo()
if (this.requested) this.$refs.home.updateApp() if (this.requested) this.$refs.home.updateApp()
this.getBoutiquePackageList() //套餐列表 this.getBoutiquePackageList() //套餐列表
...@@ -381,10 +382,13 @@ export default { ...@@ -381,10 +382,13 @@ export default {
this.jumpPage(id) this.jumpPage(id)
} }
else this.jumpPage() else this.jumpPage()
setTimeout(() => {
this.setReceptionStatus(1);
}, 1000);
}, },
done (e) { async done (e) {
this.$refs.home.finishRef.close(); this.$refs.home.finishRef.close();
if (this.recording) this.$refs.home.stopAudio(); if (this.recording) await this.$refs.home.stopAudio();
this.recording = false this.recording = false
setTimeout(() => { setTimeout(() => {
this.id = ""; this.id = "";
...@@ -392,10 +396,10 @@ export default { ...@@ -392,10 +396,10 @@ export default {
this.currentCarId = '' this.currentCarId = ''
this.bannerAutoplay = true this.bannerAutoplay = true
this.customerType = -1 this.customerType = -1
this.setReceptionStatus(e);
this.$store.dispatch("clearHistory") this.$store.dispatch("clearHistory")
this.$store.dispatch('clearReceptionTrack') this.$store.dispatch('clearReceptionTrack')
this.getBoutiquePackageList() //套餐列表 this.getBoutiquePackageList() //套餐列表
this.setReceptionStatus(-1);
}, 1500); }, 1500);
}, },
/**客户邀约接待 */ /**客户邀约接待 */
...@@ -409,6 +413,8 @@ export default { ...@@ -409,6 +413,8 @@ export default {
} //开始接待 } //开始接待
this.customerType = 0 this.customerType = 0
this.jumpPage() this.jumpPage()
uni.$logger.local.info('index-reception:回店客户〗 == ' + JSON.stringify(customer))
this.$refs.home.updateCustomerInfo(customer)
this.$nextTick(() => this.$store.dispatch('setCustomerInfo', customer)) this.$nextTick(() => this.$store.dispatch('setCustomerInfo', customer))
let { carBannerList } = this, let { carBannerList } = this,
currentCarId = '', currentCarId = '',
......
/* /*
* @Description: * @Description:
* @Author: huyue * @Author: huyue
* @Date: 2024-04-07 18:15:11 * @Date: 2024-04-07 18:15:11
* @LastEditors: limin * @LastEditors: limin
* @LastEditTime: 2025-01-03 21:26:31 * @LastEditTime: 2025-01-03 21:26:31
*/ */
// import { setToken, getToken, removeToken } from '@/utils/token';; // import { setToken, getToken, removeToken } from '@/utils/token';;
import utils from '@/utils/utils' import utils from '@/utils/utils'
// const recorderManager = uni.getRecorderManager(); // const recorderManager = uni.getRecorderManager();
export default { export default {
namespaced: true, namespaced: true,
state() { state() {
return { return {
booksList: [], booksList: [],
audioList: [], audioList: [],
receptionStatus: '', receptionStatus: '',
endReasonType: 0, endReasonType: 0,
perRecordNumber: 0, perRecordNumber: 0,
audioInfo: { audioInfo: {
audioStatus: '', audioStatus: '',
endReasonType: 0, endReasonType: 0,
receptionStartTime: '', receptionStartTime: '',
receptionEndTime: '' receptionEndTime: ''
} }
} }
}, },
mutations: { mutations: {
setAudioInfo(state, data) { setAudioInfo(state, data) {
if (data.audioStatus == 'start') { if (data.audioStatus == 'start') {
data.receptionStartTime = utils.convertDateTimeFormat(new Date(), '/') data.receptionStartTime = utils.convertDateTimeFormat(new Date(), '/')
data.receptionEndTime = '' data.receptionEndTime = ''
} }
if (data.audioStatus == 'end') { if (data.audioStatus == 'end') {
data.receptionEndTime = utils.convertDateTimeFormat(new Date(), '/') data.receptionEndTime = utils.convertDateTimeFormat(new Date(), '/')
} }
state.audioInfo = Object.assign(state.audioInfo, data) state.audioInfo = Object.assign(state.audioInfo, data)
}, },
setReceptionStatus(state, data) { setReceptionStatus(state, data) {
state.receptionStatus = data console.log(data,'===')
}, state.receptionStatus = data
setAudioList(state, data) { },
state.audioList = data setAudioList(state, data) {
}, state.audioList = data
setBooks(state, data) { },
state.booksList = data setBooks(state, data) {
}, state.booksList = data
setPerRecordNumber(state, data) { },
state.perRecordNumber = data setPerRecordNumber(state, data) {
} state.perRecordNumber = data
}, }
actions: { },
setPerRecordNumber({ commit }, value) { actions: {
commit('setPerRecordNumber', value) setPerRecordNumber({ commit }, value) {
} commit('setPerRecordNumber', value)
// startAudio({ commit, state, dispatch }) { }
// if (state.isStart) return; // startAudio({ commit, state, dispatch }) {
// commit("setAudioStart", true); // if (state.isStart) return;
// commit("setAudioList", []); // commit("setAudioStart", true);
// commit("setAudioEnd", false); // commit("setAudioList", []);
// recorderManager.start({ // commit("setAudioEnd", false);
// duration: 20000, // recorderManager.start({
// }); // duration: 20000,
// recorderManager.onStop(async (res) => { // });
// console.log("结束录音"); // recorderManager.onStop(async (res) => {
// console.log(state.isEnd, "this.isEnd"); // console.log("结束录音");
// if (!state.isEnd) { // console.log(state.isEnd, "this.isEnd");
// uni.getRecorderManager().start({ // if (!state.isEnd) {
// duration: 20000, // uni.getRecorderManager().start({
// }); // duration: 20000,
// } // });
// const result = await upload(res.tempFilePath); // }
// const storageFile = [...state.audioList, result]; // const result = await upload(res.tempFilePath);
// uni.$storage.set("storageFile", storageFile); // const storageFile = [...state.audioList, result];
// commit("setAudioList", storageFile); // uni.$storage.set("storageFile", storageFile);
// if (state.isEnd) { // commit("setAudioList", storageFile);
// console.log("上传语音"); // if (state.isEnd) {
// dispatch("uploadVoice", storageFile); // console.log("上传语音");
// } // dispatch("uploadVoice", storageFile);
// return true; // }
// }); // return true;
// }, // });
// stopAudio({ commit, state }) { // },
// commit("setAudioStart", false); // stopAudio({ commit, state }) {
// commit("setAudioEnd", true); // commit("setAudioStart", false);
// recorderManager.stop(); // commit("setAudioEnd", true);
// }, // recorderManager.stop();
// async uploadVoice({ commit, state }, tempFilePath) { // },
// const { shopMerchantId, phone } = uni.$storage.get("userInfo"), // async uploadVoice({ commit, state }, tempFilePath) {
// { customerName, phoneNumber, salesUuid, carModel } = // const { shopMerchantId, phone } = uni.$storage.get("userInfo"),
// store.state.user.customerInfo, // { customerName, phoneNumber, salesUuid, carModel } =
// receptionCustomerPaySourceList = state.booksList.map((item) => { // store.state.user.customerInfo,
// return { // receptionCustomerPaySourceList = state.booksList.map((item) => {
// id: item.id, // return {
// sourceType: item.id, // id: item.id,
// sourceUrl: item.imgUrl, // sourceType: item.id,
// }; // sourceUrl: item.imgUrl,
// }), // };
// params = { // }),
// carModel, // params = {
// endReasonType: state.endReasonType, //原因 1.异常 0.正常 // carModel,
// customerName, // endReasonType: state.endReasonType, //原因 1.异常 0.正常
// phoneNumber, // customerName,
// loginPhone: phone, // phoneNumber,
// salesUuid, // loginPhone: phone,
// receptionStatus: state.receptionStatus, //接待结果 1.成交 0.战败 // salesUuid,
// recordUrlList: tempFilePath, // receptionStatus: state.receptionStatus, //接待结果 1.成交 0.战败
// receptionStartTime: state.receptionStartTime, // recordUrlList: tempFilePath,
// receptionEndTime: state.receptionEndTime, // receptionStartTime: state.receptionStartTime,
// receptionCustomerPaySourceList, //1.付款凭证文件路径 2.客户购车发票文件路径 3.客户延保合同文件路径 // receptionEndTime: state.receptionEndTime,
// merchantId: shopMerchantId, // receptionCustomerPaySourceList, //1.付款凭证文件路径 2.客户购车发票文件路径 3.客户延保合同文件路径
// }; // merchantId: shopMerchantId,
// commit("setBooks", []); // };
// console.log(params); // commit("setBooks", []);
// if (customerName && phoneNumber && salesUuid && carModel) // console.log(params);
// uni.$api.commonApi.saveRecCustomer(params).then((res) => { // if (customerName && phoneNumber && salesUuid && carModel)
// console.log(res); // uni.$api.commonApi.saveRecCustomer(params).then((res) => {
// }); // console.log(res);
// store.dispatch("clearCustomerInfo"); // });
// commit("setReceptionStatus", 1); // store.dispatch("clearCustomerInfo");
// commit("setReceptionStatus", 0); // commit("setReceptionStatus", 1);
// uni.$storage.set("storageFile", ""); // commit("setReceptionStatus", 0);
// }, // uni.$storage.set("storageFile", "");
} // },
} }
}
...@@ -337,7 +337,7 @@ class RecordSaveService { ...@@ -337,7 +337,7 @@ class RecordSaveService {
async _saveOrUpdate(data) { async _saveOrUpdate(data) {
uni.$logger.local.info(`【接待记录保存服务】 == 开始保存或更新接待记录!!`) uni.$logger.local.info(`【接待记录保存服务】 == 开始保存或更新接待记录!!`)
const { status, tempFilePath, receptionStatus, ...record } = data const { status, tempFilePath, recordStatus, ...record } = data
const fileList = Array.isArray(record.recordUrlList) ? record.recordUrlList : [] const fileList = Array.isArray(record.recordUrlList) ? record.recordUrlList : []
const isAllCompleted = status === FileStatus.NoFile || fileList.every(i => [FileStatus.Uploaded, FileStatus.Completed].includes(i.status)) const isAllCompleted = status === FileStatus.NoFile || fileList.every(i => [FileStatus.Uploaded, FileStatus.Completed].includes(i.status))
if (isAllCompleted) { if (isAllCompleted) {
......
...@@ -333,6 +333,7 @@ class RecordService { ...@@ -333,6 +333,7 @@ class RecordService {
} }
updateReceptionStatus(status) { updateReceptionStatus(status) {
console.log('updateReceptionStatus', status)
this.record.updatePreRecords({ receptionStatus: status }) this.record.updatePreRecords({ receptionStatus: status })
} }
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* @FilePath: \gl_tape\utils\recordManager\TimeoutService.js * @FilePath: \gl_tape\utils\recordManager\TimeoutService.js
*/ */
class TimeoutService { class TimeoutService {
TIMEOUT = 720000// 40分钟 TIMEOUT = 40// 40分钟
Miniute = 60 * 1000 Miniute = 60 * 1000
TIMER_DURATION = this.TIMEOUT * this.Miniute TIMER_DURATION = this.TIMEOUT * this.Miniute
CHECK_INTERVAL = 1 * this.Miniute // 1分钟检查一次 CHECK_INTERVAL = 1 * this.Miniute // 1分钟检查一次
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!