php 实现店铺装修6
阅读原文时间:2023年07月14日阅读:2

/\*\*  
 \* @title 获取预览或发布的蜂店模板样式  
 \* @param store\_id 是 string 店铺id  
 \* @param type 是 int 装修模板的状态:1-预览蜂店装修模板样式、2-正式发布的蜂店装修模板样式  
 \* @param type\_id 是 int 要装修商品的类型(1-平台、2-特色)  
 \* @example FlagShipShopDecorate.getShopDecorateStyleOne? 调试参数:{"username":"17721355485","check\_code":"123456","method":"FlagShipShopDecorate.getShopDecorateStyleOne","type":"1","store\_id":"115066910197999","type\_id":"1"}  
 \* @return\_param\_explain list\_status:次数(1为首次进入/2为再次进入) shop\_decorate\_method:店铺装修秘籍 store\_info-- store\_version:1-蜂雷云店标准版/2-专业版/3-蜂雷云店--基础版/4-蜂雷云店--标准版/5-蜂雷云店--高级版/6-蜂雷云店--专业版 store\_name:店铺名称 store\_desc:店铺简介 bgpath:店铺背景图 short\_number:短编号 logopath:用户头像 plate\_id:店铺装修样式ID type:模板样式子板块类型(4-海景、6-二宫格、8-三宫格、9-四宫格) isShow:是否显示名称价格信息(1是、2否) sort:模块排序位置 index:商品sku排序位置 sku\_id:商品属性ID search\_name:商品搜索名称 short\_name:商品短名称 sku\_no:商品sku编号 title:商品sku名称  imgs:海景图 img:商品sku图片 sell\_price:售价 sell\_nums:销量 operate\_type:1-显示商品、2-不显示商品 activity\_info--- activityId:活动编码 activityType:活动类型 productPrice:活动售价 costPrice:成本价 title:活动标题 isAct:是否是活动(true:是、false:不是) show\_status:0-既不显示特色也不显示平台、1-只显示特色、2-只显示平台、3-即显示特色也显示平台  
 \* @method POST  
 \* @author 邹柯  
 \*/  
public function getShopDecorateStyleOne($res){  
    $user\_id=session('user.user\_id');  
    $type=$res\['type'\];  
    if($type != && $type !=){  
        E('');  
    }  
    $type\_id=$res\['type\_id'\];  
    if($type\_id != && $type\_id !=){  
        E('');  
    }  
    $store\_id=$res\['store\_id'\];

    $user\_shop\_decorate=M('user\_shop\_decorate');  
    $usd\_where\['flagship\_shop'\]=;  
    $usd\_where\['create\_id'\]=$user\_id;  
    if($type\_id ==){  
        $usd\_info=$user\_shop\_decorate->field('plate\_id')->where($usd\_where)->find();  
    }else{  
        $usd\_info=$user\_shop\_decorate->field('plate\_id\_features plate\_id')->where($usd\_where)->find();  
    }

    if(empty($usd\_info)){  
        $plate\_id=;  
    }else{  
        $plate\_id=$usd\_info\['plate\_id'\];  
    }

    if(empty($usd\_info)){  
        $plate\_id=1;  
        $plate\_content=$this->getShopDecorateInfoNew($plate\_id,$store\_id,$type\_id);  
    }else{  
        $plate\_id=$usd\_info\['plate\_id'\];  
        if(empty($plate\_id)){  
            $plate\_id=1;  
            $plate\_content=$this->getShopDecorateInfoNew($plate\_id,$store\_id,$type\_id);  
        }else{  
            $plate\_content=$this->getShopDecorateInfo($plate\_id,$type,$store\_id,$type\_id);  
        }  
    }

    //组装店铺信息   
    $plate\_content\['store\_info'\]=$this->getStoreInfoByStoreId($store\_id);   
    $shop\_decorate\_read=M('shop\_decorate\_read');   
    $cn=$shop\_decorate\_read->where(\['user\_id'=>$user\_id\])->count();   
    if($cn==){   
        $shop\_decorate\_read->data(\['user\_id'=>$user\_id\])->add();   
        $plate\_content\['list\_status'\]=;   
    }else{   
        $plate\_content\['list\_status'\]=;   
    }   
    $plate\_content\['shop\_decorate\_method'\]=$this->getShopDecorateMethod();   
    $plate\_content\['show\_status'\]=$this->isHasTeseGoods($user\_id,); 

    if($list\_status\['list\_status'\]==1){  
        $show\_status=3;  
    }else{  
        $show\_status=2;  
    }

    $plate\_content\['show\_status'\]=$show\_status;  
    return $plate\_content;   

}

返回结果

