单位荣誉
This commit is contained in:
1 parent
44833b07a8
commit
c30a3a640c
7 files changed
+152
-15
No files matched your search
@@ -17,9 +17,9 @@ class DwRongyu extends Base
|
||||
public function index()
|
||||
{
|
||||
// 设置数据总数
|
||||
$list['count'] = Teacher::count();
|
||||
$list['count'] = dwry::count();
|
||||
// 设置页面标题
|
||||
$list['title'] = '教师列表';
|
||||
$list['title'] = '单位荣誉';
|
||||
|
||||
// 模板赋值
|
||||
$this->assign('list', $list);
|
||||
@@ -28,6 +28,62 @@ class DwRongyu extends Base
|
||||
return $this->fetch();
|
||||
}
|
||||
|
||||
/**
|
||||
* 显示单位荣誉列表
|
||||
*
|
||||
* @return \think\Response
|
||||
*/
|
||||
public function ajaxData()
|
||||
{
|
||||
// 获取DT的传值
|
||||
$getdt = request()->param();
|
||||
|
||||
//得到排序的方式
|
||||
$order = $getdt['order'][0]['dir'];
|
||||
//得到排序字段的下标
|
||||
$order_column = $getdt['order'][0]['column'];
|
||||
//根据排序字段的下标得到排序字段
|
||||
$order_field = $getdt['columns'][$order_column]['name'];
|
||||
if($order_field=='')
|
||||
{
|
||||
$order_field = $getdt['columns'][$order_column]['data'];
|
||||
}
|
||||
//得到limit参数
|
||||
$limit_start = $getdt['start'];
|
||||
$limit_length = $getdt['length'];
|
||||
|
||||
//得到搜索的关键词
|
||||
$search = [
|
||||
'hjschool'=>$getdt['hjschool'],
|
||||
'fzschool'=>$getdt['fzschool'],
|
||||
'category'=>$getdt['category'],
|
||||
'search'=>$getdt['search']['value'],
|
||||
'order'=>$order,
|
||||
'order_field'=>$order_field
|
||||
];
|
||||
|
||||
// 实例化
|
||||
$dwry = new dwry();
|
||||
|
||||
// 获取荣誉总数
|
||||
$datacnt = $dwry->select()->count();
|
||||
|
||||
// 查询数据
|
||||
$data = $dwry->search($search);
|
||||
|
||||
$cnt = $data->count();
|
||||
|
||||
// 重组返回内容
|
||||
$data = [
|
||||
'draw'=> $getdt["draw"] , // ajax请求次数,作为标识符
|
||||
'recordsTotal'=>$cnt, // 获取到的结果数(每页显示数量)
|
||||
'recordsFiltered'=>$datacnt, // 符合条件的总数据量
|
||||
'data'=>$data, //获取到的数据结果
|
||||
];
|
||||
|
||||
return json($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 显示创建资源表单页.
|
||||
*
|
||||
|
||||
@@ -7,5 +7,33 @@ use app\common\model\Base;
|
||||
|
||||
class DwRongyu extends Base
|
||||
{
|
||||
//
|
||||
//搜索单位获奖荣誉
|
||||
public function search($search)
|
||||
{
|
||||
// 获取参数
|
||||
$hjschool = $search['hjschool'];
|
||||
$fzschool = $search['fzschool'];
|
||||
$category = $search['category'];
|
||||
$order_field = $search['order_field'];
|
||||
$order = $search['order'];
|
||||
$category = $search['category'];
|
||||
$search = $search['search'];
|
||||
|
||||
$data = $this->order([$order_field =>$order])
|
||||
->when(!empty($hjschool),function($query) use($hjschool){
|
||||
$query->where('hjschool','in',$hjschool);
|
||||
})
|
||||
->when(!empty($fzschool),function($query) use($fzschool){
|
||||
$query->where('fzschool','in',$fzschool);
|
||||
})
|
||||
->when(!empty($category),function($query) use($category){
|
||||
$query->where('category','in',$category);
|
||||
})
|
||||
->when(!empty($search),function($query) use($search){
|
||||
$query->where('title','like',$search);
|
||||
})
|
||||
->select();
|
||||
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace app\rongyu\model;
|
||||
|
||||
use think\Model;
|
||||
|
||||
class DwRongyuCanyu extends Model
|
||||
{
|
||||
// 关闭全局自动时间戳
|
||||
protected $autoWriteTimestamp = false;
|
||||
}
|
||||
Loaded 3 of 7 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user