Skip to content

Commit

Permalink
分离检查数据库中表是否存在,在每个函数运行前检查表是否存在
Browse files Browse the repository at this point in the history
  • Loading branch information
xaoyaoo committed Aug 13, 2024
1 parent de66625 commit cabbfd9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/api/chat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ export const apiMsgCount = (wxids: string[]) => {
}
export const apiMsgCountSolo = (wxid: string) => {
return apiMsgCount([wxid]).then((res: any) => {
return res[wxid];
return res[wxid] || 0;
}).catch((err: any) => {
console.log(err);
return 0;
Expand Down
3 changes: 2 additions & 1 deletion src/components/chat/ChatRecordsMain.vue
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,8 @@ const init = async () => {
msg_count.value = await apiMsgCountSolo(props.wxid);
// 切换最后一页
start.value = Math.floor(msg_count.value / limit.value) * limit.value;
console.log('msg_count.value', msg_count.value, limit.value)
start.value = Math.floor(msg_count.value / limit.value) * limit.value || 0
await fetchData("bottom");
} catch (error) {
console.error('Error fetching data:', error);
Expand Down

0 comments on commit cabbfd9

Please sign in to comment.