Pārlūkot izejas kodu

add - 工单分享支付

liugc 9 mēneši atpakaļ
vecāks
revīzija
dd565a8cdb

+ 2 - 9
app/common/logic/PaymentLogic.php

@@ -443,20 +443,13 @@ class PaymentLogic extends BaseLogic
             return ['sn' => $order['sn'],'need_pay'=>0];
         }
 
-        $mapSession = MappingMworkerSession::where([['type', '=', 1],['map_token', '=', $userInfo['token']], ['expire_time', '>', time()]])->findOrEmpty();
-        if(!$mapSession->isEmpty()) {
-            $token = '';
-            $mapSession->token && $token = $mapSession->token;
-            $token && $userInfo = (new MasterWokerTokenCache())->getUserInfo($token);
-        }
-
         $payService = null;
         switch ($payWay) {
             case PayEnum::WECHAT_PAY:
-                $payService = (new WorkerWeChatPayService($terminal, $userInfo['user_id'] ?? null));
+                $payService = (new WorkerWeChatPayService($terminal, null));
                 $order['pay_sn'] = $paySn;
                 $order['redirect_url'] = $redirectUrl;
-                $result = $payService->pay($from, $order);
+                $result = $payService->pay($from, $order,$userInfo['openid']??'');
                 break;
             default:
                 self::$error = '订单异常';

+ 5 - 0
app/common/service/pay/WorkerWeChatPayService.php

@@ -81,6 +81,11 @@ class WorkerWeChatPayService extends BasePayService
                     $config = WorkerWeChatConfigService::getMnpConfig();
                     $result = $this->jsapiPay($from, $order, $config['app_id'], $openid??'');
                     break;
+                case UserTerminalEnum::WECHAT_OA:
+                    $config = WorkerWeChatConfigService::getOaConfig();
+                    //$config = WeChatConfigService::getOaConfig();
+                    $result = $this->jsapiPay($from, $order, $config['app_id'], $openid??'');
+                    break;
                 default:
                     throw new \Exception('支付方式错误');
             }

+ 5 - 2
app/workerapi/controller/PayController.php

@@ -82,7 +82,7 @@ class PayController extends \app\workerapi\controller\BaseApiController
         }
         //支付流程
         $redirectUrl = $params['redirect'] ?? '/pages/payment/payment';
-        $result = PaymentLogic::workerSharePay($params['pay_way'], $params['from'], $order, [], $redirectUrl);
+        $result = PaymentLogic::workerSharePay($params['pay_way'], $params['from'], $order, ['openid'=>$params['openid']??''], $redirectUrl);
         if (false === $result) {
             return $this->fail(PaymentLogic::getError(), $params);
         }
@@ -90,5 +90,8 @@ class PayController extends \app\workerapi\controller\BaseApiController
         return $this->success('', $result);
     }
 
-
+    public function notifyOa()
+    {
+        return (new WorkerWeChatPayService(UserTerminalEnum::WECHAT_OA))->notify();
+    }
 }