{
"status":"",
"errorCode":"",
"msg":"成功",
"result":{
"plate_id":"",
"list":[
{
"type":,
"isShow":"",
"sort":,
"goods":[
{
"sku_id":"",
"operate_type":,
"index":,
"type":,
"product_num":"",
"search_name":"无线路由器wifi穿墙 信号放大 覆盖范围广",
"short_name":"斐讯K2",
"sku_no":"P001219-01",
"title":"斐讯(PHICOMM)K2 1200M智能双频无线路由器 ",
"img":"http://img.test.feelee.cc//Public/Uploads/goodsimg/I0/5aa8d44648d05.jpg",
"sell_price":"399.00",
"activity_info":{
"productId":"P001219",
"skuNo":"P001219-01",
"productPrice":"00.00",
"costPrice":"00.00",
"activityId":null,
"activityType":null,
"title":null,
"status":"",
"isAct":false
},
"store_id":"",
"sell_nums":"",
"imgs":[
"http://img.test.feelee.cc/Public/Uploads/img/I9/P001219/P001219-xyqsNNNDrC.jpg",
"http://img.test.feelee.cc/Public/Uploads/img/I5/P002975/P002975-65BSz8DPmY.jpg",
"http://img.test.feelee.cc/Public/Uploads/img/I5/P002975/P002975-409oFe6y5R.jpg",
"http://img.test.feelee.cc/Public/Uploads/img/I9/P001219/P001219-JsN1EpDf5p.jpg",
"http://img.test.feelee.cc/Public/Uploads/goodsimg/I9/5a1e81afa85f2.jpg"
]
}
]
},
{
"type":,
"isShow":"",
"sort":,
"goods":[
{
"sku_id":"",
"operate_type":,
"index":,
"type":,
"product_num":"",
"search_name":"预售 2018年3月31日前统一发货 全渠道首批发货",
"short_name":"NAS",
"sku_no":"P002026-01",
"title":"【预售】斐讯(PHICOMM)天天链N1 新一代家庭专业NAS云盘 珍珠白",
"img":"http://img.test.feelee.cc//Public/Uploads/goodsimg/I3/5a6af2a558fc5.jpg",
"sell_price":"1499.00",
"activity_info":{
"productId":"P002026",
"skuNo":"P002026-01",
"productPrice":"00.00",
"costPrice":"00.00",
"activityId":null,
"activityType":null,
"title":null,
"status":"",
"isAct":false
},
"store_id":"",
"sell_nums":"",
"imgs":[
"http://img.test.feelee.cc/Public/Uploads/goodsimg/I0/5a6af1d051e53.jpg",
"http://img.test.feelee.cc/Public/Uploads/goodsimg/I2/5a6af1d2349ff.jpg",
"http://img.test.feelee.cc/Public/Uploads/goodsimg/I4/5a6af1d496d26.jpg",
"http://img.test.feelee.cc/Public/Uploads/goodsimg/I7/5a6af1d7ccae3.jpg"
]
}
]
},
{
"type":,
"isShow":"",
"sort":,
"goods":[
{
"sku_id":"",
"operate_type":,
"index":,
"type":,
"product_num":"",
"search_name":"1TB存储容量 轻薄机身 type-c接口 USB3.0协议 高速传输",
"short_name":"斐讯H1",
"sku_no":"P002330-01",
"title":"斐讯(PHICOMM) H1 移动硬盘 ",
"img":"http://img.test.feelee.cc//Public/Uploads/server/goods/20180411/a68db15234153762907.jpg",
"sell_price":"999.00",
"activity_info":{
"productId":"P002330",
"skuNo":"P002330-01",
"productPrice":"00.00",
"costPrice":"00.00",
"activityId":null,
"activityType":null,
"title":null,
"status":"",
"isAct":false
},
"store_id":"",
"sell_nums":"",
"imgs":[
"http://img.test.feelee.cc/Public/Uploads/server/goods/20180428/d0e8c15248997668431.png",
"http://img.test.feelee.cc/Public/Uploads/server/goods/20180411/5459d15234153678189.jpg",
"http://img.test.feelee.cc/Public/Uploads/server/goods/20180411/02b5c15234153694863.jpg",
"http://img.test.feelee.cc/Public/Uploads/server/goods/20180411/b86ce15234153713606.jpg",
"http://img.test.feelee.cc/Public/Uploads/server/goods/20180411/86d0815234153734114.jpg"
]
}
]
},
{
"type":,
"isShow":"",
"sort":,
"goods":[
{
"sku_id":"",
"operate_type":,
"index":,
"type":,
"product_num":"",
"search_name":"深入清洁牙齿缝隙和牙线 有效缓解牙齿敏感",
"short_name":"多效防敏小苏打牙膏",
"sku_no":"P002023-01",
"title":"艾禾美 多效防敏小苏打牙膏 127g",
"img":"http://img.test.feelee.cc//Public/Uploads/goodsimg/I1/5a6e8b4d0d69d.jpg",
"sell_price":"10.00",
"activity_info":{
"productId":"P002023",
"skuNo":"P002023-01",
"productPrice":"00.00",
"costPrice":"00.00",
"activityId":null,
"activityType":null,
"title":null,
"status":"",
"isAct":false
},
"store_id":"",
"sell_nums":"",
"imgs":[
"http://img.test.feelee.cc/Public/Uploads/goodsimg/I4/5a6e8b3cb5a1e.jpg",
"http://img.test.feelee.cc/Public/Uploads/goodsimg/I2/5a6e8b3a55b85.jpg",
"http://img.test.feelee.cc/Public/Uploads/goodsimg/I0/5a6e8b42498da.jpg",
"http://img.test.feelee.cc/Public/Uploads/goodsimg/I2/5a6e8b4415a01.jpg",
"http://img.test.feelee.cc/Public/Uploads/goodsimg/I4/5a6e8b4606e52.jpg"
]
},
{
"sku_id":"",
"operate_type":,
"index":,
"type":,
"product_num":"",
"search_name":" CADR值=350立方米每小时 节能静音",
"short_name":"PHICOMM/斐讯 悟净A1空气净化器",
"sku_no":"P001788-01",
"title":"斐讯(PHICOMM) 悟净A1空气净化器 智能操控 除甲醛PM2.5有害气体 ",
"img":"http://img.test.feelee.cc//Public/Uploads/goodsimg/I5/5a4447016c6bd.jpg",
"sell_price":"1999.00",
"activity_info":{
"productId":"P001788",
"skuNo":"P001788-01",
"productPrice":"00.00",
"costPrice":"00.00",
"activityId":null,
"activityType":null,
"title":null,
"status":"",
"isAct":false
},
"store_id":"",
"sell_nums":"",
"imgs":[
"http://img.test.feelee.cc/Public/Uploads/goodsimg/I5/5a44466b3470f.jpg",
"http://img.test.feelee.cc/Public/Uploads/goodsimg/I0/5a444670dc152.jpg",
"http://img.test.feelee.cc/Public/Uploads/goodsimg/I4/5a4446748a00c.jpg",
"http://img.test.feelee.cc/Public/Uploads/goodsimg/I8/5a4446789d516.jpg",
"http://img.test.feelee.cc/Public/Uploads/goodsimg/I2/5a44467c4b1c4.jpg"
]
},
{
"sku_id":"",
"operate_type":,
"index":,
"type":,
"product_num":"",
"search_name":"双星定位 IP67防水防尘 心率监测 睡眠监测",
"short_name":"斐讯智能运动手环 W1",
"sku_no":"P002080-01",
"title":"斐讯(PHICOMM)智能运动手环 W1",
"img":"http://img.test.feelee.cc//Public/Uploads/goodsimg/I2/5a935cc6726b8.jpg",
"sell_price":"799.00",
"activity_info":{
"productId":"P002080",
"skuNo":"P002080-01",
"productPrice":"00.00",
"costPrice":"00.00",
"activityId":null,
"activityType":null,
"title":null,
"status":"",
"isAct":false
},
"store_id":"",
"sell_nums":"",
"imgs":[
"http://img.test.feelee.cc/Public/Uploads/goodsimg/I6/5a92689290fa7.jpg",
"http://img.test.feelee.cc/Public/Uploads/goodsimg/I9/5a9268951f274.jpg",
"http://img.test.feelee.cc/Public/Uploads/goodsimg/I1/5a9268971ff81.jpg",
"http://img.test.feelee.cc/Public/Uploads/goodsimg/I4/5a92689a83e2d.jpg",
"http://img.test.feelee.cc/Public/Uploads/goodsimg/I6/5a92689cd3547.jpg"
]
}
]
},
{
"type":,
"isShow":"",
"sort":,
"goods":[
{
"sku_id":"",
"operate_type":,
"index":,
"type":,
"product_num":"",
"search_name":"哈曼国际联合打造 高智能语音交互 智能家居 语音助手",
"short_name":"AI智能音箱",
"sku_no":"P002086-02",
"title":"斐讯(PHICOMM)AI智能音箱语音机器人 R1",
"img":"http://img.test.feelee.cc//Public/Uploads/goodsimg/I1/5aaba37587497.jpg",
"sell_price":"2499.00",
"activity_info":{
"productId":"P002086",
"skuNo":"P002086-02",
"productPrice":"00.00",
"costPrice":"00.00",
"activityId":null,
"activityType":null,
"title":null,
"status":"",
"isAct":false
},
"store_id":"",
"sell_nums":"",
"imgs":[
"http://img.test.feelee.cc/Public/Uploads/goodsimg/I1/5aaba36149de9.jpg",
"http://img.test.feelee.cc/Public/Uploads/goodsimg/I8/5aaba35eaa034.jpg",
"http://img.test.feelee.cc/Public/Uploads/goodsimg/I1/5aaba2d5dc537.jpg",
"http://img.test.feelee.cc/Public/Uploads/goodsimg/I8/5aaba2dce430a.jpg",
"http://img.test.feelee.cc/Public/Uploads/goodsimg/I9/5aaba2dd303a5.jpg"
]
}
]
},
{
"type":,
"isShow":"",
"sort":,
"goods":[
{
"sku_id":"",
"operate_type":,
"index":,
"type":,
"product_num":"",
"search_name":"店铺标准版",
"short_name":"标准版",
"sku_no":"FL001001-04",
"title":"蜂雷云店--基础版",
"img":"http://img.test.feelee.cc//Public/Uploads/server/goods/20180409/93c7115232752884714.png",
"sell_price":"365.00",
"activity_info":{
"productId":"FL001001",
"skuNo":"FL001001-04",
"productPrice":"00.00",
"costPrice":"00.00",
"activityId":null,
"activityType":null,
"title":null,
"status":"",
"isAct":false
},
"store_id":"",
"sell_nums":"",
"imgs":[
"http://img.test.feelee.cc/Public/Uploads/goodsimg/I4/5a715bc8d7c76.png"
]
},
{
"sku_id":"",
"operate_type":,
"index":,
"type":,
"product_num":"",
"search_name":"店铺标准版",
"short_name":"高级版",
"sku_no":"FL001001-06",
"title":"蜂雷云店--高级版",
"img":"http://img.test.feelee.cc//Public/Uploads/server/goods/20180409/93c7115232752884714.png",
"sell_price":"3650.00",
"activity_info":{
"productId":"FL001001",
"skuNo":"FL001001-06",
"productPrice":"00.00",
"costPrice":"00.00",
"activityId":null,
"activityType":null,
"title":null,
"status":"",
"isAct":false
},
"store_id":"",
"sell_nums":"",
"imgs":[
"http://img.test.feelee.cc/Public/Uploads/goodsimg/I4/5a715bc8d7c76.png"
]
},
{
"sku_id":"",
"operate_type":,
"index":,
"type":,
"product_num":"",
"search_name":"店铺标准版",
"short_name":"基础版",
"sku_no":"FL001001-05",
"title":"蜂雷云店--标准版",
"img":"http://img.test.feelee.cc//Public/Uploads/server/goods/20180409/93c7115232752884714.png",
"sell_price":"1800.00",
"activity_info":{
"productId":"FL001001",
"skuNo":"FL001001-05",
"productPrice":"00.00",
"costPrice":"00.00",
"activityId":null,
"activityType":null,
"title":null,
"status":"",
"isAct":false
},
"store_id":"",
"sell_nums":"",
"imgs":[
"http://img.test.feelee.cc/Public/Uploads/goodsimg/I4/5a715bc8d7c76.png"
]
},
{
"sku_id":"",
"operate_type":,
"index":,
"type":,
"product_num":"",
"search_name":"店铺标准版",
"short_name":"高级版",
"sku_no":"FL001001-07",
"title":"蜂雷云店--专业版",
"img":"http://img.test.feelee.cc//Public/Uploads/server/goods/20180409/93c7115232752884714.png",
"sell_price":"18000.00",
"activity_info":{
"productId":"FL001001",
"skuNo":"FL001001-07",
"productPrice":"00.00",
"costPrice":"00.00",
"activityId":null,
"activityType":null,
"title":null,
"status":"",
"isAct":false
},
"store_id":"",
"sell_nums":"",
"imgs":[
"http://img.test.feelee.cc/Public/Uploads/goodsimg/I4/5a715bc8d7c76.png"
]
}
]
}
],
"store_info":{
"id":"",
"store_name":"邹柯的云店多少",
"store_desc":"",
"bgpath":null,
"short_number":"",
"invitation_code":"",
"qr_code":"http://img.test.feelee.cc//Public/Uploads/img/Qrcode/I4/115066910197999.png?v=1521541204",
"logopath":"http://img.test.feelee.cc//Public/Images/Common/userLogo.png",
"qrcode_desc":"蜂雷,赚钱从未如此简单!",
"url":"http://feeleeh5.com/cloud/advanced?store_id=115066910197999",
"store_version":""
},
"list_status":,
"shop_decorate_method":{
"head":"装修秘籍",
"list":[
{
"title":"1、第壹式:",
"content":"系统初始会使用“默认样式”,商品默认按照销量从高到低进行排列;"
},
{
"title":"2、第贰式:",
"content":"点击“选择样式”,即可选择店主精选的商品布局样式;哈哈,前提是有2套或以上的样式可选哦 ^o^"
},
{
"title":"3、第叁式:",
"content":"点击商品图片,可以更换商品;点击空白区域,可以添加商品;点击“删除”图标,可以删除商品;"
},
{
"title":"4、第肆式:",
"content":"选择完样式,设置完商品后,那赶紧点击“预览”看看装修成果吧;"
},
{
"title":"5、第伍式:",
"content":"最终确认无误后,点击右上角的“发布”,即可正式生效;"
},
{
"title":"6、第陆式:",
"content":"完。"
}
],
"foot":"若以上6式都已学会,那恭喜你,你可以毕业了,小蜜感到很欣慰;如果还有其他问题,可以联系我们客服小姐姐哦;"
}
}
}

