山野付
This commit is contained in:
parent
53fc2d2ff2
commit
db65575467
|
@ -71,6 +71,8 @@ class StatisController extends BaseController
|
|||
//提现手续费收入
|
||||
$data['day_draw_fee_money'] = $draw->getSum(['statut' => 1], 'fee_money');
|
||||
|
||||
$data['total_draw_money'] = $draw->getSum(['status_in' => [1]], 'draw_money');
|
||||
|
||||
|
||||
$system_commiss = new SystemCommissionStatisServices();
|
||||
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
<?php
|
||||
namespace App\ServicePay;
|
||||
class BasePay{
|
||||
public $pay_gateway;//当前的支付通道实例
|
||||
public $pay_config;//这个通道的支付配置信息
|
||||
|
||||
//第二部配置支付信息,payConfig
|
||||
public function payConfig($type, $setConfig = [])
|
||||
{
|
||||
$config = [
|
||||
'debug' => 1,//调试
|
||||
'logDir' => to_linux_path(storage_path() . '/logs/'),
|
||||
'mch_id' => $this->pay_gateway['app_id'], //客户交易者账号
|
||||
'token' => $this->pay_gateway['app_key'],//密钥
|
||||
'interface' => $this->pay_gateway['mch_id'],//账号名称 一般用来存放三方通道
|
||||
'return_url' => action('Pay\PayController@returnNotify', ['type' => $type]),
|
||||
'notify_url' => action('Pay\PayController@notify', ['type' => $type]),
|
||||
];
|
||||
$this->pay_config = $config;
|
||||
}
|
||||
}
|
|
@ -62,7 +62,11 @@ class DaliPayServices implements PayApiInterface
|
|||
*/
|
||||
public function pay($pay_data)
|
||||
{
|
||||
// echo number_format( 500, 2,'.','');exit;
|
||||
$return = request()->all();
|
||||
$re_type = 'html';
|
||||
if (isset($return['re_type'])) {
|
||||
$re_type = $return['re_type'];
|
||||
}
|
||||
//商户号
|
||||
$accountId = $this->pay_config['mch_id'];
|
||||
//商户秘钥
|
||||
|
@ -78,19 +82,35 @@ class DaliPayServices implements PayApiInterface
|
|||
$sign = $this->sign($payData, $key);//签名
|
||||
$payData['sign'] = $sign;
|
||||
$res = Curl::to($this->pay_config['url'])->withData($payData)->post();
|
||||
$this->debugLog('下单接口请求内容' . json_encode($payData, true), []);
|
||||
|
||||
$res = is_array($res) ? $res : json_decode($res, 256);
|
||||
$this->debugLog('下单接口请求内容' . json_encode($payData, 256), []);
|
||||
$res = is_array($res) ? $res : json_decode($res, true);
|
||||
$this->debugLog('返回内容' . json_encode($res, 256), []);
|
||||
if (is_array($res) && isset($res['code']) && $res['code'] == 100) {
|
||||
$data = $res['data'];
|
||||
$url = $data['url'];
|
||||
return redirect()->away($url);
|
||||
return $this->returnPayRes($re_type,'',1,$url);
|
||||
} else {
|
||||
$msg = $res['msg'] ?? '未知错误';
|
||||
return ['code' => 0, 'msg' => $msg];
|
||||
return $this->returnPayRes($re_type,$msg,0);
|
||||
}
|
||||
}
|
||||
|
||||
private function returnPayRes($re_type,$msg,$code,$url=''){
|
||||
if ($code == 1) {
|
||||
if ($re_type == 'json') {
|
||||
return json_encode(['code' => 1, 'qrurl' => $url], 256);
|
||||
} else {
|
||||
return redirect()->away($url);
|
||||
}
|
||||
} else {
|
||||
if ($re_type == 'json') {
|
||||
return json_encode(['code' => 0, 'msg' => $msg], 256);
|
||||
} else {
|
||||
return $msg;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private function sign($tempArr, $signKey): string
|
||||
{
|
||||
|
|
|
@ -59,7 +59,11 @@ class KoulinghbPayServices implements PayApiInterface
|
|||
*/
|
||||
public function pay($pay_data)
|
||||
{
|
||||
// echo number_format( 500, 2,'.','');exit;
|
||||
$return = request()->all();
|
||||
$re_type = 'html';
|
||||
if (isset($return['re_type'])) {
|
||||
$re_type = $return['re_type'];
|
||||
}
|
||||
//商户号
|
||||
$accountId = $this->pay_config['mch_id'];
|
||||
//商户秘钥
|
||||
|
@ -85,14 +89,31 @@ class KoulinghbPayServices implements PayApiInterface
|
|||
$res = is_array($res) ? $res : json_decode($res, 256);
|
||||
if (is_array($res) && isset($res['status']) && $res['status'] == 0) {
|
||||
$url = $res['payurl'];
|
||||
return redirect()->away($url);
|
||||
return $this->returnPayRes($re_type,'',1,$url);
|
||||
} else {
|
||||
$msg = $res['msg'] ?? '未知错误';
|
||||
return ['code' => 0, 'msg' => $msg];
|
||||
$this->debugLog('错误' . $msg, []);
|
||||
return $this->returnPayRes($re_type,$msg,0);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private function returnPayRes($re_type,$msg,$code,$url=''){
|
||||
if ($code == 1) {
|
||||
if ($re_type == 'json') {
|
||||
return json_encode(['code' => 1,'errmsg'=>$msg, 'qrurl' => $url], 256);
|
||||
} else {
|
||||
return redirect()->away($url);
|
||||
}
|
||||
} else {
|
||||
if ($re_type == 'json') {
|
||||
return json_encode(['code' => 0, 'errmsg' => $msg], 256);
|
||||
} else {
|
||||
return $msg;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function sign($tempArr, $signKey,$filter=[]): string
|
||||
{
|
||||
$keyVal = '';
|
||||
|
|
|
@ -61,14 +61,16 @@ trait PayApiProvidesTrait
|
|||
return $this->pay_service = new RongYiServices();
|
||||
case 'zhanxinpay':
|
||||
return $this->pay_service = new ZhanXinPayServices();
|
||||
case 'dalipay':
|
||||
case '1003':
|
||||
return $this->pay_service = new DaliPayServices();
|
||||
case 'pingguopay':
|
||||
return $this->pay_service = new PingguopayServices();
|
||||
case 'koulinghbpay':
|
||||
case '1004':
|
||||
return $this->pay_service = new KoulinghbPayServices();
|
||||
case 'yihuibaopay':
|
||||
case '1002':
|
||||
return $this->pay_service = new YiHuiBaoPayServices();
|
||||
case '1001':
|
||||
return $this->pay_service = new ShanYePayServices();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -249,7 +249,7 @@ trait PayTrait
|
|||
$ipWhite = $ipArr[$this->pay_type];
|
||||
$this->debugLog('回调IP', [$ip,$ipWhite]);
|
||||
if (!in_array($ip, $ipWhite)) {
|
||||
$this->debugLog('IP不合法', [$ip,$ipWhite]);
|
||||
// $this->debugLog('IP不合法', [$ip,$ipWhite]);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -275,12 +275,14 @@ trait PayTrait
|
|||
$pay_channel = $request->input('pay_channel');
|
||||
|
||||
$this->debugLog('-------------订单开始-------------');
|
||||
$this->debugLog('appid->' . $request->input('app_id'));
|
||||
$this->debugLog('支付类型->' . $pay_type);
|
||||
$this->debugLog('channel->' . $pay_channel);
|
||||
//选择服务类型
|
||||
$this->setPayService($pay_type);
|
||||
|
||||
if (is_null($this->pay_service)) {
|
||||
$this->debugLog('通道不存在或支付类型错误',$request->all());
|
||||
return $this->addError(['error' => 1, 'msg' => '通道不存在或支付类型错误']);
|
||||
}
|
||||
$custorm_gateways = [];
|
||||
|
|
|
@ -0,0 +1,399 @@
|
|||
<?php
|
||||
|
||||
namespace App\ServicePay;
|
||||
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Ixudra\Curl\Facades\Curl;
|
||||
|
||||
/**
|
||||
* @package App\ServicePay
|
||||
*/
|
||||
class ShanYePayServices extends BasePay implements PayApiInterface
|
||||
{
|
||||
use PayTrait;
|
||||
use ThirdPaySignTrait;
|
||||
|
||||
public $gateway_list;//当前类型的支付通道列表
|
||||
public $pay_type;//支付类型
|
||||
public $pay_method;//支付方法
|
||||
public $pay_gateway;//当前的支付通道实例
|
||||
public $pay_config;//这个通道的支付配置信息
|
||||
public $order;
|
||||
public $request;
|
||||
public $gateway_id;
|
||||
public $pay_data;
|
||||
public $log_name;
|
||||
public $result_data;
|
||||
public static $result;
|
||||
|
||||
/**
|
||||
* 网关域名
|
||||
* @return string
|
||||
*/
|
||||
protected function getGateUrl(): string
|
||||
{
|
||||
return 'http://154.89.8.108:3020';
|
||||
}
|
||||
|
||||
//第二部配置支付信息,payConfig
|
||||
// public function payConfig($type, $setConfig = [])
|
||||
// {
|
||||
// $config = [
|
||||
// 'url' => $this->getGateUrl() . '/gateway/payApiJson.asp',
|
||||
// 'debug' => 1,//调试
|
||||
// 'logDir' => to_linux_path(storage_path() . '/logs/'),
|
||||
// 'mch_id' => $this->pay_gateway['app_id'], //客户交易者账号
|
||||
// 'token' => $this->pay_gateway['app_key'],//密钥
|
||||
// 'interface' => $this->pay_gateway['mch_id'],//账号名称 一般用来存放三方通道
|
||||
// 'return_url' => action('Pay\PayController@returnNotify', ['type' => $type]),
|
||||
// 'notify_url' => action('Pay\PayController@notify', ['type' => $type]),
|
||||
// ];
|
||||
// $this->pay_config = $config;
|
||||
// }
|
||||
|
||||
//统一下单支付
|
||||
|
||||
/**
|
||||
* @param $pay_data
|
||||
* @return array|\Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function pay($pay_data)
|
||||
{
|
||||
$createUrl=$this->getGateUrl().'/api/pay/create_order';
|
||||
$return = request()->all();
|
||||
$re_type = 'html';
|
||||
if (isset($return['re_type'])) {
|
||||
$re_type = $return['re_type'];
|
||||
}
|
||||
//商户号
|
||||
$accountId = $this->pay_config['mch_id'];
|
||||
//商户秘钥
|
||||
$key = $this->pay_gateway['cert_pub'];
|
||||
$payData = [
|
||||
'mchId' => $accountId,//商户
|
||||
'appId' => $this->pay_config['token'],
|
||||
'productId' => $this->pay_gateway['mch_id'],//对应的三方通道
|
||||
'mchOrderNo' => strval($pay_data['out_trade_no']),//订单号
|
||||
'currency'=>'cny',
|
||||
'amount' => intval($pay_data['total_amount'] * 100), //支付金额为分
|
||||
'subject' => $pay_data['subject'], //
|
||||
'extra' => 'shanye', //
|
||||
'body' => $pay_data['subject'], //
|
||||
'notifyUrl' => strval($this->pay_config['notify_url']),// //异步回调地址
|
||||
'returnUrl' => strval($this->pay_config['return_url']),// //页面跳转通知
|
||||
];
|
||||
$sign = self::md5Verify('create',$payData,$key);//签名
|
||||
$payData['sign'] = $sign;
|
||||
// $res=$this->ddcurl($this->pay_config['url'],$pay_data,false);
|
||||
$res = Curl::to($createUrl)->withData($payData)->post();
|
||||
$this->debugLog('下单接口请求内容' . json_encode($payData, true), []);
|
||||
$this->debugLog('返回内容' . json_encode($res, true), []);
|
||||
|
||||
$res = is_array($res) ? $res : json_decode($res, 256);
|
||||
if (is_array($res) && isset($res['retCode']) && $res['retCode'] == 'SUCCESS') {
|
||||
$data=$res['payParams'];
|
||||
$url = $data['payUrl'];
|
||||
$msg = $res['retMsg'] ?? '未知错误';
|
||||
return $this->returnPayRes($re_type,$msg,1,$url);
|
||||
} else {
|
||||
$msg = $res['retMsg'] ?? '未知错误';
|
||||
$this->debugLog('错误' . $msg, []);
|
||||
return $this->returnPayRes($re_type,$msg,0);
|
||||
}
|
||||
}
|
||||
|
||||
private function returnPayRes($re_type,$msg,$code,$url=''){
|
||||
if ($code == 1) {
|
||||
if ($re_type == 'json') {
|
||||
return json_encode(['code' => 1, 'qrurl' => $url], 256);
|
||||
} else {
|
||||
return redirect()->away($url);
|
||||
}
|
||||
} else {
|
||||
if ($re_type == 'json') {
|
||||
return json_encode(['code' => 0, 'msg' => $msg], 256);
|
||||
} else {
|
||||
return $msg;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function sign($tempArr, $signKey,$signSortArr=[]): string
|
||||
{
|
||||
$keyVal = '';
|
||||
|
||||
if (isset($tempArr['sign'])) {
|
||||
unset($tempArr['sign']);
|
||||
}
|
||||
|
||||
$data = [];
|
||||
foreach ($signSortArr as $key){
|
||||
if(isset($tempArr[$key])){
|
||||
array_push($data, "{$key}={$tempArr[$key]}");
|
||||
}
|
||||
}
|
||||
|
||||
ksort($tempArr);
|
||||
|
||||
|
||||
$keyVal = implode('&', $data);
|
||||
|
||||
if (!empty($signKey) && is_string($signKey)) {
|
||||
$keyVal .= $signKey;
|
||||
}
|
||||
|
||||
return strtoupper(md5($keyVal));
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查订单
|
||||
* @param $orderid
|
||||
* @return bool|string
|
||||
*/
|
||||
private function checkOrder($orderid)
|
||||
{
|
||||
try {
|
||||
$url = $this->getGateUrl() . '/api/pay/query_order';
|
||||
$payData = [
|
||||
'mchId' => $this->pay_gateway['app_id'],//商户号
|
||||
'appId' => $this->pay_config['token'],
|
||||
'mchOrderNo' => $orderid,
|
||||
];
|
||||
$key = $this->pay_gateway['cert_pub'];
|
||||
$sign = self::md5Verify('create',$payData,$key);//签名
|
||||
$payData['sign'] = $sign;
|
||||
Log::channel('pay_order')->info('查询接口请求', $payData);
|
||||
$responseRaw = Curl::to($url)->withData($payData)->get();
|
||||
// $responseRaw = $this->ddcurl($url, $payData, false);
|
||||
$response = is_array($responseRaw) ? $responseRaw : json_decode($responseRaw, 256);
|
||||
// $this->debugLog('查询接口返回' . is_array($res) ? json_encode($res, true) : json_encode(json_decode($res, 256), true));
|
||||
Log::channel('pay_order')->info('查询接口返回', $response);
|
||||
if (is_array($response)
|
||||
&& isset($response['retCode']) && $response['retCode'] == 'SUCCESS'
|
||||
&& isset($response['status']) && $response['status'] == 2
|
||||
&& isset($response['mchOrderNo']) && $response['mchOrderNo'] == $orderid
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}catch (\Exception $e){
|
||||
Log::channel('pay_order')->info('err', $e->getMessage());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
//统一验证签名
|
||||
public function verify()
|
||||
{
|
||||
$params = $this->result_data;
|
||||
$key = $this->pay_gateway['cert_pub'];
|
||||
$sindata=[];
|
||||
foreach ($params as $k=>$v){
|
||||
if($v!='' && $k!='sign'){
|
||||
$sindata[$k]=$v;
|
||||
}
|
||||
}
|
||||
$sign = self::md5Verify('create',$sindata,$key);//签名
|
||||
if (isset($params['sign']) && $sign == $params['sign']) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//返回给支付商的成功
|
||||
public function success()
|
||||
{
|
||||
echo 'success';
|
||||
exit;
|
||||
}
|
||||
|
||||
//统一回调处理
|
||||
|
||||
/**
|
||||
* 回调第一部,如果是同步,直接回传
|
||||
* @param $return
|
||||
* @param $pay_type
|
||||
* @param $request
|
||||
* @return bool|\Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function notify($return, $pay_type, $request)
|
||||
{
|
||||
// $request = json_decode(file_get_contents('php://input'), true);
|
||||
$allData = $request->all();
|
||||
$this->setLogName($pay_type);
|
||||
$this->debugLog('回调原始数据', $allData);
|
||||
$this->pay_type = $pay_type;
|
||||
$this->request = $request;
|
||||
//取得订单,是否有此订单,如果没有直接返回空
|
||||
$order_sn = $allData['mchOrderNo'];
|
||||
|
||||
$status = $allData['status'];
|
||||
|
||||
if ($status != 2) {
|
||||
return '未支付成功';
|
||||
}
|
||||
|
||||
$checkresult = $this->checkIP();//检查回调IP
|
||||
if (!$checkresult) {
|
||||
return 'ip 不合法';
|
||||
}
|
||||
//取得订单
|
||||
$this->getOrder($order_sn);
|
||||
|
||||
$return = ($return) ? 1 : 0;
|
||||
if ($return) {
|
||||
|
||||
//判断是否是商户id
|
||||
if ($this->order->merchant_id == 0) {
|
||||
return redirect()->route('web.user.index');
|
||||
}
|
||||
//
|
||||
return $this->merchantReturnSend();
|
||||
}
|
||||
//取得通道id
|
||||
$this->gateway = $this->pay_gateway = config('gateway.config')[$this->gateway_id];
|
||||
//dd($this->gateway);
|
||||
//取得支付配置
|
||||
$this->payConfig($this->pay_type);
|
||||
|
||||
$this->result_data = $allData;
|
||||
//检查三方的订单
|
||||
$checkorder = $this->checkOrder($order_sn);
|
||||
if (!$checkorder) {
|
||||
$this->debugLog('查询三方订单未支付成功');
|
||||
return '查询三方订单未支付成功';
|
||||
}
|
||||
//dump($this->result_data);
|
||||
//进行验证签名
|
||||
if (!$this->verify()) {
|
||||
$this->debugLog('签名以及支付状态验证失败');
|
||||
return '签名以及支付状态验证失败';
|
||||
}
|
||||
|
||||
return $this->payNotify();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 同步回调
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function returnPay()
|
||||
{
|
||||
//判断是否是商户id
|
||||
if ($this->order->merchant_id == 0) {
|
||||
return redirect()->route('web.user.index');
|
||||
}
|
||||
//
|
||||
return $this->merchantReturnSend();
|
||||
}
|
||||
|
||||
//异步回调
|
||||
|
||||
/**
|
||||
* 获得通道信息,取得支付配置模型,验证签名,
|
||||
* @return bool|void
|
||||
*/
|
||||
private function payNotify()
|
||||
{
|
||||
//取得通道信息内容
|
||||
$data = $this->result_data;
|
||||
$this->pay_data = $this->result_data;
|
||||
//如果应答状态不是01/A6表示支付失败
|
||||
$this->debugLog(json_encode($data, true));
|
||||
$this->debugLog('-------------' . $this->order->order_sn . '--选择----' . $this->pay_type . '----' . $this->pay_method . '----开始回调处理-------------------------');
|
||||
if (empty($data)) {
|
||||
return $this->debugLog('验证签名失败', $data);
|
||||
}
|
||||
try {
|
||||
$pay_cn_name = '';
|
||||
//统一格式化
|
||||
$this->unionHandle($data);
|
||||
//支付返回信息
|
||||
$this->pay_data = $data;
|
||||
$this->debugLog('验证签名成功,数据', $data);
|
||||
//更新订单
|
||||
$this->updateOrder();
|
||||
$this->debugLog('updateOrder Ok');
|
||||
|
||||
} catch (\Exception $exception) {
|
||||
$this->debugLog('失败异常内容:' . $exception->getMessage());
|
||||
$this->order->notify_status = 1;//支付回调成功
|
||||
$this->order->pay_status = 1;//支付状态
|
||||
$this->order->pay_ok_at = date('Y-m-d H:i:s');
|
||||
$this->order->save();//保存
|
||||
Log::channel('pay_success')->info($pay_cn_name . '支付成功,但处理订单失败', ['data' => json_encode($data)]);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 统一格式化
|
||||
*/
|
||||
public function unionHandle($data)
|
||||
{
|
||||
$result = [
|
||||
'order_sn' => $data['mchOrderNo'],//我方订单号
|
||||
'pay_order_sn' => $data['payOrderId'],//三方的订单号
|
||||
'pay_money' => number_format($data['amount'] / 100, 2, '.', ''), //支付金额,
|
||||
// 'pay_money' => $data['ordermoney'], //支付金额,
|
||||
'money' => number_format($data['amount'] / 100, 2, '.', ''),
|
||||
'pay_type' => $this->pay_type,
|
||||
'account' => ''
|
||||
];
|
||||
|
||||
$this->setResult($result);
|
||||
Log::channel('pay_success')->info('支付成功', [
|
||||
'pay_type' => $result['pay_type'], 'pay_money' => $result['pay_money'],
|
||||
'account' => $result['money'], 'order_sn' => $result['order_sn'],
|
||||
'pay_order_sn' => $result['pay_order_sn']]);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 这个调试需要配置在config/logging.php
|
||||
* @param $pay_type
|
||||
*/
|
||||
public function setLogName($pay_type)
|
||||
{
|
||||
$this->log_name = $pay_type;
|
||||
}
|
||||
|
||||
/**
|
||||
* 模拟post提交 json数据 请求接口
|
||||
* @param string $url
|
||||
* @param bool|true $https
|
||||
* @param string $method
|
||||
* @param string $param
|
||||
* @return mixed
|
||||
*/
|
||||
private function ddcurl($url = '', $param = '', $https = true, $method = 'post')
|
||||
{
|
||||
$param = json_encode($param, 320);
|
||||
$ch = curl_init($url);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||
|
||||
#判断是否为https请求
|
||||
if ($https === true) {
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
|
||||
}
|
||||
#判断是否为post请求
|
||||
if ($method == 'post') {
|
||||
curl_setopt($ch, CURLOPT_POST, true);
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS, $param);
|
||||
}
|
||||
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-type:application/json'));
|
||||
|
||||
$str = curl_exec($ch);
|
||||
|
||||
curl_close($ch);
|
||||
return $str;
|
||||
}
|
||||
}
|
||||
|
|
@ -60,6 +60,11 @@ class YiHuiBaoPayServices implements PayApiInterface
|
|||
public function pay($pay_data)
|
||||
{
|
||||
// echo number_format( 500, 2,'.','');exit;
|
||||
$return = request()->all();
|
||||
$re_type = 'html';
|
||||
if (isset($return['re_type'])) {
|
||||
$re_type = $return['re_type'];
|
||||
}
|
||||
//商户号
|
||||
$accountId = $this->pay_config['mch_id'];
|
||||
//商户秘钥
|
||||
|
@ -87,13 +92,29 @@ class YiHuiBaoPayServices implements PayApiInterface
|
|||
$res = is_array($res) ? $res : json_decode($res, 256);
|
||||
if (is_array($res) && isset($res['state']) && $res['state'] == 1 && $res['qrurl'] != '') {
|
||||
$url = $res['qrurl'];
|
||||
return redirect()->away($url);
|
||||
$msg = $res['errmsg'] ?? '未知错误';
|
||||
return $this->returnPayRes($re_type,$msg,1,$url);
|
||||
} else {
|
||||
$msg = $res['errmsg'] ?? '未知错误';
|
||||
$this->debugLog('错误' . $msg, []);
|
||||
return json_encode(['code' => 0, 'msg' => $msg],256);
|
||||
return $this->returnPayRes($re_type,$msg,0);
|
||||
}
|
||||
}
|
||||
|
||||
private function returnPayRes($re_type,$msg,$code,$url=''){
|
||||
if ($code == 1) {
|
||||
if ($re_type == 'json') {
|
||||
return json_encode(['code' => 1, 'qrurl' => $url], 256);
|
||||
} else {
|
||||
return redirect()->away($url);
|
||||
}
|
||||
} else {
|
||||
if ($re_type == 'json') {
|
||||
return json_encode(['code' => 0, 'msg' => $msg], 256);
|
||||
} else {
|
||||
return $msg;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function sign($tempArr, $signKey,$signSortArr=[]): string
|
||||
|
|
|
@ -58,10 +58,11 @@ return [
|
|||
'shandianpay' =>'闪电支付',
|
||||
'rongyipay' =>'融易支付',
|
||||
'zhanxinpay' =>'展信支付',
|
||||
'dalipay' =>'大利支付',
|
||||
'1003' =>'大利支付',
|
||||
'pingguopay' =>'苹果付',
|
||||
'koulinghbpay' =>'口令红包',
|
||||
'yihuibaopay' =>'易汇宝',
|
||||
'1004' =>'口令红包',
|
||||
'1002' =>'易汇宝',
|
||||
'1001' =>'山野付',
|
||||
],
|
||||
'payfor_status' => [
|
||||
0 => '等待处理',
|
||||
|
|
|
@ -64,5 +64,8 @@ return [
|
|||
'koulinghbpay'=>[
|
||||
'8.129.172.207'
|
||||
],
|
||||
'shanyepay'=>[
|
||||
'154.89.8.108'
|
||||
]
|
||||
]
|
||||
];
|
|
@ -31,7 +31,7 @@
|
|||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">三方通道</label>
|
||||
<label class="layui-form-label">三方通道(产品ID)</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="mch_id" lay-verify="rq" autocomplete="off" class="layui-input"/>
|
||||
</div>
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">三方通道</label>
|
||||
<label class="layui-form-label">三方通道(产品ID)</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="mch_id" value="{{ $show->mch_id }}" lay-verify="rq" autocomplete="off"
|
||||
class="layui-input"/>
|
||||
|
|
|
@ -44,7 +44,7 @@
|
|||
{type: 'checkbox',width: 80}
|
||||
, {field: 'id', width: 80, title: '通道ID', sort: true}
|
||||
, {field: 'name', title: '通道名称',minWidth: 120}
|
||||
, {field: 'mch_id', title: '三方通道',minWidth: 250}
|
||||
, {field: 'mch_id', title: '三方通道(产品ID)',minWidth: 250}
|
||||
, {field: 'ename', title: 'API标识',width:100}
|
||||
, {field: 'limit_money', title: '单笔限额',width:100}
|
||||
|
||||
|
|
|
@ -201,7 +201,22 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-col-sm6 layui-col-md3">
|
||||
<div class="layui-card">
|
||||
<div class="layui-card-header">
|
||||
成功提现金额
|
||||
<span class="layui-badge layui-bg-green layuiadmin-badge">全部</span>
|
||||
</div>
|
||||
<div class="layui-card-body layuiadmin-card-list">
|
||||
|
||||
<p class="layuiadmin-big-font" id="total_draw_money" style="color: #49afdd">0</p>
|
||||
<p>
|
||||
|
||||
<span class="layuiadmin-span-color" id=""></span>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
|
|
@ -580,6 +580,37 @@
|
|||
<p>tr_bank: 固码银行收款支付</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="119" valign="center">
|
||||
<p>
|
||||
pay_channel
|
||||
</p>
|
||||
</td>
|
||||
<td width="113" valign="center">
|
||||
<p>
|
||||
产品id
|
||||
</p>
|
||||
</td>
|
||||
<td width="55" valign="center">
|
||||
<p>
|
||||
否
|
||||
</p>
|
||||
</td>
|
||||
<td width="110" valign="center">
|
||||
<p>
|
||||
字符串
|
||||
</p>
|
||||
<p>
|
||||
|
||||
</p>
|
||||
|
||||
</td>
|
||||
<td width="208" valign="center">
|
||||
<p>
|
||||
可传,可不传 没有明确给产品id时,不用传
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="119" valign="center"
|
||||
>
|
||||
|
|
Loading…
Reference in New Issue