fix: bug修复

This commit is contained in:
2024-10-29 17:38:47 +08:00
parent 48bf3e6f33
commit 6df8d23686
31 changed files with 1032 additions and 664 deletions

View File

@@ -15,6 +15,8 @@ class BaseController extends Base {
//当前是否管理员 0:否 1:是
protected $administrator = 0;
protected $adminlang;
protected $country_code;
public function __construct() {
parent::__construct();
}

View File

@@ -13,6 +13,8 @@ class Product extends BaseController {
private $saveDirectory = 'default';
private $config; //配置信息
private $docDir;
private $rootDir;
public function __construct() {
parent::__construct();
date_default_timezone_set("Asia/Shanghai");
@@ -648,7 +650,7 @@ class Product extends BaseController {
foreach($productAttr[$key]['type'] as $kt => $attrValue ) {
//echo $attrValue."<pre>*****"; print_r($productAttr[$key]['sort']);
$arrribute[$kt] = array(
$data['product_attr'][$kt] => $attrValue,
$data['product_attr'][$kt] => trim($attrValue),
'sort'=> isset($productAttr[$key]['sort'][$kt]) ? $productAttr[$key]['sort'][$kt]: ''
);
@@ -694,7 +696,7 @@ class Product extends BaseController {
'product_id' => $last_insert_id,
'image_url' => isset($product_image['image_url']) ? $product_image['image_url'] : '',
'image_bk_color' => isset($product_image['image_bkcolor']) ? $product_image['image_bkcolor'] : '',
'image_color' => isset($product_image['image_color']) ? $product_image['image_color'] : '',
'image_color' => isset($product_image['image_color']) ? trim($product_image['image_color']) : '',
'original_url' => isset($product_image['image_url']) ? $product_image['image_url'] : '',
'country_code' => $this->country_code
);
@@ -822,7 +824,6 @@ class Product extends BaseController {
$product_images[] = $att_item;
}
//echo "<pre>-------"; print_r($product_images); die;
unset($tmp_product_images);
@@ -831,7 +832,7 @@ class Product extends BaseController {
$value['product_images'] = $product_images;
$value['product_two_img'] = model('product_two_img')->getList(array('product_id'=> $product['id']),['id' => 'asc',]);//print_r($value['product_product']);die;
//$value['product_bkimg'] = model('product_bk_img')->getList(array('product_id'=> $product['id']),['id' => 'asc',]);//print_r($value['product_bkimg']);die;
//$value['product_bkimg'] = model('product_bk_img')->getList(array('product_id'=> $product['id']),['id' => 'asc',]);
$value['product_dls'] = model('product_dl')->getList(array('product_id' => $product['id']), ['dl_sort' => 'asc', 'id' => 'asc',]);
$value['product_relateds'] = model('product')->getRelatedProductList(array('pr.product_id' => $product['id']), ['pr.related_sort' => 'asc', 'pr.id' => 'asc',], ['p.id' => 'id', 'p.name', 'pr.id' => 'related_id', 'pr.related_product_id', 'pr.related_sort', 'pr.related_desc']);
// tiaoshi($value['product_images']);die;
@@ -1047,7 +1048,7 @@ class Product extends BaseController {
foreach($productAttr[$key]['type'] as $kt => $attrValue ) {
$arrribute[$kt] = array(
$data['product_attr'][$kt] => $attrValue,
$data['product_attr'][$kt] => trim($attrValue),
'sort'=> isset($productAttr[$key]['sort']) ? $productAttr[$key]['sort'][$kt]: ''
);
@@ -1082,8 +1083,8 @@ class Product extends BaseController {
$product_image_list[$product_image_id] = array('sign' => 'update', 'where' => array('id' => $product_image_id), 'data' => array(
'product_id' => $last_update_id,
'image_url' => $product_image['image_url'],
'image_bk_color' => isset( $product_image['image_bkcolor']) ? $product_image['image_bkcolor'] : '',
'image_color' => isset($product_image['image_color']) ? $product_image['image_color']: '',
'image_bk_color' => isset($product_image['image_bkcolor']) ? $product_image['image_bkcolor'] : '',
'image_color' => isset($product_image['image_color']) ? trim($product_image['image_color']) : '',
'original_url' => $product_image['image_url'],
));
} else {
@@ -1091,12 +1092,13 @@ class Product extends BaseController {
'product_id' => $last_update_id,
'image_url' => $product_image['image_url'],
'image_bk_color' => isset($product_image['image_bkcolor']) ? $product_image['image_bkcolor'] : '',
'image_color' => isset($product_image['image_color']) ? $product_image['image_color']: '',
'image_color' => isset($product_image['image_color']) ? trim($product_image['image_color']) : '',
'original_url' => $product_image['image_url'],
));
}
//$imageModel->insertRow($image);
}
foreach ($product_image_list as $product_image_id => $image) {
if ($image['sign'] == 'insert') {
$imageModel->insertRow($image['data']);
@@ -1106,6 +1108,8 @@ class Product extends BaseController {
$imageModel->deleteRow($image['where']);
}
}
} else {
model('product_two_img')->deleteRow(['product_id' => $last_update_id]);
}
/* 二级列表主图片 end */
@@ -1591,13 +1595,13 @@ class Product extends BaseController {
$arg_order = ['a.id' => 'desc'];
$arg_field = ['a.*', 'c.id' => 'categoryid', 'c.name' => 'categoryname'];
foreach ($id as $where ){
foreach ($id as $where) {
$where = [
'a.id'=>$where,
'a.stat'=>0,
'a.id' => $where,
'a.stat' => 0,
'a.country_code' => $this->country_code
];
$result = model('product')->getProductLists($where,$arg_order,$arg_field,12);
];
$result = model('product')->getProductLists($where, $arg_order, $arg_field, 12);
}
$this->assign($result);
@@ -1711,7 +1715,9 @@ class Product extends BaseController {
}
$arg_order = ['c.sort' => 'asc', 'c.id' => 'asc'];
$arg_field = array_map(function($value) {return 'a.' . $value;}, array_keys($fields));
$arg_field = array_map(function ($value) {
return 'a.' . $value;
}, array_keys($fields));
$arg_field['c.id'] = 'categoryid';
$arg_field['c.name'] = 'categoryname';
$arg_field['c.pid'] = 'pid';
@@ -2592,7 +2598,7 @@ class Product extends BaseController {
mysqli_query($con, $sql);
}
}
} catch (Exception $e) {
} catch (\Exception $e) {
return $this->json(-1, $e->getMessage());
}

View File

@@ -49,6 +49,9 @@ class ProductCategory extends BaseController
$max_unique_id = \think\db::query($sql)[0]['unique_id'];
$value = ['categoryOptions' => $categoryOptions, 'pid' => $pid, 'max_unique_id' => $max_unique_id];
$tcoCategory = \think\Db::name('product_tco_category')->where('id', '>', 0)->where('country_code', '=', $this->country_code)->select();
$value['tcoCategoryOptions'] = $this->buildTcoCategoryToTree($tcoCategory, 0, 0, 0);
$this->assign($value);
return $this->fetch();
}

View File

@@ -1,4 +1,5 @@
<?php
namespace app\admin\controller;
use PHPExcel;
@@ -49,7 +50,6 @@ class ProductPurchaseLinks extends BaseController
$data[$val['spu']] = $val;
}
}
if (!$list->isEmpty()) {
$others = Db::name('product_purchase_links')->alias('links')
->field([
@@ -160,7 +160,7 @@ class ProductPurchaseLinks extends BaseController
$rows = $sheet->getHighestRow(); //总行数
$xlsx = [];
for($i = 2; $i <= $rows; $i++) {
for ($i = 2; $i <= $rows; $i++) {
// $xlsx[行号] = 数据
$xlsx[$i] = [
'spu' => $sheet->getCellByColumnAndRow(0, $i)->getValue(),
@@ -272,7 +272,7 @@ class ProductPurchaseLinks extends BaseController
])
->join('product_purchase_link_platforms platforms', 'platforms.id=links.platform_id')
->join('product', 'product.id=links.product_id')
->where(function($query) {
->where(function ($query) {
$query->where('product.is_show', '=', 0)->where('links.country_code', '=', $this->country_code);
if (request()->has('skeyword')) {
$query->where(function ($q) {

0
app/admin/controller/ProductSeries.php Normal file → Executable file
View File

View File

@@ -8,13 +8,17 @@ use think\Config;
use image\Image;
use pagination\Pagination;
class Webuploader extends BaseController {
class Webuploader extends BaseController
{
private $docDir = '';
private $rootDir = '';
private $basePath = '/';
private $saveDirectory = 'default';
private $num = '10';
public function __construct() {
public function __construct()
{
parent::__construct();
date_default_timezone_set("Asia/Shanghai");
$this->docDir = $this->request->server('DOCUMENT_ROOT');
@@ -26,7 +30,8 @@ class Webuploader extends BaseController {
header("Content-Type: text/html; charset=utf-8");
}
public function show() {
public function show()
{
$filter_name = $this->request->get('filter_name', '', 'urldecode');
if (!empty($filter_name)) {
$filter_name = trim(str_replace(['/../', '../', '*'], '', $filter_name), "\x20\x09\x0A\x0D\x00\x0B\x2E\x2F");
@@ -110,7 +115,11 @@ class Webuploader extends BaseController {
$path = mb_substr($image, mb_strlen($this->docDir . $this->rootDir));
$ext = strtolower(pathinfo($image, PATHINFO_EXTENSION));
switch ($ext) {
case 'jpg': case 'png': case 'gif': case 'bmp': case 'jpeg':
case 'jpg':
case 'png':
case 'gif':
case 'bmp':
case 'jpeg':
$data['images'][] = array(
'thumb' => $path,
'name' => implode(' ', $name),
@@ -119,7 +128,11 @@ class Webuploader extends BaseController {
'href' => $this->request->domain() . $path
);
break;
case 'html': case 'htm': case 'js': case 'php': case 'txt':
case 'html':
case 'htm':
case 'js':
case 'php':
case 'txt':
$data['images'][] = array(
'thumb' => $path,
'name' => implode(' ', $name),
@@ -128,7 +141,13 @@ class Webuploader extends BaseController {
'href' => 'javascript:void(0);'
);
break;
case 'avi': case 'mp4': case 'rmvb': case 'mkv': case 'wmv': case 'ogg': case 'webm':
case 'avi':
case 'mp4':
case 'rmvb':
case 'mkv':
case 'wmv':
case 'ogg':
case 'webm':
$data['images'][] = array(
'thumb' => $path,
'name' => implode(' ', $name),
@@ -137,7 +156,13 @@ class Webuploader extends BaseController {
'href' => 'javascript:void(0);'
);
break;
case 'zip': case 'rar': case 'gz': case 'tar': case 'tgz': case 'gz': case 'iso':
case 'zip':
case 'rar':
case 'gz':
case 'tar':
case 'tgz':
case 'gz':
case 'iso':
$data['images'][] = array(
'thumb' => $path,
'name' => implode(' ', $name),
@@ -203,13 +228,14 @@ class Webuploader extends BaseController {
return $this->fetch();
}
public function modal() {
public function modal()
{
$relativepath = $this->request->get('directory', '', 'urldecode');
if (!empty($relativepath)) {
$relativepath = trim(str_replace(['/../', '../', '*'], '', $relativepath), "\x20\x09\x0A\x0D\x00\x0B\x2E\x2F");
}
$func = $this->request->get('func', 'undefined');
$num = $this->num;
$num = $this->request->get('num', $this->num);
$type = $this->request->get('type', '');
$target = $this->request->get('target', '');
$thumb = $this->request->get('thumb', '');
@@ -252,14 +278,15 @@ class Webuploader extends BaseController {
return $this->fetch();
}
public function uploadiframe() {
public function uploadiframe()
{
$relativepath = $this->request->get('directory', '', 'urldecode');
if (!empty($relativepath)) {
$relativepath = trim(str_replace(['/../', '../', '*'], '', $relativepath), "\x20\x09\x0A\x0D\x00\x0B\x2E\x2F");
}
$func = $this->request->get('func', 'undefined');
//$num = $this->request->get('num/d', 1);
$num = $this->num;
$num = $this->request->get('num', $this->num);
$type = $this->request->get('type', '');
$target = $this->request->get('target', '');
$thumb = $this->request->get('thumb', '');
@@ -295,21 +322,24 @@ class Webuploader extends BaseController {
return str_replace(array_keys($tpl_replace_string), array_values($tpl_replace_string), $content);
}
public function imageupload() {
public function imageupload()
{
// 上传图片框中的描述表单名称,
$title = $this->request->get('pictitle');
$relativepath = $this->request->get('directory', '', 'urldecode');
if (!empty($relativepath)) {
$relativepath = trim(str_replace(['/../', '../', '*'], '', $relativepath), "\x20\x09\x0A\x0D\x00\x0B\x2E\x2F");
}
$this->saveDirectory = $relativepath? : 'default';
$this->saveDirectory = $relativepath ?: 'default';
// 获取表单上传文件 例如上传了001.jpg
$file = request()->file('file');
// if (empty($file))
// $file = request()->file('upfile');
// if (empty($file))
// $file = request()->file('upfile');
$image_upload_limit_size = Config::get('image_upload_limit_size');
$result = $this->validate(
['file' => $file], ['file' => 'image|fileSize:' . $image_upload_limit_size . '|fileExt:jpg,jpeg,gif,png'], ['file.image' => '上传文件必须为图片', 'file.fileSize' => '上传文件过大', 'file.fileExt' => '上传文件后缀名必须为jpg,jpeg,gif,png']
['file' => $file],
['file' => 'image|fileSize:' . $image_upload_limit_size . '|fileExt:jpg,jpeg,gif,png'],
['file.image' => '上传文件必须为图片', 'file.fileSize' => '上传文件过大', 'file.fileExt' => '上传文件后缀名必须为jpg,jpeg,gif,png']
);
if (true !== $result || !$file) {
$state = "ERROR " . $result;
@@ -332,25 +362,27 @@ class Webuploader extends BaseController {
$return_data['original'] = ''; // 这里好像没啥用 暂时注释起来
$return_data['state'] = $state;
$return_data['directory'] = $this->saveDirectory;
echo json_encode($return_data);
exit;
return json_encode($return_data);
}
public function fileupload() {
public function fileupload()
{
// 上传图片框中的描述表单名称,
$title = $this->request->get('pictitle');
$relativepath = $this->request->get('directory', '', 'urldecode');
if (!empty($relativepath)) {
$relativepath = trim(str_replace(['/../', '../', '*'], '', $relativepath), "\x20\x09\x0A\x0D\x00\x0B\x2E\x2F");
}
$this->saveDirectory = $relativepath? : 'default';
$this->saveDirectory = $relativepath ?: 'default';
// 获取表单上传文件 例如上传了001.jpg
$file = request()->file('file');
// if (empty($file))
// $file = request()->file('upfile');
// if (empty($file))
// $file = request()->file('upfile');
$file_upload_limit_size = Config::get('file_upload_limit_size');
$result = $this->validate(
['file' => $file], ['file' => 'fileSize:' . $file_upload_limit_size], ['file.fileSize' => '上传文件过大']
['file' => $file],
['file' => 'fileSize:' . $file_upload_limit_size],
['file.fileSize' => '上传文件过大']
);
if (true !== $result || !$file) {
$state = "ERROR " . $result;
@@ -377,12 +409,13 @@ class Webuploader extends BaseController {
删除上传的图片
*/
public function deluploadimage() {
public function deluploadimage()
{
$action = $this->request->get('action', 'del');
$filename = $this->request->get('filename');
$filename = empty($filename) ? $this->request->get('url') : $filename;
// $filename = str_replace('../', '', $filename);
// $filename = trim($filename, "\x20\x09\x0A\x0D\x00\x0B\x2E\x2F");
// $filename = str_replace('../', '', $filename);
// $filename = trim($filename, "\x20\x09\x0A\x0D\x00\x0B\x2E\x2F");
$filename = trim(str_replace('../', '', $filename), "\x20\x09\x0A\x0D\x00\x0B\x2E\x2F");
$filename = './' . $filename;
if ($action == 'del' && !empty($filename) && is_file($filename)) {
@@ -404,12 +437,13 @@ class Webuploader extends BaseController {
删除上传的文件
*/
public function deluploadfile() {
public function deluploadfile()
{
$action = $this->request->get('action', 'del');
$filename = $this->request->get('filename');
$filename = empty($filename) ? $this->request->get('url') : $filename;
// $filename = str_replace('../', '', $filename);
// $filename = trim($filename, "\x20\x09\x0A\x0D\x00\x0B\x2E\x2F");
// $filename = str_replace('../', '', $filename);
// $filename = trim($filename, "\x20\x09\x0A\x0D\x00\x0B\x2E\x2F");
$filename = trim(str_replace('../', '', $filename), "\x20\x09\x0A\x0D\x00\x0B\x2E\x2F");
$filename = './' . $filename;
if ($action == 'del' && !empty($filename) && is_file($filename)) {
@@ -422,7 +456,8 @@ class Webuploader extends BaseController {
exit;
}
public function preview() {
public function preview()
{
// 此页面用来协助 IE6/7 预览图片,因为 IE 6/7 不支持 base64
$DIR = 'preview';
// Create target dir
@@ -448,7 +483,10 @@ class Webuploader extends BaseController {
$src = file_get_contents('php://input');
if (preg_match("#^data:image/(\w+);base64,(.*)$#", $src, $matches)) {
$previewUrl = sprintf(
"%s://%s%s", isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off' ? 'https' : 'http', $_SERVER['HTTP_HOST'], $_SERVER['REQUEST_URI']
"%s://%s%s",
isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off' ? 'https' : 'http',
$_SERVER['HTTP_HOST'],
$_SERVER['REQUEST_URI']
);
$previewUrl = str_replace("preview.php", "", $previewUrl);
$base64 = $matches[2];
@@ -470,8 +508,9 @@ class Webuploader extends BaseController {
}
}
public function upload() {
$json = array();
public function upload()
{
$json = [];
// Make sure we have the correct directory
$relativepath = $this->request->get('directory', '', 'urldecode');
if (!empty($relativepath)) {
@@ -482,46 +521,57 @@ class Webuploader extends BaseController {
}
// Check its a directory
if (!is_dir($directory) || mb_substr($directory, 0, mb_strlen($this->basePath)) != $this->basePath) {
$json['error'] = '路径错误';
}
if (!$json) {
$file_upload_limit_size = Config::get('file_upload_limit_size');
// Check if multiple files are uploaded or just one
//获取上传的文件类型
//$type = $this->request->get('type', '');
// 获取表单上传文件
$files = $this->request->file('file');
foreach ($files as $k => $file) {
// 移动到框架应用根目录/public/uploads/ 目录下
$info = $file->validate(['size' => $file_upload_limit_size])->move($directory, false);
if ($info) {
// 成功上传后 获取上传信息
$ext = strtolower($info->getExtension());
if (in_array($ext, ['gif', 'jpg', 'jpeg', 'png', 'bmp'])) {
$image_upload_limit_size = Config::get('image_upload_limit_size');
$chick = $info->getInfo();
if ($chick['size']>=$image_upload_limit_size) {
$json['success'] = "文件大小超过1M";
} else {
$this->watermark('/uploads/' . $relativepath . '/' . $info->getFilename());
}
}
} else {
// 上传失败获取错误信息
$json['error'] = '';
$json['error'] .= '文件' . $k . $file->getError();
}
if (!mkdir($directory, 0755, true)) {
$json['error'] = '路径错误';
}
}
if (!$json) {
$json['success'] = '文件上传成功';
$json = [
'success' => '文件上传成功'
];
$file_upload_limit_size = Config::get('file_upload_limit_size');
$image_upload_limit_size = Config::get('image_upload_limit_size');
// 获取表单上传文件
$errors = [];
$files = $this->request->file('file');
foreach ($files as $k => $file) {
$file_info = $file->getInfo();
$idx = mb_strripos($file_info['name'], '.', 0, 'utf-8');
$file = $file->validate(['size' => $file_upload_limit_size]);
if (false !== $idx) {
$start = $idx;
if (mb_strlen($file_info['name'], 'utf-8') > $idx) {
$start = $idx + 1;
}
$ext = mb_substr($file_info['name'], $start);
if (in_array($ext, ['gif', 'jpg', 'jpeg', 'png', 'bmp'])) {
$file->validate(['size' => $image_upload_limit_size]);
}
}
// 移动到框架应用根目录/public/uploads/ 目录下
$info = $file->move($directory, false);
if ($info) {
// 成功上传后 获取上传信息
$this->watermark('/uploads/' . $relativepath . '/' . $info->getFilename());
} else {
// 上传失败获取错误信息
$errors[] = '文件【' . $file->getInfo()['name'] . '】' . $file->getError();
}
}
if (count($errors) != 0) {
$json = [
'success' => implode('\n', $errors)
];
}
}
echo json_encode($json);
exit;
}
public function folder() {
public function folder()
{
$json = array();
// Make sure we have the correct directory
$relativepath = $this->request->get('directory', '', 'urldecode');
@@ -569,7 +619,8 @@ class Webuploader extends BaseController {
exit;
}
public function rename() {
public function rename()
{
$json = array();
// Make sure we have the correct directory
$relativepath = $this->request->get('directory', '', 'urldecode');
@@ -617,7 +668,8 @@ class Webuploader extends BaseController {
exit;
}
public function delete() {
public function delete()
{
$json = array();
$paths = $this->request->post();
if (isset($paths['path'])) {
@@ -677,7 +729,8 @@ class Webuploader extends BaseController {
exit;
}
public function watermark($return_url = '/uploads/nopic.jpg') {
public function watermark($return_url = '/uploads/nopic.jpg')
{
$iswatermark = Config::get('watermark');
$return_data = ['watermark' => $iswatermark];
if ($iswatermark) {
@@ -707,7 +760,7 @@ class Webuploader extends BaseController {
$ttf = './hgzb.ttf';
if (file_exists($ttf)) {
$size = $wmconfig['mark_text_size'] ? $wmconfig['mark_text_size'] : 30;
$color = $wmconfig['mark_text_color'] ? : '#000000';
$color = $wmconfig['mark_text_color'] ?: '#000000';
if (!preg_match('/^#[0-9a-fA-F]{6}$/', $color)) {
$color = '#000000';
}
@@ -729,5 +782,4 @@ class Webuploader extends BaseController {
}
return $return_data;
}
}

0
app/admin/model/ProductSeries.php Normal file → Executable file
View File

View File

@@ -37,8 +37,6 @@
<li><a href="#navthird" data-toggle="tab">图片信息</a></li>
<li><a href="#navsecond" data-toggle="tab">详细内容</a></li>
<li><a href="#navseventh" data-toggle="tab">相关信息及下载</a></li>
</ul>
<div class="tab-content" style="background: #f3f3f3;">
@@ -357,7 +355,6 @@
foreach ($selectColorObj as $c=>$v) {
$sltclrOption .= $c==$product_image['image_color']?'<option value="'.$c .'" selected="">' .$v.'</option>':'<option value="'.$c .'">' .$v.'</option>';
}
echo $product_row;
?>
<tr id="product_row<?php echo $product_row; ?>">
<td class="text-left"><a href="" id="thumb-two-image<?php echo $product_row; ?>" data-toggle="image" data-folder="<?php echo $filepath;?>" class="img-thumbnail"><img class="img-responsive" src="<?php echo $product_image['image_url'];?>"></a><input name="product_product[<?php echo $product_row; ?>][image_url]" value="<?php echo $product_image['image_url'];?>" id="input-two-image<?php echo $product_row; ?>" type="hidden"></td>
@@ -367,18 +364,14 @@
if(strlen($product_image["image_color"]) ==2 || $product_image["image_color"] == ''){
echo '<select class="form-control" name="product_product['.$product_row.'][image_color]"><option value="">请选择</option>';
foreach($productColor as $clroption => $proColor) {
echo '<option value="'.$clroption .'"'.($clroption==$product_image['image_color'] ? "selected": "").'>'.$proColor . '</option>';
echo '<option value="'.$clroption.'"'.($clroption==$product_image['image_color'] ? "selected": "").'>'.$proColor.'</option>';
}
echo '</select>';
}
else{
echo '<input name="product_product['.$product_row.'][image_color]" value="'. $product_image["image_color"].'" placeholder="背景颜色" class="form-control" size="2" type="text">';
}
?>
</td>
<!--td class="text-center"><input name="product_product[<?php echo $product_row; ?>][image_bk_color]" value="<?php echo $product_image['image_bk_color'];?>" class="form-control" id="input-two-color-image<?php echo $product_row; ?>" type="text"></td-->
@@ -1272,22 +1265,21 @@ function changeAlbumImagesSort(){
}
/*二级列表主图*/
var product_row = "<?php echo '0';?>";
function addProduct() {
var sltclrOption = '<select class="form-control" name="product_image[' + product_row + '][image_color]"><option value="">请选择</option>';
for (clroption in selectColorObj) {
var sltclrOption = '<select class="form-control" name="product_product[' + product_row + '][image_color]"><option value="">请选择</option>';
for (clroption in selectColorObj) {
sltclrOption += '<option value="' + clroption + '">' + selectColorObj[clroption] + '</option>';
}
sltclrOption += '</select>';
var html = '<tr id="product_row' + product_row + '">';
html += ' <td class="text-left"><a href="" id="thumb-two-image' + product_row + '"data-toggle="image" data-folder="' + filePath + '" class="img-thumbnail"><img class="img-responsive" src="/uploads/nopic.jpg"/></a><input type="hidden" name="product_product[' + product_row + '][image_url]" value="" id="input-two-image' + product_row + '"/></td>';
html += ' <td class="text-right">' + sltclrOption + '</td>';
html += ' <td class="text-right">' + sltclrOption + '</td>';
//html += ' <td class="text-right"><input type="hidden" name="product_product[' + product_row + '][image_color]" value="" id="input-two-color-image' + product_row + '"/></td>';
//html += ' <td class="text-right"><input type="text" name="product_product[' + product_row + '][image_bkcolor]" value="" placeholder="颜色" class="form-control" size="2"/></td>';
html += ' <td class="text-right"><input type="text" name="product_product[' + product_row + '][image_desc]" value="" placeholder="描述" class="form-control" size="2"/></td>';
html += ' <td class="text-right"><input type="text" name="product_product[' + product_row + '][image_desc]" value="" placeholder="描述" class="form-control" size="2"/></td>';
html += ' <td class="text-left"><button type="button" onclick="$(\'#product_row' + product_row + '\').remove();" title="删除" class="btn btn-danger"><i class="fa fa-minus-circle"></i></button></td>';
html += '</tr>';
$('#product tbody').append(html);
@@ -1795,16 +1787,16 @@ function delAlbumAttributeColumn (object){
}
</script>
<script>
$(function() {
$('.business-button,.busniess-joinus-btn').click(function() {
$(".marsk-container").show();
});
});
/*弹出框关闭*/
$(function() {
$('.business-close').click(function() {
$(".marsk-container").hide();
});
});
<script type="text/javascript">
$(function() {
$('.business-button,.busniess-joinus-btn').click(function() {
$(".marsk-container").show();
});
});
// 弹出框关闭
$(function() {
$('.business-close').click(function() {
$(".marsk-container").hide();
});
});
</script>

View File

@@ -15,7 +15,7 @@
<h3 class="box-title">链接列表</h3>
<div class="box-tools pull-right">
<div class="input-group input-group-sm">
<input type="text" class="form-control pull-right" id="list-search-in" placeholder="Search Name" value="">
<input type="text" class="form-control pull-right" id="list-search-in" placeholder="Search Name" value="" />
<div class="input-group-btn">
<button type="button" class="btn btn-default" id="list-search-btn"><i class="fa fa-search"></i></button>
</div>
@@ -37,43 +37,43 @@
<tbody>
{if condition="!empty($list)"}
{volist name="list" id="vo"}
<tr>
<td rowspan="{$vo.rowspan}" style="vertical-align: middle;">{$vo.name}</td>
<td rowspan="{$vo.rowspan}" style="vertical-align: middle;">{$vo.spu}</td>
<td rowspan="{$vo.rowspan}" style="vertical-align: middle;">
{if condition="$vo['is_show'] == -1"}
<span class="label label-warning">未上架</span>
{else/}
<span class="label label-success">已上架</span>
{/if}
</td>
<td>
<select name="platform" data-id="{$vo.id}" data-value="{$vo.platform_id}">
{volist name="platforms" id="p"}
<option value="{$p.id}" {if condition="$vo.platform_id == $p.id"}selected="selected"{/if}>{$p.platform}</option>
{/volist}
</select>
</td>
<td>
<input type="text" name="link" value="{$vo.link}" data-id="{$vo.id}" data-value="{$vo.link}"/>
</td>
</tr>
{if condition="!empty($vo.children)"}
{volist name="vo.children" id="voc"}
<tr>
<td>
<select name="platform" data-id="{$voc.id}" data-value="{$voc.platform_id}">
{volist name="platforms" id="p"}
<option value="{$p.id}" {if condition="$voc.platform_id == $p.id" }selected="selected" {/if}>{$p.platform}</option>
{/volist}
</select>
</td>
<td>
<input type="text" name="link" value="{$voc.link}" data-id="{$voc.id}" data-value="{$voc.link}" />
</td>
</tr>
{/volist}
{/if}
<tr>
<td rowspan="{$vo.rowspan}" style="vertical-align: middle;">{$vo.name}</td>
<td rowspan="{$vo.rowspan}" style="vertical-align: middle;">{$vo.spu}</td>
<td rowspan="{$vo.rowspan}" style="vertical-align: middle;">
{if condition="$vo['is_show'] == -1"}
<span class="label label-warning">未上架</span>
{else/}
<span class="label label-success">已上架</span>
{/if}
</td>
<td>
<select name="platform" data-id="{$vo.id}" data-value="{$vo.platform_id}">
{volist name="platforms" id="p"}
<option value="{$p.id}" {if condition="$vo.platform_id == $p.id"}selected="selected" {/if}>{$p.platform}</option>
{/volist}
</select>
</td>
<td>
<input type="text" name="link" value="{$vo.link}" data-id="{$vo.id}" data-value="{$vo.link}" />
</td>
</tr>
{if condition="!empty($vo.children)"}
{volist name="vo.children" id="voc"}
<tr>
<td>
<select name="platform" data-id="{$voc.id}" data-value="{$voc.platform_id}">
{volist name="platforms" id="p"}
<option value="{$p.id}" {if condition="$voc.platform_id == $p.id"}selected="selected" {/if}>{$p.platform}</option>
{/volist}
</select>
</td>
<td>
<input type="text" name="link" value="{$voc.link}" data-id="{$voc.id}" data-value="{$voc.link}" />
</td>
</tr>
{/volist}
{/if}
{/volist}
{/if}
</tbody>
@@ -96,9 +96,9 @@
</section>
</div>
<script type="text/javascript">
$(function() {
$(function () {
// 导入
$('#import').change(function(event) {
$('#import').change(function (event) {
var input = $(this)[0]
if (input.files.length > 0) {
var _load
@@ -111,7 +111,7 @@
cache: false,
processData: false,
contentType: false,
beforeSend: function() {
beforeSend: function () {
_load = layer.load()
},
success: function (r) {
@@ -125,12 +125,12 @@
})
}
},
error: function(e) {
layer.alert('导入失败', { icon: 2 }, function() {
error: function (e) {
layer.alert('导入失败', { icon: 2 }, function () {
location.reload()
});
},
complete: function() {
complete: function () {
$('#import').val(null)
layer.close(_load)
}
@@ -139,19 +139,19 @@
})
// 更新数据
var __update = function(data, success) {
var __update = function (data, success) {
var _load
return $.ajax({
type: 'POST',
url: '/admin/product_purchase_links/update',
data: data,
dataType: 'JSON',
beforeSend: function() {
beforeSend: function () {
_load = layer.load()
},
success: function(r) {
success: function (r) {
if (r.code == 0) {
layer.alert(r.msg, { icon: 2 }, function() {
layer.alert(r.msg, { icon: 2 }, function () {
location.reload()
})
} else {
@@ -159,7 +159,7 @@
layer.msg(r.msg)
}
},
complete: function() {
complete: function () {
layer.close(_load)
}
})
@@ -167,11 +167,11 @@
$('[name="platform"]').change(function () {
var value = $(this).get(0).dataset.value
if (value == $(this).val()) return false;
__update({ id: $(this).data('id'), platform_id: $(this).val() }, function() {
__update({ id: $(this).data('id'), platform_id: $(this).val() }, function () {
$(this).get(0).dataset.value = $(this).val()
}.bind(this))
})
$('[name="link"]').change(function(){
$('[name="link"]').change(function () {
var value = $(this).get(0).dataset.value
if (value == $(this).val()) return false;
__update({ id: $(this).data('id'), link: $(this).val() }, function () {

0
app/admin/view/product_series/add.html Normal file → Executable file
View File

0
app/admin/view/product_series/edit.html Normal file → Executable file
View File

0
app/admin/view/product_series/lists.html Normal file → Executable file
View File

View File

@@ -28,7 +28,7 @@
<div class="modal-footer"></div>
</div>
</div>
<script type="text/javascript"><!--
<script type="text/javascript">
$('#modal-image a.thumbnail').on('click', function(e) {
e.preventDefault();
var target = "<?php echo $target; ?>";
@@ -81,9 +81,9 @@
}
$('#modal-image').load(url);
});
//--></script>
<script type="text/javascript"><!--
$('#button-upload').on('click', function() {
</script>
<script type="text/javascript">
$('#button-upload').on('click', function(e) {
$('#form-upload').remove();
$('body').prepend('<form enctype="multipart/form-data" id="form-upload" style="display: none;"><input type="file" name="file[]" value="" multiple="multiple"/></form>');
$('#form-upload input[name=\'file[]\']').trigger('click');
@@ -97,7 +97,7 @@
url: '<?php echo url("/admin/webuploader/upload",["directory"=>$directory,"type"=>$type]); ?>',
type: 'post',
dataType: 'json',
data: $('#form-upload').serialize(),
data: new FormData($('#form-upload')[0]),
cache: false,
contentType: false,
processData: false,
@@ -197,4 +197,4 @@
});
}
});
//--></script>
</script>

View File

@@ -225,8 +225,8 @@
}
$('#modal-image').load(url);
});
//--></script>
<script type="text/javascript"><!--
</script>
<script type="text/javascript">
$('#button-upload').on('click', function() {
$('#form-upload').remove();
$('body').prepend('<form enctype="multipart/form-data" id="form-upload" style="display: none;"><input type="file" name="file[]" value="" multiple="multiple"/></form>');
@@ -389,4 +389,4 @@
});
}
});
//--></script>
</script>

View File

@@ -58,7 +58,7 @@
"compress": false, //不启用压缩
"resize": false, //尺寸不改变
"formData": {},
"pick": {id: '#filePicker', label: '点击选择文件', "name": "file"},
"pick": {id: '#filePicker', label: '点击选择文件', "name": "file", "multiple": false},
"thumb": {"width": 110, "height": 110, "quality": 70, "allowMagnify": true, "crop": true, "preserveHeaders": false, "type": "image\/jpeg"}
};
$(function() {

View File

@@ -16,7 +16,13 @@ class BaseController extends Controller {
protected $member_id;
protected $lang;
public function __construct() {
protected $module;
protected $controller;
protected $action;
protected $langid;
public function __construct()
{
parent::__construct();
}
@@ -24,7 +30,8 @@ class BaseController extends Controller {
* 初始化操作
* @access protected
*/
protected function _initialize() {
protected function _initialize()
{
//parent::_initialize();
//$this->siteid = Config::get('siteid', 0);
$this->module = $this->request->module();

View File

@@ -133,7 +133,7 @@ class Product extends Model {
public function getNewItemLists($where = null, $order = null, $field = null, $limit = null) {
$this->alias('p')->join('product_category c', 'p.cid=c.id', 'INNER')->join('product_category t', 'c.pid=t.id', 'INNER');
if (is_array($where)) {
$where = array_merge(['p.stat' => ['eq', '0'],'p.isnew' => ['eq', '1'],'p.is_show' => ['eq', '0'],'t.isshow' => ['eq', '1'],'p.country_code' => ['eq', 'ZH']], $where);
$where = array_merge(['p.stat' => ['eq', '0'],'p.isnew' => ['eq', '1'], 'p.is_show' => ['eq', '0'],'t.isshow' => ['eq', '1'],'p.country_code' => ['eq', 'ZH']], $where);
}
if ($where) {
$this->where($where);

View File

@@ -10,7 +10,8 @@ use think\Cookie;
use app\common\controller\BaseController as Controller;
//<!--#include file="([0-9a-zA-Z/._-]+?)\.html" -->
class BaseController extends Controller {
class BaseController extends Controller
{
//当前用户
protected $customer_id = 0;
@@ -18,23 +19,30 @@ class BaseController extends Controller {
# 当前国家编码
protected $country_code = 'ZH';
public function __construct() {
protected $customer_info = [];
protected $categoryList = [];
protected $country_list = [];
protected $productCategory = [];
protected $nav_header = [];
protected $nav_footer = [];
public function __construct()
{
parent::__construct();
}
// 初始化
protected function _initialize() {
protected function _initialize()
{
parent::_initialize();
if ($this->check_true_login())
{
if ($this->check_true_login()) {
$customer_info = json_decode(Cookie::get('c'), true);
$this->view->assign('customer_info', $customer_info);
$this->customer_id = $customer_info['id'];
$this->customer_id = $customer_info['id'];
$this->customer_info = $customer_info;
}
else
{
} else {
$this->_logout();
}
@@ -43,11 +51,67 @@ class BaseController extends Controller {
$this->view->assign('seo_description', (string) Config::get('website_seo_description'));
// $this->categoryList = $this->cacheGet('productCategoryList');
if (empty($this->productCategory)) {
$this->categoryList = Loader::model('ProductCategory')->getList(['stat' => 0, 'siteid' => $this->siteid,'isshow'=>1, 'country_code' => $this->country_code], ['sort' => 'asc', 'id' => 'asc'], ['id', 'pid', 'haschild', 'name', 'shortname', 'sort', 'description', 'isshow', 'recommend', 'picture', 'icon', 'image', 'm_icon', 'unique_id']);
// $this->categoryList = Loader::model('ProductCategory')->getList(['stat' => 0, 'siteid' => $this->siteid, 'isshow' => 1, 'country_code' => $this->country_code], ['sort' => 'asc', 'id' => 'asc'], ['id', 'pid', 'haschild', 'name', 'shortname', 'sort', 'description', 'isshow', 'recommend', 'picture', 'icon', 'image', 'm_icon', 'unique_id']);
$this->categoryList = \think\Db::name('product_category')->alias('pc')
->field([
'pc.id',
'pc.pid',
'pc.haschild',
'pc.name',
'pc.shortname',
'pc.sort',
'pc.description',
'pc.isshow',
'pc.recommend',
'pc.picture',
'pc.icon',
'pc.image',
'pc.m_icon',
'pc.unique_id'
])
->where('pc.stat', '=', 0)
->where('pc.siteid', '=', $this->siteid)
->where('pc.isshow', '=', 1)
->where('pc.haschild', '=', 0)
->where('pc.country_code', '=', $this->country_code)
->whereExists(function($query) {
$query->name('product')->alias('p')
->where('p.stat', '=', 0)
->where('p.is_show', '=', 0)
->where('p.country_code', '=', $this->country_code)
->where('p.cid=pc.id');
})
->union(function($query) {
$query->name('product_category')->alias('uni_pc')
->field([
'uni_pc.id',
'uni_pc.pid',
'uni_pc.haschild',
'uni_pc.name',
'uni_pc.shortname',
'uni_pc.sort',
'uni_pc.description',
'uni_pc.isshow',
'uni_pc.recommend',
'uni_pc.picture',
'uni_pc.icon',
'uni_pc.image',
'uni_pc.m_icon',
'uni_pc.unique_id'
])
->where('uni_pc.stat', '=', 0)
->where('uni_pc.siteid', '=', $this->siteid)
->where('uni_pc.isshow', '=', 1)
->where('uni_pc.haschild', '=', 1)
->where('uni_pc.country_code', '=', $this->country_code);
})
->order(['sort' => 'asc', 'id' => 'asc'])
->select();
$this->cacheTag('ProductCategoryTag')->set('productCategoryList', $this->categoryList);
}
$this->categoryList = collection($this->categoryList);
$this->productCategory = $this->buildTreeForCategory($this->categoryList, 0);
$this->productCategory = $this->list_to_tree($this->categoryList);
// tiaoshi($this->productCategory[0]['child'][0]['child']);die;
if ($this->cacheHas('country_list')) {
$this->country_list = $this->cacheGet('country_list');
@@ -89,6 +153,26 @@ class BaseController extends Controller {
$this->view->assign('allCategoryList', $this->categoryList);
}
// 组装分类树状结构
private function buildTreeForCategory($data, $pid=0)
{
$tree = [];
foreach ($data as $val) {
if ($val['pid'] == $pid) {
$children = $this->buildTreeForCategory($data, $val['id']);
if (!empty($children)) {
$val['child'] = $children;
}
if (empty($children) && $val['haschild'] == 1) {
continue;
}
$tree[] = $val;
}
}
return $tree;
}
protected function buildTree($data, $pid = 0)
{
$tree = [];
@@ -131,7 +215,8 @@ class BaseController extends Controller {
}
//导航初始化
private function navInit(){
private function navInit()
{
// 读取缓存数据
//$header = $this->cacheGet('cache_common_nav_header_key');
//$footer = $this->cacheGet('cache_common_nav_footer_key');
@@ -142,34 +227,30 @@ class BaseController extends Controller {
// 缓存没数据则从数据库重新读取,顶部菜单
//if(empty($header))
//{
$headerData = Loader::model('Navigation')->field($field)->where(array('nav_type'=>'header', 'stat'=>0, 'pid'=>0, 'country_code' => $this->country_code))->order('sort')->select();
$header = self::navDataDealWith($headerData);
if(!empty($header))
{
foreach($header as &$v)
{
$childData = Loader::model('Navigation')->field($field)->where(array('nav_type'=>'header', 'stat'=>0, 'pid'=>$v['id'], 'country_code' => $this->country_code))->order('sort')->select();
$v['items'] = self::navDataDealWith($childData);
}
$headerData = Loader::model('Navigation')->field($field)->where(array('nav_type' => 'header', 'stat' => 0, 'pid' => 0, 'country_code' => $this->country_code))->order('sort')->select();
$header = self::navDataDealWith($headerData);
if (!empty($header)) {
foreach ($header as &$v) {
$childData = Loader::model('Navigation')->field($field)->where(array('nav_type' => 'header', 'stat' => 0, 'pid' => $v['id'], 'country_code' => $this->country_code))->order('sort')->select();
$v['items'] = self::navDataDealWith($childData);
}
//$this->cacheSet('cache_common_nav_header_key', $header, 3600);
}
//$this->cacheSet('cache_common_nav_header_key', $header, 3600);
//}
// 底部导航
//if(empty($footer))
//{
$footerdata = Loader::model('Navigation')->field($field)->where(array('nav_type'=>'footer', 'stat'=>0, 'pid'=>0, 'country_code' => $this->country_code))->order('sort')->select();
$footer = self::navDataDealWith($footerdata);
if(!empty($footer))
{
foreach($footer as &$v)
{
$childData = Loader::model('Navigation')->field($field)->where(array('nav_type'=>'footer', 'stat'=>0, 'pid'=>$v['id'], 'country_code' => $this->country_code))->order('sort')->select();
$v['items'] = self::navDataDealWith($childData);
}
$footerdata = Loader::model('Navigation')->field($field)->where(array('nav_type' => 'footer', 'stat' => 0, 'pid' => 0, 'country_code' => $this->country_code))->order('sort')->select();
$footer = self::navDataDealWith($footerdata);
if (!empty($footer)) {
foreach ($footer as &$v) {
$childData = Loader::model('Navigation')->field($field)->where(array('nav_type' => 'footer', 'stat' => 0, 'pid' => $v['id'], 'country_code' => $this->country_code))->order('sort')->select();
$v['items'] = self::navDataDealWith($childData);
}
//$this->cacheSet('cache_common_nav_footer_key', $footer, 3600);
}
//$this->cacheSet('cache_common_nav_footer_key', $footer, 3600);
//}
return [
@@ -187,13 +268,10 @@ class BaseController extends Controller {
*/
public function NavDataDealWith($data)
{
if(!empty($data) && is_array($data))
{
foreach($data as $k=>&$v)
{
if (!empty($data) && is_array($data)) {
foreach ($data as $k => &$v) {
// url处理
switch($v['data_type'])
{
switch ($v['data_type']) {
// 文章分类
case 'article':
$v['url'] = 'article/detail/'.$v['value'].'.html';
@@ -208,11 +286,10 @@ class BaseController extends Controller {
case 'goods_category':
$category = Loader::model('ProductCategory')->getRow(['stat' => 0, 'id' => $v['value'], 'country_code' => $this->country_code], null, ['id' => 'asc']);
//echo $category['pid']."<pre>=="; print_r($category);
if($category['pid'] == 0) {
$v['url'] = 'product/catelists/'.$v['value'].'.html';
}
else{
$v['url'] = 'product/subcategory/'.$v['value'].'.html';
if ($category['pid'] == 0) {
$v['url'] = 'product/catelists/' . $v['value'] . '.html';
} else {
$v['url'] = 'product/subcategory/' . $v['value'] . '.html';
}
break;
}
@@ -263,12 +340,12 @@ class BaseController extends Controller {
private function check_login_token($customer_id, $curr_time, $p)
{
$expire = 86400 * 30;
if (time() - $curr_time > $expire)
if (time() - $curr_time > $expire) {
return false;
}
$temp_p = $this->make_pwd($customer_id, $curr_time);
if ($temp_p !== $p)
{
if ($temp_p !== $p) {
return false;
}
@@ -309,8 +386,7 @@ class BaseController extends Controller {
protected function check_true_login()
{
// 校验用户是否登录,且校验cookie合法性
if (!$this->check_login())
{
if (!$this->check_login()) {
return false;
}
@@ -323,8 +399,9 @@ class BaseController extends Controller {
protected function _logout()
{
if (Cookie::has('c'))
if (Cookie::has('c')) {
Cookie::delete('c');
}
$this->customer_id = 0;
}

View File

@@ -36,18 +36,16 @@ class Group extends BaseController
{
return $this->view->fetch();
}
public function backup_treasure()
{
return $this->view->fetch();
}
public function backup_treasure()
{
return $this->view->fetch();
}
public function pssd()
{
return $this->view->fetch();
}
public function question()
{
$data = $this->request->param();
@@ -57,33 +55,32 @@ class Group extends BaseController
'a.country_code' => $this->country_code,
];
$cid = isset($data['cid']) ? $data['cid'] : 0;
if ($cid)
if ($cid) {
$where['a.cid'] = $cid;
}
$search['keyword'] = '';
if (isset($data['keyword']) && $data['keyword'] != '')
{
$where['a.title'] = ['like', '%' . $data['keyword'] . '%'];
if (isset($data['keyword']) && $data['keyword'] != '') {
$where['a.title'] = ['like', '%' . $data['keyword'] . '%'];
$search['keyword'] = $data['keyword'];
}
$order = [
'a.sort' => 'asc',
'a.id' => 'desc'
'a.sort' => 'asc',
'a.id' => 'desc',
];
$field = ['a.*', 'b.name' => 'cate_name'];
$question_list = model('question')->alias('a')->join('question_category b', 'a.cid = b.id', 'LEFT')->where($where)->order($order)->field($field)->paginate(4);
// echo model('question')->getLastSql();die;
// tiaoshi($question_list->items());die;
$question_catelist = model('question_category')->where(['stat' => 0])->select();
$value = [
'question_list' => $question_list->isEmpty() ? null : $question_list->items(),
'page' => $question_list->render(),
'cid' => $cid,
'search' => $search,
'question_catelist' => $question_catelist
$value = [
'question_list' => $question_list->isEmpty() ? null : $question_list->items(),
'page' => $question_list->render(),
'cid' => $cid,
'search' => $search,
'question_catelist' => $question_catelist,
];
$this->assign($value);
@@ -104,7 +101,7 @@ class Group extends BaseController
{
return $this->view->fetch();
}
public function responsibility()
public function responsibility()
{
return $this->view->fetch();
}
@@ -128,7 +125,6 @@ class Group extends BaseController
return $this->view->fetch();
}
public function search()
{
return $this->view->fetch();
@@ -139,7 +135,6 @@ class Group extends BaseController
return $this->view->fetch();
}
public function headset()
{
return $this->view->fetch();
@@ -195,113 +190,127 @@ class Group extends BaseController
{
return $this->view->fetch();
}
public function thunderbolt_3 ()
public function thunderbolt_3()
{
return $this->view->fetch();
}
public function customized ()
public function customized()
{
return $this->view->fetch();
}
/********20230720 顶部导航栏目************/
public function blog2023(){
public function blog2023()
{
return $this->view->fetch();
return $this->view->fetch();
}
public function brand2023(){
public function brand2023()
{
return $this->view->fetch();
return $this->view->fetch();
}
public function brand(){
public function brand()
{
return $this->view->fetch();
return $this->view->fetch();
}
public function Contact2023(){
public function Contact2023()
{
return $this->view->fetch();
return $this->view->fetch();
}
public function product2023(){
public function product2023()
{
return $this->view->fetch();
return $this->view->fetch();
}
public function catelists2023(){
public function catelists2023()
{
return $this->view->fetch();
return $this->view->fetch();
}
public function download(){
public function download()
{
return $this->view->fetch();
return $this->view->fetch();
}
public function achievement(){
public function achievement()
{
return $this->view->fetch();
return $this->view->fetch();
}
public function business2023(){
public function business2023()
{
return $this->view->fetch();
return $this->view->fetch();
}
public function distributor2023(){
public function distributor2023()
{
return $this->view->fetch();
return $this->view->fetch();
}
public function introduction2023(){
public function introduction2023()
{
return $this->view->fetch();
return $this->view->fetch();
}
public function faq(){
public function faq()
{
$where = ['stat' => 0];
$order = [
'sort' => 'asc',
'id' => 'desc'
];
$fq_list = model('fq')->where($where)->order($order)->paginate(6);
// echo model('question')->getLastSql();die;
// tiaoshi($question_list->items());die;
$where = ['stat' => 0];
$order = [
'sort' => 'asc',
'id' => 'desc',
];
$fq_list = model('fq')->where($where)->order($order)->paginate(6);
// echo model('question')->getLastSql();die;
// tiaoshi($question_list->items());die;
$value = [
'fq_list' => $fq_list->isEmpty() ? null : $fq_list->items(),
'page' => $fq_list->render(),
$value = [
'fq_list' => $fq_list->isEmpty() ? null : $fq_list->items(),
'page' => $fq_list->render(),
];
$this->assign($value);
return $this->view->fetch();
];
$this->assign($value);
return $this->view->fetch();
}
public function mileage(){
$arg_where = ['a.siteid' => $this->siteid, 'a.country_code' => $this->country_code];
$arg_order = ['a.id' => 'desc'];
$arg_field = ['a.id', 'a.cid', 'a.name', 'a.sort', 'a.headline', 'a.ishot', 'a.recommend', 'a.writer', 'a.source', 'a.viewcount', 'a.zancount', 'a.commentcount', 'a.description', 'a.picture', 'a.tags', 'a.createtime', 'c.id' => 'categoryid', 'c.name' => 'categoryname'];
$dataObject = model('Article')->getCateArticleLists($arg_where, $arg_order, $arg_field, 12);
public function mileage()
{
$arg_where = ['a.siteid' => $this->siteid, 'a.country_code' => $this->country_code];
$arg_order = ['a.id' => 'desc'];
$arg_field = ['a.id', 'a.cid', 'a.name', 'a.sort', 'a.headline', 'a.ishot', 'a.recommend', 'a.writer', 'a.source', 'a.viewcount', 'a.zancount', 'a.commentcount', 'a.description', 'a.picture', 'a.tags', 'a.createtime', 'c.id' => 'categoryid', 'c.name' => 'categoryname'];
$dataObject = model('Article')->getCateArticleLists($arg_where, $arg_order, $arg_field, 12);
$category = model('ArticleCategory')->getRow(1);
$category = model('ArticleCategory')->getRow(1);
$value = [
'list' => $dataObject->isEmpty() ? null : $dataObject->items(), //$dataObject->getCollection()->toArray()
'page' => $dataObject->render(),
'category' => $category,
];
$value = [
'list' => $dataObject->isEmpty() ? null : $dataObject->items(), //$dataObject->getCollection()->toArray()
'page' => $dataObject->render(),
'category' => $category,
];
//echo "<pre>=="; print_r($category);
$this->assign($value);
//echo "<pre>=="; print_r($category);
$this->assign($value);
return $this->view->fetch();
return $this->view->fetch();
}
public function guide(){
public function guide()
{
return $this->view->fetch();
return $this->view->fetch();
}
public function query()
{
public function query(){
return $this->view->fetch();
return $this->view->fetch();
}
public function contact(){
public function contact()
{
$banners = Loader::model("Banner")->alias('b')->field([
'b.id',
'b.typeid',
@@ -348,39 +357,43 @@ class Group extends BaseController
return $this->view->fetch();
}
public function tutorial(){
return $this->view->fetch();
}
public function distributor(){
return $this->view->fetch();
}
public function business(){
return $this->view->fetch();
}
public function introduction(){
return $this->view->fetch();
}
public function test ()
public function tutorial()
{
$field = ['a.*', 'b.name', 'b.shortname', 'b.brand_id', 'b.url_tm', 'b.url_jd'];
return $this->view->fetch();
}
public function distributor()
{
return $this->view->fetch();
}
public function business()
{
return $this->view->fetch();
}
public function introduction()
{
return $this->view->fetch();
}
public function test()
{
$field = ['a.*', 'b.name', 'b.shortname', 'b.brand_id', 'b.url_tm', 'b.url_jd'];
$special_product_list = db('special_product_relation')->alias('a')->join('product b', 'a.product_id=b.id', 'LEFT')->where(['a.special_id' => 3, 'a.stat' => 0, 'b.stat' => 0])->field($field)->limit(8)->select();
$normal_product = [];
$normal_product = [];
$special_product = [];
foreach ($special_product_list as $key => $value) {
$product_two_img = model('product_two_img')->where(['stat' => 0, 'product_id' => $value['product_id']])->find();
$value['img'] = $product_two_img['image_url'];
if ($value['type'] == 0)
$value['img'] = $product_two_img['image_url'];
if ($value['type'] == 0) {
array_push($normal_product, $value);
else if ($value['type'] == 1)
} else if ($value['type'] == 1) {
array_push($special_product, $value);
}
}
// tiaoshi($normal_product);
// tiaoshi($special_product);die;
@@ -389,60 +402,74 @@ class Group extends BaseController
$this->assign('special_product', $special_product);
return $this->view->fetch();
}
public function report()
public function report()
{
if ($this->customer_id <= 0)
if ($this->customer_id <= 0) {
$this->redirect('/login.html');
}
return $this->view->fetch();
}
public function create_report()
{
if ($this->customer_id <= 0)
if ($this->customer_id <= 0) {
return $this->json(-100, '请先登录');
}
$data = $this->request->post();
if (empty($data) || !is_array($data))
if (empty($data) || !is_array($data)) {
return $this->json(-1, '数据错误');
}
if ($data['product_name'] == '')
if ($data['product_name'] == '') {
return $this->json(-2, '产品名称不能为空');
if ($data['product_model'] == '')
}
if ($data['product_model'] == '') {
return $this->json(-3, '产品型号不能为空');
if ($data['product_manufacturer'] == '')
}
if ($data['product_manufacturer'] == '') {
return $this->json(-4, '厂商不能为空');
}
// if ($data['buy_source'] == '')
// return $this->json(-5, '购买渠道不能为空');
if ($data['customer_telephone'] != '' && !preg_match("/^1([38][0-9]|4[579]|5[0-3,5-9]|6[6]|7[0135678]|9[89])\d{8}$/", $data['customer_telephone']))
if ($data['customer_telephone'] != '' && !preg_match("/^1([38][0-9]|4[579]|5[0-3,5-9]|6[6]|7[0135678]|9[89])\d{8}$/", $data['customer_telephone'])) {
return $this->json(-6, '手机格式错误');
if ($data['customer_email'] != '' && !preg_match("/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,})$/", $data['customer_email']))
}
if ($data['customer_email'] != '' && !preg_match("/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,})$/", $data['customer_email'])) {
return $this->json(-7, '邮箱格式错误');
}
$insert_data = [
'customer_id' => $this->customer_id,
'product_name' => $data['product_name'],
'product_model' => $data['product_model'],
'product_manufacturer' => $data['product_manufacturer'],
'buy_source' => $data['buy_source'],
'product_price' => floatval($data['product_price']),
'customer_name' => $data['customer_name'],
'customer_email' => $data['customer_email'],
'customer_telephone' => $data['customer_telephone'],
'description' => $data['description'],
'create_time' => time(),
'customer_id' => $this->customer_id,
'product_name' => $data['product_name'],
'product_model' => $data['product_model'],
'product_manufacturer' => $data['product_manufacturer'],
'buy_source' => $data['buy_source'],
'product_price' => floatval($data['product_price']),
'customer_name' => $data['customer_name'],
'customer_email' => $data['customer_email'],
'customer_telephone' => $data['customer_telephone'],
'description' => $data['description'],
'create_time' => time(),
];
$result = model('report')->insert($insert_data);
if (!$result)
if (!$result) {
return $this->json(-8, '提交失败');
}
return $this->json(200, 'ok');
}
public function job()
{
$sql = "SELECT * FROM cod_job
$sql = "SELECT * FROM cod_job
WHERE stat=0
AND NOW() >= publish_time
AND NOW() <= end_time
@@ -457,16 +484,18 @@ class Group extends BaseController
{
$data = $this->request->post();
//$this->verify_check($data['captcha'], 'authcode') || $this->error('验证码有误', url('group/test'));
$sn = $data['sn'];//dump($sn);die;
$sn = $this->https_request('http://mes.orico.com.cn:8084/api/values/',$sn);dump($sn);die;
$sn = $data['sn']; //dump($sn);die;
$sn = $this->https_request('http://mes.orico.com.cn:8084/api/values/', $sn);
dump($sn);die;
}
//CURL POST请求
function https_request($url, $data = null) {
$apiUrl = "$url$data";//print_r($apiUrl);die;
$oCurl = curl_init();
if(stripos($apiUrl,"https://")!==FALSE){
curl_setopt($oCurl, CURLOPT_SSL_VERIFYPEER, FALSE);
public function https_request($url, $data = null)
{
$apiUrl = "$url$data"; //print_r($apiUrl);die;
$oCurl = curl_init();
if (stripos($apiUrl, "https://") !== false) {
curl_setopt($oCurl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($oCurl, CURLOPT_SSL_VERIFYHOST, false);
}
curl_setopt($oCurl,CURLOPT_TIMEOUT,5);
@@ -485,7 +514,8 @@ class Group extends BaseController
}
}
//可以发送get和post的请求方式
function curl_request($url,$method='get',$data=null,$https=true){
public function curl_request($url, $method = 'get', $data = null, $https = true)
{
//1.初识化curl
$ch = curl_init($url);
//2.根据实际请求需求进行参数封装
@@ -504,7 +534,8 @@ class Group extends BaseController
curl_setopt($ch,CURLOPT_POSTFIELDS,$data);
}
//3.发送请求
$result = curl_exec($ch);dump($result);die;
$result = curl_exec($ch);
dump($result);die;
//4.返回返回值,关闭连接
curl_close($ch);
return $result;
@@ -519,12 +550,16 @@ class Group extends BaseController
* @param int $flag 标志位
* @return string 返回的资源内容
*/
public function post($url, $keysArr, $flag = 0){
public function post($url, $keysArr, $flag = 0)
{
$ch = curl_init();
if(! $flag) curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_POST, TRUE);
if (!$flag) {
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
}
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $keysArr);
curl_setopt($ch, CURLOPT_URL, $url);
$ret = curl_exec($ch);

View File

@@ -107,6 +107,7 @@ class Product extends BaseController {
$value['seo_title'] = $category['seo_title']? : config('website_seo_title');
$value['seo_keyword'] = $category['seo_keyword']? : config('website_seo_keyword');
$value['seo_description'] = $category['seo_description']? : config('website_seo_description');
$this->assign($value);
return $this->fetch($template);
}
@@ -310,6 +311,7 @@ class Product extends BaseController {
->where('links.country_code', '=', $this->country_code)
->select();
$this->assign('purchase_links', $purchase_links);
//dump($value['product_relateds']);die;
return $this->fetch($template);
} else {

View File

@@ -50,8 +50,7 @@
$skuAttr = $images['image_color']; //获取多属性标签
}
else{
} else {
if ($color){
$images = $product_images[$color];
} else {
@@ -200,7 +199,7 @@
if($isColor){
//判断颜色属性取值【中文文字、色值、色块图英文名称】
$firstChar = substr($attrValue, 0, 1);
$colorFile = 'https://cc.f2b211.com/uploads/color/' .strtolower($attrValue). '.jpg';
$colorFile = 'https://cc.f2b211.com/static/colors/' .strtolower($attrValue). '.png';
if($kl == 0){
//判断为颜色色值RGB
@@ -225,7 +224,7 @@
elseif($colorType == 2){
if(isset($productColor[strtoupper($attrValue)])) {
if($attrValue == 'GD'||$attrValue == 'GR'||$attrValue == 'SV'||$attrValue == 'RG'||$attrValue == 'CO'||$attrValue == 'WD'){
echo '<li class="item attr_value tip1 '.$firstClass.'" data-type="'.$ka.'" data-value="'.trim($attrValue).'" data-feed="'.$productColor[$attrValue].'" data-tipso="'.$productColor[strtoupper($attrValue)].'"><a><img src="/uploads/color/'.$attrValue.'.jpg" alt="" style="width:20px; height: 20px; border-radius: 10px; "></a></li>';
echo '<li class="item attr_value tip1 '.$firstClass.'" data-type="'.$ka.'" data-value="'.trim($attrValue).'" data-feed="'.$productColor[$attrValue].'" data-tipso="'.$productColor[strtoupper($attrValue)].'"><a><img src="/static/colors/'.$attrValue.'.png" alt="" style="width:20px; height: 20px; border-radius: 10px; "></a></li>';
}
else{
@@ -244,7 +243,7 @@
?>
<li class="item attr_value inner tip1 <?php echo $firstClass;?>" data-tipso="<?php echo strtoupper($attrValue);?>" data-type="<?php echo trim($ka);?>" data-value="<?php echo trim($attrValue);?>">
<a>
<img src="<?php echo '/uploads/color/'.strtolower($attrValue);?>.jpg" alt="" style="width:20px; height: 20px; border-radius: 10px; ">
<img src="<?php echo '/static/colors/'.strtolower($attrValue);?>.png" alt="" style="width:20px; height: 20px; border-radius: 10px; ">
</a>
</li>
<?php
@@ -360,7 +359,7 @@
<!--产品详情-->
<div class="products_des"><?php echo $detail['ld_md_content']; ?></div>
</div>
<!-- 关联产品 s <?php //if ($product_relateds)print_r($product_relateds); ?>-->
<!-- 关联产品 s <?php //if ($product_relateds)print_r($product_relateds); ?>-->
<?php if ($product_relateds): ?>
<div class="warp2 proTfg">
<div class="swt-Container">
@@ -627,6 +626,9 @@
margin-top: 0px !important;
}
.hd .co-bg {
width: 20px;
}
</style>
<script>
$(function () {
@@ -730,8 +732,7 @@ $(function() {
function skuAttrType(){
// 获取规格值
var spec = [];
$('.hd .on').each(function()
{
$('.hd .on').each(function() {
var typeName = $(this).data('type');
var selected = {};

View File

@@ -58,7 +58,7 @@
<?php
if(!$imglist['image_color']==''){
if(strlen($imglist['image_color']) == 2){
$colorImg = '/uploads/product/'.trim($imglist['image_color']).'.jpg';
$colorImg = '/static/colors/'.trim($imglist['image_color']).'.png';
}else{
$colorImg = $imglist['image_color'];
}
@@ -130,7 +130,7 @@
<?php
if(!$imglist['image_color']==''){
if(strlen($imglist['image_color']) == 2){
$colorImg = '/uploads/product/'.trim($imglist['image_color']).'.jpg';
$colorImg = '/static/colors/'.trim($imglist['image_color']).'.png';
}else{
$colorImg = $imglist['image_color'];
}

View File

@@ -256,8 +256,9 @@ class BaseController extends Controller {
private function check_login_token($customer_id, $curr_time, $p)
{
$expire = 86400 * 30;
if (time() - $curr_time > $expire)
if (time() - $curr_time > $expire) {
return false;
}
$temp_p = $this->make_pwd($customer_id, $curr_time);
if ($temp_p !== $p)
@@ -316,8 +317,9 @@ class BaseController extends Controller {
protected function _logout()
{
if (Cookie::has('c'))
if (Cookie::has('c')) {
Cookie::delete('c');
}
$this->customer_id = 0;
}

View File

@@ -15,6 +15,7 @@ class Antifake extends BaseController
{
public function index()
{
$this->redirect("https://anti-fake-checking.com/index");
return $this->view->fetch();
}

View File

@@ -17,6 +17,14 @@ class BaseController extends Controller {
protected $country_code = 'US';
protected $customer_info = [];
protected $categoryList = [];
protected $country_list = [];
protected $productCategory = [];
protected $nav_header = [];
protected $nav_footer = [];
public function __construct() {
parent::__construct();
}
@@ -52,11 +60,66 @@ class BaseController extends Controller {
$this->view->assign('seo_description', (string) Config::get('website_seo_description'));
//$this->categoryList = $this->cacheGet('productCategoryList');
if (empty($this->productCategory)) {
$this->categoryList = Loader::model('ProductCategory')->getList(['stat' => 0, 'siteid' => $this->siteid,'isshow'=>1, 'country_code' => $this->country_code], ['sort' => 'asc', 'id' => 'asc'], ['id', 'pid', 'haschild', 'name', 'shortname', 'sort', 'description', 'isshow', 'recommend', 'picture', 'icon', 'image', 'm_icon', 'unique_id']);
// $this->categoryList = Loader::model('ProductCategory')->getList(['stat' => 0, 'siteid' => $this->siteid,'isshow'=>1, 'country_code' => $this->country_code], ['sort' => 'asc', 'id' => 'asc'], ['id', 'pid', 'haschild', 'name', 'shortname', 'sort', 'description', 'isshow', 'recommend', 'picture', 'icon', 'image', 'm_icon', 'unique_id']);
$this->categoryList = \think\Db::name('product_category')->alias('pc')
->field([
'pc.id',
'pc.pid',
'pc.haschild',
'pc.name',
'pc.shortname',
'pc.sort',
'pc.description',
'pc.isshow',
'pc.recommend',
'pc.picture',
'pc.icon',
'pc.image',
'pc.m_icon',
'pc.unique_id'
])
->where('pc.stat', '=', 0)
->where('pc.siteid', '=', $this->siteid)
->where('pc.isshow', '=', 1)
->where('pc.haschild', '=', 0)
->where('pc.country_code', '=', $this->country_code)
->whereExists(function ($query) {
$query->name('product')->alias('p')
->where('p.stat', '=', 0)
->where('p.is_show', '=', 0)
->where('p.country_code', '=', $this->country_code)
->where('p.cid=pc.id');
})
->union(function ($query) {
$query->name('product_category')->alias('uni_pc')
->field([
'uni_pc.id',
'uni_pc.pid',
'uni_pc.haschild',
'uni_pc.name',
'uni_pc.shortname',
'uni_pc.sort',
'uni_pc.description',
'uni_pc.isshow',
'uni_pc.recommend',
'uni_pc.picture',
'uni_pc.icon',
'uni_pc.image',
'uni_pc.m_icon',
'uni_pc.unique_id'
])
->where('uni_pc.stat', '=', 0)
->where('uni_pc.siteid', '=', $this->siteid)
->where('uni_pc.isshow', '=', 1)
->where('uni_pc.haschild', '=', 1)
->where('uni_pc.country_code', '=', $this->country_code);
})
->order(['sort' => 'asc', 'id' => 'asc'])
->select();
$this->cacheTag('ProductCategoryTag')->set('productCategoryList', $this->categoryList);
}
$this->categoryList = collection($this->categoryList);
$this->productCategory = $this->buildTreeForCategory($this->categoryList, 0);
if ($this->cacheHas('country_list')) {
$this->country_list = $this->cacheGet('country_list');
@@ -89,11 +152,30 @@ class BaseController extends Controller {
//echo $product_country_code."<pre>=="; print_r($this->nav_header);die;
//echo Loader::model('banner')->getlastsql();
$this->productCategory = $this->list_to_tree($this->categoryList);
$this->view->assign('productCategory', $this->productCategory);
$this->view->assign('allCategoryList', $this->categoryList);
}
// 组装分类树状结构
private function buildTreeForCategory($data, $pid = 0)
{
$tree = [];
foreach ($data as $val) {
if ($val['pid'] == $pid) {
$children = $this->buildTreeForCategory($data, $val['id']);
if (!empty($children)) {
$val['child'] = $children;
}
if (empty($children) && $val['haschild'] == 1) {
continue;
}
$tree[] = $val;
}
}
return $tree;
}
//导航初始化
private function navInit(){
// 读取缓存数据
@@ -171,7 +253,9 @@ class BaseController extends Controller {
// 商品分类
case 'goods_category':
$category = Loader::model('ProductCategory')->getRow(['stat' => 0, 'id' => $v['value'], 'country_code' => $this->country_code], null, ['id' => 'asc']);
if (empty($category)) {
continue;
}
if($category['pid'] == 0) {
$v['url'] = '/product/catelists/'.$v['value'].'.html';
}
@@ -184,6 +268,7 @@ class BaseController extends Controller {
$data[$k] = $v;
}
unset($v);
}
return $data;

View File

@@ -164,8 +164,7 @@ class Product extends BaseController {
if (empty($detail)) {
return exception('数据有误,请检查后再操作');
}
$category = Loader::model('ProductCategory')->getRow($detail['cid']);
$category = Loader::model('ProductCategory')->getRow($detail['cid']);
$cid = Loader::model('ProductCategory')->getRow($category['pid']);
$pid = Loader::model('ProductCategory')->getRow($cid['pid']);

View File

@@ -281,14 +281,14 @@
if($isColor){
//判断颜色属性取值【中文文字、色值、色块图英文名称】
$firstChar = substr($attrValue, 0, 1);
$colorFile = 'https://cc.f2b211.com/uploads/color/' .strtolower($attrValue). '.jpg';
$colorFile = 'https://cc.f2b211.com/static/colors/' .strtolower($attrValue). '.png';
if($kl == 0){
//判断为颜色色值RGB
if($firstChar == '#'){
$colorType = 1;
}
elseif(strlen($attrValue) ==2){
elseif(strlen($attrValue) == 2){
$colorType = 2;
}
//判断颜色色块图片是否存在
@@ -307,7 +307,7 @@
elseif($colorType == 2){
if(isset($productColor[strtoupper($attrValue)])) {
if($attrValue == 'GD'||$attrValue == 'GR'||$attrValue == 'SV'||$attrValue == 'RG'||$attrValue == 'CO'||$attrValue == 'WD'){
echo '<li class="item attr_value tip1 '.$firstClass.'" data-feed="'.$productColor[$attrValue].'" data-type="'.$ka.'" data-value="'.trim($attrValue).'" data-tipso="'.$productColor[strtoupper($attrValue)].'"><a><img src="/uploads/color/'.$attrValue.'.jpg" alt="" style="width:20px; height: 20px; border-radius: 10px; "></a></li>';
echo '<li class="item attr_value tip1 '.$firstClass.'" data-feed="'.$productColor[$attrValue].'" data-type="'.$ka.'" data-value="'.trim($attrValue).'" data-tipso="'.$productColor[strtoupper($attrValue)].'"><a><img src="/static/colors/'.$attrValue.'.png" alt="" style="width:20px; height: 20px; border-radius: 10px; "></a></li>';
}
else{
@@ -716,7 +716,7 @@
</div>
<!-- 关联产品 s <?php //if ($product_relateds)print_r($product_relateds); ?>-->
<!-- 关联产品 s <?php //if ($product_relateds)print_r($product_relateds); ?>-->
<?php if ($product_relateds): ?>
<div class="warp2 proTfg">
<div class="swt-Container">
@@ -779,184 +779,281 @@
<!-- 相关下载 s -->
<?php if (!$product_dls) { ?>
<?php } else { ?>
<div class="nybox proTfg">
<div class="swt-Container">
<div class="sptit" id="link3">Related Download</div>
<?php
if ($product_dls):
$selectTypeArr = config("product_dltype");
$prodls = [];
foreach ($product_dls as $dlrow) {
$prodls[$dlrow['dl_type']][] = $dlrow;
}
?>
<?php foreach ($prodls as $type => $dlclrs): ?>
<div class="xz">
<p class="xztit"><?php echo isset($selectTypeArr[$type]) ? $selectTypeArr[$type] : ''; ?></p>
<?php foreach ($dlclrs as $dl): ?>
<p class="xz1"><a
href="<?php echo url('us/download/prodownload', ['id' => $dl['id']]); ?>"><i></i><?php echo $dl['dl_name']; ?>
</a></p>
<?php endforeach; ?>
<!-- 相关下载 s -->
<?php if (!$product_dls) { ?>
<?php } else { ?>
<div class="nybox proTfg">
<div class="swt-Container">
<div class="sptit" id="link3">Related Download</div>
<?php
if ($product_dls):
$selectTypeArr = config("product_dltype");
$prodls = [];
foreach ($product_dls as $dlrow) {
$prodls[$dlrow['dl_type']][] = $dlrow;
}
?>
<?php foreach ($prodls as $type => $dlclrs): ?>
<div class="xz">
<p class="xztit"><?php echo isset($selectTypeArr[$type]) ? $selectTypeArr[$type] : ''; ?></p>
<?php foreach ($dlclrs as $dl): ?>
<p class="xz1"><a
href="<?php echo url('us/download/prodownload', ['id' => $dl['id']]); ?>"><i></i><?php echo $dl['dl_name']; ?>
</a></p>
<?php endforeach; ?>
</div>
<?php endforeach; ?>
<?php endif; ?>
</div>
<?php endforeach; ?>
<?php endif; ?>
</div>
</div>
<?php } ?>
</div>
<?php } ?>
<style>
<style>
/*点击弹框*/
.popup-quick {
width: 48rem;
position: fixed;
top: 35%;
margin-top: -235px;
left: 45%;
margin-left: -235px;
background-color: #fff;
z-index: 9999;
box-shadow: 0px 2px 5px rgba(255, 255, 255, 0.2);
color: #333;
border-radius: 0.05rem;
}
/*点击弹框*/
.popup-quick {
width: 48rem;
position: fixed;
top: 35%;
margin-top: -235px;
left: 45%;
margin-left: -235px;
background-color: #fff;
z-index: 9999;
box-shadow: 0px 2px 5px rgba(255, 255, 255, 0.2);
color: #333;
border-radius: 0.05rem;
}
.popup-quick .popup-app {
font-size: 0.14rem;
color: #333;
line-height: 22px;
padding: 30px 40px;
text-align: center;
}
.popup-quick .business-close {
width: 24px;
height: 24px;
position: absolute;
top: 20px;
right: 20px;
cursor: pointer;
}
.popup-quick .popup-business-logo img {
width: 1.5rem;
height: 1.5rem;
margin-left: 0.9rem;
}
.title-text {
font-size: 26px;
color: #101010;
font-weight: 600;
text-align: center;
padding: 34px 0;
}
.marsk-container {
background: rgba(0, 0, 0, 0.8);
display: none;
position: absolute;
position: fixed;
top: 0;
right: 0;
left: 0;
bottom: 0px;
z-index: 999;
}
.detail_form input {
height: 2.75rem;
line-height: 2.75rem;
padding: 0 0.625rem;
margin-top: 0.625rem;
border: 1px solid #dbdbdb;
display: inline-block;
}
.detail_form select {
height: 2.75rem;
line-height: 2.75rem;
padding: 0 0.625rem;
margin-top: 0.625rem;
border: 1px solid #dbdbdb;
display: inline-block;
}
.detail_form textarea {
padding: 0.225rem 0.5rem;
margin-top: 0.625rem;
border: 1px solid #dbdbdb;
display: inline-block;
}
.apply_form textarea {
padding: 0.225rem;
margin-top: 0.625rem;
border: 1px solid #dbdbdb;
display: inline-block;
}
.apply_content{ width: 43.75rem; height: auto; margin: 0 auto;}
.form_title{ width: 43.75rem; height:1.875rem; line-height: 2rem; text-align: center; padding: 3.125rem 0; font-size: 1.5rem; font-weight: bold; color: #000000;}
.apply_form p{ color: #252525; font-size: 0.875rem; font-weight: bold;}
.apply_form input{ width: calc( 100% - 1.25rem ); height: 2.75rem; line-height: 2.75rem; padding: 0 0.625rem; margin-top: 0.625rem; border: 1px solid #DBDBDB;}
.apply_form .name>div{ float: left; width: calc( (100% - 1.25rem)/2 );}
.check_box, .radio_box{ margin-top: 0.9375rem;}
.check_box ul li, .radio_box ul li{ color: #252525; font-size: 0.875rem; font-weight: 400; margin-bottom: 0.625rem; line-height: 1.25rem;}
.check_box ul li i{ display: block; float: left; width: 1rem; height: 1rem; border: 1px solid #cccccc; border-radius: 0.125rem; margin-right: 0.625rem;}
.checked i::before{ background: url(../img/check.png); width: 1rem; height: 1rem; display: block; content: '';}
.radio_box ul li i{ display: block; float: left; width: 1rem; height: 1rem; border: 1px solid #cccccc; border-radius: 50%; margin-right: 0.625rem;}
.submit_btn{ margin: 0 auto; width: 15rem; height: 2.5rem; line-height: 2.5rem; background: #009FDF; color: #ffffff; text-align: center; cursor: pointer; margin-bottom: 5.625rem;}
.radio i::before{ background: url(../img/radio.png); width: 1rem; height: 1rem; display: block; content: '';}
.popup-quick .popup-app {
font-size: 0.14rem;
color: #333;
line-height: 22px;
padding: 30px 40px;
text-align: center;
}
.detail-w {
width: 40%;
}
.detail-w02 {
width: 45%;
}
.detail-w01 {
width: 90%;
}
.detail-w02 {
width: 100%;
}
.detail_form .name > div {
float: left;
width: calc((100% - 1.25rem) / 2);
}
.popup-quick .business-close {
width: 24px;
height: 24px;
position: absolute;
top: 20px;
right: 20px;
cursor: pointer;
}
.popup-quick .popup-business-logo img {
width: 1.5rem;
height: 1.5rem;
margin-left: 0.9rem;
}
</style>
<script>
.title-text {
font-size: 26px;
color: #101010;
font-weight: 600;
text-align: center;
padding: 34px 0;
}
$(function() {
$('.tip1').tipso({
useTitle: false
});
});
.marsk-container {
background: rgba(0, 0, 0, 0.8);
display: none;
position: absolute;
position: fixed;
top: 0;
right: 0;
left: 0;
bottom: 0px;
z-index: 999;
}
</script>
<!-- 相关下载 e -->
<script type="text/javascript">
.detail_form input {
height: 2.75rem;
line-height: 2.75rem;
padding: 0 0.625rem;
margin-top: 0.625rem;
border: 1px solid #dbdbdb;
display: inline-block;
}
$(function () {
var attributes = JSON.parse('<?php echo json_encode($product_attr);?>');
var pictures = JSON.parse('<?php echo json_encode($product_images);?>');
.detail_form select {
height: 2.75rem;
line-height: 2.75rem;
padding: 0 0.625rem;
margin-top: 0.625rem;
border: 1px solid #dbdbdb;
display: inline-block;
}
//多属性选择及绑定事件
$(".hd .attr_item").click(function(){
$(this).siblings().removeClass('on');
$(this).toggleClass('on');
.detail_form textarea {
padding: 0.225rem 0.5rem;
margin-top: 0.625rem;
border: 1px solid #dbdbdb;
display: inline-block;
}
var attrVal = $(this).data('feed');
if($(this).hasClass("on")){
$(this).parents(".hd").find(".selectedAttr").text(attrVal);
}
else{
.apply_form textarea {
padding: 0.225rem;
margin-top: 0.625rem;
border: 1px solid #dbdbdb;
display: inline-block;
}
$(this).parents(".hd").find(".selectedAttr").html('');
}
.apply_content {
width: 43.75rem;
height: auto;
margin: 0 auto;
}
//验证是否所有属性全部选中
var skuCount = $('.attr_type').length;
var activeCount = $('.hd .on').length;
.form_title {
width: 43.75rem;
height: 1.875rem;
line-height: 2rem;
text-align: center;
padding: 3.125rem 0;
font-size: 1.5rem;
font-weight: bold;
color: #000000;
}
var productAttr = skuAttrType();
.apply_form p {
color: #252525;
font-size: 0.875rem;
font-weight: bold;
}
.apply_form input {
width: calc(100% - 1.25rem);
height: 2.75rem;
line-height: 2.75rem;
padding: 0 0.625rem;
margin-top: 0.625rem;
border: 1px solid #DBDBDB;
}
.apply_form .name>div {
float: left;
width: calc((100% - 1.25rem)/2);
}
.check_box,
.radio_box {
margin-top: 0.9375rem;
}
.check_box ul li,
.radio_box ul li {
color: #252525;
font-size: 0.875rem;
font-weight: 400;
margin-bottom: 0.625rem;
line-height: 1.25rem;
}
.check_box ul li i {
display: block;
float: left;
width: 1rem;
height: 1rem;
border: 1px solid #cccccc;
border-radius: 0.125rem;
margin-right: 0.625rem;
}
.checked i::before {
background: url(../img/check.png);
width: 1rem;
height: 1rem;
display: block;
content: '';
}
.radio_box ul li i {
display: block;
float: left;
width: 1rem;
height: 1rem;
border: 1px solid #cccccc;
border-radius: 50%;
margin-right: 0.625rem;
}
.submit_btn {
margin: 0 auto;
width: 15rem;
height: 2.5rem;
line-height: 2.5rem;
background: #009FDF;
color: #ffffff;
text-align: center;
cursor: pointer;
margin-bottom: 5.625rem;
}
.radio i::before {
background: url(../img/radio.png);
width: 1rem;
height: 1rem;
display: block;
content: '';
}
.detail-w {
width: 40%;
}
.detail-w02 {
width: 45%;
}
.detail-w01 {
width: 90%;
}
.detail-w02 {
width: 100%;
}
.detail_form .name>div {
float: left;
width: calc((100% - 1.25rem) / 2);
}
.hd .co-bg {
width: 20px;
}
</style>
<script>
$(function() {
$('.tip1').tipso({
useTitle: false
});
});
</script>
<!-- 相关下载 e -->
<script type="text/javascript">
$(function() {
var attributes = JSON.parse('<?php echo json_encode($product_attr); ?>');
var pictures = JSON.parse('<?php echo json_encode($product_images); ?>');
//多属性选择及绑定事件
$(".hd .attr_item").click(function() {
$(this).siblings().removeClass('on');
$(this).toggleClass('on');
var attrVal = $(this).data('feed');
if ($(this).hasClass("on")) {
$(this).parents(".hd").find(".selectedAttr").text(attrVal);
} else {
$(this).parents(".hd").find(".selectedAttr").html('');
}
//验证是否所有属性全部选中
var skuCount = $('.attr_type').length;
var activeCount = $('.hd .on').length;
var productAttr = skuAttrType();
if(activeCount == skuCount)
{
@@ -1383,48 +1480,57 @@ $(function() {
var spu = '<?php echo $detail['brand_id']; ?>';
//点击创建申请块
if(companyName && firstName && lastName && email && phone && country && industry && inquiry) {
var type = 'Agent';
//点击创建申请块
if (companyName && firstName && lastName && email && phone && country && industry && inquiry) {
var type = 'Agent';
$.ajax({
type: "POST",
url: "/us/inquiry/create",
data: {'company':companyName, 'email':email,'country':country,'name':firstName,'last_name':lastName,'phone':phone,'industry':industry,'inquiry':inquiry,'spu':spu,'refer':k_win_ref},
dataType: "json",
success: function(data){
if(data.code == 200) {
alert("Inquiry Add Success!");
location.href = '/us/Group/submission.html';
$.ajax({
type: "POST",
url: "/us/inquiry/create",
data: {
'company': companyName,
'email': email,
'country': country,
'name': firstName,
'last_name': lastName,
'phone': phone,
'industry': industry,
'inquiry': inquiry,
'spu': spu,
'refer': k_win_ref
},
dataType: "json",
success: function(data) {
if (data.code == 200) {
alert("Inquiry Add Success!");
location.href = '/us/Group/submission.html';
$(".marsk-container").hide();
$(".marsk-container").hide();
$("input[ type='text']").val('');
$('#country').val('');
$('#inquiry').val('');
$('#industry').val('');
$("input[ type='text']").val('');
$('#country').val('');
$('#inquiry').val('');
$('#industry').val('');
} else {
if (data.code == 403 || data.code == 201) {
alert(data.msg);
} else {
$('.email').addClass('error');
$('.email').next('span').removeClass('hide');
}
else{
if(data.code == 403 || data.code == 201) {
alert(data.msg);
}
else{
}
$('.email').addClass('error');
$('.email').next('span').removeClass('hide');
}
});
}
}
}
}
});
})
}
})
});
});
</script>

View File

@@ -59,7 +59,7 @@
<?php
if(!$imglist['image_color']==''){
if(strlen($imglist['image_color']) == 2){
$colorImg = '/uploads/product/'.trim($imglist['image_color']).'.jpg';
$colorImg = '/static/colors/'.trim($imglist['image_color']).'.png';
}else{
$colorImg = $imglist['image_color'];
}
@@ -114,7 +114,7 @@
<?php
if(!$imglist['image_color']==''){
if(strlen($imglist['image_color']) == 2){
$colorImg = '/uploads/product/'.trim($imglist['image_color']).'.jpg';
$colorImg = '/static/colors/'.trim($imglist['image_color']).'.png';
}else{
$colorImg = $imglist['image_color'];
}

View File

@@ -9,7 +9,6 @@ use think\TransDb;
class Index extends BaseController {
public function index() {
// 如果是手机端进官网
if (isMobile()) {
if ($_SERVER['HTTP_HOST']=="www.orico.com.cn" || $_SERVER['HTTP_HOST']=="orico.com.cn") {

View File

@@ -160,7 +160,6 @@ class Product extends BaseController {
public function detail($id = 0, $color = '') {
if ($id > 0) {
$detail = Loader::model('Product')->where(['stat' => 0, 'is_show' => 0, 'country_code' => $this->country_code, 'id' => $id])->find();