/\*\*  
 \* @title 旗舰版店铺首页  
 \* @param type\_id 否 int 要装修商品的类型(1-平台、2-特色)  
 \* @param type 否 int 板块类型(0-店主精选、1-全部宝贝、2-热销Top100)  
 \* @param sort 否 int 排序字段:type=1时必传(1销量由高到低、2价格由低到高、3价格由高到低)  
 \* @param source 是 int 来源(1-H5、2-webApp)  
 \* @param store\_id 是 string 店铺id  
 \* @param store\_type 是 string 店铺标识(me本店,其他非本店)  
 \* @param keywords 否 string 搜索(商品名称)  
 \* @param page 否 int 页码(不传默认1)  
 \* @param pageSize 否 int 每页显示条数(不传默认10)  
 \* @example FlagShipShopDecorate.myHomeStore?  调试参数:{"keywords":"","source":"1","store\_type":"other","username":"17721355485","check\_code":"123456","method":"FlagShipShopDecorate.myHomeStore","type":"1","sort":"","store\_id":"115075399495199","page":"1","pageSize":"20","type\_id":"1"}  
 \* @return\_param\_explain is\_advanced\_store\_front:是否设置高级版店铺首页(1-是/2-否) is\_store\_decorate:是否设置店铺装修(1-是、2-否) store\_info-- store\_version:1-蜂雷云店标准版/2-专业版/3-蜂雷云店--基础版/4-蜂雷云店--标准版/5-蜂雷云店--高级版/6-蜂雷云店--专业版 url:分享的高级版店铺首页H5链接 qr\_code:二维码 qrcode\_desc:分享二维码描述 url\_desc:链接分型提示 invitation\_code:邀请码 store\_name:店铺名称 store\_desc:店铺简介 bgpath:店铺背景图 short\_number:短编号 logopath:用户头像 isShow:是否显示名称价格信息(1是、2否) sort:位置排序值 goods\_info--  imgs:海景图 product\_num:该商品sku数 operate\_type:1-显示商品、2-不显示商品 product\_id:商品编号 search\_name:商品搜索名称 short\_name:商品短名称 sku\_no:商品sku编号 sku\_id:商品sku\_id title:商品名称 img:商品图片 sell\_price:商品售价 store\_id:店铺id sell\_nums:销量 type:模板样式子板块类型(4-海景、6-二宫格、8-三宫格、9-四宫格) activity\_info--- activityId:活动编码 activityType:活动类型 productPrice:活动售价 costPrice:成本价 title:活动标题 isAct:是否是活动(true:是、false:不是) show\_status:0-既不显示特色也不显示平台、1-只显示特色、2-只显示平台、3-即显示特色也显示平台  
 \* @method POST  
 \* @author 邹柯  
 \*/  
