Commit eb03ed87 by 李伟康

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

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