示例#1
0
文件: image.php 项目: syjzwjj/quyeba
 /**
  * 存储图片的信息的接口方法
  * @param string filename
  * @param string image_id唯一标识
  * @param string size规格类型
  * @param string 图片的名称
  * @param boolean 是否要大水印
  * @return stirng image_id唯一标识
  */
 function store($file, $image_id, $size = null, $name = null, $watermark = false)
 {
     if (!defined(FILE_STORAGER)) {
         define('FILE_STORAGER', 'filesystem');
     }
     list($w, $h, $t) = getimagesize($file);
     $extname = array(1 => '.gif', 2 => '.jpg', 3 => '.png', 6 => '.bmp');
     if (!isset($extname[$t])) {
         return false;
     }
     if ($image_id) {
         $params = $this->dump($image_id);
         if ($name) {
             $params['image_name'] = $name;
         }
         $params['image_id'] = $image_id;
     } else {
         $params['image_id'] = $this->gen_id();
         $params['image_name'] = $name;
         $params['storage'] = FILE_STORAGER;
     }
     if (substr($file, 0, 4) == 'http') {
         $params['storage'] = 'network';
         $params['url'] = $file;
         $params['ident'] = $file;
         $params['width'] = $w;
         $params['height'] = $h;
         $this->save($params);
         return $params['image_id'];
     }
     $params['watermark'] = $watermark;
     if (is_bool($params['watermark'])) {
         $params['watermark'] = $params['watermark'] ? 'true' : 'false';
     }
     $storager = new base_storager();
     $params['last_modified'] = time();
     list($url, $ident, $no) = explode("|", $storager->save_upload($file, 'image', '', $msg, $extname[$t]));
     if ($size) {
         $size = strtolower($size);
         $params[$size . '_url'] = $url;
         $params[$size . '_ident'] = $ident;
     } else {
         $params['url'] = $url;
         $params['ident'] = $ident;
         $params['width'] = $w;
         $params['height'] = $h;
     }
     parent::save($params);
     // Andrew 20120929
     // 图片上传的位置,在此处将图片转移到又拍云上
     $services = kernel::servicelist("custom.image.save");
     foreach ($services as $service) {
         $service->save($params);
     }
     return $params['image_id'];
 }
示例#2
0
 /**
  * 存储图片的信息的接口方法.
  *
  * @param string filename
  * @param string image_id唯一标识
  * @param string size规格类型
  * @param string 图片的名称
  * @param bool 是否要大水印
  *
  * @return stirng image_id唯一标识
  */
 public function store($file, $image_id, $size = null, $name = null, $watermark = false)
 {
     if (!defined('FILE_STORAGER')) {
         define('FILE_STORAGER', 'filesystem');
     }
     list($w, $h, $t) = getimagesize($file);
     $extname = array(1 => '.gif', 2 => '.jpg', 3 => '.png', 6 => '.bmp');
     if (!isset($extname[$t])) {
         return false;
     }
     if ($image_id) {
         $params = $this->dump($image_id);
         if ($name) {
             $params['image_name'] = $name;
         }
         $params['image_id'] = $image_id;
     } else {
         $params['image_id'] = $this->gen_id();
         $params['image_name'] = $name;
         $params['storage'] = constant('FILE_STORAGER');
     }
     if (substr($file, 0, 4) == 'http') {
         $params['storage'] = 'network';
         $params['url'] = $file;
         $params['ident'] = $file;
         $params['width'] = $w;
         $params['height'] = $h;
         $this->save($params);
         return $params['image_id'];
     }
     $params['watermark'] = 'false';
     // if(is_bool($params['watermark'])){
     // 	$params['watermark'] = $params['watermark'] ? 'true' : 'false';
     // }
     $storager = new base_storager();
     $params['last_modified'] = time();
     list($url, $ident, $no) = explode('|', $storager->save_upload($file, 'image', '', $msg, $extname[$t]));
     if ($size) {
         $size = strtolower($size);
         $params[$size . '_url'] = $url;
         $params[$size . '_ident'] = $ident;
     } else {
         $params['url'] = $url;
         $params['ident'] = $ident;
         $params['width'] = $w;
         $params['height'] = $h;
     }
     parent::save($params);
     return $params['image_id'];
 }
示例#3
0
 /**
  * 根据image_id删除二维码图片
  */
 public function remove($image_id)
 {
     $imageModel = app::get('image')->model('image');
     $imageData = $imageModel->getRow('image_id,ident,url,storage', array('image_id' => $image_id));
     if (!$imageData) {
         return true;
     }
     //删除storager中存储的图片数据
     $storager = new base_storager();
     $ident_data = $imageData['url'] . '|' . $imageData['ident'] . '|' . $imageData['storage'];
     $res = $storager->remove($ident_data, 'image');
     $imageModel->delete(array('image_id' => $image_id));
     return true;
 }
