...
|
...
|
@@ -542,21 +542,6 @@ class UsersController extends HomeBaseController{ |
|
|
if ($user['fee']>=$fee) {
|
|
|
//生成订单号
|
|
|
$order_sn=cmf_get_order_sn();
|
|
|
//进行提现
|
|
|
$app = new Application($this->options);
|
|
|
$merchantPay = $app->merchant_pay;
|
|
|
$merchantPayData = [
|
|
|
'partner_trade_no' => $order_sn, //随机字符串作为订单号,跟红包和支付一个概念。
|
|
|
'openid' => $user['open_id'], //收款人的openid
|
|
|
'check_name' => 'NO_CHECK', //文档中有三种校验实名的方法 NO_CHECK OPTION_CHECK FORCE_CHECK
|
|
|
// 're_user_name'=>'张三', //OPTION_CHECK FORCE_CHECK 校验实名的时候必须提交
|
|
|
'amount' => $fee * 100, //单位为分
|
|
|
// 'amount' => 100, //单位为分
|
|
|
'desc' => '企业付款',
|
|
|
'spbill_create_ip' => get_client_ip(0, true), //发起交易的IP地址
|
|
|
];
|
|
|
$re = $merchantPay->send($merchantPayData);
|
|
|
if ($re['return_code']=='SUCCESS' && $re['result_code']=='SUCCESS'){
|
|
|
Db::startTrans();
|
|
|
try{
|
|
|
Db::name('users')->where('id',$user_id)->setDec('fee', $fee);
|
...
|
...
|
@@ -572,8 +557,27 @@ class UsersController extends HomeBaseController{ |
|
|
Db::rollback();
|
|
|
$this->apiResponse(301,'提现失败');
|
|
|
}
|
|
|
//进行提现
|
|
|
$app = new Application($this->options);
|
|
|
$merchantPay = $app->merchant_pay;
|
|
|
$merchantPayData = [
|
|
|
'partner_trade_no' => $order_sn, //随机字符串作为订单号,跟红包和支付一个概念。
|
|
|
'openid' => $user['open_id'], //收款人的openid
|
|
|
'check_name' => 'NO_CHECK', //文档中有三种校验实名的方法 NO_CHECK OPTION_CHECK FORCE_CHECK
|
|
|
// 're_user_name'=>'张三', //OPTION_CHECK FORCE_CHECK 校验实名的时候必须提交
|
|
|
'amount' => $fee * 100, //单位为分
|
|
|
// 'amount' => 100, //单位为分
|
|
|
'desc' => '企业付款',
|
|
|
'spbill_create_ip' => get_client_ip(0, true), //发起交易的IP地址
|
|
|
];
|
|
|
$re = $merchantPay->send($merchantPayData);
|
|
|
if ($re['return_code']=='SUCCESS' && $re['result_code']=='SUCCESS'){
|
|
|
$this->apiResponse(200,'success');
|
|
|
}else{
|
|
|
Db::name('users')->where('id',$user_id)->setInc('fee', $fee);
|
|
|
Db::name('withdraw')->where([
|
|
|
'order_sn'=>$order_sn
|
|
|
])->delete();
|
|
|
$this->apiResponse(301,'提现失败');
|
|
|
}
|
|
|
}else{
|
...
|
...
|
|