Ejemplo n.º 1
0
 function input_image($params)
 {
     $params['type'] = 'image';
     $ui = new base_component_ui($this);
     $domid = $ui->new_dom_id();
     $input_name = $params['name'];
     $input_value = $params['value'];
     $image_src = base_storager::image_path($input_value, 's');
     if (!$params['width']) {
         $params['width'] = 50;
     }
     if (!$params['height']) {
         $params['height'] = 50;
     }
     $imageInputWidth = $params['width'] + 24;
     $url = ""index.php?app=desktop&act=alertpages&goto=" . urlencode("index.php?app=image&ctl=admin_manage&act=image_broswer") . """;
     $html = '<div class="image-input clearfix" style="width:' . $imageInputWidth . 'px;" gid="' . $domid . '">';
     $html .= '<div class="flt"><div class="image-input-view" style="display:table-cell;text-align:center;vertical-align: middle;width:';
     $html .= $params['width'] . 'px;height:' . $params['height'] . 'px;font-size:' . $params['height'] * 0.875 . 'px;overflow:hidden;">';
     $html .= '<img src="' . $image_src . '" onload="$(this).zoomImg(' . $params['width'] . ',' . $params['height'] . ');"/>';
     $html .= '</div></div>';
     $html .= '<div class="image-input-handle" onclick="new imgDialog(' . $url . ',{handle:this});" style="width:20px;height:' . $params['height'] . 'px;">选择' . $ui->img(array('src' => 'bundle/arrow-down.gif', 'app' => 'desktop'));
     $html .= '</div>';
     $html .= '<input type="hidden" name="' . $input_name . '" value="' . $input_value . '"/>';
     $html .= '</div>';
     return $html;
 }
Ejemplo n.º 2
0
 function input_image($params)
 {
     $params['type'] = 'image';
     $ui = new base_component_ui($this);
     $domid = $ui->new_dom_id();
     $input_name = $params['name'];
     $input_value = $params['value'];
     $image_src = base_storager::image_path($input_value, 's');
     if (!$params['width']) {
         $params['width'] = 50;
     }
     if (!$params['height']) {
         $params['height'] = 50;
     }
     $imageInputWidth = $params['width'] + 24;
     $url = "&quot;index.php?app=desktop&act=alertpages&goto=" . urlencode("index.php?app=image&ctl=admin_manage&act=image_broswer") . "&quot;";
     $html = '<div class="image-input clearfix" style="width:' . $imageInputWidth . 'px;" gid="' . $domid . '">';
     $html .= '<div class="flt"><div class="image-input-view" style="font-size:12px;text-align:center;width:';
     $html .= $params['width'] . 'px;line-height:' . $params['height'] . 'px;height:' . $params['height'] . 'px;overflow:hidden;">';
     if (!$image_src) {
         $image_src = app::get('desktop')->res_url . '/transparent.gif';
     }
     $html .= '<img src="' . $image_src . '" onload="$(this).zoomImg(' . $params['width'] . ',' . $params['height'] . ',function(mw,mh,v){this.setStyle(&quot;marginTop&quot;,(mh-v.height)/2)});"/>';
     $html .= '</div></div>';
     $html .= '<div class="image-input-handle" onclick="Ex_Loader(&quot;modedialog&quot;,function(){new imgDialog(' . $url . ',{handle:this});}.bind(this));" style="width:20px;height:' . $params['height'] . 'px;">' . app::get('desktop')->_('选择') . "" . $ui->img(array('src' => 'bundle/arrow-down.gif', 'app' => 'desktop'));
     $html .= '</div>';
     $html .= '<input type="hidden" name="' . $input_name . '" value="' . $input_value . '"/>';
     $html .= '</div>';
     return $html;
 }
Ejemplo n.º 3
0
 public function get_goods_spec()
 {
     $gid = $this->_request->get_post('gid');
     if (!$gid) {
         exit('error!');
     }
     $this->pagedata['goodshtml']['name'] = kernel::single("b2c_goods_detail_name")->show($gid, $arrGoods);
     if ($arrGoods['spec'] && is_array($arrGoods['spec'])) {
         foreach ($arrGoods['spec'] as $row) {
             $option = $row['option'];
             if ($option && is_array($option)) {
                 foreach ($option as $img) {
                     foreach ((array) explode(',', $img['spec_goods_images']) as $imageid) {
                         $return[$imageid] = base_storager::image_path($imageid, 's');
                     }
                 }
             }
         }
     }
     $arrGoods['spec2image'] = json_encode($return);
     $this->pagedata['goods'] = $arrGoods;
     $this->pagedata['goodshtml']['spec'] = kernel::single("b2c_goods_detail_spec")->show($gid, $arrGoods);
     $imageDefault = app::get('image')->getConf('image.set');
     $this->pagedata['image_default_id'] = $imageDefault['S']['default_image'];
     $this->page('site/index/spec.html', true);
 }