示例#4
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);
 }
示例#5
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}' />";
 }
示例#6
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="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;
 }
示例#7
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;
 }
示例#8
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);
 }
示例#9
0
文件: list.php 项目: syjzwjj/quyeba
 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);
 }
示例#10
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);
 }
示例#11
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;'>";
 }
示例#12
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>";
 }
示例#13
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>";
 }
示例#14
0
文件: store.php 项目: noikiy/snk.com
 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 . '">';
 }
示例#15
0
文件: spec.php 项目: syjzwjj/quyeba
 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');
 }
示例#16
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>';
    }
示例#17
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));
 }
示例#18
0
 function store($file, $image_id, $size = null, $name = null)
 {
     list($w, $h, $t) = getimagesize($file);
     $extname = array(1 => '.gif', 2 => '.jpg', 3 => '.png', 6 => '.bmp');
     if (!isset($extname[$t])) {
         return false;
     }
     if ($image_id) {
         $params = $this->dump($image_id);
         if ($name) {
             $params['image_name'] = $name;
         }
         $params['image_id'] = $image_id;
     } else {
         $params['image_id'] = $this->gen_id();
         $params['image_name'] = $name;
         $params['storage'] = $this->app->getConf('system.default_storager');
     }
     if (substr($file, 0, 4) == 'http') {
         $params['storage'] = 'network';
         $params['url'] = $file;
         $params['ident'] = $file;
         $params['width'] = $w;
         $params['height'] = $h;
         $this->save($params);
         return $params['image_id'];
     }
     $storager = new base_storager();
     $params['last_modified'] = time();
     list($url, $ident, $no) = explode("|", $storager->save_upload($file, '', '', $msg, $extname[$t]));
     if ($size) {
         $size = strtolower($size);
         $params[$size . '_url'] = $url;
         $params[$size . '_ident'] = $ident;
     } else {
         $params['url'] = $url;
         $params['ident'] = $ident;
         $params['width'] = $w;
         $params['height'] = $h;
     }
     parent::save($params);
     return $params['image_id'];
 }
示例#19
0
文件: goods.php 项目: syjzwjj/quyeba
 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>";
 }
示例#20
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');
 }
示例#21
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);
     }
 }
示例#22
0
文件: goods.php 项目: syjzwjj/quyeba
 /**
  * 获取指定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;
 }
示例#23
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');
 }
示例#24
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;
 }
示例#25
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;
 }
示例#26
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;
 }
示例#27
0
 /**
  * 获取最新的评论(默认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;
 }
示例#28
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>';
 }
示例#29
0
文件: input.php 项目: noikiy/snk.com
 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');
 }
示例#30
-1
 public function create($intext, $long_touch)
 {
     $mdl_image = app::get('image')->model('image');
     if ($exits_image = $mdl_image->dump(md5($intext . $long_touch))) {
         return $exits_image;
     }
     $tmp_file = tempnam(TMP_DIR, 'qrcode');
     wechat_qrcode_QRcode::png($intext, $tmp_file, 'L', 8, 4);
     list($w, $h, $type) = getimagesize($tmp_file);
     if ($long_touch) {
         //加入额外图像
         $resize_tmp_file = tempnam(TMP_DIR, 'qrcode_resize');
         $image_tool = vmc::singleton('image_tools_gd');
         $image_tool->resize($tmp_file, $resize_tmp_file, $w, $h, $type, $w + 180, $h + 220, false, 20);
         $water_file = PUBLIC_DIR . '/misc/long_touch.gif';
         list($w_w, $w_h, $w_type) = getimagesize($water_file);
         $warermark_set = array('wm_opacity' => 100, 'watermark_width' => $w_w, 'watermark_height' => $w_h, 'type' => $w_type, 'src_width' => $w + 180, 'src_height' => $h + 180, 'dest_x' => ($w + 180 - 120) / 2, 'dest_y' => $h + 50);
         $image_tool->watermark($resize_tmp_file, $water_file, $warermark_set);
     }
     $storager = new base_storager();
     if ($long_touch) {
         list($url, $ident, $storage) = explode('|', $storager->save_upload($resize_tmp_file, 'image', '', $msg, '.png'));
     } else {
         list($url, $ident, $storage) = explode('|', $storager->save_upload($tmp_file, 'image', '', $msg, '.png'));
     }
     $tmp_qrcode_image = array('image_id' => md5($intext . $long_touch), 'storage' => $storage, 'image_name' => 'TMP_QRCODE', 'ident' => $ident, 'url' => $url, 'width' => $w, 'height' => $h, 'last_modified' => time());
     $mdl_image->save($tmp_qrcode_image);
     unlink($tmp_file);
     if ($long_touch) {
         unlink($resize_tmp_file);
     }
     return $tmp_qrcode_image;
 }