72 lines
2.2 KiB
PHP
72 lines
2.2 KiB
PHP
<?php
|
|
|
|
namespace App\Controller;
|
|
|
|
use App\Request\InquiryRequest;
|
|
use App\Services\InquiryService;
|
|
use Extend\Wechat\WechatPay;
|
|
use Hyperf\Snowflake\IdGeneratorInterface;
|
|
use Psr\Container\ContainerExceptionInterface;
|
|
use Psr\Container\NotFoundExceptionInterface;
|
|
use Psr\Http\Message\ResponseInterface;
|
|
|
|
/**
|
|
* 问诊
|
|
*/
|
|
class InquiryController extends AbstractController
|
|
{
|
|
/**
|
|
* 创建问诊订单
|
|
* @return ResponseInterface
|
|
* @throws ContainerExceptionInterface
|
|
* @throws NotFoundExceptionInterface
|
|
*/
|
|
public function addInquiryOrder(): ResponseInterface
|
|
{
|
|
// $message = new CancelUnpayOrdersDelayDirectProducer(10000);
|
|
// $message->setDelayMs(10000);
|
|
// $producer = ApplicationContext::getContainer()->get(Producer::class);
|
|
// $producer->produce($message);
|
|
//
|
|
// $message = new CancelUnpayOrdersDelayDirectProducer(5000);
|
|
// $message->setDelayMs(5000);
|
|
// $producer = ApplicationContext::getContainer()->get(Producer::class);
|
|
// $producer->produce($message);
|
|
|
|
$request = $this->container->get(InquiryRequest::class);
|
|
$request->scene('addInquiryOrder')->validateResolved();
|
|
|
|
$InquiryService = new InquiryService();
|
|
$data = $InquiryService->addInquiryOrder();
|
|
return $this->response->json($data);
|
|
}
|
|
|
|
/**
|
|
* 获取患者问诊病例
|
|
* @return ResponseInterface
|
|
*/
|
|
public function getPatientInquiryCase(): ResponseInterface
|
|
{
|
|
$InquiryService = new InquiryService();
|
|
$data = $InquiryService->getPatientInquiryCase();
|
|
return $this->response->json($data);
|
|
}
|
|
|
|
public function addInquiryOrderTest(){
|
|
$WechatPay = new WechatPay(2);
|
|
|
|
$generator = $this->container->get(IdGeneratorInterface::class);
|
|
|
|
$out_trade_no = $generator->generate();
|
|
dump($out_trade_no);
|
|
|
|
// 获取jsapi的prepay_id
|
|
$total = 100;
|
|
$openid = "o9gYG441zEAHuYoNX7lwFKiQBzKE";
|
|
$result = $WechatPay->getJsapiPrepayId($out_trade_no,$total,$openid);
|
|
|
|
// 获取小程序支付配置
|
|
$config = $WechatPay->getAppletsPayConfig($result['prepay_id']);
|
|
dump($config);
|
|
}
|
|
} |