/** * @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 !=1 && $type !=2){ E(\'700408\'); } $type_id=$res[\'type_id\']; if($type_id !=1 && $type_id !=2){ E(\'700416\'); } $store_id=$res[\'store_id\']; $user_shop_decorate=M(\'user_shop_decorate\'); $usd_where[\'flagship_shop\']=1; $usd_where[\'create_id\']=$user_id; if($type_id ==1){ $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=1; }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==0){
$shop_decorate_read->data([\'user_id\'=>$user_id])->add();
$plate_content[\'list_status\']=1;
}else{
$plate_content[\'list_status\']=2;
}
$plate_content[\'shop_decorate_method\']=$this->getShopDecorateMethod();
$plate_content[\'show_status\']=$this->isHasTeseGoods($user_id,1);
if($list_status[\'list_status\']==1){
$show_status=3;
}else{
$show_status=2;
}
$plate_content[\'show_status\']=$show_status;
return $plate_content;
}
返回结果
{ "status":"0", "errorCode":"0", "msg":"成功", "result":{ "plate_id":"46", "list":[ { "type":4, "isShow":"2", "sort":1, "goods":[ { "sku_id":"1002975101", "operate_type":2, "index":1, "type":4, "product_num":"1", "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":"0", "isAct":false }, "store_id":"115144354559710", "sell_nums":"66825", "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":4, "isShow":"1", "sort":2, "goods":[ { "sku_id":"8012614169", "operate_type":2, "index":2, "type":4, "product_num":"1", "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":"0", "isAct":false }, "store_id":"115144354559710", "sell_nums":"10983", "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":4, "isShow":"1", "sort":3, "goods":[ { "sku_id":"8041111858", "operate_type":2, "index":3, "type":4, "product_num":"1", "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":"0", "isAct":false }, "store_id":"115144354559710", "sell_nums":"6942", "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":8, "isShow":"1", "sort":4, "goods":[ { "sku_id":"8012911722", "operate_type":2, "index":4, "type":8, "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":"0", "isAct":false }, "store_id":"115144354559710", "sell_nums":"4243", "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":"1227883301", "operate_type":2, "index":5, "type":8, "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":"0", "isAct":false }, "store_id":"115144354559710", "sell_nums":"3611", "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":"8022517282", "operate_type":2, "index":6, "type":8, "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":"0", "isAct":false }, "store_id":"115144354559710", "sell_nums":"3219", "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":4, "isShow":"1", "sort":5, "goods":[ { "sku_id":"8031411009", "operate_type":2, "index":7, "type":4, "product_num":"1", "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":"0", "isAct":false }, "store_id":"115144354559710", "sell_nums":"2880", "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":9, "isShow":"1", "sort":6, "goods":[ { "sku_id":"1000000003", "operate_type":2, "index":8, "type":9, "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":"0", "isAct":false }, "store_id":"115144354559710", "sell_nums":"1408", "imgs":[ "http://img.test.feelee.cc/Public/Uploads/goodsimg/I4/5a715bc8d7c76.png" ] }, { "sku_id":"1000000005", "operate_type":2, "index":9, "type":9, "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":"0", "isAct":false }, "store_id":"115144354559710", "sell_nums":"1405", "imgs":[ "http://img.test.feelee.cc/Public/Uploads/goodsimg/I4/5a715bc8d7c76.png" ] }, { "sku_id":"1000000004", "operate_type":2, "index":10, "type":9, "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":"0", "isAct":false }, "store_id":"115144354559710", "sell_nums":"1391", "imgs":[ "http://img.test.feelee.cc/Public/Uploads/goodsimg/I4/5a715bc8d7c76.png" ] }, { "sku_id":"1000000006", "operate_type":2, "index":11, "type":9, "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":"0", "isAct":false }, "store_id":"115144354559710", "sell_nums":"1379", "imgs":[ "http://img.test.feelee.cc/Public/Uploads/goodsimg/I4/5a715bc8d7c76.png" ] } ] } ], "store_info":{ "id":"115066910197999", "store_name":"邹柯的云店多少", "store_desc":"1", "bgpath":null, "short_number":"258731", "invitation_code":"258731", "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":"1" }, "list_status":2, "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=0; } if($type !=0 && $type !=1 && $type !=2){ E(\'700409\'); } if($type==1){ //排序字段(1销量由高到低、2价格由低到高、3价格由高到低) $sort=$res[\'sort\']; if(empty($sort)){ $sort=2; } if($sort !=1 && $sort !=2 && $sort !=3){ E(\'700410\'); } } $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,2,$self_user_id); if(empty($type_id)){ if($list[\'show_status\']==1 || $list[\'show_status\']==3){ $type_id=2; }else{ $type_id=1; } } $store_type=$res[\'store_type\']; $source=$res[\'source\']; if($source !=1 && $source !=2){ E(\'700411\'); } $keywords=$res[\'keywords\']; //页码 $page = $res[\'page\']; if(empty($page)){ $page=1; } if(!is_numeric($page) || $page <= 0){ E(\'200307\'); } //每页显示条数 $pageSize = $res[\'pageSize\']; if(empty($pageSize)){ $pageSize=10; } if(!is_numeric($pageSize) || $pageSize <= 0){ E(\'200308\'); } //组装店铺信息 $list[\'store_info\']=$this->getStoreInfoByStoreId($store_id); //判断当前登陆用户是否是要访问的旗舰版店铺首页的下级 $flag=$this->isParentUserId($self_user_id,$user_id); if($type==0){ $user_shop_decorate=M(\'user_shop_decorate\'); $usd_where[\'flagship_shop\']=1; $usd_where[\'create_id\']=$user_id; if($type_id ==1){ $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=1; }else{ $plate_id=$usd_info[\'plate_id\']; } if($list[\'show_status\']==0){ $list[\'goods_info\'][\'list\']=[]; }else{ if($type_id ==1){ $list[\'goods_info\']=$this->getShopDecorate($plate_id,2,$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,2,$store_id,$store_type,$source,$type_id); } } } }elseif($type==1){ if($sort==1){ $order="gs.sell_nums desc"; }elseif($sort==2){ $order="gs.sell_price asc"; }else{ $order="gs.sell_price desc"; } $list[\'goods_info\']=$this->getDefaultGoodsInfo(null,$order,$page,$pageSize,1,$store_id,$store_type,$source,$keywords,$flag); }else{ $list[\'goods_info\']=$this->getDefaultGoodsInfo(100,"sell_nums desc",$page,$pageSize,2,$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\']=2; $list[\'is_advanced_store_front\']=2; } return $list; }
返回结果
{ "status":"0", "errorCode":"0", "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":0, "list":[ { "type":6, "isShow":1, "sort":1, "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":"1002975101", "title":"斐讯(PHICOMM)K2 1200M智能双频无线路由器 ", "img":"http://img.test.feelee.cc//Public/Uploads/goodsimg/I0/5aa8d44648d05.jpg", "sell_price":"399.00", "sell_nums":"66825", "store_id":"115144354559710", "activity_info":{ "productId":"P001219", "skuNo":"P001219-01", "productPrice":"00.00", "costPrice":"00.00", "activityId":null, "activityType":null, "title":null, "status":"0", "isAct":false }, "type":6, "index":1 } ] } ], "foot":{ "current_page":"1", "pagesize":"1", "total_page":368 } }, "is_store_decorate":"1", "is_advanced_store_front":"1" } }
private function getShopDecorateInfoNew($plate_id,$store_id,$type_id){ $shop_decorate_template=M(\'shop_decorate_template\'); $where[\'status\']=1; $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==1){ $goods_info=$this->getDefaultGoodsInfo($list[\'goods_nums\'],"sell_nums desc",null,null,null,null,null,null,null,null,1); }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\',2); 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==1){ $goods_info[$k][\'operate_type\']=1; }else{ $goods_info[$k][\'operate_type\']=2; } $goods_info[$k][\'index\']=$k+1; if($type_id==2){ $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=0; 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\'] !=4){ $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\']=1; $sg_where[\'is_open\']=1; $count=$store_goods->field()->where($sg_where)->count(); if($count==0){ $data[\'list_status\']=2; }else{ $data[\'list_status\']=1; } 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\']=1; $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 0; } if($status==1){ if(empty($usd_info[\'plate_content_draft_features\']) && empty($usd_info[\'plate_content_draft\'])){ return 0; }elseif(!empty($usd_info[\'plate_content_draft_features\']) && empty($usd_info[\'plate_content_draft\'])){ return 1; }elseif(empty($usd_info[\'plate_content_draft_features\']) && !empty($usd_info[\'plate_content_draft\'])){ return 2; }else{ return 3; } }else{ if(empty($self_user_id)){ if(empty($usd_info[\'plate_content_features\'])) { return 0; }else{ return 1; } } if(empty($usd_info[\'plate_content_features\']) && empty($usd_info[\'plate_content\'])){ return 0; }elseif(!empty($usd_info[\'plate_content_features\']) && empty($usd_info[\'plate_content\'])){ return 1; }elseif(empty($usd_info[\'plate_content_features\']) && !empty($usd_info[\'plate_content\'])){ return 2; }else{ return 3; } } return 2; }
//获取店铺装修秘籍 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\']=1; } }else{ if($ori==1){ $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\']=6; $goods_info[$k][\'isShow\']=1; $goods_info[$k][\'index\']=$k+1; $goods_info[$k][\'imgs\']=$this->getHaiJing($v[\'seascapes\']); } $total_page=ceil($count/$pageSize); $list[\'plate_id\']=0; if(empty($goods_info)){ $foot=array(\'current_page\'=>$page,\'pagesize\'=>$pageSize,\'total_page\'=>0); $list[\'list\']=null; }else{ $foot=array(\'current_page\'=>$page,\'pagesize\'=>$pageSize,\'total_page\'=>$total_page); $list[\'list\']=array( array( \'type\'=>6, \'isShow\'=>1, \'sort\'=>1, \'goods\'=>$goods_info ) ); } $list[\'foot\']=$foot; } return $list; }
//获取店铺id信息 private function getStoreId($store_id,$store_type,$source,$sku_id){ $ob=new PublicModel(); if($source==2){ $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\']=1; $usd_where[\'create_id\']=$user_id; if($type_id==1){ $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==1){ $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\',2); 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\'] !=4){ $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\']=1; $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\']=1; if($v[\'type\'] !=4){ $goods_info[$k][\'product_num\']=\'\'; }else{ $goods_info[$k][\'product_num\']=$str[$v[\'product_id\']]; } $goods_info[$k][\'index\']=$k+1; } $total_nums=0; 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\']=1; $usd_where[\'create_id\']=$user_id; if($type_id==1){ $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==1){ $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\'] !=4){ $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\']=1; $where[\'is_default\']=1; $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\'] !=4){ $goods_info[$k][\'product_num\']=\'\'; }else{ $goods_info[$k][\'product_num\']=$str[$v[\'product_id\']]; } $goods_info[$k][\'index\']=$k+1; } $total_nums=0; 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; }
//商品海景图处理 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; }