更新
This commit is contained in:
parent
a3134c0804
commit
f16094dcae
@ -20,6 +20,9 @@ use app\common\service\pay\WeChatPayService;
|
|||||||
use Webman\Config;
|
use Webman\Config;
|
||||||
use Yansongda\Pay\Pay;
|
use Yansongda\Pay\Pay;
|
||||||
use app\common\model\user\UserAuth;
|
use app\common\model\user\UserAuth;
|
||||||
|
use GuzzleHttp\Command\Guzzle\GuzzleClient;
|
||||||
|
use Symfony\Component\HttpClient\HttpClient;
|
||||||
|
use Yansongda\Artful\Contract\HttpClientInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 支付逻辑
|
* 支付逻辑
|
||||||
@ -28,18 +31,7 @@ use app\common\model\user\UserAuth;
|
|||||||
*/
|
*/
|
||||||
class PaymentLogic extends BaseLogic
|
class PaymentLogic extends BaseLogic
|
||||||
{
|
{
|
||||||
/**
|
|
||||||
* 授权信息
|
|
||||||
* @var UserAuth|array|\think\Model
|
|
||||||
*/
|
|
||||||
protected $auth;
|
|
||||||
|
|
||||||
public function __construct()
|
|
||||||
{
|
|
||||||
$config = Config::get('payment');
|
|
||||||
Pay::config($config);
|
|
||||||
|
|
||||||
}
|
|
||||||
/**
|
/**
|
||||||
* @notes 支付
|
* @notes 支付
|
||||||
* @param $payWay
|
* @param $payWay
|
||||||
@ -80,11 +72,12 @@ class PaymentLogic extends BaseLogic
|
|||||||
'currency' => 'CNY',
|
'currency' => 'CNY',
|
||||||
],
|
],
|
||||||
"payer" => [
|
"payer" => [
|
||||||
"openid" => $auth['openid']??0
|
"openid" => $auth['openid'] ?? 0
|
||||||
],
|
],
|
||||||
'attach' => $from
|
'attach' => $from
|
||||||
];
|
];
|
||||||
|
$config = Config::get('payment');
|
||||||
|
Pay::config($config);
|
||||||
$result = Pay::wechat()->mini($order);
|
$result = Pay::wechat()->mini($order);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -92,10 +85,10 @@ class PaymentLogic extends BaseLogic
|
|||||||
$result = false;
|
$result = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (false === $result && !self::hasError()) {
|
// if (false === $result && !self::hasError()) {
|
||||||
d($payService->getError());
|
// d($payService->getError());
|
||||||
self::setError($payService->getError());
|
// self::setError($payService->getError());
|
||||||
}
|
// }
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -116,5 +109,4 @@ class PaymentLogic extends BaseLogic
|
|||||||
$suffix = mb_substr(time(), -4);
|
$suffix = mb_substr(time(), -4);
|
||||||
return $orderSn . $terminal . $suffix;
|
return $orderSn . $terminal . $suffix;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -34,9 +34,9 @@ return [
|
|||||||
// 必填-商户秘钥
|
// 必填-商户秘钥
|
||||||
'mch_secret_key' => 'F6C2A57790C667607D8E8C0C00CCF9B6',
|
'mch_secret_key' => 'F6C2A57790C667607D8E8C0C00CCF9B6',
|
||||||
// 必填-商户私钥 字符串或路径
|
// 必填-商户私钥 字符串或路径
|
||||||
'mch_secret_cert' => getenv(runtime_path('/cart/c208f16ad08e6d2516e0b73e6d0ab8da.pem')),
|
'mch_secret_cert' => runtime_path().'/cert/c208f16ad08e6d2516e0b73e6d0ab8da.pem',
|
||||||
// 必填-商户公钥证书路径
|
// 必填-商户公钥证书路径
|
||||||
'mch_public_cert_path' =>getenv(runtime_path('/cart/82fdc3426e3aeb9e5df91a9547ac5ef3.pem')),
|
'mch_public_cert_path' =>runtime_path().'/cert/82fdc3426e3aeb9e5df91a9547ac5ef3.pem',
|
||||||
// 必填
|
// 必填
|
||||||
'notify_url' => 'https://erp.lihaink.cn/api/pay/notifyMnp',
|
'notify_url' => 'https://erp.lihaink.cn/api/pay/notifyMnp',
|
||||||
// 选填-公众号 的 app_id
|
// 选填-公众号 的 app_id
|
||||||
|
Loading…
x
Reference in New Issue
Block a user