mirror of
https://github.com/crmeb/CRMEB.git
synced 2026-10-30 22:40:48 +00:00
Merge branch 'v4.7.0dev' of https://gitee.com/ZhongBangKeJi/CRMEB into v4.7.0dev
This commit is contained in:
commit
74d6bbf069
@ -157,8 +157,8 @@ class OtherOrderController
|
||||
*/
|
||||
public function pay_type(Request $request)
|
||||
{
|
||||
$payType['ali_pay_status'] = sys_config('ali_pay_status', 0) != 0;
|
||||
$payType['pay_weixin_open'] = sys_config('pay_weixin_open', 0) != 0;
|
||||
$payType['ali_pay_status'] = sys_config('ali_pay_status', '0') != '0';
|
||||
$payType['pay_weixin_open'] = sys_config('pay_weixin_open', '0') != '0';
|
||||
$payType['site_name'] = sys_config('site_name');
|
||||
$payType['now_money'] = $request->user('now_money');
|
||||
$payType['offline_pay_status'] = true;
|
||||
|
||||
@ -484,7 +484,7 @@ class StoreOrderController
|
||||
}
|
||||
|
||||
/**
|
||||
* 支付宝单独支付
|
||||
* TODO 支付宝单独支付 弃用
|
||||
* @param OrderPayServices $payServices
|
||||
* @param OtherOrderServices $services
|
||||
* @param string $key
|
||||
@ -494,11 +494,11 @@ class StoreOrderController
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
*/
|
||||
public function aliPay(OrderPayServices $payServices, OtherOrderServices $services, string $key, string $quitUrl)
|
||||
{
|
||||
$payInfo = $this->services->aliPayOrder($payServices, $services, $key, $quitUrl);
|
||||
return app('json')->success(['pay_content' => $payInfo]);
|
||||
}
|
||||
// public function aliPay(OrderPayServices $payServices, OtherOrderServices $services, string $key, string $quitUrl)
|
||||
// {
|
||||
// $payInfo = $this->services->aliPayOrder($payServices, $services, $key, $quitUrl);
|
||||
// return app('json')->success(['pay_content' => $payInfo]);
|
||||
// }
|
||||
|
||||
/**
|
||||
* 订单列表
|
||||
|
||||
@ -61,7 +61,7 @@ class UserRechargeController
|
||||
}
|
||||
|
||||
/**
|
||||
* 小程序充值
|
||||
* TODO 小程序充值 弃用
|
||||
* @param Request $request
|
||||
* @return mixed
|
||||
*/
|
||||
@ -82,7 +82,7 @@ class UserRechargeController
|
||||
}
|
||||
|
||||
/**
|
||||
* 公众号充值
|
||||
* TODO 公众号充值 弃用
|
||||
* @param Request $request
|
||||
* @return mixed
|
||||
*/
|
||||
|
||||
@ -42,8 +42,8 @@ Route::group(function () {
|
||||
Route::post('register/reset', 'v1.LoginController/reset')->name('registerReset');
|
||||
// 绑定手机号(静默授权 还未有用户信息)
|
||||
Route::post('binding', 'v1.LoginController/binding_phone')->name('bindingPhone');
|
||||
// 支付宝复制链接支付
|
||||
Route::get('ali_pay', 'v1.order.StoreOrderController/aliPay')->name('aliPay');
|
||||
// 支付宝复制链接支付 弃用
|
||||
// Route::get('ali_pay', 'v1.order.StoreOrderController/aliPay')->name('aliPay');
|
||||
//查询版权
|
||||
Route::get('copyright', 'v1.PublicController/copyright')->option(['real_name' => '申请版权']);
|
||||
|
||||
|
||||
@ -159,7 +159,7 @@ class OrderPayServices
|
||||
}
|
||||
|
||||
//发起支付
|
||||
$jsConfig = $this->payServices->payV2($payType, $orderInfo['order_id'], $orderInfo['pay_price'], $successAction, $body, $options);
|
||||
$jsConfig = $this->payServices->pay($payType, $orderInfo['order_id'], $orderInfo['pay_price'], $successAction, $body, $options);
|
||||
|
||||
//发起支付后处理返回参数
|
||||
$payInfo = $this->afterPay($orderInfo, $jsConfig, $payType);
|
||||
|
||||
@ -105,7 +105,7 @@ class PayServices
|
||||
* @param string $body
|
||||
* @return array|string
|
||||
*/
|
||||
public function payV2(string $payType, string $orderId, string $price, string $successAction, string $body, array $options = [])
|
||||
public function pay(string $payType, string $orderId, string $price, string $successAction, string $body, array $options = [])
|
||||
{
|
||||
try {
|
||||
|
||||
@ -139,7 +139,7 @@ class PayServices
|
||||
}
|
||||
|
||||
/**
|
||||
* 发起支付
|
||||
* TODO 发起支付 弃用
|
||||
* @param string $payType
|
||||
* @param string $openid
|
||||
* @param string $orderId
|
||||
@ -148,46 +148,46 @@ class PayServices
|
||||
* @param string $body
|
||||
* @return array|string
|
||||
*/
|
||||
public function pay(string $payType, string $openid, string $orderId, string $price, string $successAction, string $body, bool $isCode = false)
|
||||
{
|
||||
try {
|
||||
|
||||
//这些全都是微信支付
|
||||
if (in_array($payType, ['routine', 'weixinh5', 'weixin', 'pc', 'store'])) {
|
||||
$payType = 'wechat_pay';
|
||||
//判断是否使用v3
|
||||
if (sys_config('pay_wechat_type') == 1) {
|
||||
$payType = 'v3_wechat_pay';
|
||||
}
|
||||
}
|
||||
|
||||
if ($payType == 'alipay') {
|
||||
$payType = 'ali_pay';
|
||||
}
|
||||
|
||||
|
||||
$options = [];
|
||||
if (self::ALLIN_PAY === $payType) {
|
||||
$options['returl'] = $this->getOption('returl');
|
||||
if ($options['returl']) {
|
||||
$options['returl'] = str_replace('http://', 'https://', $options['returl']);
|
||||
}
|
||||
$options['is_wechat'] = $this->getOption('is_wechat', false);
|
||||
$options['appid'] = sys_config('routine_appId');
|
||||
$payType = 'allin_pay';
|
||||
}
|
||||
|
||||
/** @var Pay $pay */
|
||||
$pay = app()->make(Pay::class, [$payType]);
|
||||
|
||||
|
||||
return $pay->create($orderId, $price, $successAction, $body, '', ['openid' => $openid, 'isCode' => $isCode, 'pay_new_weixin_open' => (bool)sys_config('pay_new_weixin_open')] + $options);
|
||||
|
||||
} catch (\Exception $e) {
|
||||
if (strpos($e->getMessage(), 'api unauthorized rid') !== false) {
|
||||
throw new ApiException('请在微信支付配置中将小程序商户号选择改为商户号绑定');
|
||||
}
|
||||
throw new ApiException($e->getMessage());
|
||||
}
|
||||
}
|
||||
// public function pay(string $payType, string $openid, string $orderId, string $price, string $successAction, string $body, bool $isCode = false)
|
||||
// {
|
||||
// try {
|
||||
//
|
||||
// //这些全都是微信支付
|
||||
// if (in_array($payType, ['routine', 'weixinh5', 'weixin', 'pc', 'store'])) {
|
||||
// $payType = 'wechat_pay';
|
||||
// //判断是否使用v3
|
||||
// if (sys_config('pay_wechat_type') == 1) {
|
||||
// $payType = 'v3_wechat_pay';
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// if ($payType == 'alipay') {
|
||||
// $payType = 'ali_pay';
|
||||
// }
|
||||
//
|
||||
//
|
||||
// $options = [];
|
||||
// if (self::ALLIN_PAY === $payType) {
|
||||
// $options['returl'] = $this->getOption('returl');
|
||||
// if ($options['returl']) {
|
||||
// $options['returl'] = str_replace('http://', 'https://', $options['returl']);
|
||||
// }
|
||||
// $options['is_wechat'] = $this->getOption('is_wechat', false);
|
||||
// $options['appid'] = sys_config('routine_appId');
|
||||
// $payType = 'allin_pay';
|
||||
// }
|
||||
//
|
||||
// /** @var Pay $pay */
|
||||
// $pay = app()->make(Pay::class, [$payType]);
|
||||
//
|
||||
//
|
||||
// return $pay->create($orderId, $price, $successAction, $body, '', ['openid' => $openid, 'isCode' => $isCode, 'pay_new_weixin_open' => (bool)sys_config('pay_new_weixin_open')] + $options);
|
||||
//
|
||||
// } catch (\Exception $e) {
|
||||
// if (strpos($e->getMessage(), 'api unauthorized rid') !== false) {
|
||||
// throw new ApiException('请在微信支付配置中将小程序商户号选择改为商户号绑定');
|
||||
// }
|
||||
// throw new ApiException($e->getMessage());
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
@ -86,7 +86,7 @@ class RechargeServices
|
||||
$openid = '';
|
||||
}
|
||||
|
||||
$res = $this->pay->pay($recharge['recharge_type'], $openid, $recharge['order_id'], $recharge['price'], 'user_recharge', '用户充值');
|
||||
$res = $this->pay->pay($recharge['recharge_type'], $recharge['order_id'], $recharge['price'], 'user_recharge', '用户充值', ['openid' => $openid]);
|
||||
|
||||
if ($payType == PayServices::WEIXIN_PAY) {
|
||||
if (request()->isH5()) {
|
||||
@ -100,7 +100,7 @@ class RechargeServices
|
||||
$payStstus = 'allinpay_pay';
|
||||
}
|
||||
|
||||
return ['jsConfig' => $res, 'order_id' => $recharge['order_id'], 'pay_type' => strtoupper($payStstus)];
|
||||
return ['jsConfig' => $res, 'pay_key' => md5($recharge['order_id']), 'order_id' => $recharge['order_id'], 'pay_type' => strtoupper($payStstus)];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user