Ejemplo n.º 4
0
 function shopex_brand_list()
 {
     $params = $this->params;
     //api 调用合法性检查
     $this->check($params);
     $params['page_no'] = isset($params['page_no']) ? $params['page_no'] : 1;
     $params['page_size'] = isset($params['page_size']) ? $params['page_size'] : 20;
     $page_no = intval($params['page_no']) - 1;
     $page_size = intval($params['page_size']);
     $page_offset = $page_no * $page_size;
     if ($params['page_no'] == -1) {
         $item_total = $this->brand_model->count();
         $data['item_total'] = $item_total;
         $this->send_success($data);
     } else {
         $item_total = $this->brand_model->count();
         $brands = $this->brand_model->getList("*", array(), $page_offset, $page_size);
     }
     foreach ($brands as $key => $value) {
         //将brand_logo图片id 转化为可直接访问的地址
         $brand_logo = base_storager::image_path($value['brand_logo']);
         $data[$key] = array('brand_name' => $value['brand_name'], 'brand_url' => $value['brand_url'], 'brand_desc' => $value['brand_desc'], 'brand_logo' => substr($brand_logo, 0, -13), 'brand_alias' => $value['brand_keywords'], 'disabled' => $value['disabled'] ? 'true' : 'false', 'order_by' => $value['ordernum'], 'brand_setting' => serialize($value['brand_setting']), 'last_modify' => time());
     }
     $data['item_total'] = $item_total;
     $this->send_success($data);
 }
Ejemplo n.º 5
0
 public function get_goods_spec()
 {
     $gid = $this->_request->get_get('gid');
     if (!$gid) {
         echo '';
         exit;
     }
     $this->pagedata['goodshtml']['name'] = kernel::single("b2c_goods_detail_name")->show($gid, $arrGoods);
     if ($arrGoods['spec'] && is_array($arrGoods['spec'])) {
         foreach ($arrGoods['spec'] as $row) {
             $option = $row['option'];
             if ($option && is_array($option)) {
                 foreach ($option as $img) {
                     foreach ((array) explode(',', $img['spec_goods_images']) as $imageid) {
                         $return[$imageid] = base_storager::image_path($imageid, 's');
                     }
                 }
             }
         }
     }
     $this->pagedata['spec2image'] = json_encode($return);
     $imageDefault = app::get('image')->getConf('image.set');
     $this->pagedata['defaultImage'] = $imageDefault['S']['default_image'];
     $arrGoods['spec2image'] = json_encode($return);
     $this->pagedata['goods'] = $arrGoods;
     $this->pagedata['goodshtml']['spec'] = kernel::single("b2c_goods_detail_spec")->show($gid, $arrGoods);
     $imageDefault = app::get('image')->getConf('image.set');
     $this->pagedata['image_default_id'] = $imageDefault['S']['default_image'];
     $this->pagedata['goodshtml']['button'] = kernel::single('b2c_goods_detail_button')->show($gid, $arrGoods);
     $this->pagedata['form_url'] = $this->gen_url(array('app' => 'b2c', 'ctl' => 'site_cart', 'act' => 'add', 'arg0' => 'goods', 'arg1' => 'quick'));
     $this->page('site/gallery/spec_dialog.html', true);
 }
Ejemplo n.º 6
0
 /**
  * 品牌数据.
  */
 public function brand($params)
 {
     $mdl_brand = app::get('b2c')->model('brand');
     $filter = array('disabled' => 'false');
     foreach ($params as $key => $value) {
         switch ($key) {
             case 'brand_id':
             case 'brand_initial':
                 $filter[$key] = explode(',', $value);
                 break;
             case 'brand_name':
                 $filter[$key . '|has'] = $value;
                 break;
         }
     }
     $brand_list = $mdl_brand->getList('brand_id,brand_name,brand_initial,brand_logo', $filter);
     if (!$brand_list) {
         $this->failure();
     }
     foreach ($brand_list as &$brand) {
         $brand['brand_logo'] = base_storager::image_path($brand['brand_logo']);
         $brand['detail_url'] = app::get('site')->router()->gen_url(array('app' => 'b2c', 'ctl' => 'site_list', 'args' => array($brand['brand_id'])));
     }
     $this->success($brand_list);
 }
Ejemplo n.º 7
0
 public function detail_qrcode($gid)
 {
     $mobile_url = vmc::singleton('mobile_router')->gen_url(array('app' => 'b2c', 'ctl' => 'mobile_product', 'act' => 'index', 'args' => array('g' . $gid), 'full' => 1));
     $qrcode_image = vmc::singleton('wechat_qrcode')->create($mobile_url);
     $url = base_storager::image_path($qrcode_image['image_id']);
     return "<img src='{$url}' />";
 }
Ejemplo n.º 8
0
 public function modifier_avatar($col)
 {
     $img_src = base_storager::image_path($col);
     if (!$img_src) {
         return '';
     }
     return "<a href='{$img_src}' target='_blank'><img class='img-thumbnail' src='{$img_src}' style='height:30px;'></a>";
 }
