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

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