rabin 1 rok pred
rodič
commit
2fbe01df3a
2 zmenil súbory, kde vykonal 28 pridanie a 23 odobranie
  1. 11 0
      database/yspay.php
  2. 17 23
      yspay/Multi.php

+ 11 - 0
database/yspay.php

@@ -181,6 +181,17 @@ return array
 			'show'		=> 'type=2',
 		),
 
+		'cash_merno'		=> array
+		(
+			'type' 		=> 'varchar-200',
+			'name' 		=> '平台分账企业用户号',
+			'default' 	=> '',
+			'desc' 		=> '平台分账企业用户号',
+			'match' 	=> 'is_string',
+			'update'	=> 'text',
+			'show'		=> 'type=2',
+		),
+
 		'cash_card'		=> array
 		(
 			'type' 		=> 'varchar-150',

+ 17 - 23
yspay/Multi.php

@@ -10,7 +10,7 @@ class Multi
     {
         $result = $this->huafu($config, $merchant, $info);
         if ($result == 'ok') {
-            //$this->fenzhang($config, $merchant, $info);
+            $this->fenzhang($config, $merchant, $info);
         }
         
         return $result;
@@ -28,11 +28,12 @@ class Multi
     	//整理内容信息
         $content = [
             'merNo' => $merchant['merno'],
-            //'merOrderNo' => $order_num,
+            'merOrderNo' => $order_num,
             'payAmt' => $cash,
+            'ps' => $merchant['name'] . '划付',
         ];
         Dever::log($content, 'yspay_huafu');
-        $result = $this->curl('202002', $content);
+        $result = $this->curl('202001', $content);
         if ($result == 'ok') {
         	$data['status'] = 1;
         } else {
@@ -58,7 +59,7 @@ class Multi
     {
     	$this->config = $config;
 
-    	$mid = $merchant['mid'];
+    	$mid = $this->config['cash_mid'];
     	$cash = $info['fz_cash'] + $info['pt_cash'];
     	if (!$cash || $cash <= 0) {
     		return false;
@@ -67,10 +68,10 @@ class Multi
 
     	//整理内容信息
         $content = [
-            'merNo' => $merchant['merno'],
+            'merNo' => $this->config['cash_merno'],
             'merOrderNo' => $order_num,
             'payAmt' => $cash,
-            'cardNo' => hash("sha256",$this->config['card']),
+            'cardNo' => hash("sha256", $this->config['cash_card']),
             'ps' => $merchant['name'] . '分账',
         ];
         Dever::log($content, 'yspay_fenzhang');
@@ -104,9 +105,9 @@ class Multi
         }
     }
 
-	protected function header($code)
+	protected function common($param, $code)
     {
-        $header = array(
+        $param += array(
             'transCode' => $code,
             'verNo' => '100',
             'srcReqDate' => date("Ymd"),
@@ -116,7 +117,7 @@ class Multi
             'groupId' => $this->config['cash_groupid'],
         );
 
-        return $header;
+        return $param;
     }
 
 	protected function curl($code, $param, $state = true)
@@ -124,29 +125,22 @@ class Multi
 		$url = self::$host;
 		$url .= $code;
 
-    	$header = $this->header($code);
-    	$header['signature'] = $this->sign($param);
-        echo $url;
-        print_r($header);
-        print_r($param);
-    	$curl = Curl::getInstance($url, $param, 'post', true, $header)->setResultHeader(true);
-    	$header = $curl->header();
+    	$param = $this->common($param, $code);
+    	$param['signature'] = $this->sign($param);
+    	$curl = Curl::getInstance($url, $param, 'post', true);
 		$body = $curl->result();
 
-        print_r($header);
-        print_r($body);die;
-
 		if (strstr($body, '<html><head>')) {
 			return 'error';
 		}
 		$body = Dever::json_decode($body);
-		if (isset($header['respCode'])) {
-			if ($header['respCode'] == '99999999') {
+		if (isset($body['respCode'])) {
+			if ($body['respCode'] == '99999999') {
 				return $state ? 'ok' : $body;
-			} elseif ($header['respCode'] == 'FAN00012') {
+			} elseif ($body['respCode'] == 'FAN00012') {
                 return $this->curl($code, $param, $state);
             } else {
-				return $header['respMsg'];
+				return $body['respMsg'];
 			}
 		} else {
 			return 'error';