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