yansongda PAY 实现支付宝转账提现到用户

$order_sn = Order::createOrderSn('whh');
$order    = [
    'out_biz_no'   => $order_sn,
    'product_code' => 'TRANS_ACCOUNT_NO_PWD',
    'biz_scene'    => 'DIRECT_TRANSFER',
    'payee_info'   => [
        'identity'      => $post['account'],
        'identity_type' => 'ALIPAY_LOGON_ID',
        'name'          => $post['realname'],
    ],
    'trans_amount' => $post['money'] - $post['money'] * $s,
];
$config   = Service::getConfig('alipay');
$pay      = Pay::alipay($config);
$result   = $pay->transfer($order);
\app\common\model\User::$fun($user['id'], -$post['money'], $codeArr[$post['type']], '提现', true);
if ($result && isset($result['code']) && $result['code'] == 10000) {
    $data = [
        'order_sn'   => $order_sn,
        'zuser_id'   => $user['id'],
        'money'      => $post['money'],
        'real_money' => $post['money'] - $post['money'] * $s,
        'type'       => $post['type'],
        'status'     => '1',
        'realname'   => $post['realname'],
        'account'    => $post['account'],
        'createtime' => time()
    ];
    Db::name('zcash')->insert($data);
    Db::commit();
    $this->success('自动提现成功');
}


最后编辑于:2021/10/15作者: 牛逼PHP

发表评论