2020-12-03 16:57:30 +08:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace app\order\controller;
|
|
|
|
|
|
|
|
|
|
use app\order\model\ProductOrder as PoductOrderModel;
|
|
|
|
|
use enum\order\ProductOrder as ProductOrderEnum;
|
|
|
|
|
|
|
|
|
|
class OpenRefund
|
|
|
|
|
{
|
|
|
|
|
/**
|
|
|
|
|
* @description: 获取数据
|
|
|
|
|
* @param {*}
|
|
|
|
|
* @return {*}
|
|
|
|
|
*/
|
|
|
|
|
public function getList()
|
|
|
|
|
{
|
|
|
|
|
$page = 0;
|
|
|
|
|
$where = [];
|
|
|
|
|
$where2 = '';
|
2021-03-20 18:24:34 +08:00
|
|
|
if (isset($_GET['page'])) {
|
|
|
|
|
$page = ($_GET['page'] - 1) * 50;
|
2020-12-03 16:57:30 +08:00
|
|
|
}
|
2021-03-20 18:24:34 +08:00
|
|
|
if (!empty($_GET['Btime'])){
|
2020-12-03 16:57:30 +08:00
|
|
|
$date1 = date('Y-m-d', strtotime($_GET['Btime']));
|
|
|
|
|
$date2 = date('Y-m-d', strtotime($_GET['Etime']));
|
|
|
|
|
$where2 .= " UpdateTime>='" . $date1 . "' and UpdateTime<='" . $date2 . "' ";
|
|
|
|
|
}
|
2021-03-20 18:24:34 +08:00
|
|
|
if (!empty($_GET['ProductIds'])){
|
2020-12-03 16:57:30 +08:00
|
|
|
$where['ProductId'] = $_GET['ProductIds'];
|
|
|
|
|
}
|
|
|
|
|
$product_order_model = new PoductOrderModel;
|
|
|
|
|
$product_order_enum = new ProductOrderEnum;
|
|
|
|
|
$where['OrderType'] = $product_order_enum::$Refund;
|
2021-02-19 15:59:22 +08:00
|
|
|
$list = $product_order_model->openGetList($where, 'CreateTime,ProductName,PackageName,ConnectCount*AccountCount ConnectCount,Accounts,RefundRestTime,OrderState', 'CreateTime desc', "$page,50", $where2);
|
2021-03-20 18:24:34 +08:00
|
|
|
// $data = [
|
|
|
|
|
// 'list' => $list,
|
|
|
|
|
// 'count' => $product_order_model->getOpenCount($where,$where2)
|
|
|
|
|
// ];
|
|
|
|
|
$order_status = [
|
|
|
|
|
'30' => '未自动退款',
|
|
|
|
|
'40' => '已人工处理',
|
|
|
|
|
'50' => '已自动退款',
|
2020-12-03 16:57:30 +08:00
|
|
|
];
|
2021-03-20 18:24:34 +08:00
|
|
|
foreach($list as &$info){
|
|
|
|
|
$info['OrderState'] = $order_status[$info['OrderState']];
|
|
|
|
|
}
|
|
|
|
|
$retuen_info = [
|
|
|
|
|
'code' => 0,
|
|
|
|
|
'msg' => '',
|
|
|
|
|
'count' => $product_order_model->getOpenCount($where,$where2)['count'],
|
|
|
|
|
'data' => $list,
|
|
|
|
|
];
|
|
|
|
|
echo json_encode($retuen_info);
|
2020-12-03 16:57:30 +08:00
|
|
|
}
|
2021-01-27 19:12:32 +08:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @description: 导出数据
|
|
|
|
|
* @param {*}
|
|
|
|
|
* @return {*}
|
|
|
|
|
*/
|
|
|
|
|
public function export()
|
|
|
|
|
{
|
|
|
|
|
$page = 0;
|
|
|
|
|
$where = [];
|
|
|
|
|
$where2 = '';
|
2021-03-20 18:24:34 +08:00
|
|
|
if (!empty($_GET['Btime'])){
|
2021-01-27 19:12:32 +08:00
|
|
|
$date1 = date('Y-m-d', strtotime($_GET['Btime']));
|
|
|
|
|
$date2 = date('Y-m-d', strtotime($_GET['Etime']));
|
|
|
|
|
$where2 .= " UpdateTime>='" . $date1 . "' and UpdateTime<='" . $date2 . "' ";
|
|
|
|
|
}
|
2021-03-20 18:24:34 +08:00
|
|
|
if (!empty($_GET['ProductIds'])){
|
2021-03-20 18:36:46 +08:00
|
|
|
$where['ProductId'] = $_GET['ProductIds'];
|
2021-01-27 19:12:32 +08:00
|
|
|
}
|
|
|
|
|
$product_order_model = new PoductOrderModel;
|
|
|
|
|
$product_order_enum = new ProductOrderEnum;
|
|
|
|
|
$where['OrderType'] = $product_order_enum::$Refund;
|
2021-02-19 15:59:22 +08:00
|
|
|
$list = $product_order_model->openGetList($where, 'CreateTime,ProductName,PackageName,ConnectCount*AccountCount ConnectCount,Accounts,RefundRestTime,OrderState', 'CreateTime desc', "10000000", $where2);
|
2021-01-27 19:12:32 +08:00
|
|
|
|
2021-02-24 16:31:35 +08:00
|
|
|
$order_status = [
|
|
|
|
|
'30' => '未自动退款',
|
|
|
|
|
'40' => '已人工处理',
|
|
|
|
|
'50' => '已自动退款',
|
|
|
|
|
];
|
|
|
|
|
foreach($list as &$info){
|
|
|
|
|
$info['OrderState'] = $order_status[$info['OrderState']];
|
|
|
|
|
}
|
|
|
|
|
|
2021-02-19 15:59:22 +08:00
|
|
|
\exportToCsv('test.csv',['创建时间','产品','套餐','连接数','账号','剩余时间','退款状态'],$list);
|
2021-01-27 19:12:32 +08:00
|
|
|
}
|
2020-12-03 16:57:30 +08:00
|
|
|
}
|