优化上传组件,修复一处bug
This commit is contained in:
@@ -61,11 +61,11 @@ class Upload extends Base {
|
||||
'query' => $this->request->param()
|
||||
];
|
||||
if($param['type'] == 'file'){
|
||||
$map[] = ['ext', '<>', 'image'];
|
||||
$map[] = ['type', '<>', 'image'];
|
||||
}else{
|
||||
$map[] = ['ext', '=', 'image'];
|
||||
$map[] = ['type', '=', 'image'];
|
||||
}
|
||||
$list = Db::name('Attach')->paginate($pageConfig);
|
||||
$list = Db::where($map)->name('Attach')->paginate($pageConfig);
|
||||
|
||||
$this->data = [
|
||||
'from' => $this->request->param('from'),
|
||||
@@ -141,6 +141,8 @@ class Upload extends Base {
|
||||
$data = [];
|
||||
$file= $request->file('file');
|
||||
$data['savename'] = $request->param('name');
|
||||
$data['name'] = $request->param('name');
|
||||
$data['type'] = $upload_type;
|
||||
$data['mime'] = $request->param('type');
|
||||
$data['size'] = $file->getSize(); //文件大小,单位字节
|
||||
$data['md5'] = md5_file($file->getPathname());
|
||||
|
||||
@@ -135,7 +135,7 @@ class Wechat extends Base {
|
||||
$data = $this->request->post();
|
||||
$result = WechatPay::create($data);
|
||||
if (false != $result) {
|
||||
return $this->success('添加成功!', url('/admin/wechat/index'));
|
||||
return $this->success('添加成功!', url('/admin/wechat/pay'));
|
||||
} else {
|
||||
return $this->error('添加失败!');
|
||||
}
|
||||
@@ -156,7 +156,7 @@ class Wechat extends Base {
|
||||
$data = $this->request->post();
|
||||
$result = WechatPay::update($data, ['id' => $data['id']]);
|
||||
if ($result !== false) {
|
||||
return $this->success('编辑成功!', url('/admin/wechat/index'));
|
||||
return $this->success('编辑成功!', url('/admin/wechat/pay'));
|
||||
} else {
|
||||
return $this->error('修改失败!');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user