diff --git a/app/rongyu/controller/Danwei.php b/app/rongyu/controller/Danwei.php index d1a34c28..18ddef78 100644 --- a/app/rongyu/controller/Danwei.php +++ b/app/rongyu/controller/Danwei.php @@ -103,7 +103,7 @@ class Danwei extends BaseController // 实例化验证模型 $validate = new \app\rongyu\validate\DwRongyu; - $result = $validate->scene('add')->check($list); + $result = $validate->scene('create')->check($list); $msg = $validate->getError(); if(!$result){ return json(['msg'=>$msg,'val'=>0]); @@ -118,7 +118,7 @@ class Danwei extends BaseController $teachers[]['teacher_id'] = $value; } - $data->cyDwry->saveAll($teachers); + $data->cyDwry()->saveAll($teachers); // 根据更新结果设置返回提示信息 $data ? $data = ['msg' => '添加成功', 'val' => 1] @@ -288,7 +288,7 @@ class Danwei extends BaseController $data = DW::update($list); // 删除原来的参与教师 - $data->cyDwry()->where('rongyu_id' ,$id)->delete(true); + $data->cyDwry->delete(true); // 声明参与教师数组 $canyulist = []; diff --git a/app/rongyu/controller/JsRongyuInfo.php b/app/rongyu/controller/JsRongyuInfo.php index ec2e538e..4f17b0af 100644 --- a/app/rongyu/controller/JsRongyuInfo.php +++ b/app/rongyu/controller/JsRongyuInfo.php @@ -342,7 +342,7 @@ class JsRongyuInfo extends BaseController $data = ryinfo::update($list); // 删除原来的获奖人与参与人信息 - $data->allJsry->where('rongyu_id', $id)->delete(true); + $data->allJsry->delete(true); // 声明教师数组 $teacherlist = []; // 循环组成获奖教师信息 diff --git a/app/rongyu/model/DwRongyu.php b/app/rongyu/model/DwRongyu.php index fa0709c8..e0417d50 100644 --- a/app/rongyu/model/DwRongyu.php +++ b/app/rongyu/model/DwRongyu.php @@ -17,8 +17,10 @@ class DwRongyu extends BaseModel ,'category_id'=>array() ,'searchval'=>'' ]; - // 用新值替换初始值 $src = array_cover($srcfrom, $src); + $src['fzschool_id'] = strToArray($src['fzschool_id']); + $src['hjschool_id'] = strToArray($src['hjschool_id']); + $src['category_id'] = strToArray($src['category_id']); // 查询数据 $data = $this @@ -36,21 +38,21 @@ class DwRongyu extends BaseModel }) ->with( [ - 'hjSchool'=>function($query){ + 'hjSchool' => function($query){ $query->field('id, jiancheng'); }, - 'fzSchool'=>function($query){ - $query->field('id, jiancheng, jibie') + 'fzSchool' => function($query){ + $query->field('id, jiancheng, jibie_id') ->with([ - 'dwJibie'=>function($query){ + 'dwJibie' => function($query){ $query->field('id, title'); }, ]); }, - 'lxCategory'=>function($query){ + 'lxCategory' => function($query){ $query->field('id, title'); }, - 'jxCategory'=>function($query){ + 'jxCategory' => function($query){ $query->field('id, title'); } ] diff --git a/app/rongyu/validate/DwRongyu.php b/app/rongyu/validate/DwRongyu.php index 443ad22e..d551733e 100644 --- a/app/rongyu/validate/DwRongyu.php +++ b/app/rongyu/validate/DwRongyu.php @@ -13,8 +13,8 @@ class DwRongyu extends Validate * @var array */ protected $rule = [ - // 'url|请先上传荣誉图片' => 'require', - 'id|请先上传荣誉图片' => 'require', + 'url|请先上传荣誉图片' => 'require', + 'id|ID' => 'require', 'title|荣誉标题' => 'length:1,50', 'category_id|荣誉类型' => 'require|number', 'hjschool_id|获奖单位' => 'require|number', @@ -35,7 +35,7 @@ class DwRongyu extends Validate // 验证场景 protected $scene = [ - 'create' => ['title', 'category_id', 'hjschool_id', 'fzshijian', 'fzschool_id', 'jiangxiang_id'], + 'create' => ['url', 'title', 'category_id', 'hjschool_id', 'fzshijian', 'fzschool_id', 'jiangxiang_id'], 'edit' => ['id', 'title', 'category_id', 'hjschool_id', 'fzshijian', 'fzschool_id', 'jiangxiang_id'], 'createall' => ['title', 'url'], ]; diff --git a/app/rongyu/view/danwei/create.html b/app/rongyu/view/danwei/create.html index a2752cbf..e4e0d515 100644 --- a/app/rongyu/view/danwei/create.html +++ b/app/rongyu/view/danwei/create.html @@ -161,7 +161,7 @@ *奖项