测试
This commit is contained in:
48
app/Http/Controllers/AuthController.php
Normal file
48
app/Http/Controllers/AuthController.php
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Services\GatewayWorker\UserService;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class AuthController extends Controller
|
||||
{
|
||||
//
|
||||
private $service;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->service = new UserService();
|
||||
}
|
||||
|
||||
/**
|
||||
* @Method POST
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function login(): JsonResponse
|
||||
{
|
||||
$username = request()->input('username');
|
||||
$password = request()->input('password');
|
||||
|
||||
return jok(
|
||||
$this->service->login($username, $password),
|
||||
'登录成功'
|
||||
);
|
||||
}
|
||||
/**
|
||||
* @Method POST
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function register(): JsonResponse
|
||||
{
|
||||
$username = request()->input('username');
|
||||
$password = request()->input('password');
|
||||
$nickName = request()->input('nickname');
|
||||
|
||||
return jok(
|
||||
$this->service->register($username, $password, $nickName),
|
||||
'注册成功'
|
||||
);
|
||||
}
|
||||
}
|
||||
28
app/Http/Controllers/ImController.php
Normal file
28
app/Http/Controllers/ImController.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Services\GatewayWorker\ImService;
|
||||
use App\Services\GatewayWorker\UserService;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class ImController extends Controller
|
||||
{
|
||||
//
|
||||
private $service;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->service = ImService::getInstance();
|
||||
}
|
||||
public function bind()
|
||||
{
|
||||
$clientId = request()->input('client_id');
|
||||
|
||||
try {
|
||||
return jok($this->service->bindClientIdByUserId($clientId));
|
||||
} catch (\Exception $e) {
|
||||
return jerr($e->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
10
app/Http/Controllers/UserController.php
Normal file
10
app/Http/Controllers/UserController.php
Normal file
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class UserController extends Controller
|
||||
{
|
||||
//
|
||||
}
|
||||
Reference in New Issue
Block a user