This commit is contained in:
liyukun 2022-01-09 01:33:47 +08:00
parent 7e8709a76d
commit 55600e5482
167 changed files with 37 additions and 19 deletions

View File

@ -27,6 +27,10 @@ class Files extends AuthController
case 1: case 1:
$savename = Filesystem::putFile('images', $file); $savename = Filesystem::putFile('images', $file);
$filePath = "/uploads/" . $savename; $filePath = "/uploads/" . $savename;
//转换因为win导致的兼容问题
if(strtoupper(substr(PHP_OS,0,3))==='WIN'){
$filePath = str_replace( DIRECTORY_SEPARATOR, '/',$filePath);
}
break; break;
case 2: case 2:
$savename = Filesystem::putFile('images', $file); $savename = Filesystem::putFile('images', $file);
@ -53,6 +57,10 @@ class Files extends AuthController
$type = $result[2]; $type = $result[2];
if (!file_exists($path)) mkdir($path, 0755, true); if (!file_exists($path)) mkdir($path, 0755, true);
$savename = $path . md5(time()) . ".{$type}"; $savename = $path . md5(time()) . ".{$type}";
//转换因为win导致的兼容问题
if(strtoupper(substr(PHP_OS,0,3))==='WIN'){
$savename = str_replace( DIRECTORY_SEPARATOR, '/',$savename);
}
if (file_put_contents($savename, base64_decode(str_replace($result[1], '', $data['image'])))) return app("json")->success("上传成功", ['src' => "/" . $savename]); if (file_put_contents($savename, base64_decode(str_replace($result[1], '', $data['image'])))) return app("json")->success("上传成功", ['src' => "/" . $savename]);
else return app("json")->fail("上传失败,写入文件失败!"); else return app("json")->fail("上传失败,写入文件失败!");
} else return app("json")->fail("上传失败,图片格式有误!"); } else return app("json")->fail("上传失败,图片格式有误!");
@ -64,8 +72,11 @@ class Files extends AuthController
*/ */
public function tinymce() public function tinymce()
{ {
$savename = Filesystem::putFile('image', request()->file('file')); $filePath = Filesystem::putFile('image', request()->file('file'));
return json_encode(['location' => "/uploads/" . $savename]); if(strtoupper(substr(PHP_OS,0,3))==='WIN'){
$filePath = str_replace( DIRECTORY_SEPARATOR, '/',$filePath);
}
return json_encode(['location' => "/uploads/" . $filePath]);
} }
@ -122,6 +133,10 @@ class Files extends AuthController
]])->check(['file' => $file]); ]])->check(['file' => $file]);
$savename = Filesystem::putFile($type, $file); $savename = Filesystem::putFile($type, $file);
$filePath = "/uploads/" . $savename; $filePath = "/uploads/" . $savename;
//转换因为win导致的兼容问题
if(strtoupper(substr(PHP_OS,0,3))==='WIN'){
$filePath = str_replace( DIRECTORY_SEPARATOR, '/',$filePath);
}
return $savename ? app("json")->code()->success("上传成功", ['filePath' => $filePath, "name" => basename($savename)]) : app("json")->fail("上传失败"); return $savename ? app("json")->code()->success("上传成功", ['filePath' => $filePath, "name" => basename($savename)]) : app("json")->fail("上传失败");
} catch (ValidateException $e) { } catch (ValidateException $e) {
return app("json")->fail($e->getMessage()); return app("json")->fail($e->getMessage());

View File

@ -74,7 +74,7 @@ class Poster extends AuthController
$form = array(); $form = array();
$form[] = Elm::input('title', '广告名称')->col(10); $form[] = Elm::input('title', '广告名称')->col(10);
$form[] = Elm::input('url', '链接地址')->col(10); $form[] = Elm::input('url', '链接地址')->col(10);
$form[] = Elm::frameImage('image', '广告图片', Url::buildUrl('admin/images/index', array('fodder' => 'image', 'limit' => 1)))->icon("ios-image")->width('96%')->height('440px')->col(10); $form[] = Elm::frameImage('cover_path', '广告图片', Url::buildUrl('admin/images/index', array('fodder' => 'images', 'limit' => 1)))->icon("ios-image")->width('96%')->height('440px')->col(10);
$form[] = Elm::input('sort', '排序')->col(10); $form[] = Elm::input('sort', '排序')->col(10);
$form[] = Elm::select('position', '位置')->options(function () { $form[] = Elm::select('position', '位置')->options(function () {
$options = []; $options = [];
@ -102,7 +102,7 @@ class Poster extends AuthController
$form = array(); $form = array();
$form[] = Elm::input('title', '广告名称', $ainfo['title'])->col(10); $form[] = Elm::input('title', '广告名称', $ainfo['title'])->col(10);
$form[] = Elm::input('url', '链接地址', $ainfo['url'])->col(10); $form[] = Elm::input('url', '链接地址', $ainfo['url'])->col(10);
$form[] = Elm::frameImage('image', '广告图片', Url::buildUrl('admin/images/index', array('fodder' => 'image', 'limit' => 1)), $ainfo['image'])->icon("ios-image")->width('96%')->height('440px')->col(10); $form[] = Elm::frameImage('cover_path', '广告图片', Url::buildUrl('admin/images/index', array('fodder' => 'images', 'limit' => 1)), $ainfo['cover_path'])->icon("ios-image")->width('96%')->height('440px')->col(10);
$form[] = Elm::input('sort', '排序', $ainfo['sort'])->col(10); $form[] = Elm::input('sort', '排序', $ainfo['sort'])->col(10);
$form[] = Elm::select('position', '位置', $ainfo['position'])->options(function () { $form[] = Elm::select('position', '位置', $ainfo['position'])->options(function () {
$options = []; $options = [];
@ -128,13 +128,15 @@ class Poster extends AuthController
['id', ''], ['id', ''],
['title', ''], ['title', ''],
['url', ''], ['url', ''],
['image', ''], ['cover_path', ''],
['position', 0],
['sort', ''], ['sort', ''],
['status', 1], ['status', 1],
]); ]);
if ($data['title'] == "") return app("json")->fail("广告名称不能为空"); if ($data['title'] == "") return app("json")->fail("广告名称不能为空");
if ($data['url'] == "") return app("json")->fail("链接地址不能为空"); if ($data['url'] == "") return app("json")->fail("链接地址不能为空");
if (is_array($data['image'])) $data['image'] = $data['avatar'][0]; if (is_array($data['cover_path'])) $data['cover_path'] = $data['cover_path'][0];
$data['user_id'] = $this->adminId;//默认修改你
if ($id == "") { if ($id == "") {
//判断下用户是否存在 //判断下用户是否存在
$info = aModel::where('url', $data['url'])->find(); $info = aModel::where('url', $data['url'])->find();
@ -145,7 +147,7 @@ class Poster extends AuthController
} else { } else {
$res = aModel::update($data, ['id' => $id]); $res = aModel::update($data, ['id' => $id]);
} }
cache(Data::DATA_ADVERT . '_' . $data['type'], null);//清除缓存 cache(Data::DATA_ADVERT . '_' . $data['position'], null);//清除缓存
return $res ? app("json")->success("操作成功", 'code') : app("json")->fail("操作失败"); return $res ? app("json")->success("操作成功", 'code') : app("json")->fail("操作失败");
} }
} }

View File

@ -114,23 +114,20 @@
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="realname">真实姓名</label> <label for="realname">真实姓名</label>
<input type="text" class="form-control" name="realname" id="realname" <input type="text" class="form-control" name="realname" id="realname" value="{$info.realname}" disabled="disabled"/>
value="{$info.realname}" disabled="disabled"/>
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="nickname">昵称</label> <label for="nickname">昵称</label>
<input type="text" class="form-control" name="nickname" id="nickname" <input type="text" class="form-control" name="nickname" id="nickname" value="{$info.nickname}"/>
value="{$info.nickname}"/>
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="tel">电话</label> <label for="tel">电话</label>
<input type="tel" class="form-control" name="tel" id="tel" placeholder="输入您的昵称" <input type="tel" class="form-control" name="tel" id="tel" placeholder="输入您的昵称" value="{$info.tel}">
value="{$info.tel}">
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="mail">邮箱</label> <label for="email">邮箱</label>
<input type="email" class="form-control" name="mail" id="mail" aria-describedby="emailHelp" <input type="email" class="form-control" name="email" id="email" aria-describedby="emailHelp"
placeholder="请输入正确的邮箱地址" value="{$info.mail}"> placeholder="请输入正确的邮箱地址" value="{$info.email}">
<small id="emailHelp" class="form-text text-muted">请保证您填写的邮箱地址是正确的。</small> <small id="emailHelp" class="form-text text-muted">请保证您填写的邮箱地址是正确的。</small>
</div> </div>
<div class="form-group"> <div class="form-group">
@ -245,7 +242,7 @@
"nickname": $("input[name='nickname']").val(), "nickname": $("input[name='nickname']").val(),
"avatar": $("input[name='avatar']").val(), "avatar": $("input[name='avatar']").val(),
"tel": $("input[name='tel']").val(), "tel": $("input[name='tel']").val(),
"mail": $("input[name='email']").val(), "email": $("input[name='email']").val(),
"remark": $("textarea[name='remark']").val() "remark": $("textarea[name='remark']").val()
}, function (res) { }, function (res) {
if (res.status === 200) lightyear.notify(res.msg, 'success', 3000, 'mdi mdi-emoticon-happy', 'top', 'center'); if (res.status === 200) lightyear.notify(res.msg, 'success', 3000, 'mdi mdi-emoticon-happy', 'top', 'center');

View File

@ -96,9 +96,9 @@
field: 'title', field: 'title',
title: '广告名称' title: '广告名称'
}, { }, {
field: 'image', field: 'cover_path',
title: '广告图片', title: '广告图片',
formatter: function (value, row, index) { formatter: function (value) {
let html = '<img src="' + value + '" alt="" width="50px;">'; let html = '<img src="' + value + '" alt="" width="50px;">';
return html; return html;
} }

View File

@ -153,6 +153,10 @@ if (!function_exists('file_cdn')) {
//统一路径 //统一路径
$path = '/' . $path; $path = '/' . $path;
} }
//转换因为win导致的兼容问题
if(strtoupper(substr(PHP_OS,0,3))==='WIN'){
$path = str_replace( DIRECTORY_SEPARATOR, '/',$path);
}
return config("app.cdn_url") . $path; return config("app.cdn_url") . $path;
} }
} }

Binary file not shown.

Before

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1005 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 292 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 70 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 87 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 47 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 47 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 55 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 53 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 52 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 365 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 110 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 108 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 105 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 142 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 134 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 345 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 228 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 284 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 245 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 251 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 200 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 370 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 265 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 168 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 205 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 65 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 52 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 66 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 182 KiB

Some files were not shown because too many files have changed in this diff Show More