brand logo search
|
|
@ -198,30 +198,7 @@ class BrandController extends CommonController
|
|||
}
|
||||
|
||||
// 图片
|
||||
if(!empty($_FILES['file_logo']))
|
||||
{
|
||||
// 文件上传校验
|
||||
$error = FileUploadError('file_logo');
|
||||
if($error !== true)
|
||||
{
|
||||
$this->ajaxReturn($error, -1);
|
||||
}
|
||||
|
||||
// 文件类型
|
||||
list($type, $suffix) = explode('/', $_FILES['file_logo']['type']);
|
||||
$path = 'Public'.DS.'Upload'.DS.'brand'.DS.date('Y').DS.date('m').DS;
|
||||
if(!is_dir($path))
|
||||
{
|
||||
mkdir(ROOT_PATH.$path, 0777, true);
|
||||
}
|
||||
$filename = date('YmdHis').GetNumberCode(6).'.'.$suffix;
|
||||
$file_logo = $path.$filename;
|
||||
|
||||
if(move_uploaded_file($_FILES['file_logo']['tmp_name'], ROOT_PATH.$file_logo))
|
||||
{
|
||||
$_POST['logo'] = DS.$file_logo;
|
||||
}
|
||||
}
|
||||
$this->ImagesSave('logo', 'file_logo', 'brand');
|
||||
|
||||
// id为空则表示是新增
|
||||
$m = D('Brand');
|
||||
|
|
|
|||
|
|
@ -240,50 +240,6 @@ class CommonController extends Controller
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* [GetClassList 获取班级列表,二级]
|
||||
* @author Devil
|
||||
* @blog http://gong.gg/
|
||||
* @version 0.0.1
|
||||
* @datetime 2016-12-30T13:26:00+0800
|
||||
* @return [array] [班级列表]
|
||||
*/
|
||||
protected function GetClassList()
|
||||
{
|
||||
$m = M('Class');
|
||||
$data = $m->field(array('id', 'name'))->where(array('is_enable'=>1, 'pid'=>0))->select();
|
||||
if(!empty($data))
|
||||
{
|
||||
foreach($data as $k=>$v)
|
||||
{
|
||||
$data[$k]['item'] = $m->field(array('id', 'name'))->where(array('is_enable'=>1, 'pid'=>$v['id']))->select();
|
||||
}
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* [GetRoomList 获取教室列表,二级]
|
||||
* @author Devil
|
||||
* @blog http://gong.gg/
|
||||
* @version 0.0.1
|
||||
* @datetime 2016-12-30T13:26:00+0800
|
||||
* @return [array] [班级列表]
|
||||
*/
|
||||
protected function GetRoomList()
|
||||
{
|
||||
$m = M('Room');
|
||||
$data = $m->field(array('id', 'name'))->where(array('is_enable'=>1, 'pid'=>0))->select();
|
||||
if(!empty($data))
|
||||
{
|
||||
foreach($data as $k=>$v)
|
||||
{
|
||||
$data[$k]['item'] = $m->field(array('id', 'name'))->where(array('is_enable'=>1, 'pid'=>$v['id']))->select();
|
||||
}
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* [MyConfigSave 配置数据保存]
|
||||
* @author Devil
|
||||
|
|
@ -341,236 +297,6 @@ class CommonController extends Controller
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取属性参数
|
||||
* @author Devil
|
||||
* @blog http://gong.gg/
|
||||
* @version 1.0.0
|
||||
* @date 2018-07-09
|
||||
* @desc description
|
||||
*/
|
||||
protected function GetFormGoodsAttributeParams()
|
||||
{
|
||||
$result = [];
|
||||
foreach($_POST as $k=>$v)
|
||||
{
|
||||
if(substr($k, 0, 9) == 'attribute')
|
||||
{
|
||||
// key分解
|
||||
$key = explode('_', $k);
|
||||
|
||||
// 当前key是否是具体属性数据
|
||||
if(in_array('find', $key))
|
||||
{
|
||||
$result[$key[1]][$key[2]][$key[3]][$key[4]] = $v;
|
||||
} else {
|
||||
// 属性类型数据
|
||||
$result[$key[1]][$key[2]][$key[3]] = $v;
|
||||
}
|
||||
}
|
||||
}
|
||||
return ['status'=>true, 'data'=>$result];
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取app内容
|
||||
* @author Devil
|
||||
* @blog http://gong.gg/
|
||||
* @version 1.0.0
|
||||
* @date 2018-07-09
|
||||
* @desc description
|
||||
*/
|
||||
protected function GetFormGoodsContentAppParams()
|
||||
{
|
||||
// 图像类库
|
||||
$images_obj = \Library\Images::Instance(['is_new_name'=>false]);
|
||||
|
||||
// 定义图片目录
|
||||
$root_path = ROOT_PATH;
|
||||
$img_path = 'Public'.DS.'Upload'.DS.'goods_app'.DS;
|
||||
$date = DS.date('Y').DS.date('m').DS.date('d').DS;
|
||||
|
||||
// 开始处理
|
||||
$result = [];
|
||||
$name = 'content_app_';
|
||||
foreach($_POST AS $k=>$v)
|
||||
{
|
||||
if(substr($k, 0, 12) == $name)
|
||||
{
|
||||
$key = explode('_', str_replace($name, '', $k));
|
||||
if(count($key) == 2)
|
||||
{
|
||||
$result[$key[1]][$key[0]] = $v;
|
||||
|
||||
if($key[0] == 'images')
|
||||
{
|
||||
$images_key = $name.$key[0].'_file_'.$key[1];
|
||||
if(isset($_FILES[$images_key]))
|
||||
{
|
||||
// 文件上传校验
|
||||
$error = FileUploadError($images_key);
|
||||
if($error !== true)
|
||||
{
|
||||
return ['status'=>false, 'msg'=>$error];
|
||||
}
|
||||
|
||||
// 存储图片
|
||||
$temp_all = [
|
||||
'tmp_name' => $_FILES[$images_key]['tmp_name'],
|
||||
'type' => $_FILES[$images_key]['type']
|
||||
];
|
||||
$original = $images_obj->GetOriginal($temp_all, $root_path.$img_path.'original'.$date);
|
||||
if(!empty($original))
|
||||
{
|
||||
// 根据原图再次生成小图
|
||||
$compr = $images_obj->GetBinaryCompress($root_path.$img_path.'original'.$date.$original, $root_path.$img_path.'compr'.$date, 600);
|
||||
$small = $images_obj->GetBinaryCompress($root_path.$img_path.'original'.$date.$original, $root_path.$img_path.'small'.$date, 100, 100);
|
||||
|
||||
if(!empty($compr))
|
||||
{
|
||||
$result[$key[1]][$key[0]] = DS.$img_path.'compr'.$date.$small;
|
||||
} else {
|
||||
// 如果图片格式有误,则删除原图片
|
||||
$this->ImagesDelete($img_path.'original'.$date.$original);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return ['status'=>true, 'data'=>$result];
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取商品相册
|
||||
* @author Devil
|
||||
* @blog http://gong.gg/
|
||||
* @version 1.0.0
|
||||
* @date 2018-07-10
|
||||
* @desc description
|
||||
* @return [array] [一维数组但图片地址]
|
||||
*/
|
||||
protected function GetFormGoodsPhotoParams()
|
||||
{
|
||||
// 原始图片
|
||||
if(!empty($_POST['photo']) && is_array($_POST['photo']))
|
||||
{
|
||||
$result = $_POST['photo'];
|
||||
} else {
|
||||
$result = [];
|
||||
}
|
||||
|
||||
// 开始处理图片存储
|
||||
$images_name = 'photo_file';
|
||||
if(!empty($_FILES[$images_name]))
|
||||
{
|
||||
// 定义图片目录
|
||||
$root_path = ROOT_PATH;
|
||||
$img_path = 'Public'.DS.'Upload'.DS.'goods_photo'.DS;
|
||||
$date = DS.date('Y').DS.date('m').DS.date('d').DS;
|
||||
|
||||
// 图像类库
|
||||
$images_obj = \Library\Images::Instance(['is_new_name'=>false]);
|
||||
|
||||
// 图片存储处理
|
||||
for($i=0; $i<count($_FILES[$images_name]['tmp_name']); $i++)
|
||||
{
|
||||
// 文件上传校验
|
||||
$error = FileUploadError($images_name, $i);
|
||||
if($error !== true)
|
||||
{
|
||||
return ['status'=>false, 'msg'=>$error];
|
||||
}
|
||||
|
||||
// 存储图片
|
||||
$temp_all = [
|
||||
'tmp_name' => $_FILES[$images_name]['tmp_name'][$i],
|
||||
'type' => $_FILES[$images_name]['type'][$i],
|
||||
];
|
||||
$original = $images_obj->GetOriginal($temp_all, $root_path.$img_path.'original'.$date);
|
||||
if(!empty($original))
|
||||
{
|
||||
// 根据原图再次生成小图
|
||||
$compr = $images_obj->GetBinaryCompress($root_path.$img_path.'original'.$date.$original, $root_path.$img_path.'compr'.$date, 600);
|
||||
$small = $images_obj->GetBinaryCompress($root_path.$img_path.'original'.$date.$original, $root_path.$img_path.'small'.$date, 100, 100);
|
||||
|
||||
if(!empty($compr))
|
||||
{
|
||||
$result[] = DS.$img_path.'compr'.$date.$small;
|
||||
} else {
|
||||
// 如果图片格式有误,则删除原图片
|
||||
$this->ImagesDelete($img_path.'original'.$date.$original);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return ['status'=>true, 'data'=>$result];
|
||||
}
|
||||
|
||||
/**
|
||||
* 商品图片集合处理
|
||||
* @author Devil
|
||||
* @blog http://gong.gg/
|
||||
* @version 1.0.0
|
||||
* @date 2018-08-07
|
||||
* @desc description
|
||||
* @param [array] $data [字段列表]
|
||||
*/
|
||||
protected function GetGoodsImagesParams($data)
|
||||
{
|
||||
$result = [];
|
||||
if(!empty($data))
|
||||
{
|
||||
// 定义图片目录
|
||||
$root_path = ROOT_PATH;
|
||||
$img_path = 'Public'.DS.'Upload'.DS.'goods_images'.DS;
|
||||
$date = DS.date('Y').DS.date('m').DS.date('d').DS;
|
||||
|
||||
// 图像类库
|
||||
$images_obj = \Library\Images::Instance(['is_new_name'=>false]);
|
||||
|
||||
foreach($data as $field)
|
||||
{
|
||||
if(!empty($_FILES[$field]))
|
||||
{
|
||||
$file = $_FILES[$field];
|
||||
|
||||
// 文件上传校验
|
||||
$error = FileUploadError($field);
|
||||
if($error !== true)
|
||||
{
|
||||
return ['status'=>false, 'msg'=>$error];
|
||||
}
|
||||
|
||||
// 存储图片
|
||||
$temp_all = [
|
||||
'tmp_name' => $file['tmp_name'],
|
||||
'type' => $file['type'],
|
||||
];
|
||||
$original = $images_obj->GetOriginal($temp_all, $root_path.$img_path.'original'.$date);
|
||||
if(!empty($original))
|
||||
{
|
||||
// 根据原图再次生成小图
|
||||
$compr = $images_obj->GetBinaryCompress($root_path.$img_path.'original'.$date.$original, $root_path.$img_path.'compr'.$date, 600);
|
||||
$small = $images_obj->GetBinaryCompress($root_path.$img_path.'original'.$date.$original, $root_path.$img_path.'small'.$date, 100, 100);
|
||||
|
||||
if(!empty($compr))
|
||||
{
|
||||
$result[$field] = DS.$img_path.'compr'.$date.$small;
|
||||
} else {
|
||||
// 如果图片格式有误,则删除原图片
|
||||
$this->ImagesDelete($img_path.'original'.$date.$original);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return ['status'=>true, 'data'=>$result];
|
||||
}
|
||||
|
||||
/**
|
||||
* 图片删除
|
||||
* @author Devil
|
||||
|
|
@ -613,5 +339,43 @@ class CommonController extends Controller
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 图片存储
|
||||
* @author Devil
|
||||
* @blog http://gong.gg/
|
||||
* @version 1.0.0
|
||||
* @date 2018-09-11
|
||||
* @desc description
|
||||
* @param [string] $field [name名称]
|
||||
* @param [string] $post_name [file form name名称]
|
||||
* @param [string] $dir [存储路径标记]
|
||||
*/
|
||||
protected function ImagesSave($field, $post_name, $dir = 'common')
|
||||
{
|
||||
if(isset($_FILES[$post_name]['error']))
|
||||
{
|
||||
// 文件上传校验
|
||||
$error = FileUploadError($post_name);
|
||||
if($error !== true)
|
||||
{
|
||||
$this->ajaxReturn($error, -1);
|
||||
}
|
||||
|
||||
// 文件类型
|
||||
list($type, $suffix) = explode('/', $_FILES[$post_name]['type']);
|
||||
$path = 'Public'.DS.'Upload'.DS.$dir.DS.'images'.DS;
|
||||
if(!is_dir($path))
|
||||
{
|
||||
mkdir(ROOT_PATH.$path, 0777, true);
|
||||
}
|
||||
$filename = date('YmdHis').'_logo.'.$suffix;
|
||||
$file = $path.$filename;
|
||||
if(move_uploaded_file($_FILES[$post_name]['tmp_name'], ROOT_PATH.$file))
|
||||
{
|
||||
$_POST[$field] = DS.$file;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
|
@ -94,30 +94,7 @@ class ExpressController extends CommonController
|
|||
}
|
||||
|
||||
// 图片
|
||||
if(!empty($_FILES['file_icon']))
|
||||
{
|
||||
// 文件上传校验
|
||||
$error = FileUploadError('file_icon');
|
||||
if($error !== true)
|
||||
{
|
||||
$this->ajaxReturn($error, -1);
|
||||
}
|
||||
|
||||
// 文件类型
|
||||
list($type, $suffix) = explode('/', $_FILES['file_icon']['type']);
|
||||
$path = 'Public'.DS.'Upload'.DS.'express'.DS.date('Y').DS.date('m').DS;
|
||||
if(!is_dir($path))
|
||||
{
|
||||
mkdir(ROOT_PATH.$path, 0777, true);
|
||||
}
|
||||
$filename = date('YmdHis').GetNumberCode(6).'.'.$suffix;
|
||||
$file_icon = $path.$filename;
|
||||
|
||||
if(move_uploaded_file($_FILES['file_icon']['tmp_name'], ROOT_PATH.$file_icon))
|
||||
{
|
||||
$_POST['icon'] = DS.$file_icon;
|
||||
}
|
||||
}
|
||||
$this->ImagesSave('icon', 'file_icon', 'express');
|
||||
|
||||
// id为空则表示是新增
|
||||
$m = D('Express');
|
||||
|
|
|
|||
|
|
@ -116,56 +116,10 @@ class GoodsCategoryController extends CommonController
|
|||
}
|
||||
|
||||
// icon
|
||||
if(!empty($_FILES['file_icon']))
|
||||
{
|
||||
// 文件上传校验
|
||||
$error = FileUploadError('file_icon');
|
||||
if($error !== true)
|
||||
{
|
||||
$this->ajaxReturn($error, -1);
|
||||
}
|
||||
|
||||
// 文件类型
|
||||
list($type, $suffix) = explode('/', $_FILES['file_icon']['type']);
|
||||
$path = 'Public'.DS.'Upload'.DS.'goods_category'.DS.date('Y').DS.date('m').DS;
|
||||
if(!is_dir($path))
|
||||
{
|
||||
mkdir(ROOT_PATH.$path, 0777, true);
|
||||
}
|
||||
$filename = date('YmdHis').GetNumberCode(6).'.'.$suffix;
|
||||
$file_icon = $path.$filename;
|
||||
|
||||
if(move_uploaded_file($_FILES['file_icon']['tmp_name'], ROOT_PATH.$file_icon))
|
||||
{
|
||||
$_POST['icon'] = DS.$file_icon;
|
||||
}
|
||||
}
|
||||
$this->ImagesSave('icon', 'file_icon', 'goods_category');
|
||||
|
||||
// 大图片
|
||||
if(!empty($_FILES['file_big_images']))
|
||||
{
|
||||
// 文件上传校验
|
||||
$error = FileUploadError('file_big_images');
|
||||
if($error !== true)
|
||||
{
|
||||
$this->ajaxReturn($error, -1);
|
||||
}
|
||||
|
||||
// 文件类型
|
||||
list($type, $suffix) = explode('/', $_FILES['file_big_images']['type']);
|
||||
$path = 'Public'.DS.'Upload'.DS.'goods_category'.DS.date('Y').DS.date('m').DS;
|
||||
if(!is_dir($path))
|
||||
{
|
||||
mkdir(ROOT_PATH.$path, 0777, true);
|
||||
}
|
||||
$filename = date('YmdHis').GetNumberCode(6).'.'.$suffix;
|
||||
$file_big_images = $path.$filename;
|
||||
|
||||
if(move_uploaded_file($_FILES['file_big_images']['tmp_name'], ROOT_PATH.$file_big_images))
|
||||
{
|
||||
$_POST['big_images'] = DS.$file_big_images;
|
||||
}
|
||||
}
|
||||
$this->ImagesSave('big_images', 'file_big_images', 'goods_category');
|
||||
|
||||
// id为空则表示是新增
|
||||
$m = D('GoodsCategory');
|
||||
|
|
|
|||
|
|
@ -413,6 +413,236 @@ class GoodsController extends CommonController
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取属性参数
|
||||
* @author Devil
|
||||
* @blog http://gong.gg/
|
||||
* @version 1.0.0
|
||||
* @date 2018-07-09
|
||||
* @desc description
|
||||
*/
|
||||
private function GetFormGoodsAttributeParams()
|
||||
{
|
||||
$result = [];
|
||||
foreach($_POST as $k=>$v)
|
||||
{
|
||||
if(substr($k, 0, 9) == 'attribute')
|
||||
{
|
||||
// key分解
|
||||
$key = explode('_', $k);
|
||||
|
||||
// 当前key是否是具体属性数据
|
||||
if(in_array('find', $key))
|
||||
{
|
||||
$result[$key[1]][$key[2]][$key[3]][$key[4]] = $v;
|
||||
} else {
|
||||
// 属性类型数据
|
||||
$result[$key[1]][$key[2]][$key[3]] = $v;
|
||||
}
|
||||
}
|
||||
}
|
||||
return ['status'=>true, 'data'=>$result];
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取app内容
|
||||
* @author Devil
|
||||
* @blog http://gong.gg/
|
||||
* @version 1.0.0
|
||||
* @date 2018-07-09
|
||||
* @desc description
|
||||
*/
|
||||
private function GetFormGoodsContentAppParams()
|
||||
{
|
||||
// 图像类库
|
||||
$images_obj = \Library\Images::Instance(['is_new_name'=>false]);
|
||||
|
||||
// 定义图片目录
|
||||
$root_path = ROOT_PATH;
|
||||
$img_path = 'Public'.DS.'Upload'.DS.'goods_app'.DS;
|
||||
$date = DS.date('Y').DS.date('m').DS.date('d').DS;
|
||||
|
||||
// 开始处理
|
||||
$result = [];
|
||||
$name = 'content_app_';
|
||||
foreach($_POST AS $k=>$v)
|
||||
{
|
||||
if(substr($k, 0, 12) == $name)
|
||||
{
|
||||
$key = explode('_', str_replace($name, '', $k));
|
||||
if(count($key) == 2)
|
||||
{
|
||||
$result[$key[1]][$key[0]] = $v;
|
||||
|
||||
if($key[0] == 'images')
|
||||
{
|
||||
$images_key = $name.$key[0].'_file_'.$key[1];
|
||||
if(isset($_FILES[$images_key]))
|
||||
{
|
||||
// 文件上传校验
|
||||
$error = FileUploadError($images_key);
|
||||
if($error !== true)
|
||||
{
|
||||
return ['status'=>false, 'msg'=>$error];
|
||||
}
|
||||
|
||||
// 存储图片
|
||||
$temp_all = [
|
||||
'tmp_name' => $_FILES[$images_key]['tmp_name'],
|
||||
'type' => $_FILES[$images_key]['type']
|
||||
];
|
||||
$original = $images_obj->GetOriginal($temp_all, $root_path.$img_path.'original'.$date);
|
||||
if(!empty($original))
|
||||
{
|
||||
// 根据原图再次生成小图
|
||||
$compr = $images_obj->GetBinaryCompress($root_path.$img_path.'original'.$date.$original, $root_path.$img_path.'compr'.$date, 600);
|
||||
$small = $images_obj->GetBinaryCompress($root_path.$img_path.'original'.$date.$original, $root_path.$img_path.'small'.$date, 100, 100);
|
||||
|
||||
if(!empty($compr))
|
||||
{
|
||||
$result[$key[1]][$key[0]] = DS.$img_path.'compr'.$date.$small;
|
||||
} else {
|
||||
// 如果图片格式有误,则删除原图片
|
||||
$this->ImagesDelete($img_path.'original'.$date.$original);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return ['status'=>true, 'data'=>$result];
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取商品相册
|
||||
* @author Devil
|
||||
* @blog http://gong.gg/
|
||||
* @version 1.0.0
|
||||
* @date 2018-07-10
|
||||
* @desc description
|
||||
* @return [array] [一维数组但图片地址]
|
||||
*/
|
||||
private function GetFormGoodsPhotoParams()
|
||||
{
|
||||
// 原始图片
|
||||
if(!empty($_POST['photo']) && is_array($_POST['photo']))
|
||||
{
|
||||
$result = $_POST['photo'];
|
||||
} else {
|
||||
$result = [];
|
||||
}
|
||||
|
||||
// 开始处理图片存储
|
||||
$images_name = 'photo_file';
|
||||
if(!empty($_FILES[$images_name]))
|
||||
{
|
||||
// 定义图片目录
|
||||
$root_path = ROOT_PATH;
|
||||
$img_path = 'Public'.DS.'Upload'.DS.'goods_photo'.DS;
|
||||
$date = DS.date('Y').DS.date('m').DS.date('d').DS;
|
||||
|
||||
// 图像类库
|
||||
$images_obj = \Library\Images::Instance(['is_new_name'=>false]);
|
||||
|
||||
// 图片存储处理
|
||||
for($i=0; $i<count($_FILES[$images_name]['tmp_name']); $i++)
|
||||
{
|
||||
// 文件上传校验
|
||||
$error = FileUploadError($images_name, $i);
|
||||
if($error !== true)
|
||||
{
|
||||
return ['status'=>false, 'msg'=>$error];
|
||||
}
|
||||
|
||||
// 存储图片
|
||||
$temp_all = [
|
||||
'tmp_name' => $_FILES[$images_name]['tmp_name'][$i],
|
||||
'type' => $_FILES[$images_name]['type'][$i],
|
||||
];
|
||||
$original = $images_obj->GetOriginal($temp_all, $root_path.$img_path.'original'.$date);
|
||||
if(!empty($original))
|
||||
{
|
||||
// 根据原图再次生成小图
|
||||
$compr = $images_obj->GetBinaryCompress($root_path.$img_path.'original'.$date.$original, $root_path.$img_path.'compr'.$date, 600);
|
||||
$small = $images_obj->GetBinaryCompress($root_path.$img_path.'original'.$date.$original, $root_path.$img_path.'small'.$date, 100, 100);
|
||||
|
||||
if(!empty($compr))
|
||||
{
|
||||
$result[] = DS.$img_path.'compr'.$date.$small;
|
||||
} else {
|
||||
// 如果图片格式有误,则删除原图片
|
||||
$this->ImagesDelete($img_path.'original'.$date.$original);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return ['status'=>true, 'data'=>$result];
|
||||
}
|
||||
|
||||
/**
|
||||
* 商品图片集合处理
|
||||
* @author Devil
|
||||
* @blog http://gong.gg/
|
||||
* @version 1.0.0
|
||||
* @date 2018-08-07
|
||||
* @desc description
|
||||
* @param [array] $data [字段列表]
|
||||
*/
|
||||
private function GetGoodsImagesParams($data)
|
||||
{
|
||||
$result = [];
|
||||
if(!empty($data))
|
||||
{
|
||||
// 定义图片目录
|
||||
$root_path = ROOT_PATH;
|
||||
$img_path = 'Public'.DS.'Upload'.DS.'goods_images'.DS;
|
||||
$date = DS.date('Y').DS.date('m').DS.date('d').DS;
|
||||
|
||||
// 图像类库
|
||||
$images_obj = \Library\Images::Instance(['is_new_name'=>false]);
|
||||
|
||||
foreach($data as $field)
|
||||
{
|
||||
if(!empty($_FILES[$field]))
|
||||
{
|
||||
$file = $_FILES[$field];
|
||||
|
||||
// 文件上传校验
|
||||
$error = FileUploadError($field);
|
||||
if($error !== true)
|
||||
{
|
||||
return ['status'=>false, 'msg'=>$error];
|
||||
}
|
||||
|
||||
// 存储图片
|
||||
$temp_all = [
|
||||
'tmp_name' => $file['tmp_name'],
|
||||
'type' => $file['type'],
|
||||
];
|
||||
$original = $images_obj->GetOriginal($temp_all, $root_path.$img_path.'original'.$date);
|
||||
if(!empty($original))
|
||||
{
|
||||
// 根据原图再次生成小图
|
||||
$compr = $images_obj->GetBinaryCompress($root_path.$img_path.'original'.$date.$original, $root_path.$img_path.'compr'.$date, 600);
|
||||
$small = $images_obj->GetBinaryCompress($root_path.$img_path.'original'.$date.$original, $root_path.$img_path.'small'.$date, 100, 100);
|
||||
|
||||
if(!empty($compr))
|
||||
{
|
||||
$result[$field] = DS.$img_path.'compr'.$date.$small;
|
||||
} else {
|
||||
// 如果图片格式有误,则删除原图片
|
||||
$this->ImagesDelete($img_path.'original'.$date.$original);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return ['status'=>true, 'data'=>$result];
|
||||
}
|
||||
|
||||
/**
|
||||
* 商品分类添加
|
||||
* @author Devil
|
||||
|
|
|
|||
|
|
@ -71,30 +71,9 @@ class SiteController extends CommonController
|
|||
*/
|
||||
public function Save()
|
||||
{
|
||||
// 站点logo
|
||||
if(isset($_FILES['home_site_logo_img']['error']))
|
||||
{
|
||||
// 文件上传校验
|
||||
$error = FileUploadError('home_site_logo_img');
|
||||
if($error !== true)
|
||||
{
|
||||
$this->ajaxReturn($error, -1);
|
||||
}
|
||||
|
||||
// 文件类型
|
||||
list($type, $suffix) = explode('/', $_FILES['home_site_logo_img']['type']);
|
||||
$path = 'Public'.DS.'Upload'.DS.'common'.DS.'images'.DS;
|
||||
if(!is_dir($path))
|
||||
{
|
||||
mkdir(ROOT_PATH.$path, 0777, true);
|
||||
}
|
||||
$filename = date('YmdHis').'_logo.'.$suffix;
|
||||
$home_site_logo = $path.$filename;
|
||||
if(move_uploaded_file($_FILES['home_site_logo_img']['tmp_name'], ROOT_PATH.$home_site_logo))
|
||||
{
|
||||
$_POST['home_site_logo'] = DS.$home_site_logo;
|
||||
}
|
||||
}
|
||||
// logo存储
|
||||
$this->ImagesSave('home_site_logo', 'home_site_logo_img');
|
||||
$this->ImagesSave('home_site_logo_wap', 'home_site_logo_wap_img');
|
||||
|
||||
// 站点状态值处理
|
||||
if(!isset($_POST['home_user_reg_state']))
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
* @datetime 2016-12-01T21:51:08+0800
|
||||
*/
|
||||
return array(
|
||||
'site_site_logo_text' => '选择网站logo',
|
||||
'site_site_logo_text' => '选择logo',
|
||||
|
||||
// 站点关闭状态列表
|
||||
'site_site_state_list' => array(
|
||||
|
|
|
|||
|
|
@ -14,11 +14,22 @@
|
|||
<label class="block">{{$data.home_site_logo.name}}<span class="fs-12 fw-100 cr-999">({{$data.home_site_logo.describe}})</span></label>
|
||||
<button type="button" class="am-btn am-btn-default am-btn-sm am-radius">
|
||||
<i class="am-icon-cloud-upload"></i> {{:L('site_site_logo_text')}}</button>
|
||||
<input type="file" name="{{$data.home_site_logo.only_tag}}_img" multiple data-validation-message="{{$data.home_site_logo.error_tips}}" accept="image/gif,image/jpeg,image/jpg,image/png" <present name="data"> value="{{$data.home_site_logo.value}}"</present> />
|
||||
<input type="file" class="site-logo" data-tils-tag="#form-file-logo-tips" name="{{$data.home_site_logo.only_tag}}_img" multiple data-validation-message="{{$data.home_site_logo.error_tips}}" accept="image/gif,image/jpeg,image/jpg,image/png" <present name="data"> value="{{$data.home_site_logo.value}}"</present> />
|
||||
<input type="hidden" name="{{$data.home_site_logo.only_tag}}" <present name="data"> value="{{$data.home_site_logo.value}}"</present> />
|
||||
<img src="{{$image_host}}{{$data.home_site_logo.value}}" id="form-img-logo" />
|
||||
<img src="{{$image_host}}{{$data.home_site_logo.value}}" class="form-img-logo-view" />
|
||||
<div id="form-file-logo-tips"></div>
|
||||
</div>
|
||||
<div class="am-form-group am-form-file">
|
||||
<label class="block">{{$data.home_site_logo_wap.name}}<span class="fs-12 fw-100 cr-999">({{$data.home_site_logo_wap.describe}})</span></label>
|
||||
<button type="button" class="am-btn am-btn-default am-btn-sm am-radius">
|
||||
<i class="am-icon-cloud-upload"></i> {{:L('site_site_logo_text')}}</button>
|
||||
<input type="file" class="site-logo" data-tils-tag="#form-file-logo-wap-tips" name="{{$data.home_site_logo_wap.only_tag}}_img" multiple data-validation-message="{{$data.home_site_logo_wap.error_tips}}" accept="image/gif,image/jpeg,image/jpg,image/png" <present name="data"> value="{{$data.home_site_logo_wap.value}}"</present> />
|
||||
<input type="hidden" name="{{$data.home_site_logo_wap.only_tag}}" <present name="data"> value="{{$data.home_site_logo_wap.value}}"</present> />
|
||||
<if condition="!empty($data['home_site_logo_wap']['value'])">
|
||||
<img src="{{$image_host}}{{$data.home_site_logo_wap.value}}" class="form-img-logo-view" />
|
||||
</if>
|
||||
<div id="form-file-logo-wap-tips"></div>
|
||||
</div>
|
||||
<div class="am-form-group">
|
||||
<label>{{$data.common_timezone.name}}<span class="fs-12 fw-100 cr-999">({{$data.common_timezone.describe}})</span></label>
|
||||
<select name="{{$data.common_timezone.only_tag}}" class="am-radius chosen-select c-p" data-placeholder="{{$data.common_timezone.name}}" data-validation-message="{{$data.common_timezone.error_tips}}" required>
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
<div class="nav-search white">
|
||||
<div class="logo">
|
||||
<a href="{{:__MY_URL__}}">
|
||||
<img src="{{$image_host}}{{:MyC('home_site_logo')}}" alt="{{:MyC('home_seo_site_title')}}" />
|
||||
<img src="{{$image_host}}{{:MyC('home_site_logo_wap')}}" alt="{{:MyC('home_seo_site_title')}}" />
|
||||
</a>
|
||||
</div>
|
||||
<div class="logoBig">
|
||||
|
|
|
|||
|
|
@ -1,2 +1 @@
|
|||
input[name="home_site_logo_img"] { width: 135px !important; height: 32px; margin-top: 30px; }
|
||||
#form-img-logo { max-width: 180px; max-height: 38px; }
|
||||
.form-img-logo-view { max-width: 180px; max-height: 38px; }
|
||||
|
|
@ -1,13 +1,13 @@
|
|||
$(function()
|
||||
{
|
||||
// 图片选择名称展示
|
||||
$('input[name="home_site_logo_img"]').on('change', function()
|
||||
$('input.site-logo').on('change', function()
|
||||
{
|
||||
var fileNames = '';
|
||||
$.each(this.files, function()
|
||||
{
|
||||
fileNames += '<span class="am-badge">' + this.name + '</span> ';
|
||||
});
|
||||
$('#form-file-logo-tips').html(fileNames);
|
||||
$($(this).data('tils-tag')).html(fileNames);
|
||||
});
|
||||
});
|
||||
|
|
@ -114,7 +114,7 @@ color: #F5F5F2;font-size: 14px;cursor:pointer;border-radius:0px 0px ;}
|
|||
.mui-mbar-tabs{ display:none;}
|
||||
|
||||
/* 顶部小导航 */
|
||||
.header-top { background-color: #F5F5F5; border-bottom: solid 1px #E5E5E5; }
|
||||
.header-top { background-color: #fafafa; border-bottom: solid 1px #f0f0f0; }
|
||||
.header-top a, .header-top span { color: #555; }
|
||||
.header{ display:none; max-width:1000px; margin:0px auto; font-size:12px;}
|
||||
|
||||
|
|
@ -196,7 +196,7 @@ color: #F5F5F2;font-size: 14px;cursor:pointer;border-radius:0px 0px ;}
|
|||
.mui-mbar-tabs{ display:block;}
|
||||
.nav-search{padding-left:0px; max-width:1000px; margin:0px auto;padding: 20px 0;}
|
||||
.nav-search .logo{display:none;}
|
||||
.nav-search .logoBig { display: -webkit-inline-box; float:left;height:60px; width:200px; margin-left:0px;}
|
||||
.nav-search .logoBig { display: -webkit-inline-box; float:left;height:60px; width:230px; margin-left:0px;}
|
||||
.search-bar{height:50px; margin:auto;display: -webkit-inline-box;width: calc(66%);padding-left: 8%;}
|
||||
#ai-topsearch {height: 47px;}
|
||||
.shopMain{margin:0px 0px 0px 5px;}
|
||||
|
|
|
|||
|
After Width: | Height: | Size: 5.2 KiB |
|
After Width: | Height: | Size: 6.7 KiB |
|
After Width: | Height: | Size: 5.9 KiB |
|
After Width: | Height: | Size: 7.8 KiB |
|
After Width: | Height: | Size: 5.9 KiB |
|
After Width: | Height: | Size: 5.2 KiB |
|
After Width: | Height: | Size: 3.7 KiB |
|
After Width: | Height: | Size: 8.7 KiB |
|
After Width: | Height: | Size: 8.4 KiB |
|
After Width: | Height: | Size: 3.9 KiB |
|
After Width: | Height: | Size: 7.0 KiB |
|
After Width: | Height: | Size: 4.9 KiB |
|
After Width: | Height: | Size: 9.0 KiB |
|
After Width: | Height: | Size: 7.0 KiB |
|
After Width: | Height: | Size: 6.6 KiB |
|
After Width: | Height: | Size: 4.5 KiB |
|
After Width: | Height: | Size: 8.2 KiB |
|
After Width: | Height: | Size: 7.9 KiB |
|
After Width: | Height: | Size: 8.3 KiB |
|
After Width: | Height: | Size: 3.6 KiB |
|
After Width: | Height: | Size: 5.8 KiB |
|
After Width: | Height: | Size: 2.9 KiB |
|
After Width: | Height: | Size: 6.2 KiB |
|
After Width: | Height: | Size: 4.0 KiB |
|
After Width: | Height: | Size: 9.9 KiB |
|
After Width: | Height: | Size: 7.0 KiB |
|
After Width: | Height: | Size: 4.2 KiB |
|
After Width: | Height: | Size: 4.8 KiB |
|
After Width: | Height: | Size: 5.4 KiB |
|
After Width: | Height: | Size: 5.9 KiB |
|
After Width: | Height: | Size: 8.5 KiB |
0
service/Public/Upload/common/images/20180807174046_logo.png → service/Public/Upload/common/images/20180911144001_logo.png
Executable file → Normal file
|
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 21 KiB |