/** * 获取最新的评论(默认10条,不超过20条) * @param int $number //评论数量 */ public function getTopComment($number, $platformapp = 'site') { $num = intval($number) <= 0 ? 10 : (intval($number) >= 20 ? 20 : intval($number)); $_data = kernel::single('b2c_message_disask')->getTopComment($num); $data = array(); foreach ((array) $_data as $row) { if ($row['image_default_id']) { $row['_s_pic_'] = base_storager::modifier($row['image_default_id'], 's'); } else { $row['_s_pic_'] = ''; } $row['_goodsLink_'] = $this->get_link(array('app' => 'b2c', 'ctl' => $platformapp . '_product', 'act' => 'index', 'args' => array($row['product_id'])), $platformapp); #$row['_goodsDetail_'] = b2c_widgets::load('Goods')->getGoodsList(array('goodsId' =>array($row['type_id']))); #$row['_goodsDetail_'] = $row['_goodsDetail_']['goodsRows'][$row['type_id']]; $data[] = $this->_getOutData($row); } return $data; }
/** * @brief 审核页面 * * @param $enterapplyId * * @return html */ public function doExamine($enterapplyId) { $objMdlEnterapply = app::get('sysshop')->model('enterapply'); $list = $objMdlEnterapply->getRow('*', array('enterapply_id' => $enterapplyId)); $shop = unserialize($list['shop']); $checkBrand = array('shop_type' => $list['shop_type'], 'shop' => array('shop_brand' => $shop['shop_brand'])); $list['seller_name'] = shopAuth::getSellerName($list['seller_id']); $list['shoptype'] = $this->shoptype[$list['shop_type']]; $cat = app::get('sysshop')->rpcCall('category.cat.get.info', array('cat_id' => $shop['shop_cat']))[$shop['shop_cat']]; if ($shop['shop_brand']) { $brand = app::get('sysshop')->rpcCall('category.brand.get.list', array('brand_id' => $shop['shop_brand']))[$shop['shop_brand']]; } if ($list['new_brand']) { $brand = app::get('sysshop')->rpcCall('category.brand.get.list', array('brand_name' => $list['new_brand'])); if ($brand) { $brand = reset($brand); } } try { $checkB = kernel::single('sysshop_data_enterapply')->checkBrand($checkBrand, $msg); } catch (\LogicException $e) { echo $brand['brand_name'] . $e->getMessage(); exit; } if (!$checkB) { $pagedata['checkbrand'] = $msg; } $shop['brand_name'] = $brand['brand_name']; $shop['shop_cat'] = $cat['cat_name']; $shopinfo = unserialize($list['shop_info']); $shopinfo['corporate_identity_img'] = base_storager::modifier($shopinfo['corporate_identity_img'], 's'); $shopinfo['tissue_code_img'] = base_storager::modifier($shopinfo['tissue_code_img'], 's'); $shopinfo['tax_code_img'] = base_storager::modifier($shopinfo['tax_code_img'], 's'); $shopinfo['shopuser_identity_img'] = base_storager::modifier($shopinfo['shopuser_identity_img'], 's'); $shopinfo['license_img'] = base_storager::modifier($shopinfo['license_img'], 's'); $shopinfo['brand_warranty'] = base_storager::modifier($shopinfo['brand_warranty'], 's'); $pagedata['shop'] = $shop; $pagedata['shop_info'] = $shopinfo; $pagedata['itemdata'] = $list; return $this->page('sysshop/admin/enterapply/examine.html', $pagedata); }
/** * 根据条件获取商品信息 * @param array $filter (所有条件都可选) * array( 'goodsId' => array(1,2)/1, //商品ID 'priceFrom' => 5, //价格区间(低) 'priceTo' => 100, //价格区间(高) 'typeId' => 2, //商品类型ID 'catId' => array(1,2)/1, //商品分类ID 'brandId' => array(1,2)/1, //商品品牌ID 'goodsOrderBy' => 1, //商品排序 'goodsNum' => 12, //总商品数(xo最多20) ), */ public function getGoodsList($filter, $platform = 'site') { if (isset($_COOKIE['MLV'])) { if (!cachemgr::get('member_lv_disCount' . $_COOKIE['MLV'], $dis_count)) { cachemgr::co_start(); $member_level = $_COOKIE['MLV']; (array) ($arr = $this->app->model('member_lv')->getList('dis_count', array('member_lv_id' => $member_level))); $dis_count = $arr[0]['dis_count']; cachemgr::set('member_lv_disCount' . $_COOKIE['MLV'], $dis_count, cachemgr::co_end()); } } $objLvprice = $this->app->model('goods_lv_price'); $goods = $this->app->model('goods'); $objProduct = $this->app->model('products'); $objgoodscat = $this->app->model('goods_cat'); $config = $this->app->getConf('site.save_price'); $imageDefault = app::get('image')->getConf('image.set'); $search = $this->app->model('search'); $orderBy = $filter['goodsOrderBy'] ? $filter['goodsOrderBy'] : 0; $order = $filter['goodsOrderBy'] ? $this->_getOrderBy($filter['goodsOrderBy'], false) : null; $limit = intval($filter['goodsNum']) > 0 ? intval($filter['goodsNum']) : 6; //$limit = ($limit > 20) ? 20 : $limit; $result = array(); unset($filter['goodsOrderBy']); unset($filter['goodsNum']); $_filter = $this->_getFilter($filter); $result['goodsMoreLink'] = kernel::router()->gen_url(array('app' => 'b2c', 'ctl' => 'site_gallery', 'act' => 'index', 'args' => array(implode(",", (array) $filter['catId']), $search->encode($filter), $orderBy))); $goodsList = $goods->getList('*', $_filter, 0, $limit, $order['sql']); if (!empty($_filter['goods_id'])) { $goods_temp = array(); foreach ($_filter['goods_id'] as $k => $v) { foreach ($goodsList as $row) { if ($v == $row['goods_id']) { $goods_temp[$k] = $row; } } } unset($goodsList); $goodsList = $goods_temp; unset($goods_temp); } if (is_array($goodsList) && $goodsList) { foreach ($goodsList as $key => $value) { $gids[] = $value['goods_id']; $catIds[] = intval($value['cat_id']); } } if ($gids) { if ($catIds) { $catsData = $objgoodscat->getList('cat_id,cat_name', array('cat_id' => $catIds)); foreach ($catsData as $row) { $goodsCats[$row['cat_id']] = $row['cat_name']; } } if ($member_level) { $lv_price_data = $objLvprice->getList('goods_id,price', array('goods_id' => $gids, 'level_id' => $member_level)); foreach ($lv_price_data as $row) { $goodsLvPrice[$row['goods_id']] = $row['price']; } } } if (is_array($goodsList) && $goodsList) { foreach ($goodsList as $pk => $pv) { if (empty($pv['mktprice']) || $pv['mktprice'] == '0') { $pv['mktprice'] = $objProduct->getRealMkt($pv['price']); } $pv['cat_name'] = $goodsCats[$pv['cat_id']]; // add for member price #$lv_price = $objLvprice->getList('price',array('goods_id'=>$pv['goods_id'],'level_id'=>$member_level)); $lv_price[0] = $goodsLvPrice[$pv['goods_id']]; if (isset($dis_count)) { if (is_array($lv_price) && count($lv_price) > 0) { $lv_price = end($lv_price); $pv['memprice'] = $lv_price['price']; } else { $pv['memprice'] = $pv['price'] * $dis_count; } if (intval($pv['price']) != 0) { $pv['dis_count'] = (1 - $pv['memprice'] / $pv['price']) * 100; } else { $pv['dis_count'] = 0; } } else { $pv['dis_count'] = 0; $pv['memprice'] = false; } if (empty($pv['image_default_id'])) { $pv['l_pic'] = base_storager::modifier($imageDefault['L']['default_image']); $pv['m_pic'] = base_storager::modifier($imageDefault['M']['default_image']); $pv['s_pic'] = base_storager::modifier($imageDefault['S']['default_image']); } else { $pv['l_pic'] = base_storager::modifier($pv['image_default_id'], 'l'); $pv['m_pic'] = base_storager::modifier($pv['image_default_id'], 'm'); $pv['s_pic'] = base_storager::modifier($pv['image_default_id'], 's'); } $result['goodsRows'][$pv['goods_id']] = $this->_getOutData($pv); } } if ($gids) { $productData = $objProduct->getList('goods_id,product_id,marketable', array('goods_id' => $gids, 'is_default' => 'true')); foreach ($productData as $k => $val) { $_return['goodsRows'][$val['goods_id']]['products'][] = $val; $result['goodsRows'][$val['goods_id']]['goodsLink'] = $this->getGoodsLink($val['product_id'], $platform); } } return $result; }
function modifier_storager($image_id, $size = '') { return base_storager::modifier($image_id, $size); }
private function _select_spec($paramsSpec) { if ($this->pagedata['goods_spec_images']) { $specGoodsImagesArr = app::get('image')->model('image')->getList('image_id,s_url,url', array('image_id' => $this->pagedata['goods_spec_images'])); $resource_host_url = kernel::get_resource_host_url(); foreach ($specGoodsImagesArr as $row) { $row['s_url'] = $row['s_url'] ? $row['s_url'] : $row['url']; if ($row['s_url'] && !strpos($row['s_url'], '://')) { $row['s_url'] = $resource_host_url . '/' . $row['s_url']; } $goodsImages[$row['image_id']] = $row['s_url']; } } foreach ((array) $paramsSpec as $specId => $selectSpecRow) { $selectionSpec[$specId] = $selectSpecRow; //当前规格选中数量 $selectCount[$specId] = count($selectSpecRow['option']); //选中的规格 foreach ($selectSpecRow['option'] as $privateSpecValueId => $option) { $selectSpecValueId[] = $option['spec_value_id']; unset($selectionSpec[$specId]['option'][$privateSpecValueId]); if ($selectSpecRow['show_type'] == 'image') { $option['spec_image_url'] = $option['spec_image'] ? base_storager::modifier($option['spec_image']) : $this->default_spec_image_url; $option['spec_image'] = $option['spec_image'] ? $option['spec_image'] : $this->default_spec_image; } $selectionSpec[$specId]['option'][$option['spec_value_id']] = $option; } } return array('selectionSpec' => $selectionSpec, 'selectCount' => $selectCount, 'selectSpecValueId' => $selectSpecValueId); }
/** * 上传网络图片地址-本类私有方法 * @param null * @return string html内容 */ function image_www_uploader() { if ($_POST['upload_item']) { $objLibImage = kernel::single('image_data_image'); $image = $objLibImage->store($_POST['upload_item'], null, 'admin'); $objLibImage->rebuild($image['ident']); $image_src = base_storager::modifier($image['url']); $image_id = $image['url']; $this->_set_tag($image); if ($callback = $_REQUEST['callbackfunc']) { $_return = "<script>try{parent.{$callback}('{$image_id}','{$image_src}')}catch(e){}</script>"; } $_return .= "<script>parent.MessageBox.success('" . app::get('image')->_('图片上传成功') . "');</script>"; echo $_return; echo <<<EOF <div id="upload_remote_image"></div> <script> try{ if(\$('upload_remote_image').getParent('.dialog')) \$('upload_remote_image').getParent('.dialog').retrieve('instance').close(); }catch(e){} </script> EOF; } else { $html = '<div class="division"><h5>' . app::get('image')->_('网络图片地址:') . '</h5>'; $html .= view::ui()->form_start(array('method' => 'post')); $html .= view::ui()->input(array('type' => 'url', 'name' => 'upload_item', 'value' => 'http://', 'style' => 'width:70%')); $html .= '</div>'; $html .= view::ui()->form_end(); echo $html . ""; } }