123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- <?php
- namespace app\common\service;
- use think\Exception;
- class MoneyService
- {
- private $model = '';
-
- public function __construct()
- {
- $this->model = new \app\common\model\User();
- }
-
- public function withdrawTransfer($params=[]) {
- $result = [
- 'status' => 1,
- 'msg' => '',
- 'data' => [],
- ];
- try {
- $money = isset($params['money']) ? $params['money'] : '';
- $alipayAccount= isset($params['alipay_account']) ? $params['alipay_account'] : '';
- $name= isset($params['name']) ? $params['name'] : '';
- $info = [
- 'money' => $money,
- 'alipay_account' => $alipayAccount,
- 'name' => $name,
- ];
- $data['out_biz_no'] = getMillisecond() . mt_rand(1, 1000);
- $data['trans_amount'] = $info['money'];
- $data['product_code'] = 'TRANS_ACCOUNT_NO_PWD';
- $data['biz_scene'] = 'DIRECT_TRANSFER';
- $data['order_title'] = 'GG语音提现';
- $data['payee_info'] = [
- 'identity' => $info['alipay_account'],
- 'identity_type' => 'ALIPAY_LOGON_ID',
- 'name' => $info['name'],
- ];
-
- $data['remark'] = 'GG语音提现';
- require_once("../extend/AliPay/AliPay.php");
- $alipay =new \AliPay();
- $alipayResult =$alipay->AliPayWithdraw($data);
- if ($alipayResult['code'] != 10000) {
- throw new Exception($alipayResult['sub_msg']);
- }
- } catch (Exception $e) {
- $result['status'] = 0;
- $result['msg'] = $e->getMessage();
- }
- return $result;
- }
- }
|