mirror of
https://github.com/v2board/v2board.git
synced 2025-01-10 16:19:10 +08:00
update: optimization stat user
This commit is contained in:
parent
20b60d553c
commit
af2f6a31da
@ -52,7 +52,7 @@ class StatUserJob implements ShouldQueue
|
||||
}
|
||||
|
||||
$data = StatUser::where('record_at', $recordAt)
|
||||
->where('server_id', $this->server->id)
|
||||
->where('server_rate', $this->server->rate)
|
||||
->where('user_id', $this->userId)
|
||||
->first();
|
||||
if ($data) {
|
||||
@ -67,8 +67,6 @@ class StatUserJob implements ShouldQueue
|
||||
} else {
|
||||
if (!StatUser::create([
|
||||
'user_id' => $this->userId,
|
||||
'server_id' => $this->server->id,
|
||||
'server_type' => $this->protocol,
|
||||
'server_rate' => $this->server->rate,
|
||||
'u' => $this->u,
|
||||
'd' => $this->d,
|
||||
|
@ -297,8 +297,6 @@ DROP TABLE IF EXISTS `v2_stat_user`;
|
||||
CREATE TABLE `v2_stat_user` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`user_id` int(11) NOT NULL,
|
||||
`server_id` int(11) NOT NULL,
|
||||
`server_type` char(11) NOT NULL,
|
||||
`server_rate` decimal(10,2) NOT NULL,
|
||||
`u` bigint(20) NOT NULL,
|
||||
`d` bigint(20) NOT NULL,
|
||||
@ -307,9 +305,10 @@ CREATE TABLE `v2_stat_user` (
|
||||
`created_at` int(11) NOT NULL,
|
||||
`updated_at` int(11) NOT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `server_id` (`server_id`),
|
||||
UNIQUE KEY `server_rate_user_id_record_at` (`server_rate`,`user_id`,`record_at`),
|
||||
KEY `user_id` (`user_id`),
|
||||
KEY `record_at` (`record_at`)
|
||||
KEY `record_at` (`record_at`),
|
||||
KEY `server_rate` (`server_rate`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
|
||||
|
||||
@ -377,4 +376,4 @@ CREATE TABLE `v2_user` (
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
|
||||
-- 2022-03-17 05:35:39
|
||||
-- 2022-03-29 06:56:01
|
||||
|
@ -524,3 +524,13 @@ ADD `handling_fee_percent` decimal(5,2) NULL AFTER `handling_fee_fixed`;
|
||||
|
||||
ALTER TABLE `v2_order`
|
||||
ADD `handling_amount` int(11) NULL AFTER `total_amount`;
|
||||
|
||||
ALTER TABLE `v2_stat_user`
|
||||
ADD UNIQUE `server_rate_user_id_record_at` (`server_rate`, `user_id`, `record_at`),
|
||||
ADD INDEX `server_rate` (`server_rate`),
|
||||
DROP INDEX `server_id_user_id_record_at`,
|
||||
DROP INDEX `server_id`;
|
||||
|
||||
ALTER TABLE `v2_stat_user`
|
||||
DROP `server_id`,
|
||||
DROP `server_type`;
|
||||
|
2
public/assets/admin/umi.js
vendored
2
public/assets/admin/umi.js
vendored
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user