fix: 删除前端重复保存记录的代码
- 后端BaZiController已经保存记录,前端不需要再保存 - 删除result.vue中的saveRecord方法和调用 - 解决记录重复保存的问题
This commit is contained in:
1 parent
35ad04eca3
commit
c85c819008
1 file changed
-23
@@ -213,7 +213,6 @@ export default {
|
||||
const app = getApp()
|
||||
if (app.globalData && app.globalData.baziResult) {
|
||||
this.result = app.globalData.baziResult
|
||||
this.saveRecord()
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: '未获取到排盘数据',
|
||||
@@ -245,28 +244,6 @@ export default {
|
||||
return this.result.baZiKongWang[index]
|
||||
}
|
||||
return '-'
|
||||
},
|
||||
async saveRecord() {
|
||||
try {
|
||||
let sexNum = 1
|
||||
if (this.result.sex === '女' || this.result.sex === 0 || this.result.sex === '0') {
|
||||
sexNum = 0
|
||||
}
|
||||
await api.recordApi.save({
|
||||
type: 'bazi',
|
||||
name: this.result.name || '某人',
|
||||
sex: sexNum,
|
||||
inputDate: this.result.solar,
|
||||
inputData: JSON.stringify({
|
||||
date: this.result.solar,
|
||||
sex: this.result.sex
|
||||
}),
|
||||
resultData: JSON.stringify(this.result),
|
||||
aiAnalysis: this.result.aiAnalysis
|
||||
})
|
||||
} catch (e) {
|
||||
console.log('保存记录失败:', e)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user