1、修复几处bug
2、上传配置修改
This commit is contained in:
@@ -69,7 +69,7 @@ class Content extends Admin {
|
|||||||
*/
|
*/
|
||||||
public function add() {
|
public function add() {
|
||||||
if ($this->request->isPost()) {
|
if ($this->request->isPost()) {
|
||||||
$result = $this->model->save($this->param);
|
$result = $this->model->save($this->request->param());
|
||||||
if ($result) {
|
if ($result) {
|
||||||
//记录行为
|
//记录行为
|
||||||
action_log('add_content', 'content', $result, session('auth_user.uid'));
|
action_log('add_content', 'content', $result, session('auth_user.uid'));
|
||||||
|
|||||||
@@ -167,13 +167,13 @@ class Form extends Admin {
|
|||||||
return $this->fetch();
|
return $this->fetch();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function addattr(\think\Request $request){
|
public function addattr(){
|
||||||
$form_id = isset($this->param['form_id']) ? $this->param['form_id'] : '';
|
$form_id = $this->request->param('form_id', '');
|
||||||
if (!$form_id) {
|
if (!$form_id) {
|
||||||
return $this->error('非法操作!');
|
return $this->error('非法操作!');
|
||||||
}
|
}
|
||||||
if ($this->request->isPost()) {
|
if ($this->request->isPost()) {
|
||||||
$data = $request->post();
|
$data = $this->request->post();
|
||||||
$result = $this->Fattr->save($data);
|
$result = $this->Fattr->save($data);
|
||||||
if (false !== $result) {
|
if (false !== $result) {
|
||||||
return $this->success('添加成功!', url('admin/form/attr?form_id='.$form_id));
|
return $this->success('添加成功!', url('admin/form/attr?form_id='.$form_id));
|
||||||
|
|||||||
@@ -61,10 +61,10 @@ class Api {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected function checkToken($header){
|
protected function checkToken($header){
|
||||||
if (isset($header['access_token']) && $header['access_token']) {
|
if (isset($header['accesstoken']) && $header['accesstoken']) {
|
||||||
$token = authcode($header['access_token']);
|
$token = authcode($header['accesstoken']);
|
||||||
list($uid, $username, $password) = explode('|', $token);
|
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']) {
|
if ($this->user && $password === $this->user['password']) {
|
||||||
return true;
|
return true;
|
||||||
}else{
|
}else{
|
||||||
@@ -79,6 +79,6 @@ class Api {
|
|||||||
protected function setHeader(){
|
protected function setHeader(){
|
||||||
header("Access-Control-Allow-Origin: *");
|
header("Access-Control-Allow-Origin: *");
|
||||||
header("Access-Control-Allow-Methods: GET, POST, PUT, DELETE, OPTIONS");
|
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");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -19,8 +19,9 @@ class Upload {
|
|||||||
$config = $this->$upload_type();
|
$config = $this->$upload_type();
|
||||||
// 获取表单上传文件 例如上传了001.jpg
|
// 获取表单上传文件 例如上传了001.jpg
|
||||||
$file = request()->file('file');
|
$file = request()->file('file');
|
||||||
|
$size = $config['size'] * 1024 * 1024;
|
||||||
$info = $file->validate(array(
|
$info = $file->validate(array(
|
||||||
'size' => $config['size'],
|
'size' => $size,
|
||||||
'ext' => $config['ext'],
|
'ext' => $config['ext'],
|
||||||
))->move($config['rootPath'], true, false);
|
))->move($config['rootPath'], true, false);
|
||||||
|
|
||||||
|
|||||||
@@ -61,19 +61,19 @@ return [
|
|||||||
|
|
||||||
'picture_upload' => [
|
'picture_upload' => [
|
||||||
'rootPath' => ROOT_PATH . DS .'/web/uploads/',
|
'rootPath' => ROOT_PATH . DS .'/web/uploads/',
|
||||||
'size' => '204800',
|
'size' => '2',
|
||||||
'ext' => 'jpg,jpeg,png,gif'
|
'ext' => 'jpg,jpeg,png,gif'
|
||||||
],
|
],
|
||||||
|
|
||||||
'attachment_upload' => [
|
'attachment_upload' => [
|
||||||
'rootPath' => ROOT_PATH . DS .'/web/uploads/',
|
'rootPath' => ROOT_PATH . DS .'/web/uploads/',
|
||||||
'size' => '204800',
|
'size' => '2',
|
||||||
'ext' => 'doc,docx,xls,xlsx,ppt,pptx,zip,rar'
|
'ext' => 'doc,docx,xls,xlsx,ppt,pptx,zip,rar'
|
||||||
],
|
],
|
||||||
|
|
||||||
'picture_upload' => [
|
'picture_upload' => [
|
||||||
'rootPath' => ROOT_PATH . DS .'/web/uploads/',
|
'rootPath' => ROOT_PATH . DS .'/web/uploads/',
|
||||||
'size' => '204800',
|
'size' => '2',
|
||||||
'ext' => 'jpg,jpeg,png,gif'
|
'ext' => 'jpg,jpeg,png,gif'
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
|||||||
Reference in New Issue
Block a user