新增银行卡验证、修正省市区验证
This commit is contained in:
parent
71ad45422a
commit
757cd2e76e
@ -5,6 +5,7 @@ namespace App\Controller;
|
||||
use App\Constants\HttpEnumCode;
|
||||
use App\Exception\BusinessException;
|
||||
use App\Request\UserRequest;
|
||||
use App\Services\UserDoctorService;
|
||||
use App\Services\UserService;
|
||||
use App\Utils\Http;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
|
||||
@ -83,4 +83,47 @@ class UserDoctorController extends AbstractController
|
||||
$data = $UserDoctorService->getDoctorBankCard();
|
||||
return $this->response->json($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取医生银行卡详情信息
|
||||
* @return ResponseInterface
|
||||
*/
|
||||
public function getDoctorBankCardInfo(): ResponseInterface
|
||||
{
|
||||
$UserDoctorService = new UserDoctorService();
|
||||
$data = $UserDoctorService->getDoctorBankCardInfo();
|
||||
return $this->response->json($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增绑定医生银行卡
|
||||
* @return ResponseInterface
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface
|
||||
*/
|
||||
public function addDoctorBankCard(): ResponseInterface
|
||||
{
|
||||
$request = $this->container->get(UserDoctorRequest::class);
|
||||
$request->scene('addDoctorBankCard')->validateResolved();
|
||||
|
||||
$UserDoctorService = new UserDoctorService();
|
||||
$data = $UserDoctorService->addDoctorBankCard();
|
||||
return $this->response->json($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更换医生银行卡
|
||||
* @return ResponseInterface
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface
|
||||
*/
|
||||
public function putDoctorBankCard(): ResponseInterface
|
||||
{
|
||||
$request = $this->container->get(UserDoctorRequest::class);
|
||||
$request->scene('putDoctorBankCard')->validateResolved();
|
||||
|
||||
$UserDoctorService = new UserDoctorService();
|
||||
$data = $UserDoctorService->putDoctorBankCard();
|
||||
return $this->response->json($data);
|
||||
}
|
||||
}
|
||||
@ -82,14 +82,35 @@ class DoctorBankCard extends Model
|
||||
|
||||
|
||||
/**
|
||||
* 获取医生银行卡列表
|
||||
* 获取医生银行卡-单条
|
||||
* 关联银行表
|
||||
* @param array $params
|
||||
* @param array $fields
|
||||
* @return DoctorBankCard[]|Builder[]|Collection
|
||||
* @return object|null
|
||||
*/
|
||||
public static function getWithBankList(array $params, array $fields = ['*']): Collection|array
|
||||
public static function getWithBankOne(array $params, array $fields = ['*']): object|null
|
||||
{
|
||||
return self::with(['BasicBank'])->where($params)->get($fields);
|
||||
return self::with(['BasicBank'])->where($params)->first($fields);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增
|
||||
* @param array $data
|
||||
* @return \Hyperf\Database\Model\Model|DoctorBankCard
|
||||
*/
|
||||
public static function addDoctorBankCard(array $data): \Hyperf\Database\Model\Model|DoctorBankCard
|
||||
{
|
||||
return self::create($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改
|
||||
* @param array $params
|
||||
* @param array $data
|
||||
* @return int
|
||||
*/
|
||||
public static function editDoctorBankCard(array $params = [], array $data = []): int
|
||||
{
|
||||
return self::where($params)->update($data);
|
||||
}
|
||||
}
|
||||
|
||||
@ -26,6 +26,20 @@ class UserDoctorRequest extends FormRequest
|
||||
'inquiry_price',
|
||||
'work_num_day',
|
||||
],
|
||||
'addDoctorBankCard' => [ // 新增绑定医生银行卡
|
||||
'bank_id',
|
||||
'bank_card_code',
|
||||
'province_id',
|
||||
'city_id',
|
||||
'county_id',
|
||||
],
|
||||
'putDoctorBankCard' => [ // 更换医生银行卡
|
||||
'bank_id',
|
||||
'bank_card_code',
|
||||
'province_id',
|
||||
'city_id',
|
||||
'county_id',
|
||||
],
|
||||
];
|
||||
|
||||
/**
|
||||
@ -47,6 +61,11 @@ class UserDoctorRequest extends FormRequest
|
||||
'is_open' => "required|boolean",
|
||||
'inquiry_price' => "required|min:0|numeric",
|
||||
'work_num_day' => "required|min:0|numeric",
|
||||
'bank_id' => "required",
|
||||
'bank_card_code' => ['required','regex:/^(62|622)[0-9]{13,16}$/'],
|
||||
'province_id' => 'required|required_with:city_id,county_id',
|
||||
'city_id' => 'required|required_with:county_id',
|
||||
'county_id' => 'required',
|
||||
];
|
||||
}
|
||||
|
||||
@ -71,6 +90,15 @@ class UserDoctorRequest extends FormRequest
|
||||
'work_num_day.required' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||||
'work_num_day.min' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||||
'work_num_day.numeric' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||||
|
||||
'bank_id.required' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||||
'bank_card_code.required' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||||
'bank_card_code.regex' => "银行卡号填写错误",
|
||||
'province_id.required_with' => "请选择省份",
|
||||
'province_id.required' => "请选择省份",
|
||||
'city_id.required_with' => "请选择城市",
|
||||
'city_id.required' => "请选择城市",
|
||||
'county_id.required' => "请选择区县",
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@ -18,7 +18,7 @@ class AreaService extends BaseService
|
||||
// 检测省份
|
||||
if (!empty($province_id)){
|
||||
$province = $this->getAreaByAreaId($province_id);
|
||||
if (empty($province['data'])){
|
||||
if (empty($province)){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -26,7 +26,7 @@ class AreaService extends BaseService
|
||||
// 检测城市
|
||||
if (!empty($city_id) && !empty($province_id)){
|
||||
$city = $this->getAreaByAreaId($city_id,$province_id);
|
||||
if (empty($city['data'])){
|
||||
if (empty($city)){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -34,18 +34,64 @@ class AreaService extends BaseService
|
||||
// 检测区县
|
||||
if (!empty($county_id) && !empty($city_id)){
|
||||
$county = $this->getAreaByAreaId($county_id,$city_id);
|
||||
if (empty($county['data'])){
|
||||
if (empty($county)){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($province['data']) || !empty($city['data']) || !empty($county['data'])){
|
||||
if (!empty($province) || !empty($city) || !empty($county)){
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取省市区数据
|
||||
* @param string $province_id
|
||||
* @param string $city_id
|
||||
* @param string $county_id
|
||||
* @return array
|
||||
*/
|
||||
public function getAreaById(string $province_id, string $city_id, string $county_id): array
|
||||
{
|
||||
// 省份
|
||||
if (!empty($province_id)){
|
||||
$province = $this->getAreaByAreaId($province_id);
|
||||
if (empty($province)){
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
// 城市
|
||||
if (!empty($city_id) && !empty($province_id)){
|
||||
$city = $this->getAreaByAreaId($city_id,$province_id);
|
||||
if (empty($city)){
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
// 检测区县
|
||||
if (!empty($county_id) && !empty($city_id)){
|
||||
$county = $this->getAreaByAreaId($county_id,$city_id);
|
||||
if (empty($county)){
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($province) || !empty($city) || !empty($county)){
|
||||
$result = array();
|
||||
$result['province'] = $province;
|
||||
$result['city'] = $city;
|
||||
$result['county'] = $county;
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
return [];
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取省份列表
|
||||
* @return array
|
||||
@ -95,7 +141,7 @@ class AreaService extends BaseService
|
||||
}
|
||||
$area = AreaModel::getOne($params);
|
||||
|
||||
return empty($area) ? success() : success($area->toArray());
|
||||
return empty($area) ? [] : $area->toArray();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -109,6 +155,6 @@ class AreaService extends BaseService
|
||||
$params['parent_id'] = $parent_id;
|
||||
$area = AreaModel::getList($params);
|
||||
|
||||
return empty($area) ? success() : success($area->toArray());
|
||||
return empty($area) ? [] : $area->toArray();
|
||||
}
|
||||
}
|
||||
@ -44,7 +44,7 @@ class PatientFamilyService extends BaseService
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增家庭成员
|
||||
* 新增家庭成员-cuowu
|
||||
* @return array
|
||||
*/
|
||||
public function addFamily(): array
|
||||
|
||||
@ -4,10 +4,15 @@ namespace App\Services;
|
||||
|
||||
use App\Constants\HttpEnumCode;
|
||||
use App\Exception\BusinessException;
|
||||
use App\Model\BasicBank;
|
||||
use App\Model\DiseaseClassExpertise;
|
||||
use App\Model\DoctorBankCard;
|
||||
use App\Model\DoctorExpertise;
|
||||
use App\Model\OrderInquiry;
|
||||
use App\Model\UserDoctor;
|
||||
use App\Model\UserDoctorInfo;
|
||||
use App\Utils\Mask;
|
||||
use Hyperf\DbConnection\Db;
|
||||
|
||||
class UserDoctorService extends BaseService
|
||||
{
|
||||
@ -25,8 +30,8 @@ class UserDoctorService extends BaseService
|
||||
|
||||
$expertise_ids = [];
|
||||
|
||||
if (!empty($doctor_selected_expertise)){
|
||||
$expertise_ids = array_column($doctor_selected_expertise,'expertise_id');
|
||||
if (!empty($doctor_selected_expertise)) {
|
||||
$expertise_ids = array_column($doctor_selected_expertise, 'expertise_id');
|
||||
}
|
||||
|
||||
// 获取全部专长
|
||||
@ -35,11 +40,11 @@ class UserDoctorService extends BaseService
|
||||
'expertise_name',
|
||||
'expertise_sort',
|
||||
];
|
||||
$disease_class_expertise = DiseaseClassExpertise::getOrderList([],$fields);
|
||||
$disease_class_expertise = DiseaseClassExpertise::getOrderList([], $fields);
|
||||
|
||||
foreach ($disease_class_expertise as &$item){
|
||||
foreach ($disease_class_expertise as &$item) {
|
||||
$item['is_selected'] = 0;
|
||||
if (in_array($item['expertise_id'],$expertise_ids)){
|
||||
if (in_array($item['expertise_id'], $expertise_ids)) {
|
||||
$item['is_selected'] = 1;
|
||||
}
|
||||
}
|
||||
@ -55,16 +60,16 @@ class UserDoctorService extends BaseService
|
||||
*/
|
||||
public function getDoctorSelectedExpertise(string $doctor_id): array
|
||||
{
|
||||
if (empty($doctor_id)){
|
||||
if (empty($doctor_id)) {
|
||||
throw new BusinessException("缺少医生id");
|
||||
}
|
||||
|
||||
$params = array();
|
||||
$params['doctor_id'] = $doctor_id;
|
||||
$doctor_expertise = DoctorExpertise::getDiseaseClassExpertiseList($params);
|
||||
if (!empty($doctor_expertise)){
|
||||
foreach ($doctor_expertise as &$data){
|
||||
if (!empty($data['DiseaseClassExpertise'])){
|
||||
if (!empty($doctor_expertise)) {
|
||||
foreach ($doctor_expertise as &$data) {
|
||||
if (!empty($data['DiseaseClassExpertise'])) {
|
||||
$data['expertise_name'] = $data['DiseaseClassExpertise']['expertise_name'];
|
||||
}
|
||||
unset($data['DiseaseClassExpertise']);
|
||||
@ -74,12 +79,256 @@ class UserDoctorService extends BaseService
|
||||
return $doctor_expertise->toArray();
|
||||
}
|
||||
|
||||
// 获取医生银行卡
|
||||
public function getDoctorBankCard(){
|
||||
/**
|
||||
* 获取医生银行卡
|
||||
* @return array
|
||||
*/
|
||||
public function getDoctorBankCard(): array
|
||||
{
|
||||
$user_info = $this->request->getAttribute("userInfo") ?? [];
|
||||
|
||||
$params = array();
|
||||
$params['doctor_id'] = $user_info['client_user_id'];
|
||||
// $doctor_bank_card =
|
||||
$doctor_bank_card = DoctorBankCard::getWithBankOne($params);
|
||||
if (empty($doctor_bank_card)) {
|
||||
return success();
|
||||
}
|
||||
|
||||
$data = array();
|
||||
$data['bank_card_id'] = $doctor_bank_card['bank_card_id'];
|
||||
$data['bank_img_path'] = $doctor_bank_card['BasicBank']['bank_img_path'];
|
||||
$data['bank_name'] = $doctor_bank_card['BasicBank']['bank_name'];
|
||||
$data['bank_card_code_mask'] = $doctor_bank_card['bank_card_code_mask'];
|
||||
|
||||
unset($doctor_bank_card);
|
||||
|
||||
return success($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取医生银行卡详情信息
|
||||
* @return array
|
||||
*/
|
||||
public function getDoctorBankCardInfo(): array
|
||||
{
|
||||
$user_info = $this->request->getAttribute("userInfo") ?? [];
|
||||
|
||||
$bank_card_id = $this->request->input('bank_card_id');// 医生银行卡id
|
||||
|
||||
// 获取医生详情数据
|
||||
$params = array();
|
||||
$params['doctor_id'] = $user_info['client_user_id'];
|
||||
|
||||
$fields = [
|
||||
'doctor_info_id',
|
||||
'doctor_id',
|
||||
'card_name',
|
||||
'card_num_mask',
|
||||
];
|
||||
$user_doctor_info = UserDoctorInfo::getOne($params, $fields);
|
||||
if (empty($user_doctor_info)) {
|
||||
return fail(HttpEnumCode::HTTP_ERROR, "请先实名认证");
|
||||
}
|
||||
|
||||
$result = array();
|
||||
$result['info'] = array();
|
||||
$result['bank'] = array();
|
||||
|
||||
$info = array();
|
||||
$info['card_name'] = $user_doctor_info['card_name'];
|
||||
$info['card_num_mask'] = $user_doctor_info['card_num_mask'];
|
||||
|
||||
if (!empty($bank_card_id)) {
|
||||
// 获取添加的银行卡信息
|
||||
$params = array();
|
||||
$params['doctor_id'] = $user_info['client_user_id'];
|
||||
$params['bank_card_id'] = $bank_card_id;
|
||||
$doctor_bank_card = DoctorBankCard::getWithBankOne($params);
|
||||
if (empty($doctor_bank_card)) {
|
||||
return fail();
|
||||
}
|
||||
|
||||
$bank = array();
|
||||
$bank['bank_card_id'] = $doctor_bank_card['bank_card_id'];
|
||||
$bank['bank_id'] = $doctor_bank_card['bank_id'];
|
||||
$bank['bank_name'] = $doctor_bank_card['BasicBank']['bank_name'];
|
||||
$bank['bank_card_code'] = $doctor_bank_card['bank_card_code'];// 银行卡号
|
||||
$bank['province_id'] = $doctor_bank_card['province_id'];
|
||||
$bank['province'] = $doctor_bank_card['province'];
|
||||
$bank['city_id'] = $doctor_bank_card['city_id'];
|
||||
$bank['city'] = $doctor_bank_card['city'];
|
||||
$bank['county_id'] = $doctor_bank_card['county_id'];
|
||||
$bank['county'] = $doctor_bank_card['county'];
|
||||
}
|
||||
|
||||
$result['info'] = $info;// 用户数据
|
||||
$result['bank'] = $bank ?? [];// 银行卡数据
|
||||
return success($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增绑定医生银行卡
|
||||
* @return array
|
||||
*/
|
||||
public function addDoctorBankCard(): array
|
||||
{
|
||||
$user_info = $this->request->getAttribute("userInfo") ?? [];
|
||||
|
||||
$bank_id = $this->request->input('bank_id');
|
||||
$bank_card_code = $this->request->input('bank_card_code');
|
||||
$province_id = $this->request->input('province_id');
|
||||
$city_id = $this->request->input('city_id');
|
||||
$county_id = $this->request->input('county_id');
|
||||
|
||||
// 验证银行
|
||||
$params = array();
|
||||
$params['bank_id'] = $bank_id;
|
||||
$basic_bank = BasicBank::getOne($params);
|
||||
if (empty($basic_bank)) {
|
||||
return fail(HttpEnumCode::HTTP_ERROR, "开户行错误");
|
||||
}
|
||||
|
||||
// 验证省市区
|
||||
$areaService = new AreaService();
|
||||
$area = $areaService->getAreaById($province_id, $city_id, $county_id);
|
||||
if (empty($area)) {
|
||||
return fail(HttpEnumCode::HTTP_ERROR, "地区选择错误");
|
||||
}
|
||||
|
||||
// 获取医生银行卡
|
||||
$params = array();
|
||||
$params['doctor_id'] = $user_info['client_user_id'];
|
||||
$doctor_bank_card = DoctorBankCard::getOne($params);
|
||||
if (!empty($doctor_bank_card)) {
|
||||
return fail(HttpEnumCode::HTTP_ERROR, "已绑定银行卡");
|
||||
}
|
||||
|
||||
// 获取医生信息
|
||||
$params = array();
|
||||
$params['doctor_id'] = $user_info['client_user_id'];
|
||||
|
||||
$fields = [
|
||||
'doctor_id',
|
||||
'is_bind_bank',
|
||||
];
|
||||
$user_doctor = UserDoctor::getOne($params, $fields);
|
||||
if (empty($user_doctor)) {
|
||||
return fail(HttpEnumCode::HTTP_ERROR, "非法医生");
|
||||
}
|
||||
|
||||
if ($user_doctor['is_bind_bank'] == 1) {
|
||||
return fail(HttpEnumCode::HTTP_ERROR, "已绑定银行卡");
|
||||
}
|
||||
|
||||
// 处理银行卡掩码
|
||||
$bank_card_code_mask = Mask::maskBankCard($bank_card_code);
|
||||
|
||||
// 验证银行卡
|
||||
|
||||
Db::beginTransaction();
|
||||
|
||||
try {
|
||||
// 新增医生银行卡
|
||||
$data = array();
|
||||
$data['doctor_id'] = $user_info['client_user_id'];
|
||||
$data['bank_id'] = $bank_id;
|
||||
$data['bank_card_code'] = $bank_card_code;
|
||||
$data['bank_card_code_mask'] = $bank_card_code_mask;
|
||||
$data['province_id'] = $province_id;
|
||||
$data['province'] = $area['province']['area_name'];
|
||||
$data['city_id'] = $city_id;
|
||||
$data['city'] = $area['city']['area_name'];
|
||||
$data['county_id'] = $county_id;
|
||||
$data['county'] = $area['county']['area_name'];
|
||||
$doctor_bank_card = DoctorBankCard::addDoctorBankCard($data);
|
||||
if (empty($doctor_bank_card)) {
|
||||
Db::rollBack();
|
||||
return fail(HttpEnumCode::SERVER_ERROR);
|
||||
}
|
||||
|
||||
// 修改医生表绑定银行卡状态
|
||||
$params = array();
|
||||
$params['doctor_id'] = $user_info['client_user_id'];
|
||||
|
||||
$data = array();
|
||||
$data['is_bind_bank'] = 1;
|
||||
UserDoctor::editUserDoctor($params, $data);
|
||||
|
||||
Db::commit();
|
||||
} catch (\Exception $e) {
|
||||
Db::rollBack();
|
||||
return fail(HttpEnumCode::SERVER_ERROR, $e->getMessage());
|
||||
}
|
||||
|
||||
return success();
|
||||
}
|
||||
|
||||
public function putDoctorBankCard()
|
||||
{
|
||||
$user_info = $this->request->getAttribute("userInfo") ?? [];
|
||||
|
||||
$bank_card_id = $this->request->route('bank_card_id');
|
||||
$bank_id = $this->request->input('bank_id');
|
||||
$bank_card_code = $this->request->input('bank_card_code');
|
||||
$province_id = $this->request->input('province_id');
|
||||
$city_id = $this->request->input('city_id');
|
||||
$county_id = $this->request->input('county_id');
|
||||
|
||||
// 获取医生银行卡
|
||||
$params = array();
|
||||
$params['bank_card_id'] = $bank_card_id;
|
||||
$doctor_bank_card = DoctorBankCard::getOne($params);
|
||||
if (empty($doctor_bank_card)) {
|
||||
return fail();
|
||||
}
|
||||
|
||||
// 检测上次修改时间
|
||||
$updated_at = strtotime($doctor_bank_card['updated_at']);
|
||||
$moonth_start = strtotime(date("Y-m-01")); // 当月开始时间
|
||||
$moonth_end = strtotime(date("Y-m-t")); // 当月结束时间
|
||||
|
||||
if ($updated_at >= $moonth_start && $updated_at <= $moonth_end) {
|
||||
// 银行卡一月只能修改一次
|
||||
return fail(HttpEnumCode::HTTP_ERROR, "银行卡每月只能修改一次");
|
||||
}
|
||||
|
||||
// 验证银行
|
||||
$params = array();
|
||||
$params['bank_id'] = $bank_id;
|
||||
$basic_bank = BasicBank::getOne($params);
|
||||
if (empty($basic_bank)) {
|
||||
return fail(HttpEnumCode::HTTP_ERROR, "开户行错误");
|
||||
}
|
||||
|
||||
// 验证省市区
|
||||
$areaService = new AreaService();
|
||||
$area = $areaService->getAreaById($province_id, $city_id, $county_id);
|
||||
if (empty($area)) {
|
||||
return fail(HttpEnumCode::HTTP_ERROR, "地区选择错误");
|
||||
}
|
||||
|
||||
// 处理银行卡掩码
|
||||
$bank_card_code_mask = Mask::maskBankCard($bank_card_code);;
|
||||
|
||||
// 验证银行卡
|
||||
|
||||
// 修改银行卡
|
||||
$params = array();
|
||||
$params['bank_card_id'] = $bank_card_id;
|
||||
|
||||
$data = array();
|
||||
$data['bank_id'] = $bank_id;
|
||||
$data['bank_card_code'] = $bank_card_code;
|
||||
$data['bank_card_code_mask'] = $bank_card_code_mask;
|
||||
$data['province_id'] = $province_id;
|
||||
$data['province'] = $area['province']['area_name'];
|
||||
$data['city_id'] = $city_id;
|
||||
$data['city'] = $area['city']['area_name'];
|
||||
$data['county_id'] = $county_id;
|
||||
$data['county'] = $area['county']['area_name'];
|
||||
$data['updated_at'] = date('Y-m-d H:i:s',time());
|
||||
DoctorBankCard::editDoctorBankCard($params,$data);
|
||||
|
||||
return success();
|
||||
}
|
||||
}
|
||||
@ -3,16 +3,7 @@
|
||||
namespace App\Services;
|
||||
|
||||
use App\Constants\HttpEnumCode;
|
||||
use App\Exception\BusinessException;
|
||||
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\Utils\Http;
|
||||
use App\Utils\Jwt;
|
||||
use Hyperf\DbConnection\Db;
|
||||
use Psr\Container\ContainerExceptionInterface;
|
||||
use Psr\Container\NotFoundExceptionInterface;
|
||||
use App\Model\UserDoctorInfo;
|
||||
|
||||
class UserService extends BaseService
|
||||
{
|
||||
|
||||
@ -103,4 +103,25 @@ class Mask
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 银行卡掩码
|
||||
* 示例:
|
||||
* 6228480038716690979:6228****0979
|
||||
* @param string $card_num
|
||||
* @return string
|
||||
*/
|
||||
public static function maskBankCard(string $card_num): string
|
||||
{
|
||||
if (empty($card_num)){
|
||||
return $card_num;
|
||||
}
|
||||
|
||||
$result = preg_replace('/^(.{4})(.*)(.{4})$/','${1}****${3}',$card_num);
|
||||
if (empty($result)){
|
||||
return $card_num;
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
@ -23,6 +23,7 @@ use App\Controller\PatientCenterController;
|
||||
use App\Controller\PatientDoctorController;
|
||||
use App\Controller\PatientFamilyController;
|
||||
use App\Controller\SafeController;
|
||||
use App\Controller\UserController;
|
||||
use App\Controller\UserDoctorController;
|
||||
use App\Services\SafeService;
|
||||
use Hyperf\HttpServer\Router\Router;
|
||||
@ -79,6 +80,15 @@ Router::addGroup('/doctor', function () {
|
||||
Router::addGroup('/bank', function () {
|
||||
// 获取医生银行卡
|
||||
Router::get('', [UserDoctorController::class, 'getDoctorBankCard']);
|
||||
|
||||
// 获取绑定银行卡详情信息
|
||||
Router::get('/info', [UserDoctorController::class, 'getDoctorBankCardInfo']);
|
||||
|
||||
// 新增绑定医生银行卡
|
||||
Router::post('', [UserDoctorController::class, 'addDoctorBankCard']);
|
||||
|
||||
// 更换医生银行卡
|
||||
Router::put('/{bank_card_id:\d+}', [UserDoctorController::class, 'putDoctorBankCard']);
|
||||
});
|
||||
});
|
||||
|
||||
@ -206,3 +216,4 @@ Router::addGroup('/basic', function () {
|
||||
// 获取自定义科室数据
|
||||
Router::get('/department', [BasicDataController::class, 'getCustomDepartment']);
|
||||
});
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user