提现处理
This commit is contained in:
@@ -5,13 +5,16 @@
|
||||
* @Author: kangkang
|
||||
* @Date: 2020-10-11 11:22:56
|
||||
* @LastEditors: kangkang
|
||||
* @LastEditTime: 2020-10-14 10:16:05
|
||||
* @LastEditTime: 2020-10-21 20:01:22
|
||||
*/
|
||||
|
||||
namespace app\order\controller;
|
||||
|
||||
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
|
||||
{
|
||||
@@ -25,6 +28,7 @@ class CashOutAdmin extends Controller
|
||||
foreach ($list as &$v) {
|
||||
$v['status'] = $status[$v['status']];
|
||||
$v['alipay_account'] = substr($v['alipay_account'], 0, 3) . '***' . substr($v['alipay_account'], -3);
|
||||
$v['username'] = substr($v['username'], 0, 3) . '***' . substr($v['username'], -3);
|
||||
}
|
||||
$count = $cash->getCount();
|
||||
$data = [
|
||||
@@ -49,6 +53,7 @@ class CashOutAdmin extends Controller
|
||||
foreach ($list as &$v) {
|
||||
$v['status'] = $status[$v['status']];
|
||||
$v['alipay_account'] = substr($v['alipay_account'], 0, 3) . '***' . substr($v['alipay_account'], -3);
|
||||
$v['username'] = substr($v['username'], 0, 3) . '***' . substr($v['username'], -3);
|
||||
}
|
||||
$data = [
|
||||
'Code' => 10000,
|
||||
@@ -69,14 +74,63 @@ class CashOutAdmin extends Controller
|
||||
unset($data['update_time']);
|
||||
unset($data['create_time']);
|
||||
unset($data['id']);
|
||||
unset($data['username']);
|
||||
|
||||
$user = $this->userinfo;
|
||||
$cash = new CashMoedl;
|
||||
$cash_data = $cash->getOne(['id' => $id]);
|
||||
if($data['status'] == '1'){
|
||||
|
||||
|
||||
|
||||
$param = [
|
||||
'out_biz_no'=>'2020'.time().rand(10000,99999),
|
||||
'trans_amount' => $cash_data['money'],
|
||||
'product_code' => 'TRANS_ACCOUNT_NO_PWD',
|
||||
'biz_scene' => 'DIRECT_TRANSFER',
|
||||
'payee_info' => [
|
||||
'identity' => $cash_data['alipay_account'],
|
||||
'identity_type' => 'ALIPAY_LOGON_ID',
|
||||
'name' => $cash_data['real_name']
|
||||
],
|
||||
'remark' => '聚IP提现-会员'.$cash_data['username'].'-'.$cash_data['money'].'元'
|
||||
];
|
||||
$result = Alipay::transfer($param);
|
||||
if ($result){
|
||||
$data['cash_no'] = $result->alipay_fund_trans_uni_transfer_response->out_biz_no;
|
||||
$data['alipay_no'] = $result->alipay_fund_trans_uni_transfer_response->order_id;
|
||||
$data['status'] = 1;
|
||||
} else {
|
||||
die;
|
||||
}
|
||||
} else if($data['status'] == '2'){
|
||||
$user_model = new UserModel;
|
||||
$user_rest = $user_model->getOne(['id'=>$data['userid']],'RestAmount')['RestAmount'];
|
||||
$rest = $user_rest + $cash_data['money'];
|
||||
$user_model->where(['id'=>$data['userid']])->update(['RestAmount'=>$rest]);
|
||||
$score = new ScoreModel;
|
||||
$score_data = [
|
||||
'UserId' => $data['userid'],
|
||||
'ScoreType' => 9,
|
||||
'ScoreTypeName' => '提现被拒退还',
|
||||
'ScoreValue' => $cash_data['money'],
|
||||
'UserName' => $cash_data['username'],
|
||||
'OperateUserName' => $user['LoginName'],
|
||||
'RestAmount1' => $user_rest,
|
||||
'RestAmount2' => $rest,
|
||||
'CreateTime' => date('Y-m-d H:i:s',time()),
|
||||
'UpdateTime' => date('Y-m-d H:i:s',time()),
|
||||
'TenantId' => 0,
|
||||
'DeleteTag' => 0,
|
||||
];
|
||||
$score->add($score_data);
|
||||
}
|
||||
$data['op_user'] = $user['LoginName'];
|
||||
$status = ['0', '1', '2'];
|
||||
if (!in_array($data['status'], $status)) {
|
||||
unset($data['status']);
|
||||
}
|
||||
$cash = new CashMoedl;
|
||||
|
||||
$up_status = $cash->where(['id' => $id])->update($data);
|
||||
$return_info = [
|
||||
'Code' => 10000,
|
||||
|
||||
Reference in New Issue
Block a user