Example #1
0
 public function getCategory()
 {
     global $_W;
     $shopset = m('common')->getSysset('shop');
     $allcategory = array();
     $category = pdo_fetchall("SELECT * FROM " . tablename('ewei_shop_category') . " WHERE uniacid=:uniacid and enabled=1 ORDER BY parentid ASC, displayorder DESC", array(':uniacid' => $_W['uniacid']));
     $category = set_medias($category, array('thumb', 'advimg'));
     foreach ($category as $c) {
         if (empty($c['parentid'])) {
             $children = array();
             foreach ($category as $c1) {
                 if ($c1['parentid'] == $c['id']) {
                     if (intval($shopset['catlevel']) == 3) {
                         $children2 = array();
                         foreach ($category as $c2) {
                             if ($c2['parentid'] == $c1['id']) {
                                 $children2[] = $c2;
                             }
                         }
                         $c1['children'] = $children2;
                     }
                     $children[] = $c1;
                 }
             }
             $c['children'] = $children;
             $allcategory[] = $c;
         }
     }
     return $allcategory;
 }
Example #2
0
 public function getData($page)
 {
     global $_W;
     $data = htmlspecialchars_decode($page['datas']);
     $d = json_decode($data, true);
     $goodsids = array();
     foreach ($d as $k1 => &$dd) {
         if ($dd['temp'] == 'goods') {
             foreach ($dd['data'] as $k2 => $ddd) {
                 $goodsids[] = array('id' => $ddd['goodid'], 'k1' => $k1, 'k2' => $k2);
             }
         } elseif ($dd['temp'] == 'richtext') {
             $dd['content'] = $this->unescape($dd['content']);
         }
     }
     unset($dd);
     $arr = array();
     foreach ($goodsids as $a) {
         $arr[] = $a['id'];
     }
     if (count($arr) > 0) {
         $goodinfos = pdo_fetchall("SELECT id,title,productprice,marketprice,thumb FROM " . tablename('ewei_shop_goods') . " WHERE id in ( " . implode(',', $arr) . ") and uniacid= :uniacid ", array(':uniacid' => $_W['uniacid']), 'id');
         $goodinfos = set_medias($goodinfos, 'thumb');
         foreach ($d as $k1 => &$dd) {
             if ($dd['temp'] == 'goods') {
                 foreach ($dd['data'] as $k2 => &$ddd) {
                     $cdata = $goodinfos[$ddd['goodid']];
                     $ddd['name'] = $cdata['title'];
                     $ddd['priceold'] = $cdata['productprice'];
                     $ddd['pricenow'] = $cdata['marketprice'];
                     $ddd['img'] = $cdata['thumb'];
                 }
                 unset($ddd);
             }
         }
         unset($dd);
     }
     $data = json_encode($d);
     $data = rtrim($data, "]");
     $data = ltrim($data, "[");
     $pageinfo = htmlspecialchars_decode($page['pageinfo']);
     $p = json_decode($pageinfo, true);
     $page_title = empty($p[0]['params']['title']) ? "未设置页面标题" : $p[0]['params']['title'];
     $page_desc = empty($p[0]['params']['desc']) ? "未设置页面简介" : $p[0]['params']['desc'];
     $page_img = empty($p[0]['params']['img']) ? "" : tomedia($p[0]['params']['img']);
     $page_keyword = empty($p[0]['params']['kw']) ? "" : $p[0]['params']['kw'];
     $shopset = m('common')->getSysset('shop');
     $system = array('shopname' => $shopset['name'], 'shoplogo' => tomedia($shopset['logo']));
     $system = json_encode($system);
     return array('page' => $page, 'data' => $data, 'share' => array('title' => $page_title, 'desc' => $page_desc, 'imgUrl' => $page_img), 'footermenu' => intval($p[0]['params']['footer']), 'system' => $system);
 }
Example #3
0
 public function respond($obj = null)
 {
     global $_W;
     $message = $obj->message;
     $content = $obj->message['content'];
     $msgtype = strtolower($message['msgtype']);
     $event = strtolower($message['event']);
     if ($msgtype == 'text' || $event == 'click') {
         $page = pdo_fetch('select * from ' . tablename('ewei_shop_designer') . ' where keyword=:keyword and uniacid=:uniacid limit 1', array(':uniacid' => $_W['uniacid'], ':keyword' => $content));
         if (empty($page)) {
             return $this->responseEmpty();
         }
         $p = htmlspecialchars_decode($page['pageinfo']);
         $p = json_decode($p, true);
         $r_title = empty($p[0]['params']['title']) ? "未设置标题" : $p[0]['params']['title'];
         $r_desc = empty($p[0]['params']['desc']) ? "未设置页面介绍" : $p[0]['params']['desc'];
         $r_img = empty($p[0]['params']['img']) ? "" : $p[0]['params']['img'];
         $r_img = set_medias($r_img);
         $news = array(array('title' => $r_title, 'picurl' => $r_img, 'description' => $r_desc, 'url' => $_W['siteroot'] . 'app/index.php?i=' . $_W['uniacid'] . '&c=entry&m=ewei_shop&do=plugin&p=designer&pageid=' . $page['id']));
         return $obj->respNews($news);
     }
     return $this->responseEmpty();
 }
