身份认证新增医生邮箱
This commit is contained in:
parent
6e7692489b
commit
2e1834fda2
@ -22,6 +22,7 @@ use Hyperf\Snowflake\Concern\Snowflake;
|
|||||||
* @property int $register_method 注册方式(1:微信小程序 2:后台添加 )
|
* @property int $register_method 注册方式(1:微信小程序 2:后台添加 )
|
||||||
* @property int $age 年龄
|
* @property int $age 年龄
|
||||||
* @property int $sex 性别(0:未知 1:男 2:女)
|
* @property int $sex 性别(0:未知 1:男 2:女)
|
||||||
|
* @property string $email 邮箱
|
||||||
* @property string $avatar 头像
|
* @property string $avatar 头像
|
||||||
* @property int $is_online 是否在线(0:不在线 1:在线)
|
* @property int $is_online 是否在线(0:不在线 1:在线)
|
||||||
* @property string $login_at 小程序登陆时间
|
* @property string $login_at 小程序登陆时间
|
||||||
@ -43,7 +44,7 @@ class User extends Model
|
|||||||
/**
|
/**
|
||||||
* The attributes that are mass assignable.
|
* The attributes that are mass assignable.
|
||||||
*/
|
*/
|
||||||
protected array $fillable = ['user_id', 'user_name', 'user_account', 'mobile', 'wx_mobile', 'user_password', 'salt', 'user_type', 'user_status', 'register_method', 'age', 'sex', 'avatar', 'is_online', 'login_at', 'im_login_at', 'login_ip', 'created_by', 'created_at', 'updated_at'];
|
protected array $fillable = ['user_id', 'user_name', 'user_account', 'mobile', 'wx_mobile', 'user_password', 'salt', 'user_type', 'user_status', 'register_method', 'age', 'sex', 'email', 'avatar', 'is_online', 'login_at', 'im_login_at', 'login_ip', 'created_by', 'created_at', 'updated_at'];
|
||||||
|
|
||||||
protected string $primaryKey = "user_id";
|
protected string $primaryKey = "user_id";
|
||||||
|
|
||||||
|
|||||||
@ -28,6 +28,7 @@ class DoctorAuthRequest extends FormRequest
|
|||||||
// 'work_cert',
|
// 'work_cert',
|
||||||
'doctor_expertise',
|
'doctor_expertise',
|
||||||
'source',
|
'source',
|
||||||
|
'email',
|
||||||
],
|
],
|
||||||
'addAuthMulti' => [ // 新增多点执业认证信息
|
'addAuthMulti' => [ // 新增多点执业认证信息
|
||||||
'id_card_front',
|
'id_card_front',
|
||||||
@ -73,6 +74,7 @@ class DoctorAuthRequest extends FormRequest
|
|||||||
'id_card_back' => 'required|url',
|
'id_card_back' => 'required|url',
|
||||||
'sign_image' => 'required|url',
|
'sign_image' => 'required|url',
|
||||||
'source' => 'required|integer|min:1|max:2',
|
'source' => 'required|integer|min:1|max:2',
|
||||||
|
'email' => 'required',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -117,6 +119,7 @@ class DoctorAuthRequest extends FormRequest
|
|||||||
'source.integer' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
'source.integer' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||||||
'source.min' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
'source.min' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||||||
'source.max' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
'source.max' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||||||
|
'email.required' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -337,6 +337,16 @@ class DoctorAuthService extends BaseService
|
|||||||
$UserDoctorService = new UserDoctorService();
|
$UserDoctorService = new UserDoctorService();
|
||||||
$result['doctor_expertise'] = $UserDoctorService->getDoctorSelectedExpertise($doctor['doctor_id']);
|
$result['doctor_expertise'] = $UserDoctorService->getDoctorSelectedExpertise($doctor['doctor_id']);
|
||||||
|
|
||||||
|
// 获取用户邮箱
|
||||||
|
$result['email'] = "";
|
||||||
|
|
||||||
|
$params = array();
|
||||||
|
$params['user_id'] = $doctor['user_id'];
|
||||||
|
$user = User::getOne($params);
|
||||||
|
if (!empty($user)){
|
||||||
|
$result['email'] = $user['email'];
|
||||||
|
}
|
||||||
|
|
||||||
return success($result);
|
return success($result);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -369,8 +379,17 @@ class DoctorAuthService extends BaseService
|
|||||||
return fail(HttpEnumCode::HTTP_ERROR, "审核中,暂不允许修改");
|
return fail(HttpEnumCode::HTTP_ERROR, "审核中,暂不允许修改");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 获取用户数据
|
||||||
|
$params = array();
|
||||||
|
$params['user_id'] = $doctor['user_id'];
|
||||||
|
$user = User::getOne($params);
|
||||||
|
if (empty($user)){
|
||||||
|
return fail(HttpEnumCode::HTTP_ERROR, "用户错误");
|
||||||
|
}
|
||||||
|
|
||||||
// 组合存储数据
|
// 组合存储数据
|
||||||
$doctor_data = array();// 医生
|
$doctor_data = array();// 医生
|
||||||
|
$user_data = array();// 用户
|
||||||
$doctor_info_data = array();// 医生详情
|
$doctor_info_data = array();// 医生详情
|
||||||
|
|
||||||
// 头像
|
// 头像
|
||||||
@ -428,6 +447,16 @@ class DoctorAuthService extends BaseService
|
|||||||
$doctor_data['be_good_at'] = $request_params['be_good_at'];
|
$doctor_data['be_good_at'] = $request_params['be_good_at'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 邮箱
|
||||||
|
if ($user['email'] != $request_params['email']) {
|
||||||
|
// 验证邮箱
|
||||||
|
$res = PcreMatch::validateEmail($request_params['email']);
|
||||||
|
if (!$res){
|
||||||
|
return fail(HttpEnumCode::HTTP_ERROR, "请填写正确邮箱");
|
||||||
|
}
|
||||||
|
$user_data['email'] = $request_params['email'];
|
||||||
|
}
|
||||||
|
|
||||||
// 身份认证
|
// 身份认证
|
||||||
if ($request_params['source'] == 1){
|
if ($request_params['source'] == 1){
|
||||||
// 获取医生详情数据
|
// 获取医生详情数据
|
||||||
@ -602,6 +631,20 @@ class DoctorAuthService extends BaseService
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 修改用户邮箱
|
||||||
|
if (!empty($user_data)){
|
||||||
|
$params = array();
|
||||||
|
$params['user_id'] = $user['user_id'];
|
||||||
|
|
||||||
|
$data = array();
|
||||||
|
$data['email'] = $request_params['email'];
|
||||||
|
$res = User::editUser($params, $data);
|
||||||
|
if (!$res) {
|
||||||
|
Db::rollBack();
|
||||||
|
return fail(HttpEnumCode::SERVER_ERROR);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Db::commit();
|
Db::commit();
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
Db::rollBack();
|
Db::rollBack();
|
||||||
|
|||||||
@ -61,4 +61,22 @@ class PcreMatch
|
|||||||
|
|
||||||
return str_replace(config('alibaba.oss.custom_domain_name'),"",$path);
|
return str_replace(config('alibaba.oss.custom_domain_name'),"",$path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 验证邮箱是否有效
|
||||||
|
* @param $email
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public static function validateEmail($email): bool
|
||||||
|
{
|
||||||
|
// 正则表达式
|
||||||
|
$pattern = '/^[\w.%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/';
|
||||||
|
|
||||||
|
// 使用 preg_match 进行匹配
|
||||||
|
if (preg_match($pattern, $email)) {
|
||||||
|
return true; // 有效的电子邮件地址
|
||||||
|
} else {
|
||||||
|
return false; // 无效的电子邮件地址
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@ -4,15 +4,10 @@ namespace Extend\Wechat;
|
|||||||
|
|
||||||
use App\Constants\HttpEnumCode;
|
use App\Constants\HttpEnumCode;
|
||||||
use App\Exception\BusinessException;
|
use App\Exception\BusinessException;
|
||||||
use App\Factory\CacheFactory;
|
|
||||||
use App\Factory\ProdRedisFactory;
|
|
||||||
use EasyWeChat\Kernel\Exceptions\BadResponseException;
|
use EasyWeChat\Kernel\Exceptions\BadResponseException;
|
||||||
use EasyWeChat\Kernel\Exceptions\InvalidArgumentException;
|
use EasyWeChat\Kernel\Exceptions\InvalidArgumentException;
|
||||||
use EasyWeChat\Kernel\HttpClient\AccessTokenAwareClient;
|
use EasyWeChat\Kernel\HttpClient\AccessTokenAwareClient;
|
||||||
use EasyWeChat\MiniApp\Application;
|
use EasyWeChat\MiniApp\Application;
|
||||||
use Hyperf\Cache\Cache;
|
|
||||||
use Hyperf\Redis\Redis;
|
|
||||||
//use Hyperf\Utils\ApplicationContext;
|
|
||||||
use Psr\Container\ContainerExceptionInterface;
|
use Psr\Container\ContainerExceptionInterface;
|
||||||
use Psr\Container\NotFoundExceptionInterface;
|
use Psr\Container\NotFoundExceptionInterface;
|
||||||
use Psr\SimpleCache\CacheInterface;
|
use Psr\SimpleCache\CacheInterface;
|
||||||
@ -22,7 +17,6 @@ use Symfony\Contracts\HttpClient\Exception\RedirectionExceptionInterface;
|
|||||||
use Symfony\Contracts\HttpClient\Exception\ServerExceptionInterface;
|
use Symfony\Contracts\HttpClient\Exception\ServerExceptionInterface;
|
||||||
use Symfony\Contracts\HttpClient\Exception\TransportExceptionInterface;
|
use Symfony\Contracts\HttpClient\Exception\TransportExceptionInterface;
|
||||||
use Hyperf\Context\ApplicationContext;
|
use Hyperf\Context\ApplicationContext;
|
||||||
use Hyperf\Guzzle\CoroutineHandler;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user