提现修复

This commit is contained in:
wanyongkang
2020-10-21 20:54:10 +08:00
parent ff3ad053bb
commit e31107e419
2 changed files with 43 additions and 49 deletions

View File

@@ -5,16 +5,16 @@
* @Author: kangkang * @Author: kangkang
* @Date: 2020-10-11 11:22:56 * @Date: 2020-10-11 11:22:56
* @LastEditors: kangkang * @LastEditors: kangkang
* @LastEditTime: 2020-10-21 20:01:22 * @LastEditTime: 2020-10-21 20:26:56
*/ */
namespace app\order\controller; namespace app\order\controller;
use alipay\Alipay;
use app\order\model\CashOut as CashMoedl; use app\order\model\CashOut as CashMoedl;
use app\order\model\User as UserModel; use app\order\model\User as UserModel;
use app\order\model\UserScore as ScoreModel; use app\order\model\UserScore as ScoreModel;
use fastphp\base\Controller; use fastphp\base\Controller;
use alipay\Alipay;
class CashOutAdmin extends Controller class CashOutAdmin extends Controller
{ {
@@ -81,8 +81,6 @@ class CashOutAdmin extends Controller
$cash_data = $cash->getOne(['id' => $id]); $cash_data = $cash->getOne(['id' => $id]);
if ($data['status'] == '1') { if ($data['status'] == '1') {
$param = [ $param = [
'out_biz_no' => '2020' . time() . rand(10000, 99999), 'out_biz_no' => '2020' . time() . rand(10000, 99999),
'trans_amount' => $cash_data['money'], 'trans_amount' => $cash_data['money'],
@@ -91,9 +89,9 @@ class CashOutAdmin extends Controller
'payee_info' => [ 'payee_info' => [
'identity' => $cash_data['alipay_account'], 'identity' => $cash_data['alipay_account'],
'identity_type' => 'ALIPAY_LOGON_ID', 'identity_type' => 'ALIPAY_LOGON_ID',
'name' => $cash_data['real_name'] 'name' => $cash_data['real_name'],
], ],
'remark' => '聚IP提现-会员'.$cash_data['username'].'-'.$cash_data['money'].'元' 'remark' => '聚IP提现-会员' . $cash_data['username'] . '-' . $cash_data['money'] . '元',
]; ];
$result = Alipay::transfer($param); $result = Alipay::transfer($param);
if ($result) { if ($result) {

View File

@@ -2,7 +2,7 @@
/* /*
* @Author: your name * @Author: your name
* @Date: 2020-10-10 13:58:14 * @Date: 2020-10-10 13:58:14
* @LastEditTime: 2020-10-21 19:57:25 * @LastEditTime: 2020-10-21 20:47:18
* @LastEditors: kangkang * @LastEditors: kangkang
* @Description: In User Settings Edit * @Description: In User Settings Edit
* @FilePath: /phptest/app/order/controller/Index.php * @FilePath: /phptest/app/order/controller/Index.php
@@ -28,9 +28,6 @@ class CashOutIndex extends Controller
$data['apply_reason'] = $post['reason']; $data['apply_reason'] = $post['reason'];
$data['alipay_account'] = $post['alipay_account']; $data['alipay_account'] = $post['alipay_account'];
$data['real_name'] = $post['real_name']; $data['real_name'] = $post['real_name'];
$cash = new CashMoedl;
$status = $cash->add($data);
if ($status) {
$user = new UserModel; $user = new UserModel;
$user_rest = $user->getOne(['id'=>$data['userid']],'RestAmount')['RestAmount']; $user_rest = $user->getOne(['id'=>$data['userid']],'RestAmount')['RestAmount'];
$rest = $user_rest - $post['cash_out_money']; $rest = $user_rest - $post['cash_out_money'];
@@ -38,6 +35,9 @@ class CashOutIndex extends Controller
echo json_encode(['Code'=>-10000,]); echo json_encode(['Code'=>-10000,]);
die; die;
} else { } else {
$user->where(['id'=>$data['userid']])->update(['RestAmount'=>$rest]);
$cash = new CashMoedl;
$status = $cash->add($data);
$score = new ScoreModel; $score = new ScoreModel;
$score_data = [ $score_data = [
'UserId' => $data['userid'], 'UserId' => $data['userid'],
@@ -54,12 +54,8 @@ class CashOutIndex extends Controller
'DeleteTag' => 0, 'DeleteTag' => 0,
]; ];
$score->add($score_data); $score->add($score_data);
$user->where(['id'=>$data['userid']])->update(['RestAmount'=>$rest]);
} }
echo json_encode(['Code'=>10000,]); echo json_encode(['Code'=>10000,]);
} else {
echo json_encode(['Code'=>-10000,]);
}
} }
//获取记录 //获取记录