|
@@ -3,16 +3,15 @@
|
|
|
declare (strict_types=1);
|
|
|
namespace App\Controller;
|
|
|
|
|
|
-use Phper666\JWTAuth\JWT;
|
|
|
-use Hyperf\Di\Annotation\Inject;
|
|
|
-use Hyperf\HttpServer\Annotation\AutoController;
|
|
|
-use Hyperf\Validation\Contract\ValidatorFactoryInterface;
|
|
|
-use App\Tools\Result;
|
|
|
use App\JsonRpc\UserServiceInterface;
|
|
|
use App\Tools\CommonService;
|
|
|
-use function Hyperf\Support\env;
|
|
|
use App\Tools\PublicData;
|
|
|
-use Hyperf\Context\Context;
|
|
|
+use App\Tools\Result;
|
|
|
+use function Hyperf\Support\env;
|
|
|
+use Hyperf\Di\Annotation\Inject;
|
|
|
+use Hyperf\HttpServer\Annotation\AutoController;
|
|
|
+use Hyperf\Validation\Contract\ValidatorFactoryInterface;
|
|
|
+use Phper666\JWTAuth\JWT;
|
|
|
/**
|
|
|
* @AutoController()
|
|
|
*/
|
|
@@ -36,6 +35,7 @@ class LoginController extends AbstractController
|
|
|
private $userServiceClient;
|
|
|
public function login(Jwt $jwt)
|
|
|
{
|
|
|
+ // $this->logger->info("验证之前");
|
|
|
$reqData = $this->request->all();
|
|
|
$validator = $this->validationFactory->make($reqData, ['username' => 'required', 'password' => 'required', 'type' => 'required'], ['username.required' => '用户名不能为空', 'password.required' => '密码不能为空', 'type.required' => '登录方式必填']);
|
|
|
if ($validator->fails()) {
|
|
@@ -53,6 +53,7 @@ class LoginController extends AbstractController
|
|
|
if (strtolower($code) != $reqData['captcha']) {
|
|
|
return Result::error("验证码错误");
|
|
|
}
|
|
|
+ //$reqData
|
|
|
$where = [];
|
|
|
if ($reqData['type'] == 1) {
|
|
|
//密码登录
|
|
@@ -74,9 +75,8 @@ class LoginController extends AbstractController
|
|
|
'user_name' => $userInfos['data']['user_name'],
|
|
|
'mobile' => $userInfos['data']['mobile'],
|
|
|
'email' => $userInfos['data']['email'],
|
|
|
- // 'rong_token' => $userInfos['data']['rong_token'],
|
|
|
+ 'rong_token' => $userInfos['data']['rong_token'],
|
|
|
'level_id' => $userInfos['data']['level_id'],
|
|
|
- 'type_id' => $userInfos['data']['type_id'],
|
|
|
];
|
|
|
var_dump($userData);
|
|
|
// 使用默认场景登录
|
|
@@ -154,7 +154,7 @@ class LoginController extends AbstractController
|
|
|
$checkUserInfo = $this->userServiceClient->verifyUserInfo(['user_name' => $response['phone_info']['purePhoneNumber']]);
|
|
|
if ($checkUserInfo['code'] == 0) {
|
|
|
$salt = rand(1, 999999);
|
|
|
- $createUserData = ['user_name' => $response['phone_info']['purePhoneNumber'], 'salt' => $salt, 'password' => $openInfoData['openid'], 'type_id' => 20000];
|
|
|
+ $createUserData = ['user_name' => $response['phone_info']['purePhoneNumber'], 'salt' => $salt, 'password' => $openInfoData['openid']];
|
|
|
$checkUserInfo = $this->userServiceClient->createUser($createUserData);
|
|
|
}
|
|
|
//根据openid和手机号判断是否注册,未注册直接注册
|