type_id=0的情况

type_id=1的情况                         type_id=2的情况

    /**
* @title 店铺装修--商品分类
* @param type_id 是 int 分类类型(0-全部、1-平台、2-特色)
* @param store_id 是 string 店铺id
* @param source 是 int 来源(1--h5、2--app)
* @example FlagShipShopDecorate.goodsCategory? 调试参数:{"store_id":"115075399495199","username":"17721355485","check_code":"123456","method":"FlagShipShopDecorate.goodsCategory","type_id":"0"}
* @return_param_explain id:分类id name:分类名称 path:分类path img:分类图片 child:当前分类下的子分类 ad_info: --id:广告id --ad_link_type:广告链接类型(1商品详情页、2关联模块、3商品列表、4H5页面、5蜂雷头条详情页、6订单详情、7零钱明细、8蜜汁明细、9订单列表) --ad_url:广告图片地址 --redirect_url:跳转参数(具体返回的参数值见log记录)
* @method POST
* @author 邹柯
*/
public function goodsCategory($res){
//商品类型
$type_id=$res['type_id'];
if(empty($type_id)){
$type_id=;
}
if($type_id != && $type_id != && $type_id !=){
E('');
}
//店铺id
$store_id=$res['store_id'];
$proStoreGoods = new FlagShopCategoryModel();
$list=$proStoreGoods->goodsCategory($store_id,$type_id);
return $list;
}

返回结果

