WIN-2308041133\Administrator 5 달 전
부모
커밋
f63325f842
1개의 변경된 파일14개의 추가작업 그리고 8개의 파일을 삭제
  1. 14 8
      extend/liuniu/WechatService.php

+ 14 - 8
extend/liuniu/WechatService.php

@@ -595,28 +595,34 @@ class WechatService
      * @param string $detail
      * @param string $trade_type
      * @param array $options
-     * @return Order
      */
     public static function signedOrder($openid, $out_trade_no, $total_fee, $attach, $body,$contract_code, $plan_id,$spbill_create_ip,$detail = '', $trade_type = 'JSAPI', $options = [], $cid = 0,$contract_display_account='')
     {
         $total_fee = bcmul($total_fee, 100, 0);
         $timestamp=time();
         $version = '1.0';
+        $company = Company::where('id',$cid)->find();
+        if (empty($company)){
+            return'企业不存在';
+        }
         // 微信支付配置参数
-        $mch_id = "1623907696";
-        $key = "1wm55KpF5tgZFW1TYs6TBX9MWBpI5FmT";
-
+//        $mch_id = "1623907696";
+        $mch_id =  $company['pay_weixin_mchid'];
+//        $key = "1wm55KpF5tgZFW1TYs6TBX9MWBpI5FmT";
+        $key = $company['wechat_encodingaeskey'];
+        $app_id = $company['wechat_appid'];
 // 使用动态时间戳
         $current_timestamp = time();
 //        $contract_code = preg_replace("/[^0-9]/", "", $contract_code);
         $params = [
-            'appid' => 'wx5681205d1ef4d9d3',
+//            'appid' => 'wx5681205d1ef4d9d3',
+            'appid' => $app_id,
             'mch_id' => $mch_id,
-            'plan_id' => '189172',
+            'plan_id' => $plan_id,
             'contract_code' => $contract_code,
             'request_serial' => $current_timestamp, // 使用时间戳作为序列号
-            'contract_display_account' => 'sera',
-            'notify_url' => 'http://red.igxys.com/api/wechat/notify/12',
+            'contract_display_account' => $contract_display_account,
+            'notify_url' => 'http://red.igxys.com/api/wechat/notify/'.$cid,
             'timestamp' => $current_timestamp, // 动态时间戳
             'version' => '1.0',
         ];