Example #4
0
            $storeids = array_merge(explode(',', $g['storeids']), $storeids);
        }
    }
    if (!empty($storeids)) {
        if (!empty($saler['storeid'])) {
            if (!in_array($saler['storeid'], $storeids)) {
                show_json(0, '您无此门店的核销权限!');
            }
        }
    }
    $goods = set_medias($goods, 'thumb');
    $order['goodstotal'] = count($goods);
    $order['finishtime'] = date('Y-m-d H:i:s', $order['finishtime']);
    $address = false;
    $carrier = unserialize($order['carrier']);
    $set = set_medias(m('common')->getSysset('shop'), 'logo');
    show_json(1, array('order' => $order, 'goods' => $goods, 'carrier' => $carrier, 'set' => $set));
} else {
    if ($operation == 'complete') {
        $orderid = intval($_GPC['id']);
        $saler = pdo_fetch('select * from ' . tablename('ewei_shop_saler') . ' where openid=:openid and uniacid=:uniacid limit 1', array(':uniacid' => $_W['uniacid'], ':openid' => $openid));
        if (empty($saler)) {
            show_json(0, '您无核销权限!');
        }
        $order = pdo_fetch('select * from ' . tablename('ewei_shop_order') . ' where id=:id and uniacid=:uniacid  limit 1', array(':id' => $orderid, ':uniacid' => $uniacid));
        if (empty($order)) {
            show_json(0, "订单不存在!");
        }
        if (empty($order['isverify'])) {
            show_json(0, "订单无需核销!");
        }
Example #5
0
 public function getGuide($system, $pageinfo)
 {
     global $_W, $_GPC;
     if (!empty($_GPC['preview'])) {
         $guide['followed'] = '0';
     } else {
         $guide['openid2'] = m('user')->getOpenid();
         $guide['followed'] = m('user')->followed($guide['openid2']);
     }
     if ($guide['followed'] != '1') {
         $system = json_decode($system, true);
         $system['shop'] = set_medias($system['shop'], 'logo');
         $pageinfo = json_decode($pageinfo, true);
         if (!empty($_GPC['mid'])) {
             $guide['member1'] = pdo_fetch("SELECT id,nickname,openid,avatar FROM " . tablename('ewei_shop_member') . " WHERE id=:mid and uniacid= :uniacid limit 1 ", array(':uniacid' => $_W['uniacid'], ':mid' => $_GPC['mid']));
             $guide['member2'] = pdo_fetch("SELECT id,nickname,openid FROM " . tablename('ewei_shop_member') . " WHERE openid=:openid and uniacid= :uniacid limit 1 ", array(':uniacid' => $_W['uniacid'], ':openid' => $guide['openid2']));
         }
         $guide['followurl'] = $system['share']['followurl'];
         if (empty($guide['member1'])) {
             $guide['title1'] = $pageinfo['params']['guidetitle1'];
             $guide['title2'] = $pageinfo['params']['guidetitle2'];
             $guide['logo'] = $system['shop']['logo'];
         } else {
             $pageinfo['params']['guidetitle1s'] = str_replace("[邀请人]", $guide['member1']['nickname'], $pageinfo['params']['guidetitle1s']);
             $pageinfo['params']['guidetitle2s'] = str_replace("[邀请人]", $guide['member1']['nickname'], $pageinfo['params']['guidetitle2s']);
             $pageinfo['params']['guidetitle1s'] = str_replace("[访问者]", $guide['member2']['nickname'], $pageinfo['params']['guidetitle1s']);
             $pageinfo['params']['guidetitle2s'] = str_replace("[访问者]", $guide['member2']['nickname'], $pageinfo['params']['guidetitle2s']);
             $guide['title1'] = $pageinfo['params']['guidetitle1s'];
             $guide['title2'] = $pageinfo['params']['guidetitle2s'];
             $guide['logo'] = $guide['member1']['avatar'];
         }
     }
     return $guide;
 }
Example #6
0
 public function getGoods($id, $member)
 {
     global $_W;
     $credit = $member['credit1'];
     $money = $member['credit2'];
     if (empty($id)) {
         return array('canbuy' => false, 'buymsg' => '已下架');
     }
     $goods = pdo_fetch('select * from ' . tablename('ewei_shop_creditshop_goods') . ' where id=:id and uniacid=:uniacid limit 1', array(':id' => $id, ':uniacid' => $_W['uniacid']));
     if (empty($goods)) {
         return array('canbuy' => false, 'buymsg' => '已下架');
     }
     $goods = set_medias($goods, 'thumb');
     if ($goods['credit'] > 0 & $goods['money'] > 0) {
         $goods['acttype'] = 0;
     } else {
         if ($goods['credit'] > 0) {
             $goods['acttype'] = 1;
         } else {
             if ($goods['money'] > 0) {
                 $goods['acttype'] = 2;
             }
         }
     }
     $goods['endtime_str'] = date('Y-m-d H:i', $goods['endtime']);
     $goods['timestart_str'] = date('Y-m-d H:i', $goods['timestart']);
     $goods['timeend_str'] = date('Y-m-d H:i', $goods['timeend']);
     $goods['timestate'] = "";
     $goods['canbuy'] = !empty($goods['status']) && empty($goods['deleted']);
     if (empty($goods['canbuy'])) {
         $goods['buymsg'] = "已下架";
     } else {
         if ($goods['total'] > 0) {
             $logcount = pdo_fetchcolumn('select count(*)  from ' . tablename('ewei_shop_creditshop_log') . "  where goodsid=:goodsid and status>=2  and uniacid=:uniacid  ", array(':goodsid' => $id, ':uniacid' => $_W['uniacid']));
             if ($logcount >= $goods['total']) {
                 $goods['canbuy'] = false;
                 $goods['buymsg'] = empty($goods['type']) ? '已兑完' : '已抽完';
             }
         }
         if ($goods['canbuy']) {
             if ($goods['totalday'] > 0) {
                 $logcount = pdo_fetchcolumn('select count(*)  from ' . tablename('ewei_shop_creditshop_log') . "  where goodsid=:goodsid and status>=2 and  date_format(from_UNIXTIME(`createtime`),'%Y-%m-%d') = date_format(now(),'%Y-%m-%d') and uniacid=:uniacid  ", array(':goodsid' => $id, ':uniacid' => $_W['uniacid']));
                 if ($logcount >= $goods['totalday']) {
                     $goods['canbuy'] = false;
                     $goods['buymsg'] = empty($goods['type']) ? '今日已兑完' : '今日已抽完';
                 }
             }
         }
         if ($goods['canbuy']) {
             if ($goods['chanceday'] > 0) {
                 $logcount = pdo_fetchcolumn('select count(*)  from ' . tablename('ewei_shop_creditshop_log') . "  where goodsid=:goodsid and openid=:openid and status>0 and  date_format(from_UNIXTIME(`createtime`),'%Y-%m-%d') = date_format(now(),'%Y-%m-%d') and uniacid=:uniacid  ", array(':goodsid' => $id, ':uniacid' => $_W['uniacid'], ':openid' => $member['openid']));
                 if ($logcount >= $goods['chanceday']) {
                     $goods['canbuy'] = false;
                     $goods['buymsg'] = empty($goods['type']) ? '今日已兑换' : '今日已抽奖';
                 }
             }
         }
         if ($goods['canbuy']) {
             if ($goods['chance'] > 0) {
                 $logcount = pdo_fetchcolumn('select count(*)  from ' . tablename('ewei_shop_creditshop_log') . '  where goodsid=:goodsid and openid=:openid and status>0 and  uniacid=:uniacid  ', array(':goodsid' => $id, ':uniacid' => $_W['uniacid'], ':openid' => $member['openid']));
                 if ($logcount >= $goods['chance']) {
                     $goods['canbuy'] = false;
                     $goods['buymsg'] = empty($goods['type']) ? '已兑换' : '已抽奖';
                 }
             }
         }
         if ($goods['canbuy']) {
             if ($goods['usermaxbuy'] > 0) {
                 $logcount = pdo_fetchcolumn('select ifnull(sum(total),0)  from ' . tablename('ewei_shop_creditshop_log') . '  where goodsid=:goodsid and openid=:openid  and uniacid=:uniacid ', array(':goodsid' => $id, ':uniacid' => $_W['uniacid'], ':openid' => $member['openid']));
                 if ($logcount >= $goods['chance']) {
                     $goods['canbuy'] = false;
                     $goods['buymsg'] = '已参加';
                 }
             }
         }
         if ($goods['canbuy']) {
             if ($credit < $goods['credit'] && $goods['credit'] > 0) {
                 $goods['canbuy'] = false;
                 $goods['buymsg'] = "积分不足";
             }
         }
         if ($goods['canbuy']) {
             if ($goods['istime'] == 1) {
                 if (time() < $goods['timestart']) {
                     $goods['canbuy'] = false;
                     $goods['timestate'] = "before";
                     $goods['buymsg'] = "活动未开始";
                 } else {
                     if (time() > $goods['timeend']) {
                         $goods['canbuy'] = false;
                         $goods['buymsg'] = '活动已结束';
                     } else {
                         $goods['timestate'] = "after";
                     }
                 }
             }
         }
         $levelid = $member['level'];
         $groupid = $member['groupid'];
         if ($goods['canbuy']) {
             if ($goods['buylevels'] != '') {
                 $buylevels = explode(',', $goods['buylevels']);
                 if (!in_array($levelid, $buylevels)) {
                     $goods['canbuy'] = false;
                     $goods['buymsg'] = '无会员特权';
                 }
             }
         }
         if ($goods['canbuy']) {
             if ($goods['buygroups'] != '') {
                 $buygroups = explode(',', $goods['buygroups']);
                 if (!in_array($groupid, $buygroups)) {
                     $goods['canbuy'] = false;
                     $goods['buymsg'] = '无会员特权';
                 }
             }
         }
     }
     $goods['followtext'] = empty($goods['followtext']) ? '您必须关注我们的公众帐号,才能参加活动哦!' : $goods['followtext'];
     $set = $this->getSet();
     $goods['followurl'] = $set['followurl'];
     if (empty($goods['followurl'])) {
         $share = m('common')->getSysset('share');
         $goods['followurl'] = $share['followurl'];
     }
     return $goods;
 }
Example #7
0
<?php

if (!defined('IN_IA')) {
    exit('Access Denied');
}
global $_W, $_GPC;
$operation = !empty($_GPC['op']) ? $_GPC['op'] : 'index';
$openid = m('user')->getOpenid();
$uniacid = $_W['uniacid'];
$set = m('common')->getSysset('shop');
$commission = p('commission');
if ($commission) {
    $shopid = intval($_GPC['shopid']);
    if (!empty($shopid)) {
        $myshop = set_medias($commission->getShop($shopid), array('img', 'logo'));
    }
}
if ($_W['isajax']) {
    $args = array('pagesize' => 10, 'page' => $_GPC['page'], 'isnew' => $_GPC['isnew'], 'ishot' => $_GPC['ishot'], 'isrecommand' => $_GPC['isrecommand'], 'isdiscount' => $_GPC['isdiscount'], 'istime' => $_GPC['istime'], 'keywords' => $_GPC['keywords'], 'pcate' => $_GPC['pcate'], 'ccate' => $_GPC['ccate'], 'tcate' => $_GPC['tcate'], 'order' => $_GPC['order'], 'by' => $_GPC['by']);
    if (!empty($myshop['selectgoods']) && !empty($myshop['goodsids'])) {
        $args['ids'] = $myshop['goodsids'];
    }
    $goods = m('goods')->getList($args);
    show_json(1, array('goods' => $goods, 'pagesize' => $args['pagesize']));
}
include $this->template('shop/list');
Example #8
0
 public function getComments($goodsid = '0', $args = array())
 {
     global $_W;
     $page = !empty($args['page']) ? intval($args['page']) : 1;
     $pagesize = !empty($args['pagesize']) ? intval($args['pagesize']) : 10;
     $condition = ' and `uniacid` = :uniacid AND `goodsid` = :goodsid and deleted=0';
     $params = array(':uniacid' => $_W['uniacid'], ':goodsid' => $goodsid);
     $sql = "SELECT id,nickname,headimgurl,content,images FROM " . tablename('ewei_shop_goods_comment') . " where 1 {$condition} ORDER BY createtime desc LIMIT " . ($page - 1) * $pagesize . ',' . $pagesize;
     $list = pdo_fetchall($sql, $params);
     foreach ($list as &$row) {
         $row['images'] = set_medias(unserialize($row['images']));
     }
     unset($row);
     return $list;
 }
Example #9
0
<?php

//微赞科技 by QQ:800083075 http://www.012wz.com/
global $_W, $_GPC;
$openid = m('user')->getOpenid();
$shop_set = m('common')->getSysset('shop');
$set = set_medias($this->set, 'regbg');
$member = m('member')->getInfo($openid);
if ($member['isagent'] == 1 && $member['status'] == 1) {
    header("location: " . $this->createPluginMobileUrl('commission'));
    die;
}
$mid = intval($_GPC['mid']);
if ($_W['isajax']) {
    $agent = false;
    if (!empty($member['agentid'])) {
        $mid = $member['agentid'];
        $agent = m('member')->getMember($member['agentid']);
    } else {
        if (!empty($mid)) {
            $agent = m('member')->getMember($mid);
        }
    }
    $ret = array('shop_set' => $shop_set, 'set' => $set, 'member' => $member, 'agent' => $agent);
    $ret['status'] = 0;
    $status = intval($set['become_order']) == 0 ? 1 : 3;
    if ($set['become'] == '2') {
        $ordercount = pdo_fetchcolumn('select count(*) from ' . tablename('ewei_shop_order') . " where uniacid=:uniacid and openid=:openid and status>={$status} limit 1", array(':uniacid' => $_W['uniacid'], ':openid' => $openid));
        if ($ordercount < intval($set['become_ordercount'])) {
            $ret['status'] = 1;
            $ret['order'] = number_format($ordercount, 0);
Example #10
0
                     if ($it['id'] == $itemid) {
                         $specs[] = $ss;
                         break;
                     }
                 }
             }
         }
     }
     show_json(1, array('cartdata' => $cartdata, 'cartoption' => $cartoption, 'cartspecs' => $cartspecs, 'goods' => $goods, 'options' => $options, 'specs' => $specs));
 } else {
     if ($operation == 'setoption' && $_W['ispost']) {
         $id = intval($_GPC['id']);
         $goodsid = intval($_GPC['goodsid']);
         $optionid = intval($_GPC['optionid']);
         $option = pdo_fetch("select id,title,thumb,marketprice,productprice,costprice, stock,weight,specs from " . tablename('ewei_shop_goods_option') . " " . " where uniacid=:uniacid and goodsid=:goodsid and id=:id limit 1 ", array(':id' => $optionid, ':uniacid' => $uniacid, ':goodsid' => $goodsid));
         $option = set_medias($option, 'thumb');
         if (empty($option)) {
             show_json(0, '规格未找到');
         }
         pdo_update('ewei_shop_member_cart', array('optionid' => $optionid), array('id' => $id, 'uniacid' => $uniacid, 'goodsid' => $goodsid));
         show_json(1, array('optionid' => $optionid, 'optiontitle' => $option['title']));
     } else {
         if ($operation == 'updatenum' && $_W['ispost']) {
             $id = intval($_GPC['id']);
             $goodsid = intval($_GPC['goodsid']);
             $total = intval($_GPC['total']);
             empty($total) && ($total = 1);
             $data = pdo_fetchall("select id,total from " . tablename('ewei_shop_member_cart') . " " . " where id=:id and uniacid=:uniacid and goodsid=:goodsid  and openid=:openid limit 1 ", array(':id' => $id, ':uniacid' => $uniacid, ':goodsid' => $goodsid, ':openid' => $openid));
             if (empty($data)) {
                 show_json(0, '购物车数据未找到');
             }
Example #11
0
     if (!empty($og['option_goodssn'])) {
         $og['goodssn'] = $og['option_goodssn'];
     }
     if (!empty($og['option_productsn'])) {
         $og['productsn'] = $og['option_productsn'];
     }
     if (!empty($og['goodssn'])) {
         $goods .= ' 商品编号: ' . $og['goodssn'];
     }
     if (!empty($og['productsn'])) {
         $goods .= ' 商品条码: ' . $og['productsn'];
     }
     $goods .= ' 单价: ' . $og['price'] / $og['total'] . ' 折扣后: ' . $og['realprice'] / $og['total'] . ' 数量: ' . $og['total'] . ' 总价: ' . $og['price'] . " 折扣后: " . $og['realprice'] . "\r\n ";
 }
 unset($og);
 $value['goods'] = set_medias($order_goods, 'thumb');
 $value['goods_str'] = $goods;
 if (!empty($agentid) && $level > 0) {
     $commission_level = 0;
     if ($value['agentid'] == $agentid) {
         $value['level'] = 1;
         $level1_commissions = pdo_fetchall('select commission1  from ' . tablename('ewei_shop_order_goods') . ' og ' . ' left join  ' . tablename('ewei_shop_order') . ' o on o.id = og.orderid ' . ' where og.orderid=:orderid and o.agentid= ' . $agentid . "  and o.uniacid=:uniacid", array(':orderid' => $value['id'], ':uniacid' => $_W['uniacid']));
         foreach ($level1_commissions as $c) {
             $commission = iunserializer($c['commission1']);
             $commission_level += isset($commission['level' . $agentLevel['id']]) ? $commission['level' . $agentLevel['id']] : $commission['default'];
         }
     } else {
         if (in_array($value['agentid'], array_keys($agent['level1_agentids']))) {
             $value['level'] = 2;
             if ($agent['level2'] > 0) {
                 $level2_commissions = pdo_fetchall('select commission2  from ' . tablename('ewei_shop_order_goods') . ' og ' . ' left join  ' . tablename('ewei_shop_order') . ' o on o.id = og.orderid ' . ' where og.orderid=:orderid and  o.agentid in ( ' . implode(',', array_keys($agent['level1_agentids'])) . ")  and o.uniacid=:uniacid", array(':orderid' => $value['id'], ':uniacid' => $_W['uniacid']));
Example #12
0
<?php

if (!defined('IN_IA')) {
    exit('Access Denied');
}
global $_W, $_GPC;
$kwd = trim($_GPC['keyword']);
$params = array();
$params[':uniacid'] = $_W['uniacid'];
$condition = " and uniacid=:uniacid";
if (!empty($kwd)) {
    $condition .= " AND `title` LIKE :keyword";
    $params[':keyword'] = "%{$kwd}%";
}
$ds = pdo_fetchall('SELECT id,title,thumb FROM ' . tablename('ewei_shop_goods') . " WHERE 1 {$condition} order by createtime desc", $params);
$ds = set_medias($ds, 'thumb');
include $this->template('web/shop/query');
Example #13
0
 $condition = " and openid=:openid  and userdeleted=0 and deleted=0 and uniacid=:uniacid ";
 $params = array(':uniacid' => $uniacid, ':openid' => $openid);
 if ($status != '') {
     if ($status != 4) {
         $condition .= ' and status=' . intval($status);
     } else {
         $condition .= ' and refundid<>0';
     }
 } else {
     $condition .= ' and status<>-1';
 }
 $list = pdo_fetchall("select id,ordersn,price,status,iscomment,isverify,verified,iscomment,refundid,expresscom,express,expresssn from " . tablename('ewei_shop_order') . " where 1 {$condition} order by createtime desc LIMIT " . ($pindex - 1) * $psize . ',' . $psize, $params);
 $total = pdo_fetchcolumn('select count(*) from ' . tablename('ewei_shop_order') . " where 1 {$condition}", $params);
 foreach ($list as &$row) {
     $sql = 'SELECT og.goodsid,og.total,g.title,g.thumb,og.price,og.optionname as optiontitle,og.optionid FROM ' . tablename('ewei_shop_order_goods') . ' og ' . ' left join ' . tablename('ewei_shop_goods') . ' g on og.goodsid = g.id ' . ' where og.orderid=:orderid order by og.id asc';
     $row['goods'] = set_medias(pdo_fetchall($sql, array(':orderid' => $row['id'])), 'thumb');
     $row['goodscount'] = count($row['goods']);
     switch ($row['status']) {
         case "-1":
             $status = "已取消";
             break;
         case "0":
             $status = "待付款";
             break;
         case "1":
             $status = "待发货";
             break;
         case "2":
             $status = "待收货";
             break;
         case "3":
Example #14
0
                    if (empty($set['become_reg']) && (empty($member['realname']) || empty($member['mobile']))) {
                        $trigger = true;
                    }
                } else {
                    if (!empty($_GPC['mid'])) {
                        $_W['shopshare']['link'] = $this->createMobileUrl('shop', array('mid' => $_GPC['mid']));
                    }
                }
            }
        }
        include $this->template('shop/index_diy');
        exit;
    }
}
$set = set_medias(m('common')->getSysset('shop'), array('logo', 'img'));
if ($_W['isajax']) {
    if ($operation == 'index') {
        $advs = pdo_fetchall("select id,advname,link,thumb from " . tablename('ewei_shop_adv') . ' where uniacid=:uniacid and enabled=1 order by displayorder desc', array(':uniacid' => $uniacid));
        $advs = set_medias($advs, 'thumb');
        show_json(1, array('set' => $set, 'advs' => $advs));
    } else {
        if ($operation == 'goods') {
            $type = $_GPC['type'];
            $args = array('page' => $_GPC['page'], 'pagesize' => 6, 'isrecommand' => 1, 'order' => 'displayorder desc,createtime desc', 'by' => '');
            $goods = m('goods')->getList($args);
            show_json(1, array('goods' => $goods, 'pagesize' => $args['pagesize']));
        }
    }
}
$this->setHeader();
include $this->template('shop/index');
Example #15
0
            if ($operation == 'comment') {
                $goodsid = intval($_GPC['goodsid']);
                $pindex = max(1, intval($_GPC['page']));
                $psize = 5;
                $condition = ' and uniacid = :uniacid and goodsid=:goodsid and deleted=0';
                $params = array(':uniacid' => $_W['uniacid'], ':goodsid' => $goodsid);
                $sql = 'SELECT id,nickname,headimgurl,level,content,createtime, images,append_images,append_content,reply_images,reply_content,append_reply_images,append_reply_content ' . ' FROM ' . tablename('ewei_shop_order_comment') . ' where 1 ' . $condition . ' ORDER BY `id` DESC LIMIT ' . ($pindex - 1) * $psize . ',' . $psize;
                $list = pdo_fetchall($sql, $params);
                foreach ($list as &$row) {
                    $row['headimgurl'] = tomedia($row['headimgurl']);
                    $row['createtime'] = date('Y-m-d H:i', $row['createtime']);
                    $images = unserialize($row['images']);
                    $row['images'] = is_array($images) ? set_medias($images) : array();
                    $append_images = unserialize($row['append_images']);
                    $row['append_images'] = is_array($append_images) ? set_medias($append_images) : array();
                    $reply_images = unserialize($row['reply_images']);
                    $row['reply_images'] = is_array($reply_images) ? set_medias($reply_images) : array();
                    $append_reply_images = unserialize($row['append_reply_images']);
                    $row['append_reply_images'] = is_array($append_reply_images) ? set_medias($append_reply_images) : array();
                }
                unset($row);
                show_json(1, array('list' => $list, 'pagesize' => $psize));
            } else {
                if ($operation == 'recommand') {
                    $goods = m('goods')->getList(array('pagesize' => 4, 'isrecommand' => true, 'random' => true));
                    show_json(1, array('list' => $goods));
                }
            }
        }
    }
}
Example #16
0
 foreach ($list as &$row) {
     $ordercommission = 0;
     $orderpay = 0;
     foreach ($orderids as $o) {
         if ($o['orderid'] == $row['id']) {
             $row['level'] = $o['level'];
             break;
         }
     }
     $condition = "";
     $status = trim($_GPC['status']);
     if ($status != '') {
         $condition .= ' and status=' . intval($status);
     }
     $goods = pdo_fetchall("SELECT og.id,og.goodsid,g.thumb,og.price,og.total,g.title,og.optionname," . "og.commission1,og.commission2,og.commission3," . "og.status1,og.status2,og.status3," . "og.content1,og.content2,og.content3 from " . tablename('ewei_shop_order_goods') . " og" . " left join " . tablename('ewei_shop_goods') . " g on g.id=og.goodsid  " . " where og.orderid=:orderid and og.uniacid = :uniacid order by og.createtime  desc ", array(':uniacid' => $_W['uniacid'], ':orderid' => $row['id']));
     $goods = set_medias($goods, 'thumb');
     foreach ($goods as &$g) {
         if ($row['level'] == 1) {
             $commission = iunserializer($g['commission1']);
             $g['commission'] = isset($commission['level' . $agentLevel['id']]) ? $commission['level' . $agentLevel['id']] : $commission['default'];
             $totalcommission += $g['commission'];
             $ordercommission += $g['commission'];
             if ($g['status1'] >= 2) {
                 $totalpay += $g['commission'];
                 $orderpay += $g['commission'];
             }
         }
         if ($row['level'] == 2) {
             $commission = iunserializer($g['commission2']);
             $g['commission_pay'] = 0;
             $g['commission'] = isset($commission['level' . $agentLevel['id']]) ? $commission['level' . $agentLevel['id']] : $commission['default'];
Example #17
0
$operation = !empty($_GPC['op']) ? $_GPC['op'] : 'display';
$openid = m('user')->getOpenid();
$uniacid = $_W['uniacid'];
if ($_W['isajax']) {
    if ($operation == 'display') {
        $pindex = max(1, intval($_GPC['page']));
        $psize = 10;
        $condition = ' and f.uniacid = :uniacid and f.openid=:openid and f.deleted=0';
        $params = array(':uniacid' => $_W['uniacid'], ':openid' => $openid);
        $sql = 'SELECT COUNT(*) FROM ' . tablename('ewei_shop_member_favorite') . " f where 1 {$condition}";
        $total = pdo_fetchcolumn($sql, $params);
        $list = array();
        if (!empty($total)) {
            $sql = 'SELECT f.id,f.goodsid,g.title,g.thumb,g.marketprice,g.productprice FROM ' . tablename('ewei_shop_member_favorite') . ' f ' . ' left join ' . tablename('ewei_shop_goods') . ' g on f.goodsid = g.id ' . ' where 1 ' . $condition . ' ORDER BY `id` DESC LIMIT ' . ($pindex - 1) * $psize . ',' . $psize;
            $list = pdo_fetchall($sql, $params);
            $list = set_medias($list, 'thumb');
        }
        show_json(1, array('total' => $total, 'list' => $list, 'pagesize' => $psize));
    } else {
        if ($operation == 'set') {
            $id = intval($_GPC['id']);
            $goods = pdo_fetch('select id from ' . tablename('ewei_shop_goods') . ' where uniacid=:uniacid and id=:id limit 1', array(':uniacid' => $_W['uniacid'], ':id' => $id));
            if (empty($goods)) {
                show_json(0, '商品未找到');
            }
            $data = pdo_fetch('select id,deleted from ' . tablename('ewei_shop_member_favorite') . ' where uniacid=:uniacid and goodsid=:id and openid=:openid limit 1', array(':uniacid' => $_W['uniacid'], ':openid' => $openid, ':id' => $id));
            if (empty($data)) {
                $data = array('uniacid' => $_W['uniacid'], 'openid' => $openid, 'goodsid' => $id, 'createtime' => time());
                pdo_insert('ewei_shop_member_favorite', $data);
                show_json(1, array('isfavorite' => true));
            } else {
Example #18
0
 public function createShopImage($shop_set)
 {
     global $_W, $_GPC;
     $shop_set = set_medias($shop_set, 'signimg');
     $path = IA_ROOT . "/addons/ewei_shop/data/poster/" . $_W['uniacid'] . '/';
     if (!is_dir($path)) {
         load()->func('file');
         mkdirs($path);
     }
     $mid = intval($_GPC['mid']);
     $openid = m('user')->getOpenid();
     $me = m('member')->getInfo($openid);
     if ($me['isagent'] == 1 && $me['status'] == 1) {
         $userinfo = $me;
     } else {
         $mid = intval($_GPC['mid']);
         if (!empty($mid)) {
             $userinfo = m('member')->getInfo($mid);
         }
     }
     $md5 = md5(json_encode(array('openid' => $openid, 'signimg' => $shop_set['signimg'], 'version' => 4)));
     $file = $md5 . '.jpg';
     if (!is_file($path . $file)) {
         set_time_limit(0);
         @ini_set('memory_limit', '256M');
         $font = IA_ROOT . "/addons/ewei_shop/static/fonts/msyh.ttf";
         $target = imagecreatetruecolor(640, 1225);
         $bc = imagecolorallocate($target, 0, 3, 51);
         $cc = imagecolorallocate($target, 240, 102, 0);
         $wc = imagecolorallocate($target, 255, 255, 255);
         $yc = imagecolorallocate($target, 255, 255, 0);
         $bg = imagecreatefromjpeg(IA_ROOT . '/addons/ewei_shop/plugin/commission/images/poster.jpg');
         imagecopy($target, $bg, 0, 0, 0, 0, 640, 1225);
         imagedestroy($bg);
         $avatar = preg_replace('/\\/0$/i', '/96', $userinfo['avatar']);
         $head = $this->createImage($avatar);
         $w = imagesx($head);
         $h = imagesy($head);
         imagecopyresized($target, $head, 24, 32, 0, 0, 88, 88, $w, $h);
         imagedestroy($head);
         $thumb = $this->createImage($shop_set['signimg']);
         $w = imagesx($thumb);
         $h = imagesy($thumb);
         imagecopyresized($target, $thumb, 0, 160, 0, 0, 640, 640, $w, $h);
         imagedestroy($thumb);
         $qrcode_file = tomedia($this->createMyShopQrcode($userinfo['id']));
         $qrcode = $this->createImage($qrcode_file);
         $w = imagesx($qrcode);
         $h = imagesy($qrcode);
         imagecopyresized($target, $qrcode, 50, 835, 0, 0, 250, 250, $w, $h);
         imagedestroy($qrcode);
         $str1 = '我是';
         imagettftext($target, 20, 0, 150, 70, $bc, $font, $str1);
         imagettftext($target, 20, 0, 210, 70, $cc, $font, $userinfo['nickname']);
         $str2 = '我要为';
         imagettftext($target, 20, 0, 150, 105, $bc, $font, $str2);
         $str3 = $shop_set['name'];
         imagettftext($target, 20, 0, 240, 105, $cc, $font, $str3);
         $box = imagettfbbox(20, 0, $font, $str3);
         $width = $box[4] - $box[6];
         $str4 = '代言';
         imagettftext($target, 20, 0, 240 + $width + 10, 105, $bc, $font, $str4);
         imagejpeg($target, $path . $file);
         imagedestroy($target);
     }
     return $_W['siteroot'] . "addons/ewei_shop/data/poster/" . $_W['uniacid'] . "/" . $file;
 }