Browse Source

product改成goods

master
林一峰 7 years ago
parent
commit
00aa1db3ce
  1. 8
      app/Common/function.php
  2. 15
      app/Http/Controllers/Api/QrcodeController.php
  3. 18
      app/Http/Controllers/Home/IndexController.php
  4. 8
      resources/views/home/index/goods.blade.php
  5. 0
      resources/views/home/index/goodscat.blade.php
  6. 2
      resources/views/home/index/index.blade.php
  7. 2
      resources/views/home/index/test.blade.php

8
app/Common/function.php

@ -152,12 +152,12 @@ function get_front_url($param='')
//搜索关键词页面
$url .= '/s'.$param['searchid'];
}
else if($param['type'] == 'productlist')
else if($param['type'] == 'goodslist')
{
//商品列表页
$url .= '/product'.$param['catid'];
}
else if($param['type'] == 'productdetail')
else if($param['type'] == 'goodsdetail')
{
//商品内容页
$url .= '/goods/'.$param['id'];
@ -196,12 +196,12 @@ function get_wap_front_url(array $param)
//tags页面
$url .= '/s'.$param['searchid'];
}
else if($param['type'] == 'productlist')
else if($param['type'] == 'goodslist')
{
//商品列表页
$url .= '/product'.$param['catid'];
}
else if($param['type'] == 'productdetail')
else if($param['type'] == 'goodsdetail')
{
//商品内容页
$url .= '/goods/'.$param['id'];

15
app/Http/Controllers/Api/QrcodeController.php

@ -6,7 +6,7 @@ use Illuminate\Http\Request;
use App\Common\ReturnData;
use App\Common\Helper;
//二维码
//二维码,如果输出乱码就转成base64输出
class QrcodeController extends CommonController
{
public function __construct()
@ -22,4 +22,17 @@ class QrcodeController extends CommonController
return '<img src="'.Helper::qrcode($url,$size).'">';
}
//二维码
public function qrcode()
{
$url = $_REQUEST['url'];
$url = str_replace("%26","&",$url);
$url = str_replace("%3F","?",$url);
$url = str_replace("%3D","=",$url);
require_once base_path('resources/org/phpqrcode').'/phpqrcode.php';
return \QRcode::png($url,false,"H",6);
}
}

18
app/Http/Controllers/Home/IndexController.php

