正在显示
1 个修改的文件
包含
19 行增加
和
15 行删除
@@ -542,21 +542,6 @@ class UsersController extends HomeBaseController{ | @@ -542,21 +542,6 @@ class UsersController extends HomeBaseController{ | ||
542 | if ($user['fee']>=$fee) { | 542 | if ($user['fee']>=$fee) { |
543 | //生成订单号 | 543 | //生成订单号 |
544 | $order_sn=cmf_get_order_sn(); | 544 | $order_sn=cmf_get_order_sn(); |
545 | - //进行提现 | ||
546 | - $app = new Application($this->options); | ||
547 | - $merchantPay = $app->merchant_pay; | ||
548 | - $merchantPayData = [ | ||
549 | - 'partner_trade_no' => $order_sn, //随机字符串作为订单号,跟红包和支付一个概念。 | ||
550 | - 'openid' => $user['open_id'], //收款人的openid | ||
551 | - 'check_name' => 'NO_CHECK', //文档中有三种校验实名的方法 NO_CHECK OPTION_CHECK FORCE_CHECK | ||
552 | -// 're_user_name'=>'张三', //OPTION_CHECK FORCE_CHECK 校验实名的时候必须提交 | ||
553 | - 'amount' => $fee * 100, //单位为分 | ||
554 | -// 'amount' => 100, //单位为分 | ||
555 | - 'desc' => '企业付款', | ||
556 | - 'spbill_create_ip' => get_client_ip(0, true), //发起交易的IP地址 | ||
557 | - ]; | ||
558 | - $re = $merchantPay->send($merchantPayData); | ||
559 | - if ($re['return_code']=='SUCCESS' && $re['result_code']=='SUCCESS'){ | ||
560 | Db::startTrans(); | 545 | Db::startTrans(); |
561 | try{ | 546 | try{ |
562 | Db::name('users')->where('id',$user_id)->setDec('fee', $fee); | 547 | Db::name('users')->where('id',$user_id)->setDec('fee', $fee); |
@@ -572,8 +557,27 @@ class UsersController extends HomeBaseController{ | @@ -572,8 +557,27 @@ class UsersController extends HomeBaseController{ | ||
572 | Db::rollback(); | 557 | Db::rollback(); |
573 | $this->apiResponse(301,'提现失败'); | 558 | $this->apiResponse(301,'提现失败'); |
574 | } | 559 | } |
560 | + //进行提现 | ||
561 | + $app = new Application($this->options); | ||
562 | + $merchantPay = $app->merchant_pay; | ||
563 | + $merchantPayData = [ | ||
564 | + 'partner_trade_no' => $order_sn, //随机字符串作为订单号,跟红包和支付一个概念。 | ||
565 | + 'openid' => $user['open_id'], //收款人的openid | ||
566 | + 'check_name' => 'NO_CHECK', //文档中有三种校验实名的方法 NO_CHECK OPTION_CHECK FORCE_CHECK | ||
567 | +// 're_user_name'=>'张三', //OPTION_CHECK FORCE_CHECK 校验实名的时候必须提交 | ||
568 | + 'amount' => $fee * 100, //单位为分 | ||
569 | +// 'amount' => 100, //单位为分 | ||
570 | + 'desc' => '企业付款', | ||
571 | + 'spbill_create_ip' => get_client_ip(0, true), //发起交易的IP地址 | ||
572 | + ]; | ||
573 | + $re = $merchantPay->send($merchantPayData); | ||
574 | + if ($re['return_code']=='SUCCESS' && $re['result_code']=='SUCCESS'){ | ||
575 | $this->apiResponse(200,'success'); | 575 | $this->apiResponse(200,'success'); |
576 | }else{ | 576 | }else{ |
577 | + Db::name('users')->where('id',$user_id)->setInc('fee', $fee); | ||
578 | + Db::name('withdraw')->where([ | ||
579 | + 'order_sn'=>$order_sn | ||
580 | + ])->delete(); | ||
577 | $this->apiResponse(301,'提现失败'); | 581 | $this->apiResponse(301,'提现失败'); |
578 | } | 582 | } |
579 | }else{ | 583 | }else{ |
-
请 注册 或 登录 后发表评论