| 123456789101112131415161718192021222324252627282930313233343536373839 | 
							- <?php
 
- namespace app\common\model;
 
- use think\Db;
 
- class NoticeCate extends Base
 
- {
 
-     public function updates(){
 
-         $data = request()->post();
 
-         $result = validate('NoticeCate')->check($data,[],'');
 
-         if(true !== $result){
 
-             $this->error = validate('NoticeCate')->getError();
 
-             return false;
 
-         }
 
-         $id = $data['id'];
 
-         unset($data['id']);
 
-         if($id > 0){
 
-             $ret = $this->allowField(true)->save($data,['id'=>$id]);
 
-         }else{
 
-             $ret = $this->allowField(true)->save($data);
 
-         }
 
-         if(!$ret){
 
-             $this->error = '操作失败';
 
-             return false;
 
-         }
 
-         return true;
 
-     }
 
-     //分类列表
 
-     public function lists(){
 
-         $map[] = ['del','=',0];
 
-         $map[] = ['enable','=',1];
 
-         $ret = Db::name('notice_cate')->where($map)->select();
 
-         return $ret;
 
-     }
 
- }
 
 
  |