From 0c33aa934562bbf77ee7a0f41a26595ea8984347 Mon Sep 17 00:00:00 2001 From: cxdbz Date: Tue, 19 Feb 2019 19:12:43 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=B1=BB=E5=88=AB=E3=80=81?= =?UTF-8?q?=E6=95=99=E5=B8=88=E8=8D=A3=E8=AA=89=E7=AD=9B=E9=80=89=E3=80=81?= =?UTF-8?q?=E8=AF=BE=E9=A2=98=E6=95=B0=E6=8D=AE=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../rongyu/controller/JsRongyuInfo.php | 21 +++++++++++-------- application/rongyu/model/JsRongyuInfo.php | 16 +++++++++----- application/rongyu/view/js_rongyu/create.html | 2 +- application/rongyu/view/js_rongyu/edit.html | 2 +- application/rongyu/view/js_rongyu/index.html | 2 +- .../rongyu/view/js_rongyu_info/edit.html | 2 +- .../rongyu/view/js_rongyu_info/index.html | 2 +- database/migrations/20190218055858_keti.php | 4 ++++ database/seeds/Category.php | 13 +++++++++--- 9 files changed, 42 insertions(+), 22 deletions(-) diff --git a/application/rongyu/controller/JsRongyuInfo.php b/application/rongyu/controller/JsRongyuInfo.php index f3a97b8a..41a632f3 100644 --- a/application/rongyu/controller/JsRongyuInfo.php +++ b/application/rongyu/controller/JsRongyuInfo.php @@ -275,7 +275,7 @@ class JsRongyuInfo extends Base $data = ryinfo::update($list); // 删除原来的获奖人与参与人信息 - $data->allJsry()->delete(true); + $data->allJsry()->where('rongyuid',$list['id'])->delete(true); // 声明教师数组 $teacherlist = []; // 循环组成获奖教师信息 @@ -286,14 +286,17 @@ class JsRongyuInfo extends Base 'category' => 1, ]; } - // 循环组成参与教师信息 - foreach ($list['cyteachers'] as $key => $value) { - $canyulist[] = [ - 'teacherid' => $value, - 'rongyuid' => $list['id'], - 'category' => 2, - ]; + if(!empty($list['cyteachers'])){ + // 循环组成参与教师信息 + foreach ($list['cyteachers'] as $key => $value) { + $canyulist[] = [ + 'teacherid' => $value, + 'rongyuid' => $list['id'], + 'category' => 2, + ]; + } } + // 添加新的获奖人与参与人信息 $data->allJsry()->saveAll($canyulist); @@ -302,7 +305,7 @@ class JsRongyuInfo extends Base $data ? $data=['msg'=>'更新成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0]; // 返回信息 - return json($data&1); + return json($data); } /** diff --git a/application/rongyu/model/JsRongyuInfo.php b/application/rongyu/model/JsRongyuInfo.php index 451cf62a..c9adb149 100644 --- a/application/rongyu/model/JsRongyuInfo.php +++ b/application/rongyu/model/JsRongyuInfo.php @@ -10,7 +10,7 @@ class JsRongyuInfo extends Base //搜索单位获奖荣誉 public function search($search) { - // 获取参数 + // 获取参数 $hjschool = $search['hjschool']; $fzschool = $search['fzschool']; $category = $search['category']; @@ -19,15 +19,21 @@ class JsRongyuInfo extends Base $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($fzschool),function($query) use($fzschool){ + $query->where('rongyuce','in',function($q) use($fzschool){ + $q->name('JsRongyu')->where('fzschool','in',$fzschool)->field('id'); + }); + + }) ->when(!empty($category),function($query) use($category){ - $query->where('category','in',$category); + $query->where('rongyuce','in',function($q) use($category){ + $q->name('JsRongyu')->where('category','in',$category)->field('id'); + }); }) ->when(!empty($search),function($query) use($search){ $query->where('title','like',$search); diff --git a/application/rongyu/view/js_rongyu/create.html b/application/rongyu/view/js_rongyu/create.html index 5ffbe321..1a01acf8 100644 --- a/application/rongyu/view/js_rongyu/create.html +++ b/application/rongyu/view/js_rongyu/create.html @@ -13,7 +13,7 @@
- {php}$category = getCategory(112);{/php} + {php}$category = getCategory(114);{/php} {volist name="category" id="vo"} diff --git a/application/rongyu/view/js_rongyu/index.html b/application/rongyu/view/js_rongyu/index.html index fc4c7ee4..eec151c1 100644 --- a/application/rongyu/view/js_rongyu/index.html +++ b/application/rongyu/view/js_rongyu/index.html @@ -50,7 +50,7 @@
- {php}$category = getCategory(112);{/php} + {php}$category = getCategory(114);{/php}
diff --git a/application/rongyu/view/js_rongyu_info/edit.html b/application/rongyu/view/js_rongyu_info/edit.html index e3be402d..d0bc4fa7 100644 --- a/application/rongyu/view/js_rongyu_info/edit.html +++ b/application/rongyu/view/js_rongyu_info/edit.html @@ -83,7 +83,7 @@
- +
diff --git a/application/rongyu/view/js_rongyu_info/index.html b/application/rongyu/view/js_rongyu_info/index.html index 62d9f51b..d435fb1e 100644 --- a/application/rongyu/view/js_rongyu_info/index.html +++ b/application/rongyu/view/js_rongyu_info/index.html @@ -66,7 +66,7 @@
- {php}$category = getCategory(112);{/php} + {php}$category = getCategory(114);{/php}
diff --git a/database/migrations/20190218055858_keti.php b/database/migrations/20190218055858_keti.php index cfd95482..0faf2ac8 100644 --- a/database/migrations/20190218055858_keti.php +++ b/database/migrations/20190218055858_keti.php @@ -46,6 +46,10 @@ class Keti extends Migrator ->addColumn('jtshijian','integer',['limit'=>11,'null'=>false,'comment'=>'结题时间']) ->addColumn('jddengji','integer',['limit'=>11,'null'=>false,'comment'=>'鉴定等级']) ->addColumn('jtpic','string',['limit'=>100,'null'=>false,'comment'=>'结题证书图片']) + ->addColumn('create_time','integer',['limit'=>11,'null'=>true,'comment'=>'创建时间']) + ->addColumn('update_time','integer',['limit'=>11,'null'=>true,'comment'=>'更新时间']) + ->addColumn('delete_time','integer',['limit'=>11,'null'=>true,'comment'=>'删除时间']) + ->addColumn('beizhu','string',['limit'=>80,'null'=>true,'comment'=>'备注']) ->create(); } } diff --git a/database/seeds/Category.php b/database/seeds/Category.php index 2307111c..aa78aa96 100644 --- a/database/seeds/Category.php +++ b/database/seeds/Category.php @@ -30,6 +30,8 @@ class Category extends Seeder ['id'=>111,'title'=>'文件','pid'=>0,'paixu'=>11], ['id'=>112,'title'=>'单位荣誉','pid'=>0,'paixu'=>12], ['id'=>113,'title'=>'单位荣誉奖项','pid'=>0,'paixu'=>13], + ['id'=>114,'title'=>'教师荣誉','pid'=>0,'paixu'=>14], + ['id'=>115,'title'=>'教师荣誉奖项','pid'=>0,'paixu'=>15], // 二级类别 // 大学科 @@ -113,11 +115,16 @@ class Category extends Seeder ['title'=>'科研','pid'=>112,'paixu'=>1], ['title'=>'特色','pid'=>112,'paixu'=>2], // 单位荣誉奖项 - ['title'=>'先进单位','pid'=>113,'paixu'=>1], + ['title'=>'先进(个人/单位)','pid'=>113,'paixu'=>1], ['title'=>'一等奖','pid'=>113,'paixu'=>2], ['title'=>'二等奖','pid'=>113,'paixu'=>3], - ['title'=>'三等奖','pid'=>113,'paixu'=>3], - ['title'=>'优秀奖','pid'=>113,'paixu'=>3], + ['title'=>'三等奖','pid'=>113,'paixu'=>4], + ['title'=>'优秀奖','pid'=>113,'paixu'=>5], + // 教师荣誉分类 + ['title'=>'优质课','pid'=>114,'paixu'=>1], + ['title'=>'技能大赛','pid'=>114,'paixu'=>2], + ['title'=>'论文','pid'=>114,'paixu'=>3], + ['title'=>'教科研','pid'=>114,'paixu'=>4], ];