12 09 2019
     public function adduser()
    {
        $param = $this->request->param();
        if ($this->request->isPost()) {
            $adduser = Db::name("user")->insert([
                'user_nickname'                 => $param['username'],
                'avatar'                 => $param['avatar'],
                'user_email'                 => $param['email'],
                'mobile'                 => $param['phone'],
                'create_time'           => time(),
               // 'sex'                 => $param['sex'],
                'status'                => 1
              
            ]);
            if ($adduser) {
                $this->success('添加成功!');
                
            } else {
                $this->error('添加失败!');
            }
        } else {
            return $this->fetch();
        }
    }

    public function edituser()
    {
        $param = $this->request->param();
        if ($this->request->isPost()) {
            $id = $param['id'];
            $update_return = Db::name("notice")
                    ->where('id', $id)
                    ->update([
                        'title'                 => $param['title'],
                        'content'               => $param['content']
                    ]);
            if (!$update_return) {
                $this->error('修改失败!');
            } else {
                $this->success('修改成功!');
            }
        } else {
            $id = $param['id'];

            $user_find = Db::name('user')->where(['id'=>$id])->find();

            $this->assign('user_find',$user_find);
            return $this->fetch();
        }
    }
    
    public function deluser()
    {
        if ($this->request->isPost()) {
            $param = $this->request->param();
            $id = $param['id'];
            //dump($id);die;
            $deluser = Db::name("user")->delete($id);
            if ($deluser) {
                $this->success('删除成功!');               
            } else {
                $this->error('删除失败!');
            }
        }
    }
延伸阅读