{
"status":"",
"errorCode":"",
"msg":"成功",
"result":{
"categoryInfo":[
{
"id":"",
"name":"平台商品",
"sort":"",
"path":"",
"child":[
{
"id":"",
"name":"bbb",
"sort":"",
"path":"1/137",
"img":null,
"ad_info":null,
"child":null
},
{
"id":"",
"name":"qq",
"sort":"",
"path":"1/135",
"img":"http://img.test.feelee.cc//Public/Uploads/server/goodcate/20180521/56d0515269096035470.png",
"ad_info":null,
"child":[
{
"id":"",
"name":"",
"sort":"",
"path":"1/135/136",
"img":null,
"child":null
}
]
},
{
"id":"",
"name":"",
"sort":"",
"path":"1/111",
"img":"http://img.test.feelee.cc//Public/Uploads/server/goodcate/20180330/5073615223769694245.png",
"ad_info":null,
"child":null
},
{
"id":"",
"name":"斐讯商品",
"sort":"",
"path":"1/3",
"img":"http://img.test.feelee.cc//Public/Uploads/product_type_img/20180109/thumb_5a544e68cd630.jpg",
"ad_info":null,
"child":[
{
"id":"",
"name":"斐讯K3C+E1组合套装",
"sort":"",
"path":"1/3/109",
"img":"http://img.test.feelee.cc//Public/Uploads/product_type_img/20180127/thumb_5a6c116632a50.jpg",
"child":null
},
{
"id":"",
"name":"斐讯N1预售",
"sort":"",
"path":"1/3/108",
"img":"http://img.test.feelee.cc//Public/Uploads/product_type_img/20180126/thumb_5a6af4332d384.jpeg",
"child":null
},
{
"id":"",
"name":"斐讯K1S",
"sort":"",
"path":"1/3/74",
"img":"http://img.test.feelee.cc//Public/Uploads/product_type_img/20180118/thumb_5a6084b29c0aa.jpg",
"child":null
},
{
"id":"",
"name":"斐讯M1",
"sort":"",
"path":"1/3/63",
"img":"http://img.test.feelee.cc//Public/Uploads/product_type_img/20180110/thumb_5a5604ff4abb0.jpg",
"child":null
},
{
"id":"",
"name":"斐讯S7",
"sort":"",
"path":"1/3/62",
"img":"http://img.test.feelee.cc//Public/Uploads/product_type_img/20180110/thumb_5a56100d49583.png",
"child":null
},
{
"id":"",
"name":"斐讯K2mini",
"sort":"",
"path":"1/3/73",
"img":"http://img.test.feelee.cc//Public/Uploads/product_type_img/20180117/thumb_5a5eab214942e.jpg",
"child":null
},
{
"id":"",
"name":"斐讯 E1",
"sort":"",
"path":"1/3/72",
"img":"http://img.test.feelee.cc//Public/Uploads/product_type_img/20180117/thumb_5a5eab29339fc.jpg",
"child":null
},
{
"id":"",
"name":"斐讯K2",
"sort":"",
"path":"1/3/67",
"img":"http://img.test.feelee.cc//Public/Uploads/product_type_img/20180117/thumb_5a5eab3190628.jpg",
"child":null
},
{
"id":"",
"name":"斐讯K2P",
"sort":"",
"path":"1/3/71",
"img":"http://img.test.feelee.cc//Public/Uploads/product_type_img/20180117/thumb_5a5eab3f31e9b.jpg",
"child":null
},
{
"id":"",
"name":"斐讯K2C",
"sort":"",
"path":"1/3/68",
"img":"http://img.test.feelee.cc//Public/Uploads/product_type_img/20180117/thumb_5a5eab46cbcdb.JPG",
"child":null
},
{
"id":"",
"name":"路由器",
"sort":"",
"path":"1/3/61",
"img":null,
"child":null
},
{
"id":"",
"name":"斐讯K3",
"sort":"",
"path":"1/3/69",
"img":"http://img.test.feelee.cc//Public/Uploads/product_type_img/20180117/thumb_5a5eab4eca5b7.jpg",
"child":null
},
{
"id":"",
"name":"斐讯K3C",
"sort":"",
"path":"1/3/70",
"img":"http://img.test.feelee.cc//Public/Uploads/product_type_img/20180117/thumb_5a5eab55d910e.jpg",
"child":null
}
]
},
{
"id":"",
"name":"热推爆品",
"sort":"",
"path":"1/4",
"img":"http://img.test.feelee.cc//Public/Uploads/product_type_img/20180109/thumb_5a544e360cfac.jpg",
"ad_info":[
{
"id":"",
"ad_url":"http://img.test.feelee.cc//Public/Uploads/img/I2/P001402/SKU/1002883101.jpg",
"ad_link_type":"",
"redirect_url":{
"itemid":"",
"sno":"P001219-03",
"store_id":""
}
},
{
"id":"",
"ad_url":"http://img.test.feelee.cc//Public/Uploads/img/I2/P001402/SKU/1002883101.jpg",
"ad_link_type":"",
"redirect_url":{
"plate_type":""
}
},
{
"id":"",
"ad_url":"http://img.test.feelee.cc//Public/Uploads/img/I2/P001402/SKU/1002883101.jpg",
"ad_link_type":"",
"redirect_url":{
"type":"",
"brand_id":"",
"cate_type":""
}
},
{
"id":"",
"ad_url":"http://img.test.feelee.cc//Public/Uploads/img/I2/P001402/SKU/1002883101.jpg",
"ad_link_type":"",
"redirect_url":{
"url":"http://www.baidu.com"
}
}
],
"child":null
},
{
"id":"",
"name":"美妆个护",
"sort":"",
"path":"1/40",
"img":"http://img.test.feelee.cc//Public/Uploads/product_type_img/20180109/thumb_5a544d22c52a6.jpg",
"ad_info":null,
"child":[
{
"id":"",
"name":"面部护肤",
"sort":"",
"path":"1/40/45",
"img":"http://img.test.feelee.cc//Public/Uploads/product_type_img/20180119/thumb_5a61b82e3a33b.jpg",
"child":null
},
{
"id":"",
"name":"皮肤护理",
"sort":"",
"path":"1/40/88",
"img":"http://img.test.feelee.cc//Public/Uploads/product_type_img/20180119/thumb_5a61274b149d3.png",
"child":null
},
{
"id":"",
"name":"面膜",
"sort":"",
"path":"1/40/85",
"img":"http://img.test.feelee.cc//Public/Uploads/product_type_img/20180119/thumb_5a61b821d335c.jpg",
"child":null
},
{
"id":"",
"name":"彩妆",
"sort":"",
"path":"1/40/56",
"img":"http://img.test.feelee.cc//Public/Uploads/product_type_img/20180118/thumb_5a60a80ab4f35.jpg",
"child":null
},
{
"id":"",
"name":"卸妆",
"sort":"",
"path":"1/40/89",
"img":"http://img.test.feelee.cc//Public/Uploads/product_type_img/20180118/thumb_5a60a8155a23c.jpg",
"child":null
},
{
"id":"",
"name":"造型",
"sort":"",
"path":"1/40/86",
"img":"http://img.test.feelee.cc//Public/Uploads/product_type_img/20180118/thumb_5a60a1f3d0c1d.jpg",
"child":null
},
{
"id":"",
"name":"洗发",
"sort":"",
"path":"1/40/44",
"img":"http://img.test.feelee.cc//Public/Uploads/product_type_img/20180118/thumb_5a60a65805294.jpg",
"child":[
{
"id":"",
"name":"面膜",
"sort":"",
"path":"1/40/44/46",
"img":"http://img.test.feelee.cc//Public/Uploads/product_type_img/20180119/thumb_5a61b82e3a33b.jpg"
}
]
},
{
"id":"",
"name":"护发",
"sort":"",
"path":"1/40/87",
"img":"http://img.test.feelee.cc//Public/Uploads/product_type_img/20180119/thumb_5a61b9af1907c.jpg",
"child":null
},
{
"id":"",
"name":"染发",
"sort":"",
"path":"1/40/84",
"img":"http://img.test.feelee.cc//Public/Uploads/product_type_img/20180118/thumb_5a609e4d93237.jpg",
"child":null
},
{
"id":"",
"name":"沐浴",
"sort":"",
"path":"1/40/55",
"img":"http://img.test.feelee.cc//Public/Uploads/product_type_img/20180109/thumb_5a544d9857c69.jpg",
"child":null
},
{
"id":"",
"name":"口腔护理",
"sort":"",
"path":"1/40/57",
"img":"http://img.test.feelee.cc//Public/Uploads/product_type_img/20180118/thumb_5a60a1b4712a0.jpg",
"child":null
},
{
"id":"",
"name":"女性护理",
"sort":"",
"path":"1/40/58",
"img":"http://img.test.feelee.cc//Public/Uploads/product_type_img/20180109/thumb_5a544da6c7a0b.jpg",
"child":null
}
]
},
{
"id":"",
"name":"母婴用品",
"sort":"",
"path":"1/41",
"img":"http://img.test.feelee.cc//Public/Uploads/product_type_img/20180109/thumb_5a544f09afb2b.jpg",
"ad_info":null,
"child":[
{
"id":"",
"name":"牙刷/牙膏",
"sort":"",
"path":"1/41/90",
"img":"http://img.test.feelee.cc//Public/Uploads/product_type_img/20180118/thumb_5a60a73dcc5f1.jpg",
"child":null
},
{
"id":"",
"name":"牙胶安抚",
"sort":"",
"path":"1/41/83",
"img":"http://img.test.feelee.cc//Public/Uploads/product_type_img/20180118/thumb_5a608e1c23bbe.jpg",
"child":null
},
{
"id":"",
"name":"洗发沐浴",
"sort":"",
"path":"1/41/82",
"img":"http://img.test.feelee.cc//Public/Uploads/product_type_img/20180118/thumb_5a608f2ba41a7.jpg",
"child":null
},
{
"id":"",
"name":"幼儿清洁",
"sort":"",
"path":"1/41/78",
"img":"http://img.test.feelee.cc//Public/Uploads/product_type_img/20180118/thumb_5a608c73bb913.jpg",
"child":null
},
{
"id":"",
"name":"幼儿餐具",
"sort":"",
"path":"1/41/81",
"img":"http://img.test.feelee.cc//Public/Uploads/product_type_img/20180118/thumb_5a608bd269508.jpg",
"child":null
},
{
"id":"",
"name":"尿布/湿巾",
"sort":"",
"path":"1/41/80",
"img":"http://img.test.feelee.cc//Public/Uploads/product_type_img/20180118/thumb_5a6089fdb5756.jpg",
"child":null
},
{
"id":"",
"name":"奶瓶/水杯",
"sort":"",
"path":"1/41/75",
"img":"http://img.test.feelee.cc//Public/Uploads/product_type_img/20180118/thumb_5a60892f2518a.jpg",
"child":null
},
{
"id":"",
"name":"奶嘴/清洁",
"sort":"",
"path":"1/41/76",
"img":"http://img.test.feelee.cc//Public/Uploads/product_type_img/20180118/thumb_5a6089986fa4b.jpg",
"child":null
},
{
"id":"",
"name":"幼儿护肤",
"sort":"",
"path":"1/41/79",
"img":"http://img.test.feelee.cc//Public/Uploads/product_type_img/20180118/thumb_5a608b8d1a367.jpg",
"child":null
},
{
"id":"",
"name":"孕产用品",
"sort":"",
"path":"1/41/47",
"img":"http://img.test.feelee.cc//Public/Uploads/product_type_img/20180111/thumb_5a572c1942e20.jpg",
"child":null
},
{
"id":"",
"name":"防护/其他",
"sort":"",
"path":"1/41/48",
"img":"http://img.test.feelee.cc//Public/Uploads/product_type_img/20180118/thumb_5a6089e8a299b.jpg",
"child":null
}
]
},
{
"id":"",
"name":"居家百货",
"sort":"",
"path":"1/42",
"img":"http://img.test.feelee.cc//Public/Uploads/product_type_img/20180109/thumb_5a544fb000122.jpg",
"ad_info":null,
"child":[
{
"id":"",
"name":"生活电器",
"sort":"",
"path":"1/42/107",
"img":"http://img.test.feelee.cc//Public/Uploads/product_type_img/20180122/thumb_5a65600d573b7.jpg",
"child":null
},
{
"id":"",
"name":"厨房用具",
"sort":"",
"path":"1/42/94",
"img":"http://img.test.feelee.cc//Public/Uploads/product_type_img/20180122/thumb_5a656013846b7.jpg",
"child":null
},
{
"id":"",
"name":"滤水壶",
"sort":"",
"path":"1/42/49",
"img":"http://img.test.feelee.cc//Public/Uploads/product_type_img/20180118/thumb_5a60ab0185e71.jpg",
"child":null
},
{
"id":"",
"name":"杯子",
"sort":"",
"path":"1/42/51",
"img":"http://img.test.feelee.cc//Public/Uploads/product_type_img/20180109/thumb_5a544f9fe5b62.jpg",
"child":null
},
{
"id":"",
"name":"口罩",
"sort":"",
"path":"1/42/93",
"img":"http://img.test.feelee.cc//Public/Uploads/product_type_img/20180118/thumb_5a60ae5588f93.jpg",
"child":null
},
{
"id":"",
"name":"便利贴",
"sort":"",
"path":"1/42/97",
"img":"http://img.test.feelee.cc//Public/Uploads/product_type_img/20180118/thumb_5a60b0a81a056.jpg",
"child":null
},
{
"id":"",
"name":"创可贴",
"sort":"",
"path":"1/42/96",
"img":"http://img.test.feelee.cc//Public/Uploads/product_type_img/20180118/thumb_5a60b0a2e4cfe.jpg",
"child":null
},
{
"id":"",
"name":"挂钩",
"sort":"",
"path":"1/42/95",
"img":"http://img.test.feelee.cc//Public/Uploads/product_type_img/20180118/thumb_5a60b09d1ce3b.jpg",
"child":null
},
{
"id":"",
"name":"汽车香水",
"sort":"",
"path":"1/42/59",
"img":"http://img.test.feelee.cc//Public/Uploads/product_type_img/20180118/thumb_5a60ab7d74b0a.jpg",
"child":null
},
{
"id":"",
"name":"清洁工具",
"sort":"",
"path":"1/42/92",
"img":"http://img.test.feelee.cc//Public/Uploads/product_type_img/20180118/thumb_5a60add1ea5ae.jpg",
"child":null
},
{
"id":"",
"name":"洗衣用品",
"sort":"",
"path":"1/42/106",
"img":"http://img.test.feelee.cc//Public/Uploads/product_type_img/20180118/thumb_5a60b9fee32f2.jpg",
"child":null
}
]
},
{
"id":"",
"name":"数码外设",
"sort":"",
"path":"1/43",
"img":"http://img.test.feelee.cc//Public/Uploads/product_type_img/20180109/thumb_5a54500c674dd.jpg",
"ad_info":null,
"child":[
{
"id":"",
"name":"音响/耳机",
"sort":"",
"path":"1/43/54",
"img":"http://img.test.feelee.cc//Public/Uploads/product_type_img/20180118/thumb_5a60b32458396.jpg",
"child":null
},
{
"id":"",
"name":"插座",
"sort":"",
"path":"1/43/98",
"img":"http://img.test.feelee.cc//Public/Uploads/product_type_img/20180118/thumb_5a60b3487a154.jpg",
"child":null
},
{
"id":"",
"name":"键盘/鼠标",
"sort":"",
"path":"1/43/99",
"img":"http://img.test.feelee.cc//Public/Uploads/product_type_img/20180118/thumb_5a60b316a866b.jpg",
"child":null
},
{
"id":"",
"name":"Type-C数据线",
"sort":"",
"path":"1/43/52",
"img":"http://img.test.feelee.cc//Public/Uploads/product_type_img/20180109/thumb_5a54501dcbc93.jpg",
"child":null
},
{
"id":"",
"name":"HDMIi高清线",
"sort":"",
"path":"1/43/101",
"img":"http://img.test.feelee.cc//Public/Uploads/product_type_img/20180118/thumb_5a60b58d5232d.jpg",
"child":null
},
{
"id":"",
"name":"摄像头/麦克",
"sort":"",
"path":"1/43/100",
"img":"http://img.test.feelee.cc//Public/Uploads/product_type_img/20180118/thumb_5a60b31c22cfd.jpg",
"child":null
},
{
"id":"",
"name":"音频线",
"sort":"",
"path":"1/43/104",
"img":"http://img.test.feelee.cc//Public/Uploads/product_type_img/20180118/thumb_5a60b83c92770.jpg",
"child":null
},
{
"id":"",
"name":"手机壳",
"sort":"",
"path":"1/43/105",
"img":"http://img.test.feelee.cc//Public/Uploads/product_type_img/20180118/thumb_5a60b9ae2cd8b.jpg",
"child":null
},
{
"id":"",
"name":"网线转接器",
"sort":"",
"path":"1/43/103",
"img":"http://img.test.feelee.cc//Public/Uploads/product_type_img/20180118/thumb_5a60b8fd43825.jpg",
"child":null
},
{
"id":"",
"name":"网线",
"sort":"",
"path":"1/43/102",
"img":"http://img.test.feelee.cc//Public/Uploads/product_type_img/20180118/thumb_5a60b7290c501.jpg",
"child":null
}
]
},
{
"id":"",
"name":"宠物生活",
"sort":"",
"path":"1/60",
"img":"http://img.test.feelee.cc//Public/Uploads/product_type_img/20180109/thumb_5a5496b1d9b65.jpg",
"ad_info":null,
"child":[
{
"id":"",
"name":"宠物保健",
"sort":"",
"path":"1/60/66",
"img":"http://img.test.feelee.cc//Public/Uploads/product_type_img/20180111/thumb_5a572ce3cf29a.png",
"child":null
},
{
"id":"",
"name":"爱宠用品",
"sort":"",
"path":"1/60/65",
"img":"http://img.test.feelee.cc//Public/Uploads/product_type_img/20180110/thumb_5a5616e9232ab.jpg",
"child":null
},
{
"id":"",
"name":"医疗保健",
"sort":"",
"path":"1/60/64",
"img":"http://img.test.feelee.cc//Public/Uploads/product_type_img/20180110/thumb_5a560660d3efb.jpg",
"child":null
}
]
}
]
},
{
"id":"",
"name":"特色商品",
"sort":"",
"path":"",
"child":[
{
"id":"",
"name":"摄像头",
"sort":"",
"path":"2/39",
"img":null,
"ad_info":null,
"child":null
},
{
"id":"",
"name":"鼠标垫",
"sort":"",
"path":"2/38",
"img":null,
"ad_info":null,
"child":null
},
{
"id":"",
"name":"耳机",
"sort":"",
"path":"2/37",
"img":null,
"ad_info":null,
"child":null
},
{
"id":"",
"name":"鼠标",
"sort":"",
"path":"2/36",
"img":null,
"ad_info":null,
"child":null
},
{
"id":"",
"name":"键盘",
"sort":"",
"path":"2/35",
"img":null,
"ad_info":null,
"child":null
}
]
}
]
}
}
<?php
namespace Common\Model\DataModel;
use Webapp\Model\FlagShipShopDecorateModel; class FlagShopCategoryModel{
//蜂店装修--分类
public function goodsCategory($store_id,$type_id){
if($type_id==){
$category_type=C('pingtai_goods');
}elseif($type_id==){
$category_type=C('tese_goods');
}else{
$category_type=;
} //获取除顶级分类外的所有分类信息
$allCategoryInfo=$this->getAllCategoryInfo($store_id,$category_type,$type_id); //获取所有的广告信息
$allAdInfo=$this->getAllAdInfo($store_id,'me');
//获取一级分类信息
$cate_info=$this->getFirstCateInfo($category_type,$type_id);
$ids=array();
foreach ($cate_info as $k4 => $v4){
$ids[$k4] = $v4['id'];
}
array_multisort($ids, SORT_ASC,$cate_info);
//组装分类信息--新
$result['categoryInfo']=$this->getCateInfoNew($cate_info,$allAdInfo,$allCategoryInfo,$category_type,$store_id,,,null,);
$ob=new FlagShipShopDecorateModel();
$user_id=session("user.user_id");
$store=M('store');
$s_where['id']=$store_id;
$store_user_id=$store->where($s_where)->getField('user_id');
$res=$ob->isParentUserId($user_id,$store_user_id);
if($res===false){
$result['categoryInfo'][]['child']=null;
$result['categoryInfo'][]['child']=null;
}
return $result;
}
//组装分类信息--新
private function getCateInfoNew($cate_info,$allAdInfo,$allCategoryInfo,$cate_type,$store_id,$source,$le,$cts,$ori){
if($ori==){
$t1=;
$t2=;
}else{
$t1=;
$t2=;
}
//获取全部分类状态
//组装分类信息
foreach($cate_info as $k=>$v){
//获取一级分类
$categoryInfo=$this->getNextChildCategory($allAdInfo,$allCategoryInfo,$cate_type,$store_id,$source,$v['path'],$le,$cts);
if(empty($categoryInfo)){
$cate_info[$k]['child']=null;
}else{
$cate_info[$k]['child']=$categoryInfo;
foreach($categoryInfo as $k2=>$v2){
//获取二级分类
$categoryInfo2=$this->getNextChildCategory($allAdInfo,$allCategoryInfo,$cate_type,$store_id,$source,$v2['path'],$le+$t1,$cts);
if(empty($categoryInfo2)){
$cate_info[$k]['child'][$k2]['child']=null;
}else{
$cate_info[$k]['child'][$k2]['child']=$categoryInfo2;
foreach($categoryInfo2 as $k3=>$v3){
//获取三级分类
$categoryInfo3=$this->getNextChildCategory($allAdInfo,$allCategoryInfo,$cate_type,$store_id,$source,$v3['path'],$le+$t2,$cts);
if(empty($categoryInfo3)){
$cate_info[$k]['child'][$k2]['child'][$k3]['child']=null;
}else{
$cate_info[$k]['child'][$k2]['child'][$k3]['child']=$categoryInfo3;
}
}
}
}
}
}
if(empty($ori)){
if(!empty($cate_info)){
//取得列的列表
foreach ($cate_info as $k => $v){
$id[$k] = $v['sort'];
}
array_multisort($id, SORT_DESC,$cate_info);
}
$cate_info=array_merge($cate_info);
}
return $cate_info;
}
//获取所有分类信息
private function getAllCategoryInfo($store_id,$category_type,$type_id){
$store_goods_category=M('store_goods_category');
$img_base=C('img_base');
if($type_id==){
$where ="is_deleted=1 and is_open=1 and type_id='".$category_type."'";
}elseif($type_id==){
$where ="is_deleted=1 and is_open=1 and (type_id='".$category_type."' and store_id='".$store_id."')";
}else{
$where ="is_deleted=1 and is_open=1 and (type_id=1 or (type_id=2 and store_id='".$store_id."'))";
}
$cate_info=$store_goods_category->field("id,name,store_id,sort,path,type_id,concat('$img_base',img) as img")
->where($where)
->order('sort desc')
->select();
return $cate_info;
}
//获取当前分类的下的下级分类
private function getNextChildCategory($allAdInfo,$cate_info,$cate_type,$store_id,$source,$path,$le,$cts){
foreach($cate_info as $k=>$v){
$cn=substr_count($v['path'],'/');
if($path !=){
$pos=strpos("/".$v['path']."/","/".$path."/");
if($pos===false){
unset($cate_info[$k]);
continue;
}
if($cts==){
if($le==){
if($cn <= $le || $cn >=$le+){
unset($cate_info[$k]);
continue;
}
}else{
if($cn < $le || $cn >=$le+){
unset($cate_info[$k]);
continue;
}
}
}else{
if($cn <$le || $cn >=$le+){
unset($cate_info[$k]);
continue;
}
}
if($v['type_id']==){
unset($cate_info[$k]);
continue;
}
} else{
if($v['store_id'] != $store_id){
unset($cate_info[$k]);
continue;
}
}
//组装广告信息
if(empty($cts)){
if($le==){
$cate_info[$k]['ad_info']=array_merge($allAdInfo[$v['id']]);
}
}
unset($cate_info[$k]['store_id']);
unset($cate_info[$k]['type_id']);
}
return array_merge($cate_info);
}
//获取所有的广告信息
private function getAllAdInfo($store_id,$store_type,$source){
$img_base=C('img_base');
$where="is_deleted=0 and status=1";
$category_ad_info=M('category_ad')->field("id,cate_id,concat('$img_base',ad_url) as ad_url,ad_link_type,ad_link_content")->where($where)->select();
$cats_id=array_unique(array_column($category_ad_info,'cate_id'));
if(!empty($cats_id)){
foreach($cats_id as $k0=>$v0){
foreach($category_ad_info as $k=>$v){
if($v['cate_id']==$v0){
$data[$v0][$k]['id']=$v['id'];
$data[$v0][$k]['ad_url']=$v['ad_url'];
$data[$v0][$k]['ad_link_type']=$v['ad_link_type'];
$ad_link_content_arr=json_decode($v['ad_link_content'],true);
$ad_link_type=$v['ad_link_type'];
switch($ad_link_type){
case : //商品详情页
//app
$ob=new PublicModel();
if($source==){
$inf2=$ob->shopDeal($store_id);
}else{ //h5
$inf2=$ob->shopDealH5($store_id,$store_type);
}
$inf=$ob->getTeSeGoods($ad_link_content_arr['itemid']);
if(empty($inf)){//平台商品
$store_id=$inf2;
}else{
$store_id=$inf['store_id'];
}
$data[$v0][$k]['redirect_url']=array(
'itemid'=>$ad_link_content_arr['itemid'],
'sno'=>$ad_link_content_arr['sno'],
'store_id'=>$store_id
);
break;
case ://关联模块
$data[$v0][$k]['redirect_url']=array('plate_type'=>$ad_link_content_arr['plate_type']);
break;
case ://商品列表
$data[$v0][$k]['redirect_url']=array('type'=>$ad_link_content_arr['type'],'brand_id'=>$ad_link_content_arr['brand_id'],'cate_type'=>$ad_link_content_arr['cate_id']);
break;
case ://H5页面
$data[$v0][$k]['redirect_url']=array('url'=>$ad_link_content_arr['url']);
break;
case ://蜂雷头条详情页
$headlines = M('headlines','t_',C('select_db'));
$list2=$headlines->where(array('id'=>$ad_link_content_arr['id']))->field('id,title,content')->find();
$data[$v0][$k]['redirect_url']=array(
'id'=>$ad_link_content_arr['id'],
'title'=>$list2['title']
);
break;
default:
$data[$v0][$k]['redirect_url']=null;
break;
}
unset($category_ad_info[$k]['ad_link_content']);
}
}
}
}else{
$data=null;
}
return $data;
}
//获取一级分类信息
private function getFirstCateInfo($category_type,$type_id){
$store_goods_category=M('store_goods_category');
if($type_id==){
$where ="is_deleted=1 and is_open=1 and type_id=0";
}else{
$where ="is_deleted=1 and is_open=1 and id='".$category_type."'";
}
$cate_info=$store_goods_category->field('id,name,sort,path')
->where($where)
->order('sort desc')
->select();
return $cate_info;
}
}