@ -184,22 +184,22 @@ class IndexController extends CommonController
}
//商品列表页
public function productcat($cat, $page=0)
public function goodstype($cat, $page=0)
{
$pagenow = $page;
if(empty($cat) || !preg_match('/[0-9]+/',$cat)){return redirect()->route('page404');}
$post = object_to_array(DB::table('product_type')->where('id', $cat)->first(), 1);if(empty($post)){return redirect()->route('page404');}
$post = object_to_array(DB::table('goods_type')->where('id', $cat)->first(), 1);if(empty($post)){return redirect()->route('page404');}
$data['post'] = $post;
$subcat="";
$post2 = object_to_array(DB::table('product_type')->select('id')->where('pid', $cat)->get());
$post2 = object_to_array(DB::table('goods_type')->select('id')->where('pid', $cat)->get());
if(!empty($post2)){foreach($post2 as $row){$subcat=$subcat."typeid=".$row["id"]." or ";}}
$subcat=$subcat."typeid=".$cat;
$data['sql'] = $subcat;
$counts = DB::table("product")->whereRaw($subcat)->count();
$counts = DB::table("goods")->whereRaw($subcat)->count();
if($counts>sysconfig('CMS_MAXARC')){$counts=sysconfig('CMS_MAXARC');dd($counts);}
$pagesize = sysconfig('CMS_PAGESIZE');$page=0;
if($counts % $pagesize){//取总数据量除以每页数的余数
@ -211,8 +211,8 @@ class IndexController extends CommonController
$data['counts'] = $counts;
$start = $page*$pagesize;
$data['posts'] = arclist(array("table"=>"product","sql"=>$subcat, "limit"=>"$start,$pagesize")); //获取列表
$data['pagenav'] = get_listnav(array("counts"=>$counts,"pagesize"=>$pagesize,"pagenow"=>$page+1,"catid"=>$cat,"urltype"=>"product")); //获取分页列表
$data['posts'] = arclist(array("table"=>"goods","sql"=>$subcat, "limit"=>"$start,$pagesize")); //获取列表
$data['pagenav'] = get_listnav(array("counts"=>$counts,"pagesize"=>$pagesize,"pagenow"=>$page+1,"catid"=>$cat,"urltype"=>"goods")); //获取分页列表
if($post['templist']=='category2'){if(!empty($pagenow)){return redirect()->route('page404');}}
@ -220,11 +220,11 @@ class IndexController extends CommonController
}
//商品详情页
public function product($id)
public function goods($id)
{
if(empty($id) || !preg_match('/[0-9]+/',$id)){return redirect()->route('page404');}
$post = object_to_array(DB::table('product')->where('id', $id)->first(), 1);if(empty($post)){return redirect()->route('page404');}$post['name'] = DB::table('product_type')->where('id', $post['typeid'])->value('name');
$post = object_to_array(DB::table('goods')->where('id', $id)->first(), 1);if(empty($post)){return redirect()->route('page404');}$post['name'] = DB::table('goods_type')->where('id', $post['typeid'])->value('name');
if($post)
{
$cat = $post['typeid'];
@ -239,7 +239,7 @@ class IndexController extends CommonController
return redirect()->route('page404');
}
$post = object_to_array(DB::table('product_type')->where('id', $cat)->first(), 1);
$post = object_to_array(DB::table('goods_type')->where('id', $cat)->first(), 1);
return view('home.index.'.$post['temparticle'], $data);
}

8
resources/views/home/index/product.blade.php → resources/views/home/index/goods.blade.php

@ -3,11 +3,11 @@
<link rel="stylesheet" href="/css/bootstrap.min.css"><link rel="stylesheet" href="/css/style.css"><script src="/js/jquery.min.js"></script><script src="/js/bootstrap.min.js"></script></head><body>
@include('home.common.header')
<div class="container"><div class="row row-offcanvas row-offcanvas-right"><div class="col-xs-12 col-sm-9">
<div class="bread"><a href=""><?php echo sysconfig('CMS_INDEXNAME'); ?></a> > <?php echo get_cat_path($post["typeid"],'product_type','productlist'); ?></div>
<div class="bread"><a href=""><?php echo sysconfig('CMS_INDEXNAME'); ?></a> > <?php echo get_cat_path($post["typeid"],'goods_type','productlist'); ?></div>
<h1 class="page-header"><?php echo $post["title"]; ?></h1>
<div class="content"><?php echo $post["body"]; ?>
<div class="dinfo"><span class="addtime"><?php echo date("Y-m-d",$post["pubdate"]); ?></span>
<br><br>下一篇:<?php if($pre){ ?><a href="<?php echo get_front_url(array("id"=>$pre['id'],"catid"=>$pre["typeid"],"type"=>'productdetail')); ?>"><?php echo $pre["title"]; ?></a><?php }else{echo '没有了';} ?><div class="cl"></div></div>
<br><br>下一篇:<?php if($pre){ ?><a href="<?php echo get_front_url(array("id"=>$pre['id'],"catid"=>$pre["typeid"],"type"=>'goodsdetail')); ?>"><?php echo $pre["title"]; ?></a><?php }else{echo '没有了';} ?><div class="cl"></div></div>
</div>
</div><!--/.col-xs-12.col-sm-9-->
@ -18,8 +18,8 @@
<ul class="list-group">
<?php if($post["litpic"]){ ?><li class="list-group-item"><img src="<?php echo $post["litpic"]; ?>" width=100% height=auto></li><?php } ?>
<li class="list-group-item"><span class="badge "> <?php echo $post["price"]; ?></span>商品价格</li>
<li class="list-group-item"><span class="badge"><del> <?php echo $post["origin_price"]; ?></del></span>原价</li>
<li class="list-group-item"><span class="badge"><?php echo $post["sales"]; ?></span>销量</li>
<li class="list-group-item"><span class="badge"><del> <?php echo $post["market_price"]; ?></del></span>原价</li>
<li class="list-group-item"><span class="badge"><?php echo $post["sale"]; ?></span>销量</li>
</ul>
</div></div><!--/.sidebar-offcanvas--></div><!--/row--></div><!-- /.container -->
@include('home.common.footer')</body></html>

0
resources/views/home/index/productcat.blade.php → resources/views/home/index/goodscat.blade.php

2
resources/views/home/index/index.blade.php

@ -77,7 +77,7 @@
<div class="bs-docs-featurette">
<div class="container">
<h2 class="bs-docs-featurette-title">案例中心/Case Show</h2>
<h2 class="bs-docs-featurette-title">案例中心 / Case Show</h2>
<p class="lead">我们在这里展示了许多精美的案例,欢迎欣赏。</p>
<hr class="half-rule">

2
resources/views/home/index/test.blade.php

@ -3,6 +3,6 @@
<form action="/dataapi/image_upload" name="form" method="post" enctype="multipart/form-data">{{ csrf_field() }}
<input type="file" name="file" />
<input type="submit" name="submit" value="上传" />
<input type="text" name="token" value="72d623d26a1a6d61186a97f9ccf752f7" />
<input type="text" name="access_token" value="72d623d26a1a6d61186a97f9ccf752f7" />
</form>
</body></html>
Loading…
Cancel
Save