去除手机号验证
This commit is contained in:
parent
833acbbc99
commit
fa4e3e0382
@ -532,6 +532,7 @@ class CallBackController extends AbstractController
|
|||||||
|
|
||||||
// 发送短信消息
|
// 发送短信消息
|
||||||
|
|
||||||
|
// 告知处方平台
|
||||||
return $server->serve();
|
return $server->serve();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -14,6 +14,7 @@ use App\Services\UserDoctorService;
|
|||||||
use App\Services\UserService;
|
use App\Services\UserService;
|
||||||
use App\Utils\Http;
|
use App\Utils\Http;
|
||||||
use App\Utils\Log;
|
use App\Utils\Log;
|
||||||
|
use Extend\Prescription\Prescription;
|
||||||
use Extend\TencentIm\Account;
|
use Extend\TencentIm\Account;
|
||||||
use Extend\TencentIm\Friend;
|
use Extend\TencentIm\Friend;
|
||||||
use Extend\TencentIm\Group;
|
use Extend\TencentIm\Group;
|
||||||
@ -104,25 +105,25 @@ class UserController extends AbstractController
|
|||||||
// return $this->response->json($pay_config);
|
// return $this->response->json($pay_config);
|
||||||
|
|
||||||
// 发起退款
|
// 发起退款
|
||||||
$WechatPay = new WechatPay(1,2);
|
// $WechatPay = new WechatPay(1,2);
|
||||||
|
//
|
||||||
$params = array();
|
// $params = array();
|
||||||
$params['order_inquiry_id'] = 1;
|
// $params['order_inquiry_id'] = 1;
|
||||||
$order_inquiry = OrderInquiry::getOne($params);
|
// $order_inquiry = OrderInquiry::getOne($params);
|
||||||
|
//
|
||||||
|
//
|
||||||
$options = array();
|
// $options = array();
|
||||||
$options['transaction_id'] = "4200001756202303145016495897";
|
// $options['transaction_id'] = "4200001756202303145016495897";
|
||||||
$options['out_refund_no'] = "123456";
|
// $options['out_refund_no'] = "123456";
|
||||||
$options['reason'] = "退款原因";
|
// $options['reason'] = "退款原因";
|
||||||
$options['amount'] = [
|
// $options['amount'] = [
|
||||||
'refund' => (int)1,
|
// 'refund' => (int)1,
|
||||||
'total' => (int)1,
|
// 'total' => (int)1,
|
||||||
'currency' => "CNY",
|
// 'currency' => "CNY",
|
||||||
];
|
// ];
|
||||||
|
//
|
||||||
$result = $WechatPay->refund($options);
|
// $result = $WechatPay->refund($options);
|
||||||
dump($result);
|
// dump($result);
|
||||||
|
|
||||||
// 创建账号
|
// 创建账号
|
||||||
$account = new Account();
|
$account = new Account();
|
||||||
@ -234,5 +235,9 @@ class UserController extends AbstractController
|
|||||||
// return fail(HttpEnumCode::HTTP_ERROR, $res);
|
// return fail(HttpEnumCode::HTTP_ERROR, $res);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
// 对接处方平台
|
||||||
|
$Prescription = new Prescription();
|
||||||
|
$token = $Prescription->getProd();
|
||||||
|
dump($token);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -106,7 +106,7 @@ class PatientFamilyRequest extends FormRequest
|
|||||||
'card_name' => 'required',
|
'card_name' => 'required',
|
||||||
'type' => ['required',Rule::in(['1', '2', '3', '4'])],
|
'type' => ['required',Rule::in(['1', '2', '3', '4'])],
|
||||||
'id_number' => "required",
|
'id_number' => "required",
|
||||||
'mobile' => ['required','regex:/^1(3\d|4[5-9]|5[0-35-9]|6[2567]|7[0-8]|8\d|9[0-35-9])\d{8}$/'],
|
'mobile' => ['sometimes','regex:/^1(3\d|4[5-9]|5[0-35-9]|6[2567]|7[0-8]|8\d|9[0-35-9])\d{8}$/'],
|
||||||
'relation' => ['required',Rule::in(['1', '2', '3', '4', '5', '6'])],
|
'relation' => ['required',Rule::in(['1', '2', '3', '4', '5', '6'])],
|
||||||
'city_id' => 'required_with:province_id',
|
'city_id' => 'required_with:province_id',
|
||||||
'province_id' => 'required_with:city_id,county_id',
|
'province_id' => 'required_with:city_id,county_id',
|
||||||
@ -137,7 +137,7 @@ class PatientFamilyRequest extends FormRequest
|
|||||||
'type.required' => "请选择证件类型",
|
'type.required' => "请选择证件类型",
|
||||||
'type.in' => "证件类型错误",
|
'type.in' => "证件类型错误",
|
||||||
'id_number.required' => "请选择证件号",
|
'id_number.required' => "请选择证件号",
|
||||||
'mobile.required' => "手机号不能为空",
|
// 'mobile.required' => "手机号不能为空",
|
||||||
'mobile.regex' => "手机号格式错误",
|
'mobile.regex' => "手机号格式错误",
|
||||||
'relation.required' => "请选择患者关系",
|
'relation.required' => "请选择患者关系",
|
||||||
'relation.in' => "患者关系错误",
|
'relation.in' => "患者关系错误",
|
||||||
|
|||||||
165
extend/Prescription/Prescription.php
Normal file
165
extend/Prescription/Prescription.php
Normal file
@ -0,0 +1,165 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Extend\Prescription;
|
||||||
|
|
||||||
|
use App\Constants\HttpEnumCode;
|
||||||
|
use App\Exception\BusinessException;
|
||||||
|
use GuzzleHttp\Client;
|
||||||
|
use GuzzleHttp\Exception\GuzzleException;
|
||||||
|
use Hyperf\Di\Annotation\Inject;
|
||||||
|
use Hyperf\Redis\Redis;
|
||||||
|
use Hyperf\Utils\ApplicationContext;
|
||||||
|
use Psr\Container\ContainerExceptionInterface;
|
||||||
|
use Psr\Container\ContainerInterface;
|
||||||
|
use Psr\Container\NotFoundExceptionInterface;
|
||||||
|
|
||||||
|
class Prescription
|
||||||
|
{
|
||||||
|
#[Inject]
|
||||||
|
protected ContainerInterface $container;
|
||||||
|
|
||||||
|
#[Inject]
|
||||||
|
protected Client $client;
|
||||||
|
|
||||||
|
#[Inject]
|
||||||
|
protected Redis $redis;
|
||||||
|
|
||||||
|
protected string $api_url;
|
||||||
|
protected string $client_id;
|
||||||
|
protected string $client_secret;
|
||||||
|
protected array $header;
|
||||||
|
public string $version = "v1";
|
||||||
|
|
||||||
|
public function __construct(){
|
||||||
|
// 请求地址
|
||||||
|
$this->api_url = "http://49.233.3.200:6304/api/thridapi/";
|
||||||
|
$this->client_id = "ZD-004";
|
||||||
|
$this->client_secret = "0baa5927164710b9f800bf33546b6da3";
|
||||||
|
$this->container = ApplicationContext::getContainer();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取token接口
|
||||||
|
* @return string token数据
|
||||||
|
*/
|
||||||
|
protected function getToken(): string
|
||||||
|
{
|
||||||
|
$option = [
|
||||||
|
"json" => array(
|
||||||
|
"clientId" => $this->client_id,
|
||||||
|
"clientSecret" => $this->client_secret,
|
||||||
|
)
|
||||||
|
];
|
||||||
|
|
||||||
|
try {
|
||||||
|
$response = $this->httpRequest($this->api_url . $this->version . '/user_thrid/token', $option);
|
||||||
|
|
||||||
|
if (empty($response['result'])){
|
||||||
|
// 返回值为空
|
||||||
|
throw new BusinessException(HttpEnumCode::getMessage(HttpEnumCode::SERVER_ERROR));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (empty($response['result']['token'])){
|
||||||
|
// 返回值为空
|
||||||
|
throw new BusinessException(HttpEnumCode::getMessage(HttpEnumCode::SERVER_ERROR));
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (GuzzleException $e) {
|
||||||
|
throw new BusinessException($e->getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->header = [
|
||||||
|
"Authorization" => "Bearer " . $response['result']['token']
|
||||||
|
];
|
||||||
|
|
||||||
|
$this->redis->set("prescription_token",$response['result']['token'],60 * 60 * 1.5);
|
||||||
|
return $response['result']['token'];
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取药品
|
||||||
|
public function getProd(){
|
||||||
|
$option = [
|
||||||
|
"json" => array(
|
||||||
|
"page" => 1,
|
||||||
|
"pageSize" => 1,
|
||||||
|
),
|
||||||
|
];
|
||||||
|
|
||||||
|
try {
|
||||||
|
$response = $this->httpRequest($this->api_url . $this->version . '/drug/syncDrugCatalogue', $option);
|
||||||
|
if (empty($response['result'])){
|
||||||
|
// 返回值为空
|
||||||
|
throw new BusinessException(HttpEnumCode::getMessage(HttpEnumCode::SERVER_ERROR));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (empty($response['result']['rows'])){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
dump($response);
|
||||||
|
// 获取总数
|
||||||
|
// $count
|
||||||
|
} catch (GuzzleException $e) {
|
||||||
|
throw new BusinessException($e->getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
// return $response['token'];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 请求封装
|
||||||
|
* @param string $path
|
||||||
|
* @param array $option
|
||||||
|
* @return array
|
||||||
|
* @throws GuzzleException
|
||||||
|
*/
|
||||||
|
protected function httpRequest(string $path,array $arg = []): array
|
||||||
|
{
|
||||||
|
if ($path != "http://49.233.3.200:6304/api/thridapi/v1/drug/syncDrugCatalogue"){
|
||||||
|
$this->redis = $this->container->get(Redis::class);
|
||||||
|
|
||||||
|
$access_token = $this->redis->get("prescription_token");
|
||||||
|
if (empty($access_token)){
|
||||||
|
$access_token = $this->getToken();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($access_token)){
|
||||||
|
$option = [
|
||||||
|
"headers" => [
|
||||||
|
"Authorization" => "Bearer " . $access_token
|
||||||
|
]
|
||||||
|
];
|
||||||
|
}
|
||||||
|
if (!empty($option)){
|
||||||
|
$arg = array_merge($arg,$option);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
dump($arg);
|
||||||
|
|
||||||
|
$response = $this->client->post($path, $arg);
|
||||||
|
|
||||||
|
if ($response->getStatusCode() != '200'){
|
||||||
|
// 请求失败
|
||||||
|
throw new BusinessException($response->getBody()->getContents());
|
||||||
|
}
|
||||||
|
|
||||||
|
$body = json_decode($response->getBody(),true);
|
||||||
|
if (empty($body)){
|
||||||
|
// 返回值为空
|
||||||
|
throw new BusinessException(HttpEnumCode::getMessage(HttpEnumCode::SERVER_ERROR));
|
||||||
|
}
|
||||||
|
dump($body);
|
||||||
|
|
||||||
|
if (empty($body['data'])){
|
||||||
|
// 返回值为空
|
||||||
|
if (!empty($body['message'])){
|
||||||
|
throw new BusinessException($body['message']);
|
||||||
|
}
|
||||||
|
throw new BusinessException(HttpEnumCode::getMessage(HttpEnumCode::SERVER_ERROR));
|
||||||
|
}
|
||||||
|
|
||||||
|
return $body['data'];
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user