/** * 列表 */ public function index() { parent::_authUser(array(1, 2, 5, 7, 8, 9)); $title = $this->_get('q'); //关键字搜索 $areaId = $this->_getid('area_id', 0); //城区 $serviceId = $this->_getid('service_id', 0); //商圈 $shopType = $this->_getid('shop_type', 0); //店铺类型 $tips = $this->_getid('tips', 0); //参与活动 $status = $this->_getid('status', 2); //状态 $p = $this->_getid('p', 1); $where = array('AND' => array('city_id' => steadmin::$adminInfo['city_id'])); if ($title) { $where['LIKE'] = array('shop_name' => parent::safeSearch($title)); } if ($tips) { $where['LIKE'] = array('tips_list' => ',' . ($tips - 1) . ','); } if ($areaId) { $where['AND']['area_id'] = $areaId; } if ($serviceId) { $where['AND']['service_id'] = $serviceId; } if ($shopType) { $where['AND']['shop_type'] = $shopType - 1; } if ($status) { $where['AND']['status'] = $status - 1; } //DOTO:后期可能会让另外的帐号也可以来管理这个店(比喻品牌创建了多个分店,那么品牌可以管理所有的分店,分店也可以管理自己的店),那么需要额外指定管理权限 if (!parent::_checkIsAdmin()) { if (steadmin::$adminInfo['groupid'] == 8) { //店长 $where['AND']['shop_id'] = steadmin::$adminInfo['shop_id']; } elseif (parent::_checkIsPresident()) { $where['AND']['service_id'] = steadmin::$adminInfo['service_id']; } else { $where['AND']['user_id'] = steadmin::$adminInfo['user_id']; } } $rs = M('ste_shop')->where($where)->page($p)->order('shop_id DESC')->findAll(); $total = M('ste_shop')->getTotal(); // z(M('ste_shop')->getAllSql()); // z($rs); if ($rs) { foreach ($rs as $k => $v) { $rs[$k]['userName'] = parent::_getAdminName($v['user_id']); $rs[$k]['tipsList'] = implode(',', parent::_getTipsGroupList($this->steSetting['shop_tips'], $v['tips_list'])); $rs[$k]['areaName'] = parent::getAreaName($v['area_id']); $rs[$k]['serviceName'] = isset($this->serviceData[$v['service_id']]) ? $this->serviceData[$v['service_id']]['stitle'] : ''; $rs[$k]['stime'] = date('H:i', strtotime($v['stime'])); $rs[$k]['etime'] = date('H:i', strtotime($v['etime'])); } } $this->assign(array('adminData' => $this->adminData, 'service' => $this->serviceData, 'area' => M('area')->field('aid,name')->where(array('city_id' => steadmin::$adminInfo['city_id'], 'area_level' => 2))->findAll(false), 'rs' => $rs, 'total' => $total, 'p' => $p, 'area_id' => $areaId, 'service_id' => $serviceId, 'shop_type' => $shopType, 'title' => $title, 'tips_id' => $tips, 'status' => $status, 'setting' => $this->steSetting)); $this->display(); }
function preview() { $id = $this->_getid('id', 0); if (!$id) { showError('参数丢失'); } $rs = M('ste_goods')->where(array('gid' => $id))->find(); if (!$rs) { showError('商品不存在'); } steadmin::$adminInfo['city_id'] = 3301; $goodPic = $rs['goods_pic']; $rs['goods_tips'] = parent::_getTipsGroupList($this->steSetting['goods_tips'], $rs['goods_tips']); $rs['goods_pic'] = getImgUrl(getThumb($goodPic, 0)); $rs['orig_pic'] = getImgUrl(getThumb($goodPic, 2)); if ($rs['is_realtime'] && $rs['booked_time']) { $rs['goods_desc'] = '<p><img src="' . getImgUrl('statics/default/images/steward/2015/presell_' . $rs['booked_time'] . '.png') . '"/></p><br/>' . $rs['goods_desc']; } $rs['goods_desc'] = htmlspecialchars_decode($rs['goods_desc']); $rs['is_delay'] = parent::_getShopName($rs['shop_id'], 'is_delay'); $rs['cate_name'] = parent::_getCateName($rs['cate_id']); $rs['shop_name'] = parent::_getShopName($rs['shop_id'], 'shop_name'); $rs['order_counts'] = $rs['order_counts'] * 3; ////2015-03-31 新增刷新销量 $list = explode(',', 'is_delay,gid,cate_id,shop_id,shop_name,goods_name,goods_subtitle,goods_spec,goods_tips,goods_pic,orig_pic,original_price,price_pre,price,goods_desc,order_counts,sale_counts,storage_counts,is_realtime,is_hot,is_new,is_recommend,is_limited,limit_counts'); foreach ($list as $val) { $rs['goodsData'][$val] = $rs[$val]; } $rs['goodsData'] = json_encode($rs['goodsData']); if (!$rs['status'] || $rs['status'] == 2) { $rs['sale_status'] = 0; } if ($rs['start_times'] <= TIME) { if ($rs['end_times'] < TIME) { $rs['sale_status'] = 0; } elseif ($rs['end_times'] >= TIME) { $rs['sale_status'] = 1; } } else { $rs['sale_status'] = 2; } $rs['sale_time'] = outTime($rs['start_times']); // z($rs); $this->assign(array('id' => $id, 'rs' => $rs, 'vid' => 0)); $this->display(); }