Ejemplo n.º 9
0
 public function modifier_logo($col)
 {
     if (!$col) {
         return '';
     }
     $img_url = base_storager::image_path($col, 'xs');
     return '<img class="img-thumbnail img-circle" width="30" src="' . $img_url . '">';
 }
Ejemplo n.º 10
0
 public function column_content_pic($row)
 {
     $img_src = base_storager::image_path($row['@row']['image_id'], 'xs');
     if (!$img_src) {
         return '';
     }
     return "<img class='img-thumbnail' src='{$img_src}' style='height:30px;'>";
 }
Ejemplo n.º 11
0
 public function modifier_avatar($col)
 {
     if (!$col) {
         return '';
     }
     $url = base_storager::image_path($col);
     return "<img src={$url} class='img-circle'  width=20 height=20>";
 }
Ejemplo n.º 12
0
 function show($gid, &$aGoods = null, $other_params = array())
 {
     $render = $this->app->render();
     if (!$aGoods) {
         #$o = kernel::single('b2c_goods_model');
         $aGoods = $this->getGoods($gid);
     }
     $render->pagedata['specimagewidth'] = $this->app->getConf('spec.image.width');
     $render->pagedata['specimageheight'] = $this->app->getConf('spec.image.height');
     $render->pagedata['goods'] = $aGoods;
     $render->pagedata['other_params'] = json_encode($other_params);
     $cur = app::get('ectools')->model('currency');
     $cur_info = $_COOKIE["S"]["CUR"] ? $cur->getcur($_COOKIE["S"]["CUR"]) : $cur->getFormat();
     if ($cur_info['cur_sign']) {
         $cur_info['sign'] = $cur_info['cur_sign'];
     }
     $ret = array('decimals' => $this->app->getConf('system.money.decimals'), 'dec_point' => $this->app->getConf('system.money.dec_point'), 'thousands_sep' => $this->app->getConf('system.money.thousands_sep'), 'fonttend_decimal_type' => $this->app->getConf('system.money.operation.carryset'), 'fonttend_decimal_remain' => $this->app->getConf('system.money.decimals'), 'sign' => $cur_info['sign']);
     if (isset($cur_info['cur_default']) && $cur_info['cur_default'] === "false") {
         $ret['cur_rate'] = $cur_info['cur_rate'];
     }
     unset($cur_info);
     if ($aGoods['spec'] && is_array($aGoods['spec'])) {
         foreach ($aGoods['spec'] as $row) {
             $option = $row['option'];
             if ($option && is_array($option)) {
                 foreach ($option as $img) {
                     foreach ((array) explode(',', $img['spec_goods_images']) as $imageid) {
                         if ($imageid) {
                             $return[$imageid] = array('small' => base_storager::image_path($imageid, 's'), 'middle' => base_storager::image_path($imageid, 'm'), 'big' => base_storager::image_path($imageid, 'b'));
                         }
                     }
                 }
             }
         }
     }
     $render->pagedata['goods']['spec2image'] = json_encode($return);
     $render->pagedata['spec_default_pic'] = $this->app->getConf('spec.default.pic');
     if ($aGoods['spec'] && is_array($aGoods['spec'])) {
         foreach ($aGoods['spec'] as $row) {
             $option = $row['option'];
             if ($option && is_array($option)) {
                 foreach ($option as $img) {
                     foreach ((array) explode(',', $img['spec_goods_images']) as $imageid) {
                         if ($imageid) {
                             $return[$imageid] = array('small' => base_storager::image_path($imageid, 's'), 'middle' => base_storager::image_path($imageid, 'm'), 'big' => base_storager::image_path($imageid, 'b'));
                         }
                     }
                 }
             }
         }
     }
     list($usec, $sec) = explode(" ", microtime());
     $microtime = substr($usec, strpos($usec, '.') + 1) . $sec;
     $render->pagedata['goodsspec_classname'] = "goods-spec-" . $gid . "-" . $microtime;
     $render->pagedata['goods']['spec2image'] = json_encode($return);
     $render->pagedata['money_format'] = json_encode($ret);
     return $render->fetch('site/product/spec_list.html');
 }
Ejemplo n.º 13
0
    /**
     * finder img列的链接修改.
     *
     * @param array 某行具体数据的数组
     *
     * @return string 链接html
     */
    public function column_img($row)
    {
        $row = $row['@row'];
        if ($row['storage'] == 'network') {
            return '<a class="btn btn-xs btn-default" href="' . $row['ident'] . '" target="_blank">网络图片</a>';
        }
        return '<a href="' . base_storager::image_path($row['image_id']) . '" target="_blank">
<img class="img-thumbnail" src="' . base_storager::image_path($row['image_id'], 'xs') . '" style="height:50px" /></a>';
    }
Ejemplo n.º 14
0
 function gimages_upload()
 {
     $image = $this->app->model('image');
     $image_name = $_FILES['files']['name'][0];
     $image_id = $image->store($_FILES['files']['tmp_name'][0], null, null, $image_name);
     $image->rebuild($image_id, array('L', 'M', 'S', 'XS'));
     $this->_set_tag($image_id, array('商品相册图'));
     echo json_encode(array('url' => base_storager::image_path($image_id, 's'), 'image_id' => $image_id));
 }
