提现修复

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
* @Date: 2020-10-11 11:22:56
* @LastEditors: kangkang
* @LastEditTime: 2020-10-21 20:01:22
* @LastEditTime: 2020-10-21 20:26:56
*/
namespace app\order\controller;
use alipay\Alipay;
use app\order\model\CashOut as CashMoedl;
use app\order\model\User as UserModel;
use app\order\model\UserScore as ScoreModel;
use fastphp\base\Controller;
use alipay\Alipay;
class CashOutAdmin extends Controller
{
@@ -81,8 +81,6 @@ class CashOutAdmin extends Controller
$cash_data = $cash->getOne(['id' => $id]);
if ($data['status'] == '1') {
$param = [
'out_biz_no' => '2020' . time() . rand(10000, 99999),
'trans_amount' => $cash_data['money'],
@@ -91,9 +89,9 @@ class CashOutAdmin extends Controller
'payee_info' => [
'identity' => $cash_data['alipay_account'],
'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);
if ($result) {

View File

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