php 实现店铺装修7的更多相关文章

  1. 关于淘宝店铺装修弹出层popup的记录

    小龙最近做了一下下淘宝的店铺装修,里面封装的widget深不见底,刚刚整明白popup,也就是弹出层的使用方法,大神勿喷: <div class="area001">触 ...

  2. Adobe Photoshop CC2018最新教程+某宝店铺装修教程

    PS免费教程,ps淘宝店铺装修教程.该资源为本人从某商网站重金买来,现免费分享给大家,下载地址:百度网盘,https://pan.baidu.com/s/127PjFbGwVVUVce1litHFsw

  3. php 实现店铺装修5

    /** * @title 选中蜂店装修模板样式 * @param plate_id 是 int 商品(平台或特色)装修样式ID * @param type_id 是 int 要装修商品的类型(1-平台 ...

  4. php 实现店铺装修6

    /** * @title 获取预览或发布的蜂店模板样式 * @param store_id 是 string 店铺id * @param type 是 int 装修模板的状态:1-预览蜂店装修模板样式 ...

  5. php 实现店铺装修8

    /** * @title 店铺装修--根据分类获取商品列表 * @param source 是 int 来源(1--h5.2--app) * @param type 是 string 店铺类型--首页 ...

  6. php 实现店铺装修3

    /** * @title 装修店铺 * @param plate_id 是 int 店铺装修样式ID * @param type 是 int 模板样式子板块类型(4-海景.6-二宫格.8-三宫格.9- ...

  7. php 实现店铺装修2

    <?php namespace Webapp\Model; use Common\Model\DataModel\FlagShopCategoryModel; use Common\Model\ ...

  8. php 实现店铺装修1

    一.原型分析 1.店铺未装修的情况下,使用默认样式,哪个是默认样式由后台告知: 2.所有的样式由后台进行维护(但后台始终有一个默认样式,不可删除不可编辑),所有样式,只要用户未编辑过,则默认按照商品的 ...

  9. php 实现店铺装修4

    /** * @title 发布装修的店铺 * @example FlagShipShopDecorate.fabu? 调试参数:{"username":"17721355 ...

随机推荐

  1. 解决前端项目启动时报错:Use // eslint-disable-next-line to ignore the next line.

    首先说一下这个问题产生的原因: 项目创建时设置了使用 eslint 进行代码规范检查. 解决办法: 找到webpack.base.conf.js文件,并且将下满这行代码注释掉. ...(config. ...

  2. 【摘录自MDN】对事件冒泡和捕捉的解释

    当一个事件触发了一个有父元素的元素(例如我们的<video>时),现代浏览器运行两个不同的阶段 - 捕获阶段和冒泡阶段. 在捕获阶段: 浏览器检查元素的最外层祖先(<html> ...

  3. php 算法知识 猴子选大王

    一群猴子排成一圈,按1,2,...,n依次编号. 然后从第1只开始数,数到第m只,把它踢出圈, 从它后面再开始数,再数到第m只,在把它踢出去..., 如此不停的进行下去,直到最后只剩下一只猴子为止,那 ...

  4. Python 基础之面向对象之八步理解装饰器

    装饰器:在不改变原有代码的情况下,为该原函数扩展新功能特征:返回新函数,替换旧函数语法:@ 语法糖 1.装饰器原型 #例1: def kuozhan(func):    def newfunc():  ...

  5. Java自学-集合框架 ArrayList和HashSet的区别

    Java ArrayList和HashSet的区别 示例 1 : 是否有顺序 ArrayList: 有顺序 HashSet: 无顺序 HashSet的具体顺序,既不是按照插入顺序,也不是按照hashc ...

  6. 操作系统OS - 同步和异步,阻塞和非阻塞

    同步和异步关注的是消息通信机制,阻塞/非阻塞是程序在等待调用结果(消息,返回值)时的状态

  7. npm安装包时报错:Error: EPERM: operation not permitted, rename

    解决方法:先执行 npm cache clean -force在安装需要的包.

  8. FTP、SFTP、SCP的区别

    转载于>> FTP(File Transfer Protocol) 是TCP/IP网络上两台计算机传送文件的协议,FTP是在TCP/IP网络和INTERNET上最早使用的协议之一,它属于网 ...

  9. Educational Codeforces Round 72 (Rated for Div. 2)E(线段树,思维)

    #define HAVE_STRUCT_TIMESPEC#include<bits/stdc++.h>using namespace std;#define BUF_SIZE 100000 ...

  10. centos7中redis安装

    官网地址:http://redis.io/ 官网下载地址:http://redis.io/download 1. 下载Redis源码(tar.gz),并上传到Linux:或 wget http://d ...