technologyRule($data); if(!$status) return [$status,$msg]; if($this->isEmpty($data,'id')) return [false,'ID不存在']; $first = Technology::where('title',$data['title'])->where('id','<>',$data['id'])->where('del_time',0)->first(); if(!empty($first))return [false,'名称已存在!']; $model = new Technology(); $model = $model->where('id',$data['id'])->first(); $model->title = $data['title']; $model->process_id = $data['process_id']; $model->save(); return [true,'保存成功!']; } public function technologyAdd($data,$user){ list($status,$msg) = $this->technologyRule($data); if(!$status) return [$status,$msg]; $first = Technology::where('title',$data['title'])->where('del_time',0)->first(); if(!empty($first))return [false,'名称已存在!']; $model = new Technology(); $model->title = $data['title']; $model->process_id = $data['process_id']; $model->save(); return [true,'保存成功!']; } public function technologyDel($data){ if($this->isEmpty($data,'id')) return [false,'ID必须!']; Technology::where('id',$data['id'])->update([ 'del_time' => time() ]); return [true,'删除成功']; } public function technologyList($data){ $list = Technology::where('del_time',0)->select('*'); $list = $this->limit($list,'',$data); return [200,$list]; } public function technologyRule($data){ if($this->isEmpty($data,'title')) return [false,'名称不能为空!']; if($this->isEmpty($data,'process_id')) return [false,'工序不能为空!']; return [true,'']; } }