| 
					
				 | 
			
			
				@@ -64,6 +64,10 @@ class Cash 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     	}
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     	
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     	$info = Dever::db('pay/yspay_cash')->find($where);
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    	if (!$info) {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    		$where['source_order_num'] = $id . '_O';
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    		$info = Dever::db('pay/yspay_cash')->find($where);
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    	}
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     	if ($info) {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     		$merchant = Dever::db('pay/yspay_merchant')->one($info['merchant_id']);
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     		if ($merchant) {
 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -155,6 +159,7 @@ class Cash 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	        	$data['fz_cash'] += $fenzhang;
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	        	$data['hf_cash'] = $data['cash'] - $data['fz_cash'];
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	        } else {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	        	$data['hf_cash'] = $data['cash'];
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	        	unset($data['fz_cash']);
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	        }
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	    }
 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -275,6 +280,24 @@ class Cash 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     	return 'ok';
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     }
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    # 直接划付
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public function test_tixian_api()
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    	$info['merchant_id'] = Dever::input('merchant_id');
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		$info['hf_cash'] = Dever::input('hf_cash');
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		$info['order_num'] = Dever::order('TX');
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		if ($info) {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			$merchant = Dever::db('pay/yspay_merchant')->one($info['merchant_id']);
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	    	if ($merchant) {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	    		$config = Dever::db('pay/yspay')->one(array('account_id' => $merchant['account_id']));
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	    		if ($config) {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	    			return Dever::load('pay/yspay/multi')->huafu($config, $merchant, $info);
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	    		}
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	    	}
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		}
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    	return 'ok';
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    }
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     # 查询订单
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     public function test_query_api()
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     {
 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -348,6 +371,8 @@ class Cash 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     	}
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     	$cash = $cash*$this->num;
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		$yue = $merchant['hf_cash'] - $merchant['hf_tx_cash'] - $this->num*$this->bfj;
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		$cash = intval($cash);
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		$yue = intval($yue);
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		if ($yue < $cash) {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			Dever::alert('余额不足');
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		}
 
			 |