mirror of
https://github.com/kuaifan/dootask.git
synced 2025-12-10 18:02:55 +00:00
perf: 优化数据结构
This commit is contained in:
parent
0be6c70e92
commit
6e68f399b4
@ -1101,10 +1101,17 @@ class UsersController extends AbstractController
|
||||
];
|
||||
$row = UmengAlias::where($inArray);
|
||||
if ($row->exists()) {
|
||||
$row->update(['updated_at' => Carbon::now()]);
|
||||
$row->update([
|
||||
'ua' => $data['userAgent'],
|
||||
'device' => $data['deviceModel'],
|
||||
'updated_at' => Carbon::now()
|
||||
]);
|
||||
return Base::retSuccess('别名已存在');
|
||||
}
|
||||
$row = UmengAlias::createInstance($inArray);
|
||||
$row = UmengAlias::createInstance(array_merge($inArray, [
|
||||
'ua' => $data['userAgent'],
|
||||
'device' => $data['deviceModel'],
|
||||
]));
|
||||
if ($row->save()) {
|
||||
return Base::retSuccess('添加成功');
|
||||
} else {
|
||||
|
||||
@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddUmengAliasDevice extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
//
|
||||
Schema::table('umeng_alias', function (Blueprint $table) {
|
||||
if (!Schema::hasColumn('umeng_alias', 'device')) {
|
||||
$table->text('ua')->nullable()->after('platform')->comment('userAgent');
|
||||
$table->string('device', 100)->nullable()->default('')->after('platform')->comment('设备类型');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
//
|
||||
Schema::table('umeng_alias', function (Blueprint $table) {
|
||||
$table->dropColumn("ua");
|
||||
$table->dropColumn("device");
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -101,13 +101,15 @@ export default {
|
||||
//
|
||||
if (this.userId > 0 && this.$isEEUiApp) {
|
||||
$A.eeuiAppSendMessage({
|
||||
action: 'intiUmeng',
|
||||
action: 'initApp',
|
||||
apiUrl: $A.apiUrl(''),
|
||||
userid: this.userId,
|
||||
token: this.userToken,
|
||||
userAgent: window.navigator.userAgent,
|
||||
});
|
||||
setTimeout(_ => {
|
||||
$A.eeuiAppSendMessage({
|
||||
action: 'setUmengAlias',
|
||||
userid: this.userId,
|
||||
token: this.userToken,
|
||||
url: $A.apiUrl('users/umeng/alias')
|
||||
});
|
||||
}, 6000)
|
||||
|
||||
@ -66,6 +66,7 @@
|
||||
|
||||
<script>
|
||||
import {mapState} from "vuex";
|
||||
|
||||
export default {
|
||||
name: 'DialogDroupWordChain',
|
||||
|
||||
@ -85,46 +86,46 @@ export default {
|
||||
computed: {
|
||||
...mapState(['dialogDroupWordChain', 'userInfo', 'dialogMsgs', 'cacheDialogs']),
|
||||
|
||||
isFullscreen({ windowWidth }) {
|
||||
isFullscreen({windowWidth}) {
|
||||
return windowWidth < 576;
|
||||
},
|
||||
|
||||
num(){
|
||||
return this.list.filter(h=>h.type != 'case')?.length || 0;
|
||||
num() {
|
||||
return this.list.filter(h => h.type != 'case')?.length || 0;
|
||||
},
|
||||
|
||||
allList(){
|
||||
allList() {
|
||||
const msg = this.dialogDroupWordChain.msgData?.msg || {};
|
||||
let list = JSON.parse(JSON.stringify(msg.list || []));
|
||||
this.dialogMsgs.filter(h=>{
|
||||
this.dialogMsgs.filter(h => {
|
||||
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) {
|
||||
}).forEach((h) => {
|
||||
(h.msg.list || []).forEach(k => {
|
||||
if (k.type != 'case' && list.map(j => j.id).indexOf(k.id) == -1) {
|
||||
list.push(k)
|
||||
}
|
||||
})
|
||||
});
|
||||
return list.filter(h=>(h.text || '').trim());
|
||||
return list.filter(h => (h.text || '').trim());
|
||||
},
|
||||
|
||||
isEdit(){
|
||||
isEdit() {
|
||||
return this.oldData != JSON.stringify(this.list);
|
||||
},
|
||||
|
||||
dialog(){
|
||||
return this.cacheDialogs.find(h=>h.id == this.dialogDroupWordChain.dialog_id) || {}
|
||||
dialog() {
|
||||
return this.cacheDialogs.find(h => h.id == this.dialogDroupWordChain.dialog_id) || {}
|
||||
},
|
||||
},
|
||||
|
||||
watch: {
|
||||
show(val){
|
||||
if(!val){
|
||||
show(val) {
|
||||
if (!val) {
|
||||
this.value = "#" + this.$L('接龙') + " \n";
|
||||
this.list = [];
|
||||
}else{
|
||||
if(this.dialogDroupWordChain.type == 'create'){
|
||||
this.$nextTick(()=>{
|
||||
} else {
|
||||
if (this.dialogDroupWordChain.type == 'create') {
|
||||
this.$nextTick(() => {
|
||||
this.$refs.wordChainTextareaRef.focus()
|
||||
})
|
||||
}
|
||||
@ -133,7 +134,7 @@ export default {
|
||||
},
|
||||
|
||||
dialogDroupWordChain(data) {
|
||||
if(data.type == 'create' && data.dialog_id){
|
||||
if (data.type == 'create' && data.dialog_id) {
|
||||
this.show = true;
|
||||
this.createId = this.userId;
|
||||
this.list = [];
|
||||
@ -150,18 +151,18 @@ export default {
|
||||
text: this.userInfo.nickname
|
||||
});
|
||||
}
|
||||
if(data.type == 'participate' && data.dialog_id && data.msgData){
|
||||
if (data.type == 'participate' && data.dialog_id && data.msgData) {
|
||||
this.show = true;
|
||||
this.createId = data.msgData.msg.createid || data.msgData.msg.userid;
|
||||
this.value = data.msgData.msg.text;
|
||||
this.list = this.allList;
|
||||
this.list = this.allList;
|
||||
this.oldData = JSON.stringify(this.list);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
onAdd(){
|
||||
onAdd() {
|
||||
this.list.push({
|
||||
id: Date.now(),
|
||||
type: 'text',
|
||||
@ -171,8 +172,8 @@ export default {
|
||||
this.scrollTo();
|
||||
},
|
||||
|
||||
scrollTo(){
|
||||
this.$nextTick(()=>{
|
||||
scrollTo() {
|
||||
this.$nextTick(() => {
|
||||
this.$refs.wordChainListRef.scrollTo(0, 99999);
|
||||
});
|
||||
},
|
||||
@ -186,14 +187,14 @@ export default {
|
||||
return;
|
||||
}
|
||||
//
|
||||
const texts = this.list.map(h=> h.text);
|
||||
if( texts.length != [...new Set(texts)].length ){
|
||||
const texts = this.list.map(h => h.text);
|
||||
if (texts.length != [...new Set(texts)].length) {
|
||||
$A.modalConfirm({
|
||||
content: '重复内容将不再计入接龙结果',
|
||||
cancelText: '返回编辑',
|
||||
okText: '继续发送',
|
||||
onOk: () => {
|
||||
this.send()
|
||||
this.send()
|
||||
}
|
||||
})
|
||||
return;
|
||||
@ -206,8 +207,8 @@ export default {
|
||||
*/
|
||||
send() {
|
||||
const list = [];
|
||||
this.list.forEach(h=>{
|
||||
if ((h.text || h.type != "case") && list.map(h=> h.text).indexOf(h.text) == -1) {
|
||||
this.list.forEach(h => {
|
||||
if ((h.text || h.type != "case") && list.map(h => h.text).indexOf(h.text) == -1) {
|
||||
list.push(h);
|
||||
}
|
||||
});
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user