<?php namespace WebappModel; use CommonModelDataModelFlagShopCategoryModel; use CommonModelDataModelHomeSpecialSessionModel; use CommonModelDataModelAccountModel; /* * @class 旗舰版店铺装修模块 */ class FlagShipShopDecorateModel{ /** * @title 蜂店样式列表 * @param type_id 是 int 装修商品的类型(1-平台商品、2-特色商品) * @example FlagShipShopDecorate.getShopDecorateStyle? 调试参数:{"method":"FlagShipShopDecorate.getShopDecorateStyle","type_id":"1"} * @return {"status":"0","errorCode":"0","msg":"u6210u529f","result":[{"id":"1","goods_nums":"50","name":"u9ed8u8ba4u6837u5f0f","preview":"http://img.test.feelee.cc//Public/Uploads/server/user/20180614/62bed15289674582554.png","list_status":2}]} * @return_param_explain id:模板id preview:店铺模板装修图片 list_status:选中状态(1是、2否) goods_nums:商品数量 name:模板样式名称 example:查看案例 * @method POST * @author 邹柯 */ public function getShopDecorateStyle($res){ $user_id=session("user.user_id"); $type_id=$res['type_id']; if($type_id !=1 && $type_id !=2){ E('700416'); } $shop_decorate_template=M('shop_decorate_template'); $where['status']=1; $where['is_deleted']=0; $list=$shop_decorate_template->field('id,img,is_default,goods_nums,name')->where($where)->select(); $user_shop_decorate=M('user_shop_decorate'); $usd_where['create_id']=$user_id; $usd_where['flagship_shop']=1; if($type_id==1){ $res_info=$user_shop_decorate->field('plate_id')->where($usd_where)->find(); }else{ $res_info=$user_shop_decorate->field('plate_id_features as plate_id')->where($usd_where)->find(); } $img_url=C('picture_img_domain'); foreach($list as $k=>$v){ if(!empty($v['img'])){ $list[$k]['preview']=$img_url.$v['img']; }else{ $list[$k]['preview']=null; } if(empty($res_info)){ if($v['is_default']==1){ $list[$k]['list_status']=1; }else{ $list[$k]['list_status']=2; } }else{ if($res_info['plate_id']==$v['id']){ $list[$k]['list_status']=1; }else{ $list[$k]['list_status']=2; } } unset($list[$k]['img']); unset($list[$k]['is_default']); $list[$k]['example']=C('h5_base')."cloud/advanced-sample?id=".$v['id']; } return $list; }