goCheck('payway'); $result = PaymentLogic::getPayWay($this->userId, $this->userInfo['terminal'], $params); if ($result === false) { return $this->fail(PaymentLogic::getError()); } return $this->data($result); } /** * @notes 预支付 * @return \think\response\Json * @author 段誉 * @date 2023/2/28 14:21 */ public function prepay() { $params = (new PayValidate())->post()->goCheck(); //订单信息 $order = PaymentLogic::getPayOrderInfo($params); if (false === $order) { return $this->fail(PaymentLogic::getError(), $params); } // 请求支付系统 $companyInfo = Company::where(['id' => $this->userInfo['company_id']])->find(); $requestData = [ 'street' => $companyInfo['street'], 'order_from' => 12, 'order_type' => 101, 'pay_user_role' => $this->userInfo['group_id'], 'pay_user_info' => $this->userInfo, 'business_order_no' => $order['sn'], 'total_fee' => intval(bcmul($order['order_amount'], 100)), 'business_callback_url' => (string)url('pay/notifyApp', [], false, true) ]; $result = PayRequestLogic::getPrePayId($requestData); if (false === $result) { return $this->fail(PaymentLogic::getError(), $params); } return $this->success('', $result['data']); } /** * @notes 获取支付状态 * @return \think\response\Json * @author 段誉 * @date 2023/3/1 16:23 */ public function payStatus() { $params = (new PayValidate())->goCheck('status', ['user_id' => $this->userId]); $result = PaymentLogic::getPayStatus($params); if ($result === false) { return $this->fail(PaymentLogic::getError()); } return $this->data($result); } /** * @notes 小程序支付回调 * @return \Psr\Http\Message\ResponseInterface * @throws \EasyWeChat\Kernel\Exceptions\InvalidArgumentException * @throws \EasyWeChat\Kernel\Exceptions\RuntimeException * @throws \ReflectionException * @throws \Throwable * @author 段誉 * @date 2023/2/28 14:21 */ public function notifyMnp() { return (new WeChatPayService(UserTerminalEnum::WECHAT_MMP))->notify(); } /** * @notes 公众号支付回调 * @return \Psr\Http\Message\ResponseInterface * @throws \EasyWeChat\Kernel\Exceptions\InvalidArgumentException * @throws \EasyWeChat\Kernel\Exceptions\RuntimeException * @throws \ReflectionException * @throws \Throwable * @author 段誉 * @date 2023/2/28 14:21 */ public function notifyOa() { return (new WeChatPayService(UserTerminalEnum::WECHAT_OA))->notify(); } /** * @notes app支付回调 * @return \Psr\Http\Message\ResponseInterface * @throws \EasyWeChat\Kernel\Exceptions\InvalidArgumentException * @throws \EasyWeChat\Kernel\Exceptions\RuntimeException * @throws \ReflectionException * @throws \Throwable * @date 2023/2/28 14:21 */ public function notifyApp() { $param = $this->request->param(); return (new WeChatPayService(UserTerminalEnum::ANDROID))->notify($param); } }