Ejemplo n.º 15
0
 function column_goods_pic($row)
 {
     $o = app::get('b2c')->model('goods');
     $g = $o->db_dump(array('goods_id' => $row['goods_id']), 'image_default_id');
     $img_src = base_storager::image_path($g['image_default_id'], 's');
     if (!$img_src) {
         return '';
     }
     return "<a href='{$img_src}' class='img-tip pointer' target='_blank' onmouseover='bindFinderColTip(event);'><span>&nbsp;pic</span></a>";
 }
Ejemplo n.º 16
0
 public function index($cat_id = '', $urlFilter = null, $orderBy = 0, $page = 1, $virtual_cat_id = null, $showtype = null)
 {
     $request_params = $this->_request->get_params();
     $request_params = utils::_filter_input($request_params);
     $urlFilter = utils::_filter_input($urlFilter);
     $urlFilter = htmlspecialchars(urldecode($urlFilter));
     $_GET['scontent'] = htmlspecialchars($_GET['scontent']);
     if (!empty($urlFilter) && $urlFilter != $_GET['scontent']) {
         $urlFilter .= '_' . $_GET['scontent'];
     } else {
         $urlFilter = $_GET['scontent'];
     }
     if (empty($cat_id) && empty($urlFilter)) {
         $url = $this->gen_url(array('app' => 'wap', 'ctl' => 'default', 'act' => 'index'));
         $this->_response->set_redirect($url)->send_headers();
     }
     $oSearch = $this->app->model('search');
     $tmp_filter = $oSearch->decode($urlFilter);
     if ($request_params[5] || $_GET['virtual_cat_id']) {
         $virtual_cat_id = $request_params[5] ? $request_params[5] : intval($_GET['virtual_cat_id']);
     }
     $params = $this->filter_decode($tmp_filter, $cat_id, $virtual_cat_id);
     $page = $params['page'] ? $params['page'] : $page;
     $this->pagedata['filter'] = $params['params'];
     $goodsData = $this->get_goods($params['filter'], $page, $params['orderby']);
     $screen = $this->screen($cat_id, $params['params']);
     $this->pagedata['screen'] = $screen['screen'];
     $this->pagedata['active_filter'] = $screen['active_filter'];
     $this->pagedata['orderby_sql'] = $params['orderby'];
     $this->pagedata['showtype'] = $params['showtype'];
     $this->pagedata['is_store'] = $params['is_store'];
     $this->pagedata['goodsData'] = $goodsData;
     if ($tmp_filter['search_keywords'][0]) {
         $tmp_filter['search_keywords'][0] = str_replace('%xia%', '_', $tmp_filter['search_keywords'][0]);
     }
     //面包屑
     $GLOBALS['runtime']['path'] = $this->runtime_path($cat_id, $tmp_filter['search_keywords'][0], $virtual_cat_id);
     //搜索关键字
     if (isset($tmp_filter['search_keywords'][0])) {
         $keywords = str_replace(' ', '%20', $tmp_filter['search_keywords'][0]);
         $this->set_cookie('S[SEARCH_KEY]', $keywords);
     }
     //setSeo
     $this->_set_seo($screen['seo_info']);
     if (in_array('gallery-index', $this->weixin_share_page)) {
         $this->pagedata['from_weixin'] = $this->from_weixin;
         $this->pagedata['weixin']['appid'] = $this->weixin_a_appid;
         $this->pagedata['weixin']['imgUrl'] = base_storager::image_path(app::get('weixin')->getConf('weixin_basic_setting.weixin_logo'));
         $this->pagedata['weixin']['linelink'] = app::get('wap')->router()->gen_url(array('app' => 'b2c', 'ctl' => 'wap_gallery', 'act' => 'index', 'arg0' => $cat_id, 'full' => 1));
         $this->pagedata['weixin']['shareTitle'] = $this->title;
         $this->pagedata['weixin']['descContent'] = $this->description;
     }
     $this->set_tmpl('gallery');
     $this->page('wap/gallery/index.html');
 }
