Files
juipphp/app/order/controller/TbRefund.php
2020-10-14 20:20:49 +08:00

119 lines
3.0 KiB
PHP

<?php
/*
* @Descripttion:
* @version:
* @Author: kangkang
* @Date: 2020-10-13 19:52:37
* @LastEditors: kangkang
* @LastEditTime: 2020-10-14 20:12:00
*/
/*
* @Descripttion:
* @version:
* @Author: kangkang
* @Date: 2020-10-13 19:52:37
* @LastEditors: kangkang
* @LastEditTime: 2020-10-14 20:04:16
*/
namespace app\order\controller;
use app\order\model\TbRefund as RefundMOdel;
use enum\order\TbRefund as RefundEnum;
use fastphp\base\Controller;
class TbRefund extends Controller
{
function list() {
$refund = new RefundMOdel;
$list = $refund->getListPage();
foreach ($list as &$v) {
$v['Phone'] = substr($v['Phone'], 0, 3) . '***' . substr($v['Phone'], -3);
$v['status'] = RefundEnum::$refundStatus[$v['status']];
}
$count = $refund->getCount();
$data = [
'Code' => 10000,
'count' => $count['count'],
'data' => $list,
];
echo json_encode($data);
}
public function pageList()
{
if (!$_GET) {
die;
}
$page = ($_GET['page'] - 1) * 50;
$refund = new RefundMOdel;
$list = $refund->getListPage([], '*', 'id desc', "$page,50");
foreach ($list as &$v) {
$v['Phone'] = substr($v['Phone'], 0, 3) . '***' . substr($v['Phone'], -3);
$v['status'] = RefundEnum::$refundStatus[$v['status']];
}
$data = [
'Code' => 10000,
'data' => $list,
];
echo json_encode($data);
}
//获取记录
public function search()
{
$Phone = json_decode(file_get_contents("php://input"), true)['Phone'];
$refund = new RefundMOdel;
if ($Phone) {
$list = $refund->getListPage(['Phone' => $Phone], '*', 'id desc', '100');
} else {
$list = $refund->getListPage();
$count = $refund->getCount();
}
foreach ($list as &$v) {
$v['Phone'] = substr($v['Phone'], 0, 3) . '***' . substr($v['Phone'], -3);
$v['status'] = RefundEnum::$refundStatus[$v['status']];
}
$data = [
'Code' => 10000,
'count' => $count['count'] ?? 0,
'data' => $list,
];
echo json_encode($data);
}
/**
* @description: 获取点击的那一条数据
* @param {type}
* @return {type}
*/
public function getOneInfo()
{
if (!$_GET) {
die;
}
$id = $_GET['id'];
$refund = new RefundMOdel;
$where = ['Id' => $id];
$info = $refund->getOne($where);
$data = [
'Code' => 10000,
'data' => $info,
];
echo json_encode($data);
}
/**
* @description: 处理退款
* @param {type}
* @return {type}
*/
public function handle()
{
$data = json_decode(file_get_contents("php://input"), true)['info'];
$id = $data['Id'];
dump($data);
}
}