test: debug: 会话过期判断

dev/timezone
Lei OT 1 year ago
parent 1b59824e73
commit 56b132dd38

@ -40,7 +40,18 @@ const InputComposer = ({ mobile }) => {
const talkabled = !isEmpty(currentConversation.sn) && websocketOpened;
const isExpired = !isEmpty(currentConversation.conversation_expiretime) ? dayjs(currentConversation.conversation_expiretime).add(8, 'hours').isBefore(dayjs()) : true;
const gt24h = !isEmpty(currentConversation.last_received_time) ? dayjs().diff(dayjs(currentConversation.last_received_time), 'hour') > 24 : true;
const textabled = talkabled && (!(gt24h && isExpired)); // ,
const lt24h = !isEmpty(currentConversation.last_received_time) ? dayjs().diff(dayjs(currentConversation.last_received_time), 'hour') <= 24 : false;
// lt24h || !isExpired
const textabled = talkabled && (lt24h || !isExpired); // ,
// debug:
console.group('InputComposer textabled');
console.log('c_sn, websocketOpened, lt24h, isExpired, textabled', currentConversation.sn, websocketOpened, lt24h, isExpired, textabled);
console.log('received time, expire time', currentConversation.last_received_time, ', ', currentConversation.conversation_expiretime);
if (!isEmpty(currentConversation.sn) && !textabled) {
console.log('current chat: ---- \n', JSON.stringify(currentConversation, null, 2));
// window.$pageSpy.triggerPlugins('onOfflineLog', 'upload');
}
console.groupEnd();
const textPlaceHolder = !textabled
? ''
: mobile === undefined

@ -8,7 +8,7 @@ const PageSpyLog = () => {
window.$pageSpy.triggerPlugins('onOfflineLog', 'download');
window.$pageSpy.triggerPlugins('onOfflineLog', 'upload');
}}>
Debug日志 ({window.$pageSpy.address.substring(0, 4)})
上传Debug日志 ({window.$pageSpy.address.substring(0, 4)})
</a>
)}
</>

Loading…
Cancel
Save