Ejemplo n.º 17
0
 /**
  * 订单取消事件埋点
  * @param array sdf
  * @return boolean success or failure
  */
 protected function request($sdf, $method = '', $callback = array(), $title = '', $time_out = 1, $rpc_id = null)
 {
     $arr_data = array();
     $arr_data['tid'] = $sdf['order_id'];
     $arr_data['aftersale_id'] = $sdf['return_id'];
     if ($sdf['title']) {
         $arr_data['title'] = $sdf['title'];
     }
     if ($sdf['content']) {
         $arr_data['content'] = $sdf['content'];
     }
     $arr_data['messager'] = '';
     if ($sdf['add_time']) {
         $arr_data['created'] = date('Y-m-d H:i:s', $sdf['add_time']);
     }
     if ($sdf['comment']) {
         $arr_data['memo'] = $sdf['comment'] ? $sdf['comment'] : '';
     }
     if ($sdf['status']) {
         $arr_data['status'] = $sdf['status'];
     }
     if ($sdf['member_id']) {
         $arr_data['buyer_id'] = $sdf['member_id'];
     }
     if ($sdf['product_data']) {
         $arr_product_data = unserialize($sdf['product_data']);
     }
     if ($sdf['image_file']) {
         $arr_data['attachment'] = base_storager::image_path($sdf['image_file']);
     }
     if (isset($arr_product_data) && $arr_product_data) {
         foreach ($arr_product_data as $key => &$items) {
             $arr_product_data[$key]['sku_bn'] = $items['bn'];
             unset($items['bn']);
             $arr_product_data[$key]['sku_name'] = $items['name'];
             unset($items['name']);
             $arr_product_data[$key]['number'] = $items['num'];
             unset($items['num']);
         }
         $arr_data['aftersale_items'] = json_encode($arr_product_data);
     } else {
         $arr_data['aftersale_items'] = "";
     }
     $arr_callback = array('class' => 'b2c_api_callback_app', 'method' => 'callback', 'params' => array('method' => !$method ? 'store.trade.aftersale.add' : $method, 'tid' => $arr_data['tid']));
     if (!$method) {
         //$rst = $this->b2c_app->matrix()->call('store.trade.remarket.add', $arr_data);
         parent::request('store.trade.aftersale.add', $arr_data, $arr_callback, 'Aftersales add', 1);
     } else {
         //$rst = $this->b2c_app->matrix()->call($method, $arr_data);
         parent::request($method, $arr_data, $arr_callback, 'Aftersales update', 1);
     }
 }
Ejemplo n.º 18
0
 /**
  * 获取指定id商品相关信息
  *
  * @param int|array $id 商品id 可以传整数或整数组成的数组
  */
 public function _get_products($id)
 {
     if (!$id) {
         return false;
     }
     $router = app::get('site')->router();
     $json = kernel::single('b2c_cart_json');
     if (!is_array($id)) {
         $id = array($id);
     }
     foreach ($id as $_key => $_id) {
         #if( isset($this->arr_gift[$_id]) ) unset($id[$_key]);
     }
     if (!$id) {
         return $this->arr_gift;
     }
     $arr_gift = $this->o_product->getList_1('*', array('product_id' => $id));
     foreach ((array) $arr_gift as $row) {
         $gift = $row['gift'];
         if (!$gift) {
             continue;
         }
         if (!isset($gift['max_limit'])) {
             $gift['max_limit'] = 9999999;
         }
         if ($gift['marketable'] == 'false') {
             //品录芄锍凳ы!
             unset($row);
             continue;
         }
         if (!$this->arr_all_goods_info[$row['goods_id']]) {
             $tmp = $this->o_goods->getList('image_default_id', array('goods_id' => $row['goods_id']));
             $this->arr_all_goods_info[$row['goods_id']] = $tmp[0];
         }
         $arr_goods_info = $this->arr_all_goods_info[$row['goods_id']];
         $aResult[$row['product_id']] = array('bn' => $row['bn'], 'price' => array('price' => $row['price'], 'cost' => $row['cost'], 'member_lv_price' => $row['price'], 'buy_price' => 0), 'json_price' => array('price' => $row['price'], 'cost' => $row['cost'], 'member_lv_price' => $row['price'], 'buy_price' => 0), 'product_id' => $row['product_id'], 'goods_id' => $row['goods_id'], 'goods_type' => $row['goods_type'], 'name' => $row['name'], 'consume_score' => $gift['consume_score'], 'max_buy_store' => $gift['max_buy_store'], 'gain_score' => intval($row['gain_score']), 'type_id' => $row['type_id'], 'min_buy' => $row['min_buy'], 'spec_info' => $row['spec_info'], 'spec_desc' => is_array($row['spec_desc']) ? $row['spec_desc'] : @unserialize($row['spec_desc']), 'weight' => $row['weight'], 'quantity' => 1, 'params' => $row['params'], 'floatstore' => $row['floatstore'], 'store' => empty($row['store']) ? $row['store'] === 0 ? 0 : 999999 : $row['store'], 'freez' => $row['freez'], 'default_image' => array('thumbnail' => $arr_goods_info['image_default_id']), '_limit' => $gift['max_limit'] - $gift['real_limit']);
         //组合JSON格式让JS显示
         $aResult[$row['product_id']]['json_price']['price'] = $json->get_cur_order($aResult[$row['product_id']]['json_price']['price']);
         $aResult[$row['product_id']]['json_price']['cost'] = $json->get_cur_order($aResult[$row['product_id']]['json_price']['cost']);
         $aResult[$row['product_id']]['json_price']['member_lv_price'] = $json->get_cur_order($aResult[$row['product_id']]['json_price']['member_lv_price']);
         $aResult[$row['product_id']]['json_price']['buy_price'] = $json->get_cur_order($aResult[$row['product_id']]['json_price']['buy_price']);
         $aResult[$row['product_id']]['url'] = $router->gen_url(array('app' => 'gift', 'ctl' => 'site_gift', 'full' => 1, 'act' => 'index', 'arg' => $aResult[$row['product_id']]['goods_id']));
         $aResult[$row['product_id']]['thumbnail'] = base_storager::image_path($aResult[$row['product_id']]['default_image']['thumbnail'], 's');
         $buy_limit = $gift['max_limit'] - $gift['real_limit'];
         $aResult[$row['product_id']]['max_buy_store'] = $gift['max_buy_store'] > $buy_limit ? $buy_limit : $gift['max_buy_store'];
         $this->arr_gift[$row['product_id']] = $aResult[$row['product_id']];
     }
     return $this->arr_gift;
 }
