作者 v_bairong06

手机端个人中心、商品列表接口添加调试

... ... @@ -32,6 +32,12 @@ class GoodsBrandModel extends CommonModel {
return $this->where($where)->select();
}
// 获取商品品牌名称
public function getListName() {
$where['is_del'] = 0;
return $this->where($where)->getField('brand_name',true);
}
// 获取商品品牌详情
public function getInfo($id) {
$where['is_del'] = 0;
... ...
... ... @@ -53,7 +53,7 @@ class GoodsController extends HomebaseController {
$this->display();
}
// 商品列表页
// 商品列表页(pc端)
public function goods_list() {
// 处理筛选内容
$search = I('get.');
... ... @@ -96,6 +96,7 @@ class GoodsController extends HomebaseController {
$price_search = array('0-300','300-2000','2000-5000','5000-10000','10000-20000','20000');
$this->assign('price_search',$price_search);
$this->region();
$this->assign('search_page',U('Portal/Goods/search_page'));
$this->assign('brandList',$this->goods_brand_model->getList());
$this->display();
}
... ... @@ -156,7 +157,7 @@ class GoodsController extends HomebaseController {
$order = array('g.istop'=>'DESC');
}
} else {
$order = array('ctime'=>'DESC');
$order = array('g.ctime'=>'DESC');
}
$count = $this->goods_model->alias('g')
->join('__GOODS_BRAND__ as gb on g.brand_id = gb.id')
... ... @@ -164,9 +165,9 @@ class GoodsController extends HomebaseController {
->where($where)
->count();
$page = $this->page_goods($count, 20);
$page = $this->page_goods($count, 12);
$posts = $this->goods_model->field(array('g.*,gb.brand_name,p.name'))->alias('g')
$posts = $this->goods_model->field(array('g.id,g.sort_id,g.brand_id,g.region_id,g.goods_name,g.short_name,g.goods_price,g.price,g.num,g.thumb,gb.brand_name,p.name'))->alias('g')
->join('__GOODS_BRAND__ as gb on g.brand_id = gb.id')
->join('__PRODUCT__ as p on g.sort_id = p.id')
->where($where)
... ... @@ -177,6 +178,45 @@ class GoodsController extends HomebaseController {
return $posts;
}
// 商品列表页(手机端)
public function goods_list_mobile() {
if(IS_POST) {
// 处理筛选内容
$search['region'] = I('post.region');
$search['price'] = I('post.price');
$search['brand'] = I('post.brand');
$where = $this->goods_search($search);
$_GET['p'] = I('post.page',0,'intval');
if(I('post.id',0,'intval')) {
$ids = $this->product_model->getChildId(I('post.id'));
$where['g.is_del'] = 0;
$where['g.sort_id'] = array('in',$ids);
$goodsList = $this->_lists($where,$search['sort']);
} elseif(I('post.cid',0,'intval')) {
$where['g.is_del'] = 0;
$where['g.sort_id'] = array('in',I('post.cid'));
$goodsList = $this->_lists($where,$search['sort']);
} else {
$this->ajaxReturn(array('status'=>false,'msg'=>'参数错误'));
}
foreach ($goodsList as $k=>$v) {
$goodsList[$k]['thumb'] = sp_get_image_preview_url($v['thumb']);
}
$this->ajaxReturn(array('status'=>true,'msg'=>'成功','data'=>$goodsList));
} else {
$this->assign('id',I('get.id',0,'intval'));
$this->assign('cid',I('get.cid',0,'intval'));
// 筛选功能数组
$price_search = array('0-300','300-2000','2000-5000','5000-10000','10000-20000','20000');
$this->assign('price_search',json_encode($price_search));
$this->region();
$this->assign('brandList',json_encode($this->goods_brand_model->getListName()));
$this->assign('search_page',U('Portal/Goods/search_page'));
$this->display('goods_list');
}
}
// 商品搜索页面
public function search() {
$keyword = $where['g.goods_name|g.short_name|gb.brand_name|p.name'] = I('get.keyword');
... ...
... ... @@ -11,7 +11,12 @@
<body>
<tc_include file="Public:header"/>
<tc_include file="Public:nav"/>
<div class="inbanner" style="background-image: url(__TMPL__Public/assets/images/banner/inbanner.jpg);">
<php>
$home_slides=sp_getslide("academe_banner");
$home_slides=empty($home_slides)?$default_home_slides:$home_slides[0];
</php>
<div class="inbanner" style="background-image: url({:sp_get_asset_upload_path($home_slides['slide_pic'])});">
<!--分类-->
<div class="catebox">
<div class="in-catebox">
... ...
... ... @@ -11,7 +11,12 @@
<body>
<tc_include file="Public:header"/>
<tc_include file="Public:nav"/>
<div class="inbanner" style="background-image: url(__TMPL__Public/assets/images/banner/inbanner.jpg);">
<php>
$home_slides=sp_getslide("academe_banner");
$home_slides=empty($home_slides)?$default_home_slides:$home_slides[0];
</php>
<div class="inbanner" style="background-image: url({:sp_get_asset_upload_path($home_slides['slide_pic'])});">
<!--分类-->
<div class="catebox">
<div class="in-catebox">
... ...
... ... @@ -11,7 +11,12 @@
<body>
<tc_include file="Public:header"/>
<tc_include file="Public:nav"/>
<div class="inbanner" style="background-image: url(__TMPL__Public/assets/images/banner/inbanner.jpg);">
<php>
$home_slides=sp_getslide("academe_banner");
$home_slides=empty($home_slides)?$default_home_slides:$home_slides[0];
</php>
<div class="inbanner" style="background-image: url({:sp_get_asset_upload_path($home_slides['slide_pic'])});">
<!--分类-->
<div class="catebox">
<div class="in-catebox">
... ...
... ... @@ -11,7 +11,12 @@
<body>
<tc_include file="Public:header"/>
<tc_include file="Public:nav"/>
<div class="inbanner" style="background-image: url(__TMPL__Public/assets/images/banner/inbanner.jpg);">
<php>
$home_slides=sp_getslide("academe_banner");
$home_slides=empty($home_slides)?$default_home_slides:$home_slides[0];
</php>
<div class="inbanner" style="background-image: url({:sp_get_asset_upload_path($home_slides['slide_pic'])});">
<!--分类-->
<div class="catebox">
<div class="in-catebox">
... ...
... ... @@ -11,7 +11,12 @@
<body>
<tc_include file="Public:header" />
<tc_include file="Public:nav"/>
<div class="inbanner" style="background-image: url(__TMPL__Public/assets/images/banner/inbanner.jpg);">
<php>
$home_slides=sp_getslide("consult_banner");
$home_slides=empty($home_slides)?$default_home_slides:$home_slides[0];
</php>
<div class="inbanner" style="background-image: url({:sp_get_asset_upload_path($home_slides['slide_pic'])});">
<!--分类-->
<div class="catebox">
<div class="in-catebox">
... ...
... ... @@ -12,7 +12,12 @@
<body>
<tc_include file="Public:header"/>
<tc_include file="Public:nav"/>
<div class="inbanner" style="background-image: url(__TMPL__Public/assets/images/banner/inbanner.jpg);">
<php>
$home_slides=sp_getslide("consult_banner");
$home_slides=empty($home_slides)?$default_home_slides:$home_slides[0];
</php>
<div class="inbanner" style="background-image: url({:sp_get_asset_upload_path($home_slides['slide_pic'])});">
<!--分类-->
<div class="catebox">
<div class="in-catebox">
... ...
... ... @@ -11,7 +11,12 @@
<body>
<tc_include file="Public:header" />
<tc_include file="Public:nav"/>
<div class="inbanner" style="background-image: url(__TMPL__Public/assets/images/banner/inbanner.jpg);">
<php>
$home_slides=sp_getslide("consult_banner");
$home_slides=empty($home_slides)?$default_home_slides:$home_slides[0];
</php>
<div class="inbanner" style="background-image: url({:sp_get_asset_upload_path($home_slides['slide_pic'])});">
<!--分类-->
<div class="catebox">
<div class="in-catebox">
... ...
... ... @@ -11,7 +11,12 @@
<body>
<tc_include file="Public:header" />
<tc_include file="Public:nav"/>
<div class="inbanner" style="background-image: url(__TMPL__Public/assets/images/banner/inbanner.jpg);">
<php>
$home_slides=sp_getslide("consult_banner");
$home_slides=empty($home_slides)?$default_home_slides:$home_slides[0];
</php>
<div class="inbanner" style="background-image: url({:sp_get_asset_upload_path($home_slides['slide_pic'])});">
<!--分类-->
<div class="catebox">
<div class="in-catebox">
... ...
... ... @@ -11,7 +11,12 @@
<body>
<tc_include file="Public:header"/>
<tc_include file="Public:nav"/>
<div class="inbanner" style="background-image: url(__TMPL__Public/assets/images/banner/inbanner.jpg);">
<php>
$home_slides=sp_getslide("consult_banner");
$home_slides=empty($home_slides)?$default_home_slides:$home_slides[0];
</php>
<div class="inbanner" style="background-image: url({:sp_get_asset_upload_path($home_slides['slide_pic'])});">
<!--分类-->
<div class="catebox">
<div class="in-catebox">
... ...
... ... @@ -11,7 +11,12 @@
<body>
<tc_include file="Public:header"/>
<tc_include file="Public:nav"/>
<div class="inbanner" style="background-image: url(__TMPL__Public/assets/images/banner/inbanner.jpg);">
<php>
$home_slides=sp_getslide("successor_banner");
$home_slides=empty($home_slides)?$default_home_slides:$home_slides[0];
</php>
<div class="inbanner" style="background-image: url({:sp_get_asset_upload_path($home_slides['slide_pic'])});">
<!--分类-->
<div class="catebox" id="matt">
<div class="in-catebox">
... ...
... ... @@ -74,8 +74,8 @@
})
}
var region=change(`"{$region_mobile}"`);
var price=change(`"{$region_mobile}"`);
var brand=change(`"{$region_mobile}"`);
var price=change(`"{$price_search}"`);
var brand=change(`"{$brandList}"`);
function change(arr) {
qyarr=arr.substring(1,arr.length - 1);
return JSON.parse(qyarr);
... ... @@ -92,8 +92,7 @@
});
}
function search_page() {
location.href = "{$search_url}";
location.href = "{$search_page}";
}
</script>
</html>
\ No newline at end of file
... ...
... ... @@ -42,7 +42,7 @@
</div>
<div class="select_group">
<volist name="sortList" id="vo" key="key">
<a class="select_item" href="{:U('Goods/goods_list',array('id'=>$vo['id']))}">
<a class="select_item" href="{:U('Goods/goods_list_mobile',array('id'=>$vo['id']))}">
<img src="http://feiyi.test.bronet.cn/themes/simplebootx_mobile/Public/assets/img/index_icon{$key}.png" class="select_logo" />
<p class="select_title">{$vo.name}</p>
</a>
... ...
... ... @@ -24,7 +24,6 @@
<div id="container_main">
<div class="seach_hot">
<p class="myseach_title">热门搜索</p>
<i class="iconfont icon-shanchu"></i>
</div>
<div class="seach_list">
<volist name="klist" id="vo">
... ...
... ... @@ -34,7 +34,7 @@
<div class="container_right">
<volist name="sort_list" id="vo">
<div class="container_right_list">
<a href="{:U('Portal/Goods/goods_list',array('cid'=>$vo['id']))}" class="container_right_list_head">
<a href="{:U('Portal/Goods/goods_list_mobile',array('cid'=>$vo['id']))}" class="container_right_list_head">
<span class="head_title">{$vo.name}</span>
<span class="head_mintitle">全部</span>
<i class="iconfont icon-arrows"></i>
... ... @@ -77,16 +77,16 @@
</body>
<script type="text/javascript">
function fenlei() {
window.location = "classification.html"
window.location = "{:U('Portal/Goods/sort_list')}"
}
function personl() {
window.location = "personl.html"
window.location = "{:U('User/Center/index')}"
}
function cart() {
window.location = "cart.html"
window.location = "{:U('User/Cart/index')}"
}
function index() {
window.location = "index.html"
window.location = "{:U('Portal/Index/index')}"
}
window.onload = function() {
var mySwiper = new Swiper('.swiper-container', {
... ...
... ... @@ -536,7 +536,7 @@ s {
.list_main_v_logo {
width: 2.36rem;
height: 2.36rem;
background-color: red;
/*background-color: red;*/
}
.list_main_v_res {
... ...
... ... @@ -83,25 +83,21 @@
<a href="javascript:;" class="main_select_list will">
<i class="iconfont icon-my_iconsmall"></i>
<p class="list_title">入会申请</p>
<span class="bz">{$count.willUser}</span>
</a>
<div class="main_select_line"></div>
<a href="{:U('Portal/Will/mission_list')}" class="main_select_list">
<i class="iconfont icon-share"></i>
<p class="list_title">任务发布</p>
<span class="bz">{$count.willMission}</span>
</a>
<div class="main_select_line"></div>
<a href="{:U('Portal/Will/events_list')}" class="main_select_list">
<i class="iconfont icon-icon-test2"></i>
<p class="list_title">近期活动</p>
<span class="bz">{$count.willEvents}</span>
</a>
<div class="main_select_line"></div>
<a href="{:U('Portal/Will/product_list')}" class="main_select_list">
<i class="iconfont icon-icon-test1"></i>
<p class="list_title">双创项目</p>
<span class="bz">{$count.willProduce}</span>
</a>
</div>
</div>
... ...