no message

This commit is contained in:
kuaifan 2024-11-18 15:30:42 +08:00
parent ad3e773f27
commit 479d3e3f39
5 changed files with 33 additions and 18 deletions

View File

@ -786,7 +786,7 @@ class DialogController extends AbstractController
*
* @apiParam {Object} id 消息ID
* - 1、多个ID用逗号分隔1,2,3
* - 2、另一种格式:{"id": "[会话ID]"},如:{"2": 0, "3": 10}
* - 2、另一种格式:{"id": "会话ID|0"},如:{"2": 0, "3": 10}
* -- 会话ID标记id之后的消息已读
* -- 其他:标记已读
*

View File

@ -42,7 +42,6 @@ class UsersController extends AbstractController
/**
* @api {get} api/users/login 01. 登录、注册
*
* @apiDescription 需要token身份
* @apiVersion 1.0.0
* @apiGroup users
* @apiName login

View File

@ -960,11 +960,19 @@ class Base
/**
* 判断是否二维数组
* @param $array
* @param bool $strict 严格模式,是否每个元素都是数组
* @return bool
*/
public static function isTwoArray($array)
public static function isTwoArray($array, bool $strict = true)
{
return is_array($array) && count(array_filter($array, 'is_array')) > 0;
if (!is_array($array)) {
return false;
}
$count = count(array_filter($array, 'is_array'));
if ($strict) {
return $count === count($array);
}
return $count > 0;
}
/**

View File

@ -820,7 +820,7 @@ export default {
},
render: (h, {row}) => {
const checkin_face = $A.cloneJSON(row.checkin_face || '')
return h('div', checkin_face ? this.$L('已上传') : '-');
return h('AutoTip', checkin_face ? this.$L('已上传') : '-');
},
}, {
key: 'checkin_mac',

View File

@ -3298,13 +3298,16 @@ export default {
state.readTimeout = null;
//
if (state.userId === 0) {
data && (data.read_at = null);
return;
}
if (Object.values(state.readWaitData).length === 0) {
const entries = Object.entries(state.readWaitData);
if (entries.length === 0) {
data && (data.read_at = null);
return
}
const ids = $A.cloneJSON(state.readWaitData);
state.readWaitData = {};
const ids = Object.fromEntries(entries.slice(0, 100));
state.readWaitData = Object.fromEntries(entries.slice(100));
//
dispatch("call", {
method: 'post',
@ -3313,18 +3316,23 @@ export default {
id: ids
}
}).then(({data}) => {
for (const id in ids) {
if (ids.hasOwnProperty(id) && /^\d+$/.test(ids[id])) {
state.dialogMsgs.some(item => {
if (item.dialog_id == ids[id] && item.id >= id) {
item.read_at = $A.daytz().format("YYYY-MM-DD HH:mm:ss")
}
})
}
}
Object.entries(ids)
.filter(([_, dialogId]) => /^\d+$/.test(dialogId))
.forEach(([msdId, dialogId]) => {
state.dialogMsgs
.filter(item => item.dialog_id == dialogId && item.id >= msdId)
.forEach(item => {
item.read_at = $A.daytz().format("YYYY-MM-DD HH:mm:ss");
});
});
dispatch("saveDialog", data)
}).catch(_ => {
state.readWaitData = ids;
Object.keys(ids)
.forEach(id => {
const msg = state.dialogMsgs.find(item => item.id == id);
if (msg) msg.read_at = null;
});
state.readWaitData = Object.assign(state.readWaitData, ids);
}).finally(_ => {
state.readLoadNum++
});