Ejemplo n.º 19
0
 function index()
 {
     $GLOBALS['runtime']['path'][] = array('title' => app::get('wap')->_('首页'), 'link' => kernel::base_url(1));
     $this->set_tmpl('index');
     $this->title = app::get('wap')->getConf('wap.shopname');
     if (in_array('index', $this->weixin_share_page)) {
         $this->pagedata['from_weixin'] = $this->from_weixin;
         $this->pagedata['weixin']['appid'] = $this->weixin_a_appid;
         $this->pagedata['weixin']['imgUrl'] = base_storager::image_path(app::get('weixin')->getConf('weixin_basic_setting.weixin_logo'));
         $this->pagedata['weixin']['linelink'] = app::get('wap')->router()->gen_url(array('app' => 'wap', 'ctl' => 'default', 'full' => 1));
         $this->pagedata['weixin']['shareTitle'] = app::get('weixin')->getConf('weixin_basic_setting.weixin_name');
         $this->pagedata['weixin']['descContent'] = app::get('weixin')->getConf('weixin_basic_setting.weixin_brief');
     }
     $this->page('index.html');
 }
Ejemplo n.º 20
0
 function get_share_goods_data($aGoods)
 {
     if ($aGoods['images']) {
         foreach ($aGoods['images'] as $images_row) {
             $image_url = base_storager::image_path($images_row['image_id']);
             $images[] = $image_url;
         }
     }
     $data['title'] = $aGoods['title'];
     $data['price'] = $aGoods['price'];
     $data['image'] = implode(',', $images);
     $url_array = array('app' => 'b2c', 'ctl' => 'site_product', 'arg0' => $aGoods['product_id']);
     $product_url = kernel::single('base_component_request')->get_full_http_host() . kernel::single('site_controller')->gen_url($url_array);
     $data['link'] = $product_url;
     $data['shopname'] = app::get('site')->getConf('site.name');
     return $data;
 }
Ejemplo n.º 21
0
 public function get_params($sdf)
 {
     $arr_data = array();
     $arr_data['tid'] = $sdf['order_id'];
     $arr_data['aftersale_id'] = $sdf['return_id'];
     if ($sdf['title']) {
         $arr_data['title'] = $sdf['title'];
     }
     if ($sdf['content']) {
         $arr_data['content'] = $sdf['content'];
     }
     $arr_data['messager'] = '';
     if ($sdf['add_time']) {
         $arr_data['created'] = date('Y-m-d H:i:s', $sdf['add_time']);
     }
     if ($sdf['comment']) {
         $arr_data['memo'] = $sdf['comment'] ? $sdf['comment'] : '';
     }
     if ($sdf['status']) {
         $arr_data['status'] = $sdf['status'];
     }
     if ($sdf['member_id']) {
         $arr_data['buyer_id'] = $sdf['member_id'];
     }
     if ($sdf['product_data']) {
         $arr_product_data = unserialize($sdf['product_data']);
     }
     if ($sdf['image_file']) {
         $arr_data['attachment'] = base_storager::image_path($sdf['image_file']);
     }
     if (isset($arr_product_data) && $arr_product_data) {
         foreach ($arr_product_data as $key => &$items) {
             $arr_product_data[$key]['sku_bn'] = $items['bn'];
             unset($items['bn']);
             $arr_product_data[$key]['sku_name'] = $items['name'];
             unset($items['name']);
             $arr_product_data[$key]['number'] = $items['num'];
             unset($items['num']);
         }
         $arr_data['aftersale_items'] = json_encode($arr_product_data);
     } else {
         $arr_data['aftersale_items'] = "";
     }
     return $arr_data;
 }
Ejemplo n.º 22
0
 function column_img($row)
 {
     $set = $this->app->getConf('image.set');
     if (!$set) {
         $set = app::get('image')->getConf('image.default.set');
     }
     $obj = app::get('image')->model('image');
     $row = $obj->dump($row['image_id']);
     if ($set) {
         if ($set['S']['width']) {
             $width = 'width=' . ($row['width'] > $set['S']['width'] ? $set['S']['width'] : $row['width']);
         }
     }
     if ($row['storage'] == 'network') {
         return '<a href="' . $row['ident'] . '" target="_blank"><img src="' . $row['ident'] . '" ' . $width . ' /></a>';
     }
     return '<a href="' . base_storager::image_path($row['image_id']) . '" target="_blank"><img src="' . base_storager::image_path($row['image_id'], 's') . '" ' . $width . ' /></a>';
 }
