mirror of
https://github.com/v2board/v2board.git
synced 2024-11-10 09:39:10 +08:00
remove: soft delete
This commit is contained in:
parent
0f488540f4
commit
b174403a2a
@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use App\Models\Order;
|
||||
use Illuminate\Console\Command;
|
||||
|
||||
class Test extends Command
|
||||
@ -37,5 +38,6 @@ class Test extends Command
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
dd(Order::where('user_id', 4)->delete());
|
||||
}
|
||||
}
|
||||
|
@ -7,10 +7,10 @@ use App\Http\Requests\Admin\UserGenerate;
|
||||
use App\Http\Requests\Admin\UserSendMail;
|
||||
use App\Http\Requests\Admin\UserUpdate;
|
||||
use App\Jobs\SendEmailJob;
|
||||
use App\Services\UserService;
|
||||
use App\Utils\Helper;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\Order;
|
||||
use App\Models\User;
|
||||
use App\Models\Plan;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
@ -277,16 +277,4 @@ class UserController extends Controller
|
||||
'data' => true
|
||||
]);
|
||||
}
|
||||
|
||||
public function drop(Request $request)
|
||||
{
|
||||
$user = User::find($request->input('id'));
|
||||
if (!$user) abort(500, '用户不存在');
|
||||
if (!$user->delete()) {
|
||||
abort(500, '删除失败');
|
||||
}
|
||||
return response([
|
||||
'data' => true
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
@ -25,12 +25,6 @@ class User
|
||||
$request->session()->put('email', $user->email);
|
||||
$request->session()->put('id', $user->id);
|
||||
}
|
||||
// if ($request->input('lang')) {
|
||||
// $request->session()->put('lang', $request->input('lang'));
|
||||
// }
|
||||
// if ($request->session()->get('lang')) {
|
||||
// App::setLocale($request->session()->get('lang'));
|
||||
// }
|
||||
if (!$request->session()->get('id')) {
|
||||
abort(403, '未登录或登陆已过期');
|
||||
}
|
||||
|
@ -75,7 +75,6 @@ class AdminRoute
|
||||
$router->post('/user/ban', 'Admin\\UserController@ban');
|
||||
$router->post('/user/resetSecret', 'Admin\\UserController@resetSecret');
|
||||
$router->post('/user/setInviteUser', 'Admin\\UserController@setInviteUser');
|
||||
$router->post('/user/drop', 'Admin\\UserController@drop');
|
||||
// StatOrder
|
||||
$router->get ('/stat/getOverride', 'Admin\\StatController@getOverride');
|
||||
$router->get ('/stat/getServerLastRank', 'Admin\\StatController@getServerLastRank');
|
||||
|
@ -3,11 +3,9 @@
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class User extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
protected $table = 'v2_user';
|
||||
protected $dateFormat = 'U';
|
||||
protected $guarded = ['id'];
|
||||
|
@ -2,9 +2,12 @@
|
||||
|
||||
namespace App\Services;
|
||||
|
||||
use App\Models\InviteCode;
|
||||
use App\Models\Order;
|
||||
use App\Models\Server;
|
||||
use App\Models\Ticket;
|
||||
use App\Models\User;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class UserService
|
||||
{
|
||||
|
@ -342,10 +342,9 @@ CREATE TABLE `v2_user` (
|
||||
`expired_at` bigint(20) DEFAULT '0',
|
||||
`created_at` int(11) NOT NULL,
|
||||
`updated_at` int(11) NOT NULL,
|
||||
`deleted_at` int(11) DEFAULT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `email_deleted_at` (`email`,`deleted_at`)
|
||||
UNIQUE KEY `email` (`email`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
|
||||
-- 2021-06-30 15:34:40
|
||||
-- 2021-07-01 11:00:48
|
||||
|
@ -412,9 +412,13 @@ ALTER TABLE `v2_order`
|
||||
ALTER TABLE `v2_payment`
|
||||
ADD `uuid` char(32) NOT NULL AFTER `id`;
|
||||
|
||||
ALTER TABLE `v2_user`
|
||||
ADD `deleted_at` int(11) NULL AFTER `updated_at`;
|
||||
|
||||
ALTER TABLE `v2_user`
|
||||
ADD UNIQUE `email_deleted_at` (`email`, `deleted_at`),
|
||||
DROP INDEX `email`;
|
||||
|
||||
ALTER TABLE `v2_user`
|
||||
DROP `deleted_at`;
|
||||
|
||||
ALTER TABLE `v2_user`
|
||||
ADD UNIQUE `email` (`email`),
|
||||
DROP INDEX `email_deleted_at`;
|
||||
|
Loading…
Reference in New Issue
Block a user