40 lines
1.1 KiB
PHP
40 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace app\controller;
|
|
|
|
use support\Request;
|
|
use app\model\zdoo\Customer;
|
|
|
|
class CustomerController
|
|
{
|
|
public function index(Request $request)
|
|
{
|
|
$statusList = $request->get('statusList', '');
|
|
$name = $request->get('name', '');
|
|
|
|
$statusListArray = explode(',', $statusList);
|
|
$statusListSelected = [];
|
|
foreach(Customer::$statusList as $k => $v){
|
|
$tmpItem = [
|
|
'name' => $v,
|
|
'value' => $k
|
|
];
|
|
if(in_array($k, $statusListArray)){
|
|
$tmpItem['selected'] = true;
|
|
}
|
|
$statusListSelected[] = $tmpItem;
|
|
}
|
|
|
|
return view('customer/index', ['statusList' => $statusList, 'name' => $name, 'statusListSelected' => json_encode($statusListSelected)]);
|
|
}
|
|
|
|
public function apiGetList(Request $request)
|
|
{
|
|
$statusList = $request->get('statusList', '');
|
|
$name = $request->get('name', '');
|
|
|
|
$list = Customer::getPageList($statusList, $name);
|
|
|
|
return json(['code' => 0, 'msg' => 'ok', 'list' => $list]);
|
|
}
|
|
} |