diff --git a/application/admin/controller/Content.php b/application/admin/controller/Content.php index e318c878..400ca6a0 100644 --- a/application/admin/controller/Content.php +++ b/application/admin/controller/Content.php @@ -69,7 +69,7 @@ class Content extends Admin { */ public function add() { if ($this->request->isPost()) { - $result = $this->model->save($this->param); + $result = $this->model->save($this->request->param()); if ($result) { //记录行为 action_log('add_content', 'content', $result, session('auth_user.uid')); diff --git a/application/admin/controller/Form.php b/application/admin/controller/Form.php index 7f6d4ca6..060c867c 100644 --- a/application/admin/controller/Form.php +++ b/application/admin/controller/Form.php @@ -167,13 +167,13 @@ class Form extends Admin { return $this->fetch(); } - public function addattr(\think\Request $request){ - $form_id = isset($this->param['form_id']) ? $this->param['form_id'] : ''; + public function addattr(){ + $form_id = $this->request->param('form_id', ''); if (!$form_id) { return $this->error('非法操作!'); } if ($this->request->isPost()) { - $data = $request->post(); + $data = $this->request->post(); $result = $this->Fattr->save($data); if (false !== $result) { return $this->success('添加成功!', url('admin/form/attr?form_id='.$form_id)); diff --git a/application/common/controller/Api.php b/application/common/controller/Api.php index d673ff1e..c0a04e3f 100644 --- a/application/common/controller/Api.php +++ b/application/common/controller/Api.php @@ -61,10 +61,10 @@ class Api { } protected function checkToken($header){ - if (isset($header['access_token']) && $header['access_token']) { - $token = authcode($header['access_token']); + if (isset($header['accesstoken']) && $header['accesstoken']) { + $token = authcode($header['accesstoken']); list($uid, $username, $password) = explode('|', $token); - $this->user = model('User')->where('uid', $uid)->where('username', $username)->find(); + $this->user = model('Member')->where('uid', $uid)->where('username', $username)->find(); if ($this->user && $password === $this->user['password']) { return true; }else{ @@ -79,6 +79,6 @@ class Api { protected function setHeader(){ header("Access-Control-Allow-Origin: *"); header("Access-Control-Allow-Methods: GET, POST, PUT, DELETE, OPTIONS"); - header("Access-Control-Allow-Headers: Origin, X-Requested-With, Content-Type, Accept, Authorization, access_token"); + header("Access-Control-Allow-Headers: Origin, X-Requested-With, Content-Type, Accept, Authorization, accessToken"); } } \ No newline at end of file diff --git a/application/common/controller/Upload.php b/application/common/controller/Upload.php index ddc2c141..fe8271a8 100644 --- a/application/common/controller/Upload.php +++ b/application/common/controller/Upload.php @@ -19,8 +19,9 @@ class Upload { $config = $this->$upload_type(); // 获取表单上传文件 例如上传了001.jpg $file = request()->file('file'); + $size = $config['size'] * 1024 * 1024; $info = $file->validate(array( - 'size' => $config['size'], + 'size' => $size, 'ext' => $config['ext'], ))->move($config['rootPath'], true, false); diff --git a/application/config.php b/application/config.php index ec691a20..41d73651 100644 --- a/application/config.php +++ b/application/config.php @@ -61,19 +61,19 @@ return [ 'picture_upload' => [ 'rootPath' => ROOT_PATH . DS .'/web/uploads/', - 'size' => '204800', + 'size' => '2', 'ext' => 'jpg,jpeg,png,gif' ], 'attachment_upload' => [ 'rootPath' => ROOT_PATH . DS .'/web/uploads/', - 'size' => '204800', + 'size' => '2', 'ext' => 'doc,docx,xls,xlsx,ppt,pptx,zip,rar' ], 'picture_upload' => [ 'rootPath' => ROOT_PATH . DS .'/web/uploads/', - 'size' => '204800', + 'size' => '2', 'ext' => 'jpg,jpeg,png,gif' ], ];