post(); $data['org_id'] =cur_org_id(); $result = validate($this->validateName)->check($data,[],''); if(true !== $result){ $this->error = validate($this->validateName)->getError(); return false; } $data['img'] = isset($data['img'])?implode(',',$data['img']):''; $id = $data['id']; unset($data['id']); if($id > 0){ $ret = $this->allowField(true)->save($data,['id'=>$id]); }else{ $data['create_time'] = date('Y-m-d H:i:s'); $ret = $this->allowField(true)->save($data); } if(!$ret){ $this->error = '操作失败'; return false; } return true; } public function groupUpdates(){ $data = request()->post(); $data['org_id'] = 0; $result = validate($this->validateName)->check($data,[],''); if(true !== $result){ $this->error = validate($this->validateName)->getError(); return false; } $data['img'] = isset($data['img'])?implode(',',$data['img']):''; $id = $data['id']; unset($data['id']); if($id > 0){ $ret = $this->allowField(true)->save($data,['id'=>$id]); }else{ $data['create_time'] = date('Y-m-d H:i:s'); $ret = $this->allowField(true)->save($data); } if(!$ret){ $this->error = '操作失败'; return false; } return true; } }