注册用户,新增用户配置
This commit is contained in:
parent
77dd5c9331
commit
9b096e0060
@ -8,6 +8,7 @@ use App\Model\User as UserModel;
|
||||
use App\Model\UserDoctor as UserDoctorModel;
|
||||
use App\Model\UserPatient as UserPatientModel;
|
||||
use App\Model\UserPharmacist as UserPharmacistModel;
|
||||
use App\Model\UserSystem;
|
||||
use App\Utils\Http;
|
||||
use App\Utils\Jwt;
|
||||
use App\Utils\Log;
|
||||
@ -115,6 +116,21 @@ class LoginService extends BaseService
|
||||
$client_user_id = $user_doctor['doctor_id'];
|
||||
}
|
||||
|
||||
// 新增用户配置表
|
||||
$params = array();
|
||||
$params['user_id'] = $user['user_id'];
|
||||
$user_system = UserSystem::getOne($params);
|
||||
if (empty($user_system)) {
|
||||
$data = array();
|
||||
$data['user_id'] = $user['user_id'];
|
||||
$data['is_accept_im_message_push'] = 1; // 默认新增一下配置表
|
||||
$user_system = UserSystem::addUserSystem($data);
|
||||
if (empty($user_system)) {
|
||||
Db::rollBack();
|
||||
return fail(HttpEnumCode::SERVER_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
// 创建im账号
|
||||
$account = new Account();
|
||||
// 创建单个账号
|
||||
@ -224,7 +240,6 @@ class LoginService extends BaseService
|
||||
$data = array();
|
||||
$data['login_ip'] = $login_ip ?? "";
|
||||
$data['last_login_at'] = date('Y-m-d H:i:s', time());
|
||||
|
||||
UserModel::editUser($params, $data);
|
||||
|
||||
// 组合生成token的数据
|
||||
@ -359,6 +374,21 @@ class LoginService extends BaseService
|
||||
return fail(HttpEnumCode::SERVER_ERROR);
|
||||
}
|
||||
|
||||
// 新增用户配置表
|
||||
$params = array();
|
||||
$params['user_id'] = $user['user_id'];
|
||||
$user_system = UserSystem::getOne($params);
|
||||
if (empty($user_system)) {
|
||||
$data = array();
|
||||
$data['user_id'] = $user['user_id'];
|
||||
$data['is_accept_im_message_push'] = 1; // 默认新增一下配置表
|
||||
$user_system = UserSystem::addUserSystem($data);
|
||||
if (empty($user_system)) {
|
||||
Db::rollBack();
|
||||
return fail(HttpEnumCode::SERVER_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
// 创建im账号
|
||||
$account = new Account();
|
||||
// 创建单个账号
|
||||
@ -438,6 +468,9 @@ class LoginService extends BaseService
|
||||
} elseif ($user['user_type'] == 3) {
|
||||
$params['pharmacist_id'] = $result['pharmacist_id'];
|
||||
$res = UserPharmacistModel::editUserPharmacist($params, $data);
|
||||
} else {
|
||||
Db::rollBack();
|
||||
return fail(HttpEnumCode::USER_STATUS_ERROR);
|
||||
}
|
||||
|
||||
if (!$res) {
|
||||
@ -455,7 +488,7 @@ class LoginService extends BaseService
|
||||
// 创建单个账号
|
||||
$account->createAccount($user['user_id'], $user['user_name'], $avatar);
|
||||
}
|
||||
}catch(\Exception $e){
|
||||
} catch (\Throwable $e) {
|
||||
Log::getInstance()->error("IM账号倒入失败");
|
||||
}
|
||||
}
|
||||
@ -483,7 +516,9 @@ class LoginService extends BaseService
|
||||
$token = $Jwt->encode($token_user_data);
|
||||
|
||||
// 登录成功,删除验证码
|
||||
// $redis->del("login_code" . $phone);
|
||||
if ($app_env != 'dev') {
|
||||
$redis->del("login_code" . $phone);
|
||||
}
|
||||
|
||||
// 组合返回数据
|
||||
$data = array();
|
||||
@ -588,7 +623,7 @@ class LoginService extends BaseService
|
||||
return fail(HttpEnumCode::SERVER_ERROR);
|
||||
}
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
} catch (\Throwable $e) {
|
||||
// 此处不进行处理
|
||||
return fail(HttpEnumCode::GET_WX_ERROR, $e->getMessage());
|
||||
}
|
||||
|
||||
@ -856,9 +856,15 @@ class UserService extends BaseService
|
||||
$params = array();
|
||||
$params['user_id'] = $user['user_id'];
|
||||
$user_system = UserSystem::getOne($params);
|
||||
if (empty($user_system)){
|
||||
$data = array();
|
||||
$data['user_id'] = $user['user_id'];
|
||||
$data['is_accept_im_message_push'] = 1; // 默认新增一下配置表
|
||||
$user_system = UserSystem::addUserSystem($data);
|
||||
if (empty($user_system)){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
$message = "您有一条新的问诊消息";
|
||||
// 判断消息类型
|
||||
|
||||
@ -36,7 +36,7 @@ class Account extends Base
|
||||
|
||||
$path = $this->config['base_url'] . $this->version . "/im_open_login_svc/account_import?" . $this->buildRequestParams();
|
||||
return $this->postRequest($path,$options);
|
||||
}catch (\Exception $e) {
|
||||
}catch (\Throwable $e) {
|
||||
throw new BusinessException($e->getMessage(), HttpEnumCode::SERVER_ERROR);
|
||||
}
|
||||
}
|
||||
@ -74,7 +74,7 @@ class Account extends Base
|
||||
}
|
||||
|
||||
return true;
|
||||
}catch (\Exception $e) {
|
||||
}catch (\Throwable $e) {
|
||||
throw new BusinessException($e->getMessage(), HttpEnumCode::SERVER_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user