post(); $data['org_id'] =cur_org_id(); $result = validate($this->validateName)->check($data,[],''); if(true !== $result){ $this->error = validate($this->validateName)->getError(); return false; } $id = $data['id']; unset($data['id']); if($id > 0){ $data['update_time'] = date('Y-m-d H:i:s'); $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; } // $name = '洗涤物品'; // $content = $name.':新增'; // if($id > 0){ // $content = $name.':编辑'; // $data['id'] = $id; // }else{ // $data['id'] = $this->id; // } // model('ActionLog')->addlog(is_login(),34,$content,$data,cur_org_id()); return true; } public function getList($orgId=0){ if($orgId==0){ $orgId = cur_org_id(); } $list =$this ->where('org_id',$orgId) ->where('del',0) ->where('enable',1) ->field('id,title') ->order('sort','asc') ->select() ->toArray(); return $list; } }