新增腾讯im。
This commit is contained in:
@@ -55,7 +55,7 @@ class CancelUnpayOrdersDelayDirectConsumer extends ConsumerMessage
|
||||
return Result::DROP;// 销毁
|
||||
}
|
||||
|
||||
if ($order_inquiry['inquiry_refund_status'] != 0 && $order_inquiry['inquiry_refund_status'] != 5) {
|
||||
if (!in_array($order_inquiry['inquiry_refund_status'],[0,4,5])) {
|
||||
// 问诊订单退款状态(0:无退款 1:申请退款 2:退款中 3:退款成功 4:拒绝退款 5:退款关闭)
|
||||
Log::getInstance()->error("队列执行失败原因:订单正在退款中");
|
||||
return Result::DROP;// 销毁
|
||||
@@ -67,10 +67,16 @@ class CancelUnpayOrdersDelayDirectConsumer extends ConsumerMessage
|
||||
return Result::DROP;// 销毁
|
||||
}
|
||||
|
||||
// 检测订单删除状态
|
||||
if ($order_inquiry['is_delete'] == 1) {
|
||||
// 删除状态(0:否 1:是)
|
||||
Log::getInstance()->error("取消未支付订单:订单已被删除");
|
||||
return Result::ACK;// 销毁
|
||||
}
|
||||
|
||||
// 取消问诊订单
|
||||
$data = array();
|
||||
$data['inquiry_status'] = 7;
|
||||
$data['inquiry_refund_status'] = 2;
|
||||
$data['inquiry_pay_status'] = 5;
|
||||
$data['cancel_time'] = date("Y-m-d H:i:s",time());
|
||||
$data['cancel_reason'] = 5; // 取消订单原因(1:医生未接诊 2:主动取消 3:无可分配医生 4:客服取消 5:支付超时)
|
||||
|
||||
@@ -105,4 +105,39 @@ class InquiryController extends AbstractController
|
||||
$data = $InquiryService->getPatientInquiryOrderInfo();
|
||||
return $this->response->json($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 取消患者问诊订单
|
||||
* @return ResponseInterface
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface
|
||||
*/
|
||||
public function putCancelPatientInquiryOrder(): ResponseInterface
|
||||
{
|
||||
$InquiryService = new InquiryService();
|
||||
$data = $InquiryService->putCancelPatientInquiryOrder();
|
||||
return $this->response->json($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除问诊订单
|
||||
* @return ResponseInterface
|
||||
*/
|
||||
public function deletePatientInquiryOrder(): ResponseInterface
|
||||
{
|
||||
$InquiryService = new InquiryService();
|
||||
$data = $InquiryService->deletePatientInquiryOrder();
|
||||
return $this->response->json($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 问诊订单取消支付
|
||||
* @return ResponseInterface
|
||||
*/
|
||||
public function putPatientInquiryOrderCancelPay(): ResponseInterface
|
||||
{
|
||||
$InquiryService = new InquiryService();
|
||||
$data = $InquiryService->putPatientInquiryOrderCancelPay();
|
||||
return $this->response->json($data);
|
||||
}
|
||||
}
|
||||
@@ -11,6 +11,12 @@ use App\Request\UserRequest;
|
||||
use App\Services\UserDoctorService;
|
||||
use App\Services\UserService;
|
||||
use App\Utils\Http;
|
||||
use Extend\TencentIm\Account;
|
||||
use Extend\TencentIm\Friend;
|
||||
use Extend\TencentIm\Group;
|
||||
use Extend\TencentIm\Message;
|
||||
use Extend\TencentIm\MessageParams;
|
||||
use Extend\TencentIm\Profile;
|
||||
use Extend\Wechat\Wechat;
|
||||
use Extend\Wechat\WechatPay;
|
||||
use Hyperf\Amqp\Producer;
|
||||
@@ -75,27 +81,22 @@ class UserController extends AbstractController
|
||||
|
||||
// 支付测试
|
||||
public function testpay(){
|
||||
// $weChat = new Wechat(1);
|
||||
//
|
||||
// $wx_info_data = $weChat->codeToSession("0219AIFa1ROoUE0e4lIa1bO27I29AIF9");
|
||||
// dump($wx_info_data);die;
|
||||
|
||||
// 发起支付
|
||||
$out_trade_no = $this->request->input('out_trade_no');
|
||||
$generator = $this->container->get(IdGeneratorInterface::class);
|
||||
|
||||
$WechatPay = new WechatPay(1);
|
||||
|
||||
// 获取预支付交易会话标识
|
||||
$total = 0.01 * 100;
|
||||
$prepay = $WechatPay->getJsapiPrepayId($out_trade_no,$total,"omgU35DlE-rxTAGgcBjOuc4xdcX8");
|
||||
if (empty($prepay)){
|
||||
return fail(HttpEnumCode::SERVER_ERROR, "订单创建失败");
|
||||
}
|
||||
|
||||
// 获取小程序支付配置
|
||||
$pay_config = $WechatPay->getAppletsPayConfig($prepay['prepay_id']);
|
||||
return $this->response->json($pay_config);
|
||||
// $out_trade_no = $this->request->input('out_trade_no');
|
||||
// $generator = $this->container->get(IdGeneratorInterface::class);
|
||||
//
|
||||
// $WechatPay = new WechatPay(1);
|
||||
//
|
||||
// // 获取预支付交易会话标识
|
||||
// $total = 0.01 * 100;
|
||||
// $prepay = $WechatPay->getJsapiPrepayId($out_trade_no,$total,"omgU35DlE-rxTAGgcBjOuc4xdcX8");
|
||||
// if (empty($prepay)){
|
||||
// return fail(HttpEnumCode::SERVER_ERROR, "订单创建失败");
|
||||
// }
|
||||
//
|
||||
// // 获取小程序支付配置
|
||||
// $pay_config = $WechatPay->getAppletsPayConfig($prepay['prepay_id']);
|
||||
// return $this->response->json($pay_config);
|
||||
|
||||
// 发起退款
|
||||
// $WechatPay = new WechatPay(1);
|
||||
@@ -117,5 +118,53 @@ class UserController extends AbstractController
|
||||
//
|
||||
// $result = $WechatPay->refund($options);
|
||||
// dump($result);
|
||||
|
||||
// 创建账号
|
||||
$account = new Account();
|
||||
$profile = new Profile();
|
||||
$group = new Group();
|
||||
$friend = new Friend();
|
||||
$message = new Message();
|
||||
// $result = $account->createAccount(1234567,'测试患者',"https://img.applets.igandanyiyuan.com/applet/doctor/avatar/03dc8df2-e7c0-4ad9-b87e-5133e40e0f76.jpg");
|
||||
|
||||
// 查询账号导入状态
|
||||
// $result = $account->checkAccountStatus("123456");
|
||||
|
||||
// 设置账户资料
|
||||
// $arg = array();
|
||||
// $arg['Tag_Profile_IM_Gender'] = "Gender_Type_Male";
|
||||
// $arg['Tag_Profile_IM_BirthDay'] = 19961007;
|
||||
// $arg['Tag_Profile_Custom_Hname'] = "协和医院";
|
||||
// $arg['Tag_Profile_Custom_Title'] = "主任医师";
|
||||
// $result = $profile->setProfile("123456",$arg);
|
||||
|
||||
// 添加用户好友分组
|
||||
// $result = $group->addUserGroup('123456');
|
||||
|
||||
// 获取用户好友分组
|
||||
// $result = $group->getUserGroup('123456');
|
||||
|
||||
// 添加好友
|
||||
// $result = $friend->addFriend("123456",'1234567',"快速问诊");
|
||||
|
||||
// 发送消息
|
||||
$arg = array();
|
||||
$arg['From_Account'] = "1234567"; // 发送方user_id 如系统发送,无需填写
|
||||
$arg['To_Account'] = "123456"; // 接收方user_id
|
||||
$arg['ForbidCallbackControl'] = ['ForbidBeforeSendMsgCallback'];
|
||||
|
||||
$arg['MsgBody'] = [
|
||||
[
|
||||
"MsgType" => "TIMTextElem",
|
||||
"MsgContent" => [
|
||||
"Text" => "测试消息",
|
||||
],
|
||||
]
|
||||
];
|
||||
|
||||
$result = $message->sendMessage($arg);
|
||||
dump($result);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -9,12 +9,18 @@ use App\Request\UserDoctorRequest;
|
||||
use App\Services\DoctorAuthService;
|
||||
use App\Services\DoctorInquiryService;
|
||||
use App\Services\UserDoctorService;
|
||||
use Extend\TencentIm\Account;
|
||||
use Hyperf\Amqp\Producer;
|
||||
use Hyperf\DbConnection\Db;
|
||||
use Hyperf\Utils\ApplicationContext;
|
||||
use Psr\Container\ContainerExceptionInterface;
|
||||
use Psr\Container\NotFoundExceptionInterface;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
use Symfony\Contracts\HttpClient\Exception\ClientExceptionInterface;
|
||||
use Symfony\Contracts\HttpClient\Exception\DecodingExceptionInterface;
|
||||
use Symfony\Contracts\HttpClient\Exception\RedirectionExceptionInterface;
|
||||
use Symfony\Contracts\HttpClient\Exception\ServerExceptionInterface;
|
||||
use Symfony\Contracts\HttpClient\Exception\TransportExceptionInterface;
|
||||
|
||||
class UserDoctorController extends AbstractController
|
||||
{
|
||||
@@ -280,6 +286,13 @@ class UserDoctorController extends AbstractController
|
||||
/**
|
||||
* 获取医生名片
|
||||
* @return ResponseInterface
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface
|
||||
* @throws ClientExceptionInterface
|
||||
* @throws DecodingExceptionInterface
|
||||
* @throws RedirectionExceptionInterface
|
||||
* @throws ServerExceptionInterface
|
||||
* @throws TransportExceptionInterface
|
||||
*/
|
||||
public function getDoctorInfoCard(): ResponseInterface
|
||||
{
|
||||
@@ -287,4 +300,9 @@ class UserDoctorController extends AbstractController
|
||||
$data = $UserDoctorService->getDoctorInfoCard();
|
||||
return $this->response->json($data);
|
||||
}
|
||||
|
||||
// 获取医生问诊消息列表
|
||||
public function getDoctorMessageList(){
|
||||
|
||||
}
|
||||
}
|
||||
@@ -678,6 +678,157 @@ class InquiryService extends BaseService
|
||||
return success($order_inquiry->toArray());
|
||||
}
|
||||
|
||||
/**
|
||||
* 取消患者问诊订单
|
||||
* @return array
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface
|
||||
*/
|
||||
public function putCancelPatientInquiryOrder(): array
|
||||
{
|
||||
$user_info = $this->request->getAttribute("userInfo") ?? [];
|
||||
|
||||
$order_inquiry_id = $this->request->route('order_inquiry_id');
|
||||
|
||||
// 获取订单数据
|
||||
$params = array();
|
||||
$params['patient_id'] = $user_info['client_user_id'];
|
||||
$params['order_inquiry_id'] = $order_inquiry_id;
|
||||
$params['is_delete'] = 0;
|
||||
$order_inquiry = OrderInquiry::getOne($params);
|
||||
if (empty($order_inquiry)){
|
||||
return fail();
|
||||
}
|
||||
|
||||
// 检测订单状态
|
||||
if (!in_array($order_inquiry['inquiry_status'],[1,2,3])) {
|
||||
// 问诊订单状态(1:待支付 2:待分配 3:待接诊 4:已接诊 5:已完成 6:已结束 7:已取消)
|
||||
return fail(HttpEnumCode::HTTP_ERROR,"订单无法取消");
|
||||
}
|
||||
|
||||
if (!in_array($order_inquiry['inquiry_refund_status'],[0,4,5])) {
|
||||
// 问诊订单退款状态(0:无退款 1:申请退款 2:退款中 3:退款成功 4:拒绝退款 5:退款关闭)
|
||||
return fail(HttpEnumCode::HTTP_ERROR,"订单正在退款中");
|
||||
}
|
||||
|
||||
// 支付状态(1:未支付 2:已支付 3:支付中 4:支付失败 5:支付超时 6:支付关闭 7:已撤销 8:转入退款)
|
||||
|
||||
Db::beginTransaction();
|
||||
try {
|
||||
// 修改问诊订单为取消
|
||||
$data = array();
|
||||
$data['inquiry_status'] = 7;
|
||||
$data['cancel_time'] = date("Y-m-d H:i:s",time());
|
||||
$data['cancel_reason'] = 2; // 取消订单原因(1:医生未接诊 2:主动取消 3:无可分配医生 4:客服取消 5:支付超时)
|
||||
$data['updated_at'] = date("Y-m-d H:i:s",time());
|
||||
|
||||
$params = array();
|
||||
$params['order_inquiry_id'] = $order_inquiry['order_inquiry_id'];
|
||||
OrderInquiry::edit($params,$data);
|
||||
|
||||
// 检测支付状态,判断是否需要退款处理
|
||||
if ($order_inquiry['inquiry_pay_status'] == 2){
|
||||
// 需退款
|
||||
$this->inquiryRefund($order_inquiry['order_inquiry_id'],"取消问诊");
|
||||
}
|
||||
|
||||
} catch (\Exception $e) {
|
||||
Db::rollBack();
|
||||
return fail(HttpEnumCode::HTTP_ERROR, $e->getMessage());
|
||||
}
|
||||
|
||||
return success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除问诊订单
|
||||
* @return array
|
||||
*/
|
||||
public function deletePatientInquiryOrder(): array
|
||||
{
|
||||
$user_info = $this->request->getAttribute("userInfo") ?? [];
|
||||
|
||||
$order_inquiry_id = $this->request->route('order_inquiry_id');
|
||||
|
||||
// 获取订单数据
|
||||
$params = array();
|
||||
$params['patient_id'] = $user_info['client_user_id'];
|
||||
$params['order_inquiry_id'] = $order_inquiry_id;
|
||||
$params['is_delete'] = 0;
|
||||
$order_inquiry = OrderInquiry::getOne($params);
|
||||
if (empty($order_inquiry)){
|
||||
return fail();
|
||||
}
|
||||
|
||||
// 检测订单状态
|
||||
if (!in_array($order_inquiry['inquiry_status'],[1,5])) {
|
||||
// 问诊订单状态(1:待支付 2:待分配 3:待接诊 4:已接诊 5:已完成 6:已结束 7:已取消)
|
||||
return fail(HttpEnumCode::HTTP_ERROR,"订单无法删除");
|
||||
}
|
||||
|
||||
if (!in_array($order_inquiry['inquiry_refund_status'],[0,4,5])) {
|
||||
// 问诊订单退款状态(0:无退款 1:申请退款 2:退款中 3:退款成功 4:拒绝退款 5:退款关闭)
|
||||
return fail(HttpEnumCode::HTTP_ERROR,"订单正在退款中");
|
||||
}
|
||||
|
||||
// 修改订单删除状态
|
||||
$data = array();
|
||||
$data['is_delete'] = 1;
|
||||
|
||||
$params = array();
|
||||
$params['order_inquiry_id'] = $order_inquiry['order_inquiry_id'];
|
||||
|
||||
OrderInquiry::edit($params,$data);
|
||||
|
||||
return success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 问诊订单取消支付
|
||||
* @return array
|
||||
*/
|
||||
public function putPatientInquiryOrderCancelPay(): array
|
||||
{
|
||||
$user_info = $this->request->getAttribute("userInfo") ?? [];
|
||||
|
||||
$order_inquiry_id = $this->request->route('order_inquiry_id');
|
||||
|
||||
// 获取订单数据
|
||||
$params = array();
|
||||
$params['patient_id'] = $user_info['client_user_id'];
|
||||
$params['order_inquiry_id'] = $order_inquiry_id;
|
||||
$params['is_delete'] = 0;
|
||||
$order_inquiry = OrderInquiry::getOne($params);
|
||||
if (empty($order_inquiry)){
|
||||
return fail();
|
||||
}
|
||||
|
||||
// 检测订单状态
|
||||
if (!in_array($order_inquiry['inquiry_status'],[1])) {
|
||||
// 问诊订单状态(1:待支付 2:待分配 3:待接诊 4:已接诊 5:已完成 6:已结束 7:已取消)
|
||||
return fail(HttpEnumCode::HTTP_ERROR,"订单无法删除");
|
||||
}
|
||||
|
||||
if (!in_array($order_inquiry['inquiry_refund_status'],[0,4,5])) {
|
||||
// 问诊订单退款状态(0:无退款 1:申请退款 2:退款中 3:退款成功 4:拒绝退款 5:退款关闭)
|
||||
return fail(HttpEnumCode::HTTP_ERROR,"订单正在退款中");
|
||||
}
|
||||
|
||||
// 修改订单删除状态
|
||||
$data = array();
|
||||
$data['inquiry_status'] = 7;
|
||||
$data['cancel_time'] = date("Y-m-d H:i:s",time());
|
||||
$data['cancel_reason'] = 2; // 取消订单原因(1:医生未接诊 2:主动取消 3:无可分配医生 4:客服取消 5:支付超时)
|
||||
$data['cancel_remarks'] = "未支付取消";
|
||||
$data['updated_at'] = date("Y-m-d H:i:s",time());
|
||||
|
||||
$params = array();
|
||||
$params['order_inquiry_id'] = $order_inquiry['order_inquiry_id'];
|
||||
OrderInquiry::edit($params,$data);
|
||||
|
||||
return success();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取医生未接诊订单数量
|
||||
@@ -797,7 +948,7 @@ class InquiryService extends BaseService
|
||||
}
|
||||
|
||||
// 检测订单退款状态
|
||||
if (in_array($order_inquiry['inquiry_refund_status'], [2, 3, 4, 5])) {
|
||||
if (in_array($order_inquiry['inquiry_refund_status'], [2, 3, 5])) {
|
||||
// 问诊订单退款状态(0:无退款 1:申请退款 2:退款中 3:退款成功 4:拒绝退款 5:退款关闭)
|
||||
throw new BusinessException("订单退款状态错误");
|
||||
}
|
||||
|
||||
@@ -25,6 +25,7 @@ class Auth
|
||||
"/area/county" => "get", // 获取区县信息
|
||||
"/callback/wxpay/inquiry/success" => "post", // 微信支付回调
|
||||
"/callback/wxpay/inquiry/refund" => "post", // 微信退款回调
|
||||
"/callback/im" => "post", // im回调
|
||||
"/testpay" => "get", // 测试
|
||||
];
|
||||
}
|
||||
|
||||
@@ -18,12 +18,13 @@ class HttpRequest
|
||||
|
||||
/**
|
||||
* 请求封装
|
||||
* post请求
|
||||
* @param string $path
|
||||
* @param array $option
|
||||
* @return array
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
public function getRequest(string $path,array $option = []): array
|
||||
public function postRequest(string $path, array $option = []): array
|
||||
{
|
||||
$response = $this->client->post($path, $option);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user