feat: init project codebase
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
/**
|
||||
* 通用搜索控件,如用户等
|
||||
*/
|
||||
class Search extends AdminController
|
||||
{
|
||||
|
||||
function _get($model,$nama_field = 'name')
|
||||
{
|
||||
$this->load->model($model);
|
||||
$searchText = $this->input->get('name');
|
||||
$searchId = $this->input->get('id');
|
||||
$param = [];
|
||||
if(!empty($searchId)){
|
||||
$param['id'] = $searchId;
|
||||
}else{
|
||||
$param[$nama_field] = $searchText;
|
||||
}
|
||||
$page = 1;
|
||||
$limit = 100;
|
||||
$items = $this->$model->listing($param, ($page-1)*$limit,$limit,'base.id,base.'.$nama_field);
|
||||
$this->success($items);
|
||||
}
|
||||
|
||||
function user_get()
|
||||
{
|
||||
$this->_get('customer_model','nickname');
|
||||
}
|
||||
|
||||
function package_get()
|
||||
{
|
||||
$this->_get('package_model');
|
||||
}
|
||||
|
||||
function disease_get()
|
||||
{
|
||||
$this->_get('disease_model');
|
||||
}
|
||||
|
||||
function series_number_get()
|
||||
{
|
||||
$this->_get('series_number_model','device_id');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user