Ejemplo n.º 23
0
 function get_sales_ads($params = array())
 {
     $ad_position = $params['ad_position'] ? $params['ad_position'] : 1;
     $db = kernel::database();
     $sql = "select *  FROM `sdb_mobileapi_sales_ads` where disabled = 'false' and ad_position = '" . $ad_position . "' order by ordernum asc;";
     $indexads = $db->select($sql);
     $groupad = array();
     foreach ($indexads as $key => $v) {
         $v['ad_img'] = base_storager::image_path($v['ad_img']);
         $groupad[$v['group_code']]['items'][] = $v;
     }
     $res = array();
     foreach ($groupad as $key => $value) {
         $res[] = $value;
     }
     return $res;
     //print_r($res);exit;
 }
Ejemplo n.º 24
0
 function input_siteimage($params)
 {
     $ui = new base_component_ui($this);
     $domid = $ui->new_dom_id();
     $input_name = $params['name'];
     $input_value = $params['value'];
     if ($input_value) {
         $image_url = base_storager::image_path($input_value);
     }
     $render = app::get('seller')->render();
     $render->pagedata = $params;
     $render->pagedata['id'] = $domid;
     $render->pagedata['name'] = $input_name;
     $render->pagedata['url'] = $image_url;
     $render->pagedata['image_id'] = $input_value;
     $render->pagedata['tag'] = $params['tag'];
     return $render->fetch('ui/input_image_seller.html');
 }
Ejemplo n.º 25
0
 function get_all_list()
 {
     $db = kernel::database();
     /*
     $sql = "select *  FROM `sdb_mobileapi_indexad` where disabled = 'false' order by group_code asc, ordernum asc;";
     $indexads = $db->select($sql);
     
     $groupad = array();
     foreach ($indexads as $key => $v){
     	
     	$v['ad_img'] = base_storager::image_path($v['ad_img']);
     	$groupad[$v['group_code']]['group_code'] = $v['group_code'];
     	$groupad[$v['group_code']]['group_name'] = $v['group_name'];
     	$groupad[$v['group_code']]['items'][] = $v;
     }
     
     $res = array();
     foreach ($groupad as $key => $value) {
     	$res[] = $value;
     }
     */
     $sql = "select *  FROM `sdb_mobileapi_indexad_group` where disabled = 'false' order by ordernum asc, group_id asc;";
     $indexads_group = $db->select($sql);
     $now_time = time();
     foreach ($indexads_group as $key => $v) {
         $sql = "select *  FROM `sdb_mobileapi_indexad` where disabled = 'false' and group_id = '" . $v['group_id'] . "' order by ordernum asc, ad_id asc;";
         $indexads = $db->select($sql);
         $groupad = array();
         foreach ($indexads as $ads) {
             if ($ads['url_type'] == 'goods') {
                 $sql = 'select g.buy_count, sg.initial_num FROM `sdb_starbuy_special_goods` AS sg LEFT JOIN `sdb_b2c_products` AS p ON p.product_id = sg.product_id LEFT JOIN `sdb_b2c_goods` AS g ON p.goods_id = g.goods_id WHERE sg.product_id = ' . $ads['ad_url'];
                 $counts = $db->selectrow($sql);
                 $ads['buy_count'] = $counts['buy_count'] + $counts['initial_num'];
             }
             $ads['ad_img'] = base_storager::image_path($ads['ad_img']);
             $groupad[] = $ads;
         }
         $indexads_group[$key]['items'] = $groupad;
         $indexads_group[$key]['system_time'] = $now_time;
     }
     return $indexads_group;
     //print_r($res);exit;
 }
Ejemplo n.º 26
0
 function shopex_spec_values_list($params)
 {
     $params = $this->params;
     //api 调用合法性检查
     $this->check($params);
     /*如果当前用户不是系统管理员,检查当前用户操作权限(暂时不限制权限)
       if( !$this->is_admin )
           $this->user_permission($this->user_id,'catgoods');
       */
     $params['page_no'] = isset($params['page_no']) ? $params['page_no'] : 1;
     $params['page_size'] = isset($params['page_size']) ? $params['page_size'] : 20;
     $page_no = intval($params['page_no']) - 1;
     $page_size = intval($params['page_size']);
     $page_offset = $page_no * $page_size;
     $spec_row = $this->spec_model->getList('spec_id', array('spec_name' => $params['spec_names'], 'alias' => $params['spec_alias']));
     if ($spec_row) {
         $spec_id = $spec_row[0]['spec_id'];
         $filter['spec_id'] = $spec_id;
     } else {
         $error['code'] = null;
         $error['msg'] = 'ECStore中没有对应的规格';
         $this->send_error($error);
     }
     if ($params['page_no'] == -1) {
         $item_total = $this->spec_values_model->count($filter);
         $data['item_total'] = $item_total;
         $this->send_success($data);
     } else {
         $item_total = $this->spec_values_model->count($filter);
         $spec_values = $this->spec_values_model->getList('*', $filter, $page_offset, $page_size);
     }
     if (!$spec_values) {
         $this->send_success();
     }
     //获取规格值
     foreach ($spec_values as $spec_k => $spec_v) {
         $image_url = base_storager::image_path($spec_v['spec_image']);
         $spec_value[$spec_k] = array('spec_value' => $spec_v['spec_value'], 'new_spec_value' => '', 'spec_value_alias' => $spec_v['alias'], 'order_by' => intval($spec_v['p_order']), 'image_url' => substr($image_url, 0, -13));
     }
     $data = $spec_value;
     $data['item_total'] = $item_total;
     $this->send_success($data);
 }
Ejemplo n.º 27
0
 /**
  * 购物车结果
  */
 public function preview()
 {
     $cart_stage = vmc::singleton('b2c_cart_stage');
     $cart_result = $cart_stage->currency_result();
     $is_empty = $cart_stage->is_empty($cart_result);
     if ($is_empty) {
         $this->failure('购物车为空');
     }
     $result_arr = array();
     foreach ($cart_result['objects']['goods'] as $key => $item) {
         $product = $item['item']['product'];
         $product['item_url'] = app::get('site')->router()->gen_url(array('app' => 'b2c', 'ctl' => 'site_product', 'args' => array($product['product_id'])));
         $product['remove_url'] = app::get('site')->router()->gen_url(array('app' => 'b2c', 'ctl' => 'site_cart', 'act' => 'remove', 'args' => array($item['obj_ident'])));
         $product['image_url'] = base_storager::image_path($product['image_id'], 'm');
         $product['price'] = vmc::singleton('ectools_math')->formatNumber($product['price'], app::get('ectools')->getConf('site_decimal_digit_count'), app::get('ectools')->getConf('site_decimal_digit_count'));
         $result_arr[] = $product;
     }
     $this->success($result_arr);
 }
Ejemplo n.º 28
0
 function get_sales_ads($key)
 {
     $ads_id = '';
     foreach ($this->ads_position as $k => $v) {
         if ($v['key'] == $key) {
             $ads_id = $k;
         }
     }
     if ($ads_id) {
         $re = $this->getList('*', array('ad_position' => $ads_id, 'disabled' => 'false'), 0, -1, " ordernum ASC");
         if ($re) {
             foreach ($re as $k => $v) {
                 $re[$k]['img_url'] = base_storager::image_path($v['ad_img']);
             }
         }
         return $re;
     }
     return false;
 }
Ejemplo n.º 29
0
 public function save()
 {
     $this->begin('index.php?app=wechat&ctl=admin_autoreply&act=index');
     $data = $_POST;
     $mdl_rr = app::get('wechat')->model('replyrule');
     if (isset($data['keywords']) && trim($data['keywords']) != '') {
         $data['keywords'] .= ',';
     }
     if (!$data['media']['wmedia_id']) {
         $data['media']['update_time'] = time();
     }
     if ($data['media']['wtype'] == 'news') {
         $data['media']['wcontent']['Articles']['item']['PicUrl'] = base_storager::image_path($data['media']['wcontent']['Articles']['item']['PicUrl_image_id']);
     }
     if ($mdl_rr->save($data)) {
         $this->end(true, '保存成功!');
     } else {
         $this->end(false, '保存失败!');
     }
 }
Ejemplo n.º 30
0
    /**
     * finder img列的链接修改
     * @param array 某行具体数据的数组
     * @return string 链接html
     */
    function column_img($row)
    {
        $obj = app::get('image')->model('image');
        $row = $obj->dump($row['image_id']);
        $limitwidth = 50;
        $maxsize = max($row['width'], $row['height']);
        if ($maxsize > $limitwidth) {
            $size = 'width=';
            $size .= $row['width'] - $row['width'] * (($maxsize - 50) / $maxsize);
            $size .= ' height=';
            $size .= $row['height'] - $row['height'] * (($maxsize - 50) / $maxsize);
        } else {
            $size = 'width=' . $row['width'] . ' height=' . $row['height'];
        }
        if ($row['storage'] == 'network') {
            return '<a href="' . $row['ident'] . '" target="_blank"><div title="' . $row['ident'] . '" style="line-height:41px;width:50px;text-align:center;background:#efefef;">网络图片</div></a><input type="text" value="' . $row['ident'] . '" style="font-size:9px;font-family:verdana;border:none;width:50px;padding:0;margin:0;display:block;background:#333;color:#fff"/>';
        }
        return '<div  style="width:50px;height:50px;display:block;font-family:Arail;vertical-align: middle;display:table-cell;font-size:42.5px;padding:1px;background:#fff;"><a href="' . base_storager::image_path($row['image_id']) . '" target="_blank" style="display:block;">
<img src="' . base_storager::image_path($row['image_id'], 's') . '" ' . $size . ' /></a></div>';
    }