public function myHomeStore($res){  
    $self\_user\_id=session('user.user\_id');  
    //0-店主精选、1-全部宝贝、2-热销Top100  
    $type=$res\['type'\];  
    if(empty($type)){  
        $type=;  
    }  
    if($type != && $type != && $type !=){  
        E('');  
    }  
    if($type==){  
        //排序字段(1销量由高到低、2价格由低到高、3价格由高到低)  
        $sort=$res\['sort'\];  
        if(empty($sort)){  
            $sort=;  
        }  
        if($sort != && $sort != && $sort !=){  
            E('');  
        }  
    }  
    $type\_id=$res\['type\_id'\];

    $store\_id=$res\['store\_id'\];  
    $store=M('store');  
    $store\_info=$store->field('user\_id')->where(\['id'=>$store\_id\])->find();  
    $user\_id=$store\_info\['user\_id'\];  
    $list\['show\_status'\]=$this->isHasTeseGoods($user\_id,,$self\_user\_id);  
    if(empty($type\_id)){  
        if($list\['show\_status'\]== || $list\['show\_status'\]==){  
            $type\_id=;  
        }else{  
            $type\_id=;  
        }  
    }  
    $store\_type=$res\['store\_type'\];  
    $source=$res\['source'\];  
    if($source != && $source !=){  
        E('');  
    }  
    $keywords=$res\['keywords'\];

    //页码  
    $page = $res\['page'\];  
    if(empty($page)){  
        $page=;  
    }  
    if(!is\_numeric($page) || $page <= ){  
        E('');  
    }

    //每页显示条数  
    $pageSize = $res\['pageSize'\];  
    if(empty($pageSize)){  
        $pageSize=;  
    }  
    if(!is\_numeric($pageSize) || $pageSize <= ){  
        E('');  
    }  
    //组装店铺信息  
    $list\['store\_info'\]=$this->getStoreInfoByStoreId($store\_id);  
    //判断当前登陆用户是否是要访问的旗舰版店铺首页的下级  
    $flag=$this->isParentUserId($self\_user\_id,$user\_id);  
    if($type==){  
        $user\_shop\_decorate=M('user\_shop\_decorate');  
        $usd\_where\['flagship\_shop'\]=;  
        $usd\_where\['create\_id'\]=$user\_id;  
        if($type\_id ==){  
            $usd\_info=$user\_shop\_decorate->field('plate\_id')->where($usd\_where)->order('create\_time desc')->find();  
        }else{  
            $usd\_info=$user\_shop\_decorate->field('plate\_id\_features as plate\_id,plate\_content\_features')->where($usd\_where)->order('create\_time desc')->find();  
        }  
        if(empty($usd\_info)){  
            $plate\_id=;  
        }else{  
            $plate\_id=$usd\_info\['plate\_id'\];  
        }  
        if($list\['show\_status'\]==){  
            $list\['goods\_info'\]\['list'\]=\[\];  
        }else{  
            if($type\_id ==){  
                $list\['goods\_info'\]=$this->getShopDecorate($plate\_id,,$store\_id,$store\_type,$source,$type\_id);  
            }else{  
                if(empty($usd\_info\['plate\_content\_features'\])){  
                    $list\['goods\_info'\]=null;  
                }else{  
                    $list\['goods\_info'\]=$this->getShopDecorate($plate\_id,,$store\_id,$store\_type,$source,$type\_id);  
                }  
            }  
        }  
    }elseif($type==){  
        if($sort==){  
            $order="gs.sell\_nums desc";  
        }elseif($sort==){  
            $order="gs.sell\_price asc";  
        }else{  
            $order="gs.sell\_price desc";  
        }  
        $list\['goods\_info'\]=$this->getDefaultGoodsInfo(null,$order,$page,$pageSize,,$store\_id,$store\_type,$source,$keywords,$flag);  
    }else{  
        $list\['goods\_info'\]=$this->getDefaultGoodsInfo(,"sell\_nums desc",$page,$pageSize,,$store\_id,$store\_type,$source,$keywords,$flag);  
    }  
    $store\_extend=M('store\_extend');  
    $se\_where\['user\_id'\]=$user\_id;  
    $store\_version\_id=$store\_extend->field('store\_id,version\_id')->where($se\_where)->find();  
    if(!empty($store\_version\_id)){  
        $store\_version=M('store\_version');  
        $sv\_where\['id'\]=$store\_version\_id\['version\_id'\];  
        $s\_info=$store\_version->field('is\_store\_decorate,is\_advanced\_store\_front')->where($sv\_where)->find();  
        $list\['is\_store\_decorate'\]=$s\_info\['is\_store\_decorate'\];  
        $list\['is\_advanced\_store\_front'\]=$s\_info\['is\_advanced\_store\_front'\];  
    }else{  
        $list\['is\_store\_decorate'\]=;  
        $list\['is\_advanced\_store\_front'\]=;  
    }  
    return $list;  
}

返回结果

{
"status":"",
"errorCode":"",
"msg":"成功",
"result":{
"store_info":{
"logopath":"http://img.test.feelee.cc//Public/Images/Common/userLogo.png",
"qrcode_desc":"蜂雷,赚钱从未如此简单!",
"url":"http://feeleeh5.com/cloud/advanced?store_id=",
"store_version":null
},
"goods_info":{
"plate_id":,
"list":[
{
"type":,
"isShow":,
"sort":,
"goods":[
{
"imgs":[
"http://img.test.feelee.cc/Public/Uploads/img/I9/P001219/P001219-xyqsNNNDrC.jpg",
"http://img.test.feelee.cc/Public/Uploads/img/I5/P002975/P002975-65BSz8DPmY.jpg",
"http://img.test.feelee.cc/Public/Uploads/img/I5/P002975/P002975-409oFe6y5R.jpg",
"http://img.test.feelee.cc/Public/Uploads/img/I9/P001219/P001219-JsN1EpDf5p.jpg",
"http://img.test.feelee.cc/Public/Uploads/goodsimg/I9/5a1e81afa85f2.jpg"
],
"product_id":"P001219",
"search_name":"无线路由器wifi穿墙 信号放大 覆盖范围广",
"short_name":"斐讯K2",
"sku_no":"P001219-01",
"sku_id":"",
"title":"斐讯(PHICOMM)K2 1200M智能双频无线路由器 ",
"img":"http://img.test.feelee.cc//Public/Uploads/goodsimg/I0/5aa8d44648d05.jpg",
"sell_price":"399.00",
"sell_nums":"",
"store_id":"",
"activity_info":{
"productId":"P001219",
"skuNo":"P001219-01",
"productPrice":"00.00",
"costPrice":"00.00",
"activityId":null,
"activityType":null,
"title":null,
"status":"",
"isAct":false
},
"type":,
"index":
}
]
}
],
"foot":{
"current_page":"",
"pagesize":"",
"total_page":
}
},
"is_store_decorate":"",
"is_advanced_store_front":""
}
}

private function getShopDecorateInfoNew($plate_id,$store_id,$type_id){
$shop_decorate_template=M('shop_decorate_template');
$where['status']=;
$where['id']=$plate_id;
$list=$shop_decorate_template->field('id,plate_content,goods_nums')->where($where)->find();
$plate_content=json_decode($list['plate_content'],true);
if($type_id==){
$goods_info=$this->getDefaultGoodsInfo($list['goods_nums'],"sell_nums desc",null,null,null,null,null,null,null,null,);
}else{
$goods_info=$this->getDefaultGoodsNull($list['goods_nums'],$type_id);

        $sku\_ids=array\_unique(array\_column($goods\_info,'sku\_id'));  
        $sku\_info=$this->getGoodsInfo($sku\_ids,$store\_id,'me',);  
        foreach($goods\_info as $k=>$v){  
            $goods\_info\[$k\]\['product\_id'\]=$sku\_info\[$v\['sku\_id'\]\]\['product\_id'\];  
            $goods\_info\[$k\]\['sku\_no'\]=$sku\_info\[$v\['sku\_id'\]\]\['sku\_no'\];  
        }  
    }  
    //查询商品是否有多个sku  
    $str=$this->getMultiSku($goods\_info);  
    foreach($goods\_info as $k=>$v){  
        $data\[\]=array(  
            'productId'=>$v\['product\_id'\],  
            'skuNo'=>$v\['sku\_no'\]  
        );  
        $sk\[$v\['sku\_id'\]\]=$v\['sku\_no'\];  
    }  
    $home\_special\_session=new HomeSpecialSessionModel();  
    $res\_info=$home\_special\_session->getGoodsActInfo($data);  
    foreach($goods\_info as $k=>$v){  
        $goods\_info\[$k\]\['activity\_info'\]=$res\_info\[$sk\[$v\['sku\_id'\]\]\];  
        if($type\_id==){  
            $goods\_info\[$k\]\['operate\_type'\]=;  
        }else{  
            $goods\_info\[$k\]\['operate\_type'\]=;  
        }  
        $goods\_info\[$k\]\['index'\]=$k+;  
        if($type\_id==){  
            $goods\_info\[$k\]\['search\_name'\]=$sku\_info\[$v\['sku\_id'\]\]\['search\_name'\];  
            $goods\_info\[$k\]\['short\_name'\]=$sku\_info\[$v\['sku\_id'\]\]\['short\_name'\];  
            $goods\_info\[$k\]\['sku\_no'\]=$sku\_info\[$v\['sku\_id'\]\]\['sku\_no'\];  
            $goods\_info\[$k\]\['title'\]=$sku\_info\[$v\['sku\_id'\]\]\['title'\];  
            $goods\_info\[$k\]\['img'\]=$sku\_info\[$v\['sku\_id'\]\]\['img'\];  
            $goods\_info\[$k\]\['sell\_price'\]=$sku\_info\[$v\['sku\_id'\]\]\['sell\_price'\];  
            $goods\_info\[$k\]\['store\_id'\]=$sku\_info\[$v\['sku\_id'\]\]\['store\_id'\];  
            $goods\_info\[$k\]\['sell\_nums'\]=$sku\_info\[$v\['sku\_id'\]\]\['sell\_nums'\];  
            $goods\_info\[$k\]\['imgs'\]=$sku\_info\[$v\['sku\_id'\]\]\['imgs'\];  
        }  
    }  
    $total\_nums=;  
    foreach($plate\_content as $k=>$v){  
        $at=array\_slice($goods\_info,$total\_nums,$v\['goods\_nums'\]);  
        foreach($at as $k2=>$v2){  
            $at\[$k2\]\['type'\]=$v\['type'\];  
            $at\[$k2\]\['sort'\]=$v\['sort'\];  
            $at\[$k2\]\['isShow'\]=$v\['isShow'\];  
            if($v\['type'\] !=){  
                $at\[$k2\]\['product\_num'\]='';  
            }else{  
                $at\[$k2\]\['product\_num'\]=$str\[$v2\['product\_id'\]\];  
            }  
        }  
        $plate\_content\[$k\]\['goods'\]=$at;  
        $total\_nums +=$v\['goods\_nums'\];  
        unset($plate\_content\[$k\]\['goods\_nums'\]);  
    }  
    $arrs\['plate\_id'\]=$plate\_id;  
    $arrs\['list'\]=$plate\_content;  
    return $arrs;  
}

//判断当前登陆用户是否是要访问的旗舰版店铺首页的下级  
public function isParentUserId($user\_id,$store\_user\_id){  
    if(empty($user\_id)){  
        return false;  
    }  
    $customer=M('customer');  
    $c\_info=$customer->field('partent\_user\_id')->where(\['user\_id'=>$user\_id\])->find();  
    if($c\_info\['partent\_user\_id'\]==$store\_user\_id || $user\_id==$store\_user\_id){  
        return true;  
    }  
    return false;  
}

/\*\*  
 \* @title 判断是否有特色商品  
 \* @param store\_id 是 string 店铺id  
 \* @example FlagShipShopDecorate.getHasTeseGoods?  调试参数:{"username":"17721355485","check\_code":"123456","method":"FlagShipShopDecorate.getHasTeseGoods","store\_id":"115075399495199"}  
 \* @return {"status":"0","errorCode":"0","msg":"成功","result":{"list\_status":1}}  
 \* @return\_param\_explain list\_status:1-有特色商品、2-无特色商品  
 \* @method POST  
 \* @author 邹柯  
 \*/  
public function getHasTeseGoods($res){  
    $store\_id=$res\['store\_id'\];  
    $store\_goods=M('store\_goods');  
    $sg\_where\['store\_id'\]=$store\_id;  
    $sg\_where\['is\_deleted'\]=;  
    $sg\_where\['is\_open'\]=;  
    $count=$store\_goods->field()->where($sg\_where)->count();  
    if($count==){  
        $data\['list\_status'\]=;  
    }else{  
        $data\['list\_status'\]=;  
    }  
    return $data;  
}

//判断当前店铺下是否有特色商品  
//$status 1.预览(草稿) 2.发布 0-既不显示特色也不显示平台、1-只显示特色、2-只显示平台、3-即显示特色也显示平台  
public function isHasTeseGoods($user\_id,$status,$self\_user\_id){  
    $user\_shop\_decorate=M('user\_shop\_decorate');  
    $usd\_where\['create\_id'\]=$user\_id;  
    $usd\_where\['flagship\_shop'\]=;  
    $usd\_info=$user\_shop\_decorate->field('use\_status,plate\_content\_draft,plate\_content,plate\_content\_draft\_features,plate\_content\_features')->where($usd\_where)->find();  
    if(empty($usd\_info)){  
        return ;  
    }  
    if($status==){  
        if(empty($usd\_info\['plate\_content\_draft\_features'\]) && empty($usd\_info\['plate\_content\_draft'\])){  
            return ;  
        }elseif(!empty($usd\_info\['plate\_content\_draft\_features'\]) && empty($usd\_info\['plate\_content\_draft'\])){  
            return ;  
        }elseif(empty($usd\_info\['plate\_content\_draft\_features'\]) && !empty($usd\_info\['plate\_content\_draft'\])){  
            return ;  
        }else{  
            return ;  
        }  
    }else{  
        if(empty($self\_user\_id)){  
            if(empty($usd\_info\['plate\_content\_features'\])) {  
                return ;  
            }else{  
                return ;  
            }  
        }  
        if(empty($usd\_info\['plate\_content\_features'\]) && empty($usd\_info\['plate\_content'\])){  
            return ;  
        }elseif(!empty($usd\_info\['plate\_content\_features'\]) && empty($usd\_info\['plate\_content'\])){  
            return ;  
        }elseif(empty($usd\_info\['plate\_content\_features'\]) && !empty($usd\_info\['plate\_content'\])){  
            return ;  
        }else{  
            return ;  
        }  
    }  
    return ;  
}

//获取店铺装修秘籍  
public function getShopDecorateMethod(){  
    $arr\['head'\]="装修秘籍";  
    $arr\['list'\]=\[  
        \[  
            'title'=>'1、第壹式:',  
            'content'=>'系统初始会使用“默认样式”,商品默认按照销量从高到低进行排列;',  
        \],\[  
            'title'=>'2、第贰式:',  
            'content'=>'点击“选择样式”,即可选择店主精选的商品布局样式;哈哈,前提是有2套或以上的样式可选哦 ^o^',  
        \],\[  
            'title'=>'3、第叁式:',  
            'content'=>'点击商品图片,可以更换商品;点击空白区域,可以添加商品;点击“删除”图标,可以删除商品;',  
        \],\[  
            'title'=>'4、第肆式:',  
            'content'=>'选择完样式,设置完商品后,那赶紧点击“预览”看看装修成果吧;',  
        \],\[  
            'title'=>'5、第伍式:',  
            'content'=>'最终确认无误后,点击右上角的“发布”,即可正式生效;',  
        \],\[  
            'title'=>'6、第陆式:',  
            'content'=>'完。',  
        \],  
    \];  
    $arr\['foot'\]="若以上6式都已学会,那恭喜你,你可以毕业了,小蜜感到很欣慰;如果还有其他问题,可以联系我们客服小姐姐哦;";  
    return $arr;  
}

//获取商品详情  
private function getGoodsInfo($sku\_ids,$store\_id,$store\_type,$source){  
    $img\_url=rtrim(C('img\_base'),'/');  
    $goods\_sku\_m=M('goods\_sku gs');  
    //根据sku\_id查找对应的商品  
    $where\['gs.sku\_id'\] =array("in",$sku\_ids);  
    $goods\_info = $goods\_sku\_m->join('left join \_\_GOODS\_\_ gd on gd.product\_id=gs.product\_id')  
        ->field('seascapes,gs.product\_id,gs.sku\_no,gd.search\_name,gs.short\_name,gs.sku\_no,gs.sku\_id,gs.title,concat("'.$img\_url.'",gs.img) as img,gs.sell\_price,gs.sell\_nums')  
        ->where($where)  
        ->select();  
    foreach($goods\_info as $k=>$v){  
        $v\['imgs'\]=$this->getHaiJing($v\['seascapes'\]);  
        $arr\[$v\['sku\_id'\]\]=$v;  
        $arr\[$v\['sku\_id'\]\]\['store\_id'\]=$this->getStoreId($store\_id,$store\_type,$source,$v\['sku\_id'\]);  
    }  
    return $arr;  
}

//获取默认模板所需要的商品
private function getDefaultGoodsInfo($limit,$order,$page,$pageSize,$ori,$store_id,$store_type,$source,$keywords,$flag){
$img_url=rtrim(C('img_base'),'/');
$goods_sku_m=M('goods_sku gs');
//根据sku_id查找对应的商品
if($flag==false){ //不是下级或用户未登录
$where="gs.is_show=0 and gs.status=1 and gs.is_deleted=0 and gd.is_deleted=0 and gd.is_online=1 and sg.is_deleted=1 and sg.is_open=1 and sg.store_id='$store_id' and gs.goods_type=2";
}else{
$where="gs.is_show=0 and gs.status=1 and gs.is_deleted=0 and gd.is_deleted=0 and gd.is_online=1 and sg.is_deleted=1 and sg.is_open=1 and (sg.store_id='$store_id' or sg.store_id is null)";
}
if(!empty($keywords)){
$where .=" and (gs.title like '%$keywords%' or gd.search_name like '%$keywords%' or gs.short_name like '%$keywords%')";
}
if(empty($page)){
$list = $goods_sku_m->join('left join __GOODS__ gd on gd.product_id=gs.product_id')
->join('left join __STORE_GOODS__ sg on sg.sku_id=gs.sku_id')
->field('gd.seascapes,gs.product_id,gd.search_name,gs.short_name,gs.sku_no,gs.sku_id,gs.title,concat("'.$img_url.'",gs.img) as img,gs.sell_price,sum(gs.sell_nums) as sell_nums')
->where($where)
->order($order)
->limit($limit)
->group('gs.product_id')
->select();
foreach($list as $k=>$v){
$list[$k]['store_id']=$this->getStoreId($store_id,$store_type,$source,$v['sku_id']);
$list[$k]['imgs']=$this->getHaiJing($v['seascapes']);
$data[]=array(
'productId'=>$v['product_id'],
'skuNo'=>$v['sku_no']
);
}

        $home\_special\_session=new HomeSpecialSessionModel();  
        $res\_info=$home\_special\_session->getGoodsActInfo($data);  
        foreach($list as $k=>$v){  
            $list\[$k\]\['activity\_info'\]=$res\_info\[$v\['sku\_no'\]\];  
            $list\[$k\]\['operate\_type'\]=;  
        }  
    }else{  
        if($ori==){  
            $count = $goods\_sku\_m->join('left join \_\_GOODS\_\_ gd on gd.product\_id=gs.product\_id')  
                ->join('left join \_\_STORE\_GOODS\_\_ sg on sg.sku\_id=gs.sku\_id')  
                ->where($where)  
                ->count('DISTINCT gs.product\_id');  
            $goods\_info = $goods\_sku\_m->join('left join \_\_GOODS\_\_ gd on gd.product\_id=gs.product\_id')  
                ->join('left join \_\_STORE\_GOODS\_\_ sg on sg.sku\_id=gs.sku\_id')  
                ->field('gd.seascapes,gs.product\_id,gd.search\_name,gs.short\_name,gs.sku\_no,gs.sku\_id,gs.title,concat("'.$img\_url.'",gs.img) as img,gs.sell\_price,gs.sell\_nums')  
                ->where($where)  
                ->order($order)  
                ->group('gs.product\_id')  
                ->page($page,$pageSize)  
                ->select();  
        }else{  
            $count =$limit;  
            $sql = $goods\_sku\_m->join('left join \_\_GOODS\_\_ gd on gd.product\_id=gs.product\_id')  
                ->join('left join \_\_STORE\_GOODS\_\_ sg on sg.sku\_id=gs.sku\_id')  
                ->field('gd.seascapes,gs.product\_id,gd.search\_name,gs.short\_name,gs.sku\_no,gs.sku\_id,gs.title,concat("'.$img\_url.'",gs.img) as img,gs.sell\_price,gs.sell\_nums')  
                ->where($where)  
                ->order($order)  
                ->group('gs.product\_id')  
                ->limit($limit)  
                ->select(false);  
            try{  
                $goods\_info=M()->table(sprintf('(%s) a', $sql) )->page($page,$pageSize)->select();  
            }catch (\\Exception $e){  
                echo($e->getMessage());  
            }  
            //组装分页信息  
            $count=count($goods\_info);  
        }  
        foreach($goods\_info as $k=>$v){  
            $data\[\]=array(  
                'productId'=>$v\['product\_id'\],  
                'skuNo'=>$v\['sku\_no'\]  
            );  
        }  
        $home\_special\_session=new HomeSpecialSessionModel();  
        $res\_info=$home\_special\_session->getGoodsActInfo($data);  
        foreach($goods\_info as $k=>$v){  
            $goods\_info\[$k\]\['store\_id'\]=$this->getStoreId($store\_id,$store\_type,$source,$v\['sku\_id'\]);  
            $goods\_info\[$k\]\['activity\_info'\]=$res\_info\[$v\['sku\_no'\]\];  
            $goods\_info\[$k\]\['type'\]=;  
            $goods\_info\[$k\]\['isShow'\]=;  
            $goods\_info\[$k\]\['index'\]=$k+;  
            $goods\_info\[$k\]\['imgs'\]=$this->getHaiJing($v\['seascapes'\]);  
        }  
        $total\_page=ceil($count/$pageSize);

        $list\['plate\_id'\]=;  
        if(empty($goods\_info)){  
            $foot=array('current\_page'=>$page,'pagesize'=>$pageSize,'total\_page'=>);  
            $list\['list'\]=null;  
        }else{  
            $foot=array('current\_page'=>$page,'pagesize'=>$pageSize,'total\_page'=>$total\_page);  
            $list\['list'\]=array(  
                array(  
                    'type'=>,  
                    'isShow'=>,  
                    'sort'=>,  
                    'goods'=>$goods\_info  
                )  
            );  
        }  
        $list\['foot'\]=$foot;  
    }

    return $list;  
}

//获取店铺id信息  
private function getStoreId($store\_id,$store\_type,$source,$sku\_id){  
    $ob=new PublicModel();  
    if($source==){  
        $inf=$ob->shopDeal($store\_id);  
    }else{ //h5  
        $inf=$ob->shopDealH5($store\_id,$store\_type);  
    }  
    $infs=$ob->getTeSeGoods($sku\_id);  
    if(empty($infs)){//平台商品  
        $store\_id=$inf;  
    }else{  
        $store\_id=$infs\['store\_id'\];  
    }  
    return $store\_id;  
}

//获取店铺装修信息  
private function getShopDecorateInfo($plate\_id,$type,$store\_id,$type\_id){  
    $user\_id=session("user.user\_id");  
    $user\_shop\_decorate=M('user\_shop\_decorate');  
    $usd\_where\['flagship\_shop'\]=;  
    $usd\_where\['create\_id'\]=$user\_id;  
    if($type\_id==){  
        $usd\_info=$user\_shop\_decorate->field('id,plate\_content,plate\_content\_draft,plate\_content\_features,plate\_content\_draft\_features')->where($usd\_where)->find();  
    }else{  
        $usd\_info=$user\_shop\_decorate->field('id,plate\_content\_features plate\_content,plate\_content\_draft\_features plate\_content\_draft')->where($usd\_where)->find();  
    }  
    if(!empty($usd\_info)){  
        if($type==){  
            $plate\_content=json\_decode($usd\_info\['plate\_content\_draft'\],true);  
        }else{  
            $plate\_content=json\_decode($usd\_info\['plate\_content'\],true);  
        }  
        foreach($plate\_content as $k=>$v){  
            foreach($v\['goods'\] as $k2=>$v2){  
                if(!empty($v2\['sku\_id'\])){  
                    $arr\[\]=$v2\['sku\_id'\];  
                }  
            }  
        }  
        $sku\_info=$this->getGoodsInfo($arr,$store\_id,'me',);  
        foreach($sku\_info as $k=>$v){  
            $data\[\]=array(  
                'productId'=>$v\['product\_id'\],  
                'skuNo'=>$v\['sku\_no'\]  
            );  
            $sk\[$v\['sku\_id'\]\]=$v\['sku\_no'\];  
        }  
        $home\_special\_session=new HomeSpecialSessionModel();  
        $res\_info=$home\_special\_session->getGoodsActInfo($data);  
        //查询商品是否有多个sku  
        $str=$this->getMultiSku($sku\_info);  
        foreach($plate\_content as $k=>$v){  
            foreach($v\['goods'\] as $k2=>$v2){  
                $plate\_content\[$k\]\['goods'\]\[$k2\]\['type'\]=$v\['type'\];  
                $plate\_content\[$k\]\['goods'\]\[$k2\]\['sort'\]=$v\['sort'\];  
                $plate\_content\[$k\]\['goods'\]\[$k2\]\['isShow'\]=$v\['isShow'\];  
                if($v\['type'\] !=){  
                    $plate\_content\[$k\]\['goods'\]\[$k2\]\['product\_num'\]='';  
                }else{  
                    $plate\_content\[$k\]\['goods'\]\[$k2\]\['product\_num'\]=$str\[$sku\_info\[$v2\['sku\_id'\]\]\['product\_id'\]\];  
                }  
                $plate\_content\[$k\]\['goods'\]\[$k2\]\['search\_name'\]=$sku\_info\[$v2\['sku\_id'\]\]\['search\_name'\];  
                $plate\_content\[$k\]\['goods'\]\[$k2\]\['short\_name'\]=$sku\_info\[$v2\['sku\_id'\]\]\['short\_name'\];  
                $plate\_content\[$k\]\['goods'\]\[$k2\]\['sku\_no'\]=$sku\_info\[$v2\['sku\_id'\]\]\['sku\_no'\];  
                $plate\_content\[$k\]\['goods'\]\[$k2\]\['title'\]=$sku\_info\[$v2\['sku\_id'\]\]\['title'\];  
                $plate\_content\[$k\]\['goods'\]\[$k2\]\['img'\]=$sku\_info\[$v2\['sku\_id'\]\]\['img'\];  
                $plate\_content\[$k\]\['goods'\]\[$k2\]\['sell\_price'\]=$sku\_info\[$v2\['sku\_id'\]\]\['sell\_price'\];  
                $plate\_content\[$k\]\['goods'\]\[$k2\]\['activity\_info'\]=$res\_info\[$sk\[$v2\['sku\_id'\]\]\];  
                $plate\_content\[$k\]\['goods'\]\[$k2\]\['store\_id'\]=$sku\_info\[$v2\['sku\_id'\]\]\['store\_id'\];  
                $plate\_content\[$k\]\['goods'\]\[$k2\]\['sell\_nums'\]=$sku\_info\[$v2\['sku\_id'\]\]\['sell\_nums'\];  
                $plate\_content\[$k\]\['goods'\]\[$k2\]\['imgs'\]=$sku\_info\[$v2\['sku\_id'\]\]\['imgs'\];  
            }  
        }  
        $arrs\['plate\_id'\]=$plate\_id;  
        $arrs\['list'\]=$plate\_content;  
        return $arrs;  
    }else{  
        $shop\_decorate\_template=M('shop\_decorate\_template');  
        $where\['status'\]=;  
        $where\['id'\]=$plate\_id;  
        $list=$shop\_decorate\_template->field('id,plate\_content,goods\_nums')->where($where)->find();  
        $plate\_content=json\_decode($list\['plate\_content'\],true);  
        $goods\_info=$this->getDefaultGoodsInfo($list\['goods\_nums'\],"sell\_nums desc");  
        //查询商品是否有多个sku  
        $str=$this->getMultiSku($goods\_info);  
        foreach($goods\_info as $k=>$v){  
            $data\[\]=array(  
                'productId'=>$v\['product\_id'\],  
                'skuNo'=>$v\['sku\_no'\]  
            );  
            $sk\[$v\['sku\_id'\]\]=$v\['sku\_no'\];  
        }  
        $home\_special\_session=new HomeSpecialSessionModel();  
        $res\_info=$home\_special\_session->getGoodsActInfo($data);  
        foreach($goods\_info as $k=>$v){  
            $goods\_info\[$k\]\['activity\_info'\]=$res\_info\[$sk\[$v\['sku\_id'\]\]\];  
            $goods\_info\[$k\]\['operate\_type'\]=;  
            if($v\['type'\] !=){  
                $goods\_info\[$k\]\['product\_num'\]='';  
            }else{  
                $goods\_info\[$k\]\['product\_num'\]=$str\[$v\['product\_id'\]\];  
            }  
            $goods\_info\[$k\]\['index'\]=$k+;  
        }  
        $total\_nums=;  
        foreach($plate\_content as $k=>$v){  
            $at=array\_slice($goods\_info,$total\_nums,$v\['goods\_nums'\]);  
            foreach($at as $k2=>$v2){  
                $at\[$k2\]\['type'\]=$v\['type'\];  
                $at\[$k2\]\['sort'\]=$v\['sort'\];  
                $at\[$k2\]\['isShow'\]=$v\['isShow'\];  
            }  
            $plate\_content\[$k\]\['goods'\]=$at;  
            $total\_nums +=$v\['goods\_nums'\];  
            unset($plate\_content\[$k\]\['goods\_nums'\]);  
        }  
        $arrs\['plate\_id'\]=$plate\_id;  
        $arrs\['list'\]=$plate\_content;  
        return $arrs;  
    }  
}

//获取店铺装修信息  
private function getShopDecorate($plate\_id,$type,$store\_id,$store\_type,$source,$type\_id){  
    $store=M('store');  
    $store\_info=$store->field('user\_id')->where(\['id'=>$store\_id\])->find();  
    $user\_id=$store\_info\['user\_id'\];

    $user\_shop\_decorate=M('user\_shop\_decorate');  
    $usd\_where\['flagship\_shop'\]=;  
    $usd\_where\['create\_id'\]=$user\_id;  
    if($type\_id==){  
        $usd\_where\['plate\_id'\]=$plate\_id;  
        $usd\_info=$user\_shop\_decorate->field('id,plate\_content,plate\_content\_draft')  
            ->where($usd\_where)  
            ->order('create\_time desc')  
            ->find();  
    }else{  
        $usd\_where\['plate\_id\_features'\]=$plate\_id;  
        $usd\_info=$user\_shop\_decorate->field('id,plate\_content\_features plate\_content,plate\_content\_draft\_features plate\_content\_draft')  
            ->where($usd\_where)  
            ->order('create\_time desc')  
            ->find();  
    }

    if(!empty($usd\_info)){  
        if($type==){  
            $plate\_content=json\_decode($usd\_info\['plate\_content\_draft'\],true);  
        }else{  
            $plate\_content=json\_decode($usd\_info\['plate\_content'\],true);  
        }  
        foreach($plate\_content as $k=>$v){  
            foreach($v\['goods'\] as $k2=>$v2){  
                $arr\[\]=$v2\['sku\_id'\];  
            }  
        }  
        $sku\_info=$this->getGoodsInfo($arr,$store\_id,$store\_type,$source);

        foreach($sku\_info as $k=>$v){  
            $data\[\]=array(  
                'productId'=>$v\['product\_id'\],  
                'skuNo'=>$v\['sku\_no'\]  
            );  
            $sk\[$v\['sku\_id'\]\]=$v\['sku\_no'\];  
        }  
        $home\_special\_session=new HomeSpecialSessionModel();  
        $res\_info=$home\_special\_session->getGoodsActInfo($data);  
        //查询商品是否有多个sku  
        $str=$this->getMultiSku($sku\_info);  
        foreach($plate\_content as $k=>$v){  
            foreach($v\['goods'\] as $k2=>$v2){  
                $plate\_content\[$k\]\['goods'\]\[$k2\]\['type'\]=$v\['type'\];  
                $plate\_content\[$k\]\['goods'\]\[$k2\]\['isShow'\]=$v\['isShow'\];  
                if($v\['type'\] !=){  
                    $plate\_content\[$k\]\['goods'\]\[$k2\]\['product\_num'\]='';  
                }else{  
                    $plate\_content\[$k\]\['goods'\]\[$k2\]\['product\_num'\]=$str\[$sku\_info\[$v2\['sku\_id'\]\]\['product\_id'\]\];  
                }  
                $plate\_content\[$k\]\['goods'\]\[$k2\]\['search\_name'\]=$sku\_info\[$v2\['sku\_id'\]\]\['search\_name'\];  
                $plate\_content\[$k\]\['goods'\]\[$k2\]\['short\_name'\]=$sku\_info\[$v2\['sku\_id'\]\]\['short\_name'\];  
                $plate\_content\[$k\]\['goods'\]\[$k2\]\['sku\_no'\]=$sku\_info\[$v2\['sku\_id'\]\]\['sku\_no'\];  
                $plate\_content\[$k\]\['goods'\]\[$k2\]\['title'\]=$sku\_info\[$v2\['sku\_id'\]\]\['title'\];  
                $plate\_content\[$k\]\['goods'\]\[$k2\]\['img'\]=$sku\_info\[$v2\['sku\_id'\]\]\['img'\];  
                $plate\_content\[$k\]\['goods'\]\[$k2\]\['sell\_price'\]=$sku\_info\[$v2\['sku\_id'\]\]\['sell\_price'\];  
                $plate\_content\[$k\]\['goods'\]\[$k2\]\['activity\_info'\]=$res\_info\[$sk\[$v2\['sku\_id'\]\]\];  
                $plate\_content\[$k\]\['goods'\]\[$k2\]\['store\_id'\]=$sku\_info\[$v2\['sku\_id'\]\]\['store\_id'\];  
                $plate\_content\[$k\]\['goods'\]\[$k2\]\['sell\_nums'\]=$sku\_info\[$v2\['sku\_id'\]\]\['sell\_nums'\];  
                $plate\_content\[$k\]\['goods'\]\[$k2\]\['imgs'\]=$sku\_info\[$v2\['sku\_id'\]\]\['imgs'\];  
            }  
        }  
        $arrs\['plate\_id'\]=$plate\_id;  
        $arrs\['list'\]=$plate\_content;  
        return $arrs;  
    }else{  
        $shop\_decorate\_template=M('shop\_decorate\_template');  
        $where\['status'\]=;  
        $where\['is\_default'\]=;  
        $list=$shop\_decorate\_template->field('id,plate\_content,goods\_nums')->where($where)->find();  
        $plate\_content=json\_decode($list\['plate\_content'\],true);  
        $goods\_info=$this->getDefaultGoodsInfo($list\['goods\_nums'\],"sell\_nums desc",null,null,null,$store\_id,$store\_type);  
        //查询商品是否有多个sku  
        $str=$this->getMultiSku($goods\_info);  
        foreach($goods\_info as $k=>$v){  
            $data\[\]=array(  
                'productId'=>$v\['product\_id'\],  
                'skuNo'=>$v\['sku\_no'\]  
            );  
            $sk\[$v\['sku\_id'\]\]=$v\['sku\_no'\];  
        }  
        $home\_special\_session=new HomeSpecialSessionModel();  
        $res\_info=$home\_special\_session->getGoodsActInfo($data);  
        foreach($goods\_info as $k=>$v){  
            $goods\_info\[$k\]\['activity\_info'\]=$res\_info\[$sk\[$v\['sku\_id'\]\]\];  
            if($v\['type'\] !=){  
                $goods\_info\[$k\]\['product\_num'\]='';  
            }else{  
                $goods\_info\[$k\]\['product\_num'\]=$str\[$v\['product\_id'\]\];  
            }  
            $goods\_info\[$k\]\['index'\]=$k+;  
        }  
        $total\_nums=;  
        foreach($plate\_content as $k=>$v){  
            $at=array\_slice($goods\_info,$total\_nums,$v\['goods\_nums'\]);  
            foreach($at as $k2=>$v2){  
                $at\[$k2\]\['type'\]=$v\['type'\];  
                $at\[$k2\]\['sort'\]=$v\['sort'\];  
                $at\[$k2\]\['isShow'\]=$v\['isShow'\];  
            }  
            $plate\_content\[$k\]\['goods'\]=$at;  
            $total\_nums +=$v\['goods\_nums'\];  
            unset($plate\_content\[$k\]\['goods\_nums'\]);  
        }  
        $arrs\['plate\_id'\]=$plate\_id;  
        $arrs\['list'\]=$plate\_content;  
        return $arrs;  
    }  
}

//查询商品是否有多个sku  
public function getMultiSku($goods\_info){  
    $public = new \\Common\\Model\\DataModel\\PublicModel();  
    $product\_info=$public->isMoreSku(array\_column($goods\_info,'product\_id'));  
    $new\_data=\[\];  
    foreach ($product\_info as $key=>$value){  
        $new\_data\[$value\['product\_id'\]\]=empty($value\['num'\])?'':$value\['num'\];  
    }  
    return $new\_data;  
}

//获取店铺信息  
public function getStoreInfoByStoreId($store\_id){  
    $img\_url=rtrim(C('img\_base'),'/');  
    $public = new PublicModel();  
    $store=M('store');  
    $store\_info=$store->field('id,user\_id,name as store\_name,introduction as store\_desc,concat("'.$img\_url.'",bgpath) as bgpath,short\_number,invitation\_code')  
        ->where('id="'.$store\_id.'"')  
        ->find();

    //根据user\_id获取个人头像  
    $u=M('user')->field('head\_pic')->where(array('user\_id'=>$store\_info\['user\_id'\]))->find();  
    if(empty($u\['head\_pic'\])){  
        $store\_info\['logopath'\]=$img\_url.C('user\_logo');  
    }else{  
        $store\_info\['logopath'\]=$public->getHeadPic($u\['head\_pic'\]);  
    }  
    $store\_info\['qrcode\_desc'\]=C("qrcode\_desc");  
    $store\_info\['url\_desc'\]=C("url\_desc");  
    $store\_info\['url'\]=C("h5\_base")."cloud/flagship?store\_id=".$store\_id;  
    $ob=new AccountModel();  
    $store\_info\['qr\_code'\]=$img\_url.$ob->getQrCode($store\_info\['user\_id'\],$store\_info\['url'\],'');  
    $store\_extend=M('store\_extend');  
    $se\_info=$store\_extend->field('version\_id')->where(\['store\_id'=>$store\_info\['id'\]\])->find();  
    $store\_info\['store\_version'\]=$se\_info\['version\_id'\];  
    return $store\_info;  
}&nbsp;

//商品海景图处理  
public function getHaiJing($imgs){  
    $img\_base=rtrim(C('img\_base'),'/');  
    $imgs = explode(',', $imgs);  
    if($imgs){  
        $imgs\_t=array();  
        foreach($imgs as $v){  
            $imgs\_t\[\]=empty($v)?'':$img\_base.$v;  
        }  
    }  
    return $imgs\_t;  
}

手机扫一扫

移动阅读更方便

阿里云服务器
腾讯云服务器
七牛云服务器

你可能感兴趣的文章