正在显示
1 个修改的文件
包含
16 行增加
和
16 行删除
@@ -463,7 +463,23 @@ class UsersController extends HomeBaseController{ | @@ -463,7 +463,23 @@ class UsersController extends HomeBaseController{ | ||
463 | $fee=$this->request->param('fee'); | 463 | $fee=$this->request->param('fee'); |
464 | $user=Db::name('users')->where('id',$user_id)->find(); | 464 | $user=Db::name('users')->where('id',$user_id)->find(); |
465 | if ($user['fee']>=$fee) { | 465 | if ($user['fee']>=$fee) { |
466 | + //生成订单号 | ||
466 | $order_sn=cmf_get_order_sn(); | 467 | $order_sn=cmf_get_order_sn(); |
468 | + //进行提现 | ||
469 | + $app = new Application($this->options); | ||
470 | + $merchantPay = $app->merchant_pay; | ||
471 | + $merchantPayData = [ | ||
472 | + 'partner_trade_no' => $order_sn, //随机字符串作为订单号,跟红包和支付一个概念。 | ||
473 | + 'openid' => $user['open_id'], //收款人的openid | ||
474 | + 'check_name' => 'NO_CHECK', //文档中有三种校验实名的方法 NO_CHECK OPTION_CHECK FORCE_CHECK | ||
475 | +// 're_user_name'=>'张三', //OPTION_CHECK FORCE_CHECK 校验实名的时候必须提交 | ||
476 | + 'amount' => $fee * 100, //单位为分 | ||
477 | +// 'amount' => 100, //单位为分 | ||
478 | + 'desc' => '企业付款', | ||
479 | + 'spbill_create_ip' => get_client_ip(0, true), //发起交易的IP地址 | ||
480 | + ]; | ||
481 | + $re = $merchantPay->send($merchantPayData); | ||
482 | + if ($re['return_code']=='SUCCESS' && $re['result_code']=='SUCCESS'){ | ||
467 | Db::startTrans(); | 483 | Db::startTrans(); |
468 | try{ | 484 | try{ |
469 | Db::name('users')->where('id',$user_id)->setDec('fee', $fee); | 485 | Db::name('users')->where('id',$user_id)->setDec('fee', $fee); |
@@ -479,22 +495,6 @@ class UsersController extends HomeBaseController{ | @@ -479,22 +495,6 @@ class UsersController extends HomeBaseController{ | ||
479 | Db::rollback(); | 495 | Db::rollback(); |
480 | $this->apiResponse(301,'提现失败'); | 496 | $this->apiResponse(301,'提现失败'); |
481 | } | 497 | } |
482 | - $app = new Application($this->options); | ||
483 | - $merchantPay = $app->merchant_pay; | ||
484 | - | ||
485 | - $merchantPayData = [ | ||
486 | - 'partner_trade_no' => $order_sn, //随机字符串作为订单号,跟红包和支付一个概念。 | ||
487 | - 'openid' => $user['open_id'], //收款人的openid | ||
488 | - 'check_name' => 'NO_CHECK', //文档中有三种校验实名的方法 NO_CHECK OPTION_CHECK FORCE_CHECK | ||
489 | -// 're_user_name'=>'张三', //OPTION_CHECK FORCE_CHECK 校验实名的时候必须提交 | ||
490 | - 'amount' => $fee * 100, //单位为分 | ||
491 | -// 'amount' => 100, //单位为分 | ||
492 | - 'desc' => '企业付款', | ||
493 | - 'spbill_create_ip' => get_client_ip(0, true), //发起交易的IP地址 | ||
494 | - ]; | ||
495 | - $re = $merchantPay->send($merchantPayData); | ||
496 | -// var_dump($re); | ||
497 | - if ($re['return_code']=='SUCCESS' && $re['result_code']=='SUCCESS'){ | ||
498 | $this->apiResponse(200,'success',$re); | 498 | $this->apiResponse(200,'success',$re); |
499 | } | 499 | } |
500 | }else{ | 500 | }else{ |
-
请 注册 或 登录 后发表评论