1、修复几处bug

2、上传配置修改
This commit is contained in:
2018-04-03 19:26:06 +08:00
parent b97da3e1ac
commit 1f0dd54ab8
5 changed files with 13 additions and 12 deletions

View File

@@ -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'));

View File

@@ -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));

View File

@@ -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");
}
}

View File

@@ -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);

View File

@@ -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'
],
];