58 lines
1.7 KiB
PHP
58 lines
1.7 KiB
PHP
<?php
|
|
/*
|
|
* @Author: your name
|
|
* @Date: 2020-10-10 13:58:14
|
|
* @LastEditTime: 2020-10-12 11:15:09
|
|
* @LastEditors: your name
|
|
* @Description: In User Settings Edit
|
|
* @FilePath: /phptest/app/order/controller/Index.php
|
|
*/
|
|
|
|
namespace app\order\controller;
|
|
|
|
use app\order\model\CashOut as CashMoedl;
|
|
use fastphp\base\Controller;
|
|
|
|
class Index extends Controller
|
|
{
|
|
//接收提现请求
|
|
public function index()
|
|
{
|
|
$post = json_decode(file_get_contents("php://input"), true);
|
|
$data = [];
|
|
$data['userid'] = $this->userinfo['UserId'];
|
|
$data['username'] = $this->userinfo['LoginName'];
|
|
$data['money'] = $post['cash_out_money'];
|
|
$data['apply_reason'] = $post['reason'];
|
|
$data['alipay_account'] = $post['alipay_account'];
|
|
$cash = new CashMoedl;
|
|
$status = $cash->add($data);
|
|
if ($status) {
|
|
echo json_encode(['Code'=>10000,]);
|
|
} else {
|
|
echo json_encode(['Code'=>-10000,]);
|
|
}
|
|
}
|
|
|
|
//获取记录
|
|
public function getData()
|
|
{
|
|
$cash = new CashMoedl;
|
|
$list = $cash->getListPage([],'username,money,apply_reason,alipay_account,status,create_time');
|
|
//提现状态
|
|
$status = ['待处理', '提现成功', '提现未成功'];
|
|
foreach ($list as &$v) {
|
|
$v['status'] = $status[$v['status']];
|
|
$v['alipay_account'] = substr($v['alipay_account'], 0, 3) . '***' . substr($v['alipay_account'], -5);
|
|
}
|
|
$count = $cash->getCount();
|
|
$data = [
|
|
'Code' => 10000,
|
|
'count' => $count['count'],
|
|
'data' => $list,
|
|
];
|
|
echo json_encode($data);
|
|
}
|
|
|
|
}
|