perf: 优化数据结构

This commit is contained in:
kuaifan 2024-03-20 02:49:30 +09:00
parent 0be6c70e92
commit 6e68f399b4
4 changed files with 81 additions and 33 deletions

View File

@ -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 {

View File

@ -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");
});
}
}

View File

@ -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)

View File

@ -66,6 +66,7 @@
<script>
import {mapState} from "vuex";
export default {
name: 'DialogDroupWordChain',