fix: bug修复

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

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,9 +164,8 @@ 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']);
if (empty($category)) {
@@ -251,7 +250,7 @@ class Product extends BaseController {
$this->assign('count',$count);
$this->assign($value);
$this->viewcount($id);
$purchase_links = Db::name('product_purchase_links')->alias('links')
->field(['links.id', 'platforms.platform', 'links.link'])
->join('product_purchase_link_platforms platforms', 'platforms.id=links.platform_id')
@@ -259,7 +258,7 @@ class Product extends BaseController {
->where('links.country_code', '=', $this->country_code)
->select();
$this->assign('purchase_links', $purchase_links);
return $this->fetch($template);
} else {
return exception('数据有误,请检查后再操作');

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 } ?>
<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 .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: '';}
</div>
<?php } ?>
.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);
}
</style>
<script>
<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;
}
$(function() {
$('.tip1').tipso({
useTitle: false
});
});
.popup-quick .popup-app {
font-size: 0.14rem;
color: #333;
line-height: 22px;
padding: 30px 40px;
text-align: center;
}
</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();
.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: '';
}
.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';
$.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();
//点击创建申请块
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';
$(".marsk-container").hide();
$("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');
$("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');
}
}
}
}
});
}
}
});
})
}
});
})
});
</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'];
}