7 changed files with 138 additions and 92 deletions
-
5app/Admin/Common/Auth.php
-
45app/Admin/Common/WxPay.php
-
41app/Admin/Controllers/LanzuCsInfoController.php
-
83app/Admin/Controllers/LanzuCsWithdrawController.php
-
1app/Admin/Controllers/LanzuMpWithdrawController.php
-
2app/Models/LanzuCsWithdraw.php
-
33app/Models/LanzuUserBalance.php
@ -0,0 +1,45 @@ |
|||
<?php |
|||
|
|||
|
|||
namespace App\Admin\Common; |
|||
|
|||
|
|||
use App\Models\ImsCjdcUser; |
|||
use EasyWeChat\Factory; |
|||
|
|||
class WxPay |
|||
{ |
|||
/** |
|||
* 企业付配置 |
|||
* @param array $data |
|||
* @return array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string |
|||
* @throws \EasyWeChat\Kernel\Exceptions\InvalidArgumentException |
|||
* @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException |
|||
* @throws \GuzzleHttp\Exception\GuzzleException |
|||
*/ |
|||
public static function transfers($data = []) |
|||
{ |
|||
$app = Factory::payment(config('wechat.payment.default')); |
|||
$res = $app->transfer->toBalance([ |
|||
'partner_trade_no' => $data['partner_trade_no'], // 商户订单号,需保持唯一性(只能是字母或者数字,不能包含有符号)
|
|||
'openid' => $data['openid'], |
|||
'check_name' => 'NO_CHECK', // NO_CHECK:不校验真实姓名, FORCE_CHECK:强校验真实姓名
|
|||
're_user_name' => $data['re_user_name'], // 如果 check_name 设置为FORCE_CHECK,则必填用户真实姓名
|
|||
'amount' => $data['amount'], // 企业付款金额,单位为分
|
|||
'desc' => $data['desc'], // 企业付款操作说明信息。必填
|
|||
]); |
|||
return $res; |
|||
} |
|||
|
|||
public static function pay($model,$form) |
|||
{ |
|||
$data = []; |
|||
$user = ImsCjdcUser::find($model->user_id); |
|||
$data['openid'] = $user->openid; |
|||
$data['amount'] = $form->model()->money * 100; |
|||
$data['partner_trade_no'] = $form->model()->id; |
|||
$data['re_user_name'] = $model->name; |
|||
$data['desc'] = $model->name; |
|||
return self::transfers($data); |
|||
} |
|||
} |
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue