diff --git a/app/Http/Controllers/Api/DialogController.php b/app/Http/Controllers/Api/DialogController.php index bceb061aa..55a89603a 100755 --- a/app/Http/Controllers/Api/DialogController.php +++ b/app/Http/Controllers/Api/DialogController.php @@ -2195,6 +2195,8 @@ public function msg__wordchain() ->orderByDesc('created_at') ->where('msg', 'like', "%$uuid%") ->value('msg'); + // + $createId = $dialogMsg['createid'] ?? $user->userid; // 新增 $msgList = $dialogMsg['list'] ?? []; $addList = array_udiff($list, $msgList, function($a, $b) { @@ -2213,6 +2215,7 @@ public function msg__wordchain() } $list = $msgList; } else { + $createId = $user->userid; $uuid = Base::generatePassword(36); foreach ($list as $key => $item) { $list[$key]['id'] = intval(round(microtime(true) * 1000)) + $key; @@ -2227,6 +2230,7 @@ public function msg__wordchain() 'text' => $text, 'list' => $list, 'userid' => $user->userid, + 'createid' => $createId, 'uuid' => $uuid, ]; return WebSocketDialogMsg::sendMsg(null, $dialog_id, 'word-chain', $msgData, $user->userid); diff --git a/resources/assets/js/pages/manage/components/DialogGroupWordChain.vue b/resources/assets/js/pages/manage/components/DialogGroupWordChain.vue index 0fefe54bf..53ab90649 100644 --- a/resources/assets/js/pages/manage/components/DialogGroupWordChain.vue +++ b/resources/assets/js/pages/manage/components/DialogGroupWordChain.vue @@ -100,12 +100,12 @@ export default { return h.type == "word-chain" && h.msg?.uuid == msg.uuid }).forEach((h)=>{ (h.msg.list || []).forEach(k=>{ - if( k.type != 'case' && list.map(j=>j.id).indexOf(k.id) == -1 ){ + if (k.type != 'case' && list.map(j=>j.id).indexOf(k.id) == -1) { list.push(k) } }) }); - return list; + return list.filter(h=>(h.text || '').trim()); }, isEdit(){ @@ -152,7 +152,7 @@ export default { } if(data.type == 'participate' && data.dialog_id && data.msgData){ this.show = true; - this.createId = data.msgData.msg.userid; + this.createId = data.msgData.msg.createid || data.msgData.msg.userid; this.value = data.msgData.msg.text; this.list = this.allList; this.oldData = JSON.stringify(this.list); @@ -178,18 +178,13 @@ export default { }, onSend() { - if( !this.isEdit ){ + if (!this.isEdit) { return; } - // - if(!this.value){ + if (!this.value) { $A.messageError("请输入接龙主题"); return; } - if( this.list.find(h=> !h.text && h.type != "case") ){ - $A.messageError("请输入接龙内容"); - return; - } // const texts = this.list.map(h=> h.text); if( texts.length != [...new Set(texts)].length ){ @@ -212,7 +207,7 @@ export default { send() { const list = []; this.list.forEach(h=>{ - if(h.text && list.map(h=> h.text).indexOf(h.text) == -1){ + if ((h.text || h.type != "case") && list.map(h=> h.text).indexOf(h.text) == -1) { list.push(h); } }); @@ -231,7 +226,7 @@ export default { this.show = false; this.$store.dispatch("saveDialogMsg", data); }).catch(({msg}) => { - if( msg.indexOf("System error") !== -1){ + if (msg.indexOf("System error") !== -1) { $A.modalInfo({ title: '版本过低', content: '服务器版本过低,请升级服务器。', diff --git a/resources/assets/js/pages/manage/components/DialogView.vue b/resources/assets/js/pages/manage/components/DialogView.vue index 8a132f42d..8e9109242 100644 --- a/resources/assets/js/pages/manage/components/DialogView.vue +++ b/resources/assets/js/pages/manage/components/DialogView.vue @@ -80,7 +80,7 @@