Пример #1
0
 public function getCartTotal()
 {
     $member = get_member_account(false);
     $openid = $member['openid'];
     $cartotal = mysqld_selectcolumn("select sum(total) from " . table('shop_cart') . " where session_id='" . $openid . "'");
     return empty($cartotal) ? 0 : $cartotal;
 }
Пример #2
0
    $condition = $condition . ' and openid in (select alifans.openid from ' . table('alipay_alifans') . ' alifans where alifans.nickname like :alipayname)';
    $conditiondata[':alipayname'] = '%' . $_GP['alipayname'] . '%';
}
$status = 1;
if (empty($_GP['showstatus']) || $_GP['showstatus'] == 1) {
    $status = 1;
}
if ($_GP['showstatus'] == -1) {
    $status = 0;
}
if (!empty($_GP['rank_level'])) {
    $rank_model = mysqld_select("SELECT * FROM " . table('rank_model') . "where rank_level=" . intval($_GP['rank_level']));
    if (!empty($rank_model['rank_level'])) {
        $condition = $condition . " and experience>=" . $rank_model['experience'];
        $rank_model2 = mysqld_select("SELECT * FROM " . table('rank_model') . "where rank_level>" . $rank_model['rank_level'] . ' order  by rank_level limit 1');
        if (!empty($rank_model2['rank_level'])) {
            if (intval($rank_model['experience']) < intval($rank_model2['experience'])) {
                $condition = $condition . " and experience<" . $rank_model2['experience'];
            }
        }
    }
}
$rank_model_list = mysqld_selectall("SELECT * FROM " . table('rank_model') . " order by rank_level");
$list = mysqld_selectall('SELECT * FROM ' . table('member') . " where 1=1 and `istemplate`=0  and `status`={$status} {$condition} " . " LIMIT " . ($pindex - 1) * $psize . ',' . $psize, $conditiondata);
$total = mysqld_selectcolumn('SELECT COUNT(*) FROM ' . table('member') . " where 1=1 and `istemplate`=0 {$condition} ", $conditiondata);
$pager = pagination($total, $pindex, $psize);
foreach ($list as $index => $item) {
    $list[$index]['weixin'] = mysqld_selectall("SELECT * FROM " . table('weixin_wxfans') . " WHERE openid = :openid", array(':openid' => $item['openid']));
    $list[$index]['alipay'] = mysqld_selectall("SELECT * FROM " . table('alipay_alifans') . " WHERE openid = :openid", array(':openid' => $item['openid']));
}
include page('list');
Пример #3
0
    }
    if ($status != '-99') {
        $condition .= " AND status = '" . intval($status) . "'";
    }
    if ($status == '3') {
        $condition .= " and ( status = 3 or status = -5 or status = -6)";
    }
    $dispatchs = mysqld_selectall("SELECT * FROM " . table('shop_dispatch'));
    $dispatchdata = array();
    if (is_array($dispatchs)) {
        foreach ($dispatchs as $disitem) {
            $dispatchdata[$disitem['id']] = $disitem;
        }
    }
    $list = mysqld_selectall("SELECT * FROM " . table('shop_order') . " WHERE 1=1 {$condition} ORDER BY  createtime DESC LIMIT " . ($pindex - 1) * $psize . ',' . $psize);
    $total = mysqld_selectcolumn('SELECT COUNT(*) FROM ' . table('shop_order') . " WHERE 1=1  {$condition}");
    $pager = pagination($total, $pindex, $psize);
    if (!empty($_GP['report'])) {
        foreach ($list as $id => $item) {
            $list[$id]['ordergoods'] = mysqld_selectall("SELECT (select category.name\tfrom" . table('shop_category') . " category where (0=goods.ccate and category.id=goods.pcate) or (0!=goods.ccate and category.id=goods.ccate) ) as categoryname,goods.thumb,ordersgoods.price,ordersgoods.total,goods.title,ordersgoods.optionname from " . table('shop_order_goods') . " ordersgoods left join " . table('shop_goods') . " goods on goods.id=ordersgoods.goodsid  where  ordersgoods.orderid=:oid order by ordersgoods.createtime  desc ", array(':oid' => $item['id']));
        }
        $report = 'orderreport';
        require_once 'report.php';
        exit;
    }
    include page('order_list');
}
if ($operation == 'detail') {
    $orderid = intval($_GP['id']);
    $order = mysqld_select("SELECT * FROM " . table('shop_order') . " WHERE id=:id", array(":id" => $orderid));
    $payments = mysqld_selectall("SELECT * FROM " . table('payment') . " WHERE enabled = 1");
Пример #4
0
         message('触发关键字' . $_GP['keywords'] . "已存在!");
     }
     if (!empty($_FILES['thumb']['tmp_name'])) {
         file_delete($_GP['thumb_old']);
         $upload = file_upload($_FILES['thumb']);
         if (is_error($upload)) {
             message($upload['message'], '', 'error');
         }
         $thumb = $upload['path'];
     }
     $data = array('title' => $_GP['title'], 'ruletype' => $_GP['ruletype'], 'keywords' => $_GP['keywords'], 'thumb' => $thumb, 'description' => $_GP['description'], 'url' => $_GP['url']);
     mysqld_insert('weixin_rule', $data);
     message('保存成功!', 'refresh', 'success');
 } else {
     if ($rule['keywords'] != $_GP['keywords']) {
         $count = mysqld_selectcolumn('SELECT count(id) FROM ' . table('weixin_rule') . " WHERE  keywords = :keywords", array(':keywords' => $_GP['keywords']));
         if ($count > 0) {
             message('触发关键字' . $_GP['keywords'] . "已存在!");
         }
     }
     if (!empty($_FILES['thumb']['tmp_name'])) {
         file_delete($_GP['thumb_old']);
         $upload = file_upload($_FILES['thumb']);
         if (is_error($upload)) {
             message($upload['message'], '', 'error');
         }
         $thumb = $upload['path'];
     }
     $data = array('title' => $_GP['title'], 'ruletype' => $_GP['ruletype'], 'keywords' => $_GP['keywords'], 'description' => $_GP['description'], 'url' => $_GP['url']);
     if (!empty($thumb)) {
         $data['thumb'] = $thumb;
Пример #5
0
<?php

$member = get_member_account(true, true);
$openid = $member['openid'];
$member = member_get($openid);
$paymentconfig = "";
if (strpos($_SERVER['HTTP_USER_AGENT'], 'MicroMessenger')) {
    $paymentconfig = " and code!='alipay'";
} else {
    if (is_mobile_request()) {
        $paymentconfig = " and code!='weixin'";
    }
}
$paymentlist = mysqld_selectall("select * from " . table("payment") . " where `enabled`=1  and `code`!='gold' and `online`=1 {$paymentconfig} ");
$paymentscount = mysqld_selectcolumn("select count(id) from " . table("payment") . " where `enabled`=1  and `code`!='gold' and `online`=1 {$paymentconfig} ");
if (empty($paymentscount)) {
    message("未找到可用的在线支付方式,暂时不支持余额充值。");
}
if (checksubmit("submit")) {
    if (empty($_GP['charge']) || round($_GP['charge'], 2) <= 0) {
        message("请输入要充值的金额");
    }
    $paytypecode = $_GP['paymentcode'];
    if (empty($paytypecode)) {
        message("请选择充值方式。");
    }
    $payment = mysqld_select("select * from " . table("payment") . " where `enabled`=1 and `code`=:code and `code`!='gold' and `online`=1", array('code' => $paytypecode));
    if (empty($payment['id'])) {
        message("未找到付款方式,付款失败");
    }
    $goodtitle = "余额充值" . $_GP['charge'] . "元";
Пример #6
0
    $condition .= " AND isnew = 1";
    $sorturl .= "&isnew=1";
}
if (!empty($_GP['ishot'])) {
    $condition .= " AND ishot = 1";
    $sorturl .= "&ishot=1";
}
if (!empty($_GP['isdiscount'])) {
    $condition .= " AND isdiscount = 1";
    $sorturl .= "&isdiscount=1";
}
if (!empty($_GP['istime'])) {
    $condition .= " AND istime = 1 ";
    $sorturl .= "&istime=1";
}
$children = array();
$category = mysqld_selectall("SELECT * FROM " . table('shop_category') . " WHERE deleted=0 and enabled=1 ORDER BY parentid ASC, displayorder DESC", array(), 'id');
foreach ($category as $index => $row) {
    if (!empty($row['parentid'])) {
        $children[$row['parentid']][$row['id']] = $row;
        unset($category[$index]);
    }
}
$list = mysqld_selectall("SELECT * FROM " . table('shop_goods') . " WHERE  deleted=0 AND status = '1' {$condition} ORDER BY {$sortfield}  ");
$total = mysqld_selectcolumn('SELECT COUNT(*) FROM ' . table('shop_goods') . " WHERE  deleted=0  AND status = '1' {$condition}");
$pager = pagination($total, $pindex, $psize, $url = '', $context = array('before' => 0, 'after' => 0, 'ajaxcallback' => ''));
$id = $profile['id'];
if ($profile['status'] == 0) {
    $profile['flag'] = 0;
}
include themePage('goodlist');
Пример #7
0
     exit;
 } else {
     $pindex = max(1, intval($_GP['page']));
     $psize = 20;
     $status = intval($_GP['status']);
     $where = "openid = '" . $openid . "'";
     if ($status == -5) {
         $where .= " and ( status=-2 or status=-3 or status=-4 )";
     }
     if ($status == 99) {
         // $where.=" and ( status=-5 or status=-6 or status=3 )";
     } else {
         $where .= " and status={$status}";
     }
     $list = mysqld_selectall("SELECT * FROM " . table('shop_order') . " WHERE {$where} ORDER BY id DESC LIMIT " . ($pindex - 1) * $psize . ',' . $psize, array(), 'id');
     $total = mysqld_selectcolumn('SELECT COUNT(*) FROM ' . table('shop_order') . " WHERE  openid = '" . $openid . "'");
     $pager = pagination($total, $pindex, $psize);
     if (!empty($list)) {
         foreach ($list as &$row) {
             $goods = mysqld_selectall("SELECT g.id, g.title, g.thumb, g.marketprice,o.total,o.optionid FROM " . table('shop_order_goods') . " o left join " . table('shop_goods') . " g on o.goodsid=g.id " . " WHERE o.orderid='{$row['id']}'");
             foreach ($goods as &$item) {
                 //属性
                 $option = mysqld_select("select title,marketprice,weight,stock from " . table("shop_goods_option") . " where id=:id limit 1", array(":id" => $item['optionid']));
                 if ($option) {
                     $item['title'] = "[" . $option['title'] . "]" . $item['title'];
                     $item['marketprice'] = $option['marketprice'];
                 }
             }
             unset($item);
             $row['goods'] = $goods;
             $row['total'] = $goodsid;
Пример #8
0
} elseif ($operation == 'default') {
    $id = intval($_GP['id']);
    mysqld_update('shop_address', array('isdefault' => 0), array('openid' => $openid));
    mysqld_update('shop_address', array('isdefault' => 1), array('id' => $id));
    message(1, '', 'ajax');
} elseif ($operation == 'detail') {
    $id = intval($_GP['id']);
    $row = mysqld_select("SELECT id, realname, mobile, province, city, area, address FROM " . table('shop_address') . " WHERE id = :id", array(':id' => $id));
    message($row, '', 'ajax');
} elseif ($operation == 'remove') {
    $id = intval($_GP['id']);
    if (!empty($id)) {
        $address = mysqld_select("select isdefault from " . table('shop_address') . " where id='{$id}'  and openid='" . $openid . "' limit 1 ");
        if (!empty($address)) {
            //修改成不直接删除,而设置deleted=1
            mysqld_update("shop_address", array("deleted" => 1, "isdefault" => 0), array('id' => $id, 'openid' => $openid));
            if ($address['isdefault'] == 1) {
                //如果删除的是默认地址,则设置是新的为默认地址
                $maxid = mysqld_selectcolumn("select max(id) as maxid from " . table('shop_address') . " where  openid='" . $openid . "' limit 1 ");
                if (!empty($maxid)) {
                    mysqld_update('shop_address', array('isdefault' => 1), array('id' => $maxid, 'openid' => $openid));
                    die(json_encode(array("result" => 1, "maxid" => $maxid)));
                }
            }
        }
    }
    die(json_encode(array("result" => 1, "maxid" => 0)));
} else {
    $address = mysqld_selectall("SELECT * FROM " . table('shop_address') . " WHERE deleted=0 and openid = :openid", array(':openid' => $openid));
    include themePage('address');
}
Пример #9
0
        }
        $fee = round($_GP['charge'], 2);
        if ($fee > $member['gold']) {
            message('账户余额不足,最多能提取' . $member['gold'] . '元');
        }
        $ordersn = 'rg' . date('Ymd') . random(6, 1);
        $gold_order = mysqld_select("SELECT * FROM " . table('gold_teller') . " WHERE ordersn = '{$ordersn}'");
        if (!empty($gold_order['ordersn'])) {
            $ordersn = 'rg' . date('Ymd') . random(6, 1);
        }
        member_gold($openid, $fee, 'usegold', '余额提取' . $fee . '元');
        mysqld_insert('gold_teller', array('openid' => $openid, 'fee' => $fee, 'status' => 0, 'ordersn' => $ordersn, 'createtime' => time()));
        message('余额提取申请成功!', 'refresh', 'success');
        exit;
    }
    $applygold = mysqld_selectcolumn("select sum(fee) from " . table("gold_teller") . " where status=0 and openid=" . $openid);
    if (empty($applygold)) {
        $applygold = '0';
    }
    include themePage('outchargegold');
    exit;
}
if ($op == 'history') {
    $pindex = max(1, intval($_GP['page']));
    $psize = 20;
    $list = mysqld_selectall("select * from " . table("gold_teller") . " where openid=:openid order by createtime desc LIMIT " . ($pindex - 1) * $psize . ',' . $psize, array(":openid" => $openid));
    $total = mysqld_selectcolumn('SELECT COUNT(*) FROM ' . table('gold_teller') . " where  openid=:openid ", array(":openid" => $openid));
    $pager = pagination($total, $pindex, $psize);
    include themePage('outchargegold_history');
    exit;
}
Пример #10
0
<?php

$settings = globaSetting();
$advs = mysqld_selectall("select * from " . table('shop_adv') . " where enabled=1  order by displayorder desc");
$allgoods = mysqld_selectcolumn("SELECT count(*) FROM " . table('shop_goods') . " WHERE deleted =0");
$children_category = array();
$category = mysqld_selectall("SELECT *,'' as list FROM " . table('shop_category') . " WHERE isrecommand=1 and enabled=1 and deleted=0 ORDER BY parentid ASC, displayorder DESC", array(), 'id');
foreach ($category as $index => $row) {
    if (!empty($row['parentid'])) {
        $children_category[$row['parentid']][$row['id']] = $row;
        unset($category[$index]);
    }
}
$first_good_list = array();
$recommandcategory = array();
foreach ($category as &$c) {
    if ($c['isrecommand'] == 1) {
        $c['list'] = mysqld_selectall("SELECT * FROM " . table('shop_goods') . " WHERE  isrecommand=1 and deleted=0 AND status = 1  and pcate='{$c['id']}'  ORDER BY displayorder DESC, sales");
        foreach ($c['list'] as &$c1goods) {
            if ($c1goods['isrecommand'] == 1 && $c1goods['isfirst'] == 1) {
                $first_good_list[] = $c1goods;
            }
        }
        $recommandcategory[] = $c;
    }
    if (!empty($children_category[$c['id']])) {
        foreach ($children_category[$c['id']] as &$child) {
            if ($child['isrecommand'] == 1) {
                $child['list'] = mysqld_selectall("SELECT * FROM " . table('shop_goods') . " WHERE  isrecommand=1 and deleted=0 AND status = 1  and pcate='{$c['id']}' and ccate='{$child['id']}'  ORDER BY displayorder DESC, sales DESC ");
                foreach ($child['list'] as &$c2goods) {
                    if ($c2goods['isrecommand'] == 1 && $c2goods['isfirst'] == 1) {
Пример #11
0
    $condition .= " and t1.realnamestr='" . $realname . "'";
}
if (!empty($_GP['addressname'])) {
    $addressname = $_GP['addressname'];
    $condition .= " and t1.tdrealname='" . $addressname . "'";
}
if (!empty($_GP['ordersn'])) {
    $ordersn = $_GP['ordersn'];
    $condition .= " and t1.ordersn='" . $ordersn . "'";
}
if ($isstatus == 1) {
    $conditionOrderStatus = "and orders.status>=1";
} else {
    $conditionOrderStatus = "and orders.status=3";
}
if (!empty($_GP['orderstatisticsEXP01'])) {
    $psize = 9999;
    $pindex = 1;
}
$list = mysqld_selectall("select t1.* from (SELECT orders.status,orders.id,orders.createtime,orders.ordersn,orders.price,orders.dispatchprice,orders.paytype,(orders.address_realname ) tdrealname,(concat(orders.address_province,orders.address_city,orders.address_area,orders.address_address) ) tdaddress,(orders.address_mobile ) tdmobile from " . table('shop_order') . " orders where 1=1 {$conditionOrderStatus} order by orders.createtime  desc) t1 where 1=1   {$condition}   LIMIT " . ($pindex - 1) * $psize . ',' . $psize);
foreach ($list as $id => $displayorder) {
    $list[$id]['ordergoods'] = mysqld_selectall("SELECT (select category.name\tfrom" . table('shop_category') . " category where (0=goods.ccate and category.id=goods.pcate) or (0!=goods.ccate and category.id=goods.ccate) ) as categoryname,goods.thumb,ordersgoods.price,ordersgoods.total,goods.title,ordersgoods.optionname from " . table('shop_order_goods') . " ordersgoods left join " . table('shop_goods') . " goods on goods.id=ordersgoods.goodsid  where  ordersgoods.orderid=:oid order by ordersgoods.createtime  desc ", array(':oid' => $list[$id]['id']));
}
$total = mysqld_selectcolumn("select count(t1.id) from (SELECT orders.* from " . table('shop_order') . " orders where 1=1 {$conditionOrderStatus} order by orders.createtime  desc) t1 where 1=1  {$condition}  ");
$pager = pagination($total, $pindex, $psize);
if (!empty($_GP['orderstatisticsEXP01'])) {
    $report = "orderstatistics";
    require_once 'report.php';
    exit;
}
include addons_page('orderstatistics');
Пример #12
0
 public function do_getaward()
 {
     $xc_zjp = mysqld_select("SELECT * FROM " . table('xc_zjp_reply'));
     $member = get_member_account(true, intval($xc_zjp['needreg']) == 1);
     $openid = $member['openid'];
     if (empty($openid)) {
         message('非法访问,请重新发送消息进入抽奖页面!');
     }
     $member = member_get($openid);
     if (empty($xc_zjp)) {
         message('非法访问,请重新发送消息进入抽奖页面!');
     }
     $result = array('status' => -1, 'message' => '');
     $total = mysqld_selectcolumn("SELECT COUNT(*) FROM " . table('xc_zjp_winner') . " WHERE  open_id = '{$openid}' and TO_DAYS(NOW())-TO_DAYS(FROM_UNIXTIME(createtime))<= " . $xc_zjp["periodlottery"]);
     $myuser = mysqld_select("SELECT * FROM " . table('xc_zjp_user') . " WHERE  open_id = '{$openid}' ");
     $friendcount = 0;
     $arr_times = $this->get_today_times($total, $xc_zjp['maxlottery'], $friendcount);
     $result['useCount'] = false;
     $useCredit = false;
     if ($arr_times['today_has'] <= 0) {
         if (!empty($xc_zjp['basenum']) && $xc_zjp['basenum'] < $member['credit']) {
             $useCredit = true;
         }
     }
     if ($arr_times['today_has'] <= 0) {
         if (empty($xc_zjp['basenum']) || !empty($xc_zjp['basenum']) && $xc_zjp['basenum'] > $member['credit']) {
             $result['nochance'] = $arr_times['today_has'];
             $result['message'] = '抽奖机会已用完!';
             $vars = array();
             $vars['message'] = $result;
             $vars['redirect'] = refresh();
             $vars['type'] = 'ajax';
             exit(json_encode($vars));
         }
     }
     $result['surplusCount'] = $arr_times['today_has'] - 1 < 0 ? -1 : $arr_times['today_has'] - 1;
     if (!empty($xc_zjp['basenum'])) {
         $result['useCredit1'] = $xc_zjp['basenum'];
         $result['surplusCredit1'] = $member['credit'] - $xc_zjp['basenum'] < 0 ? 0 : $member['credit'] - $xc_zjp['basenum'];
     } else {
         $result['useCredit1'] = 0;
         $result['surplusCredit1'] = 0;
     }
     $result['useCount'] = true;
     $gifts = mysqld_selectall("SELECT * FROM " . table('xc_zjp_award') . " WHERE  total>0 ORDER BY probalilty ASC");
     //计算每个礼物的概率
     $probability = 0;
     $rate = 1;
     $award = array();
     foreach ($gifts as $name => $gift) {
         if (empty($gift['probalilty'])) {
             continue;
         }
         if ($gift['probalilty'] < 1) {
             $temp = explode('.', $gift['probalilty']);
             $temp = pow(10, strlen($temp[1]));
             $rate = $temp < $rate ? $rate : $temp;
         }
         $probability = $probability + $gift['probalilty'] * $rate;
         $award[] = array('id' => $gift['id'], 'probalilty' => $probability);
     }
     $all = 100 * $rate;
     if ($probability < $all) {
         $award[] = array('title' => '', 'probalilty' => $all);
     }
     mt_srand((double) microtime() * 1000000);
     $rand = mt_rand(1, $all);
     foreach ($award as $key => $gift) {
         if (isset($award[$key - 1])) {
             if ($rand > $award[$key - 1]['probalilty'] && $rand <= $gift['probalilty']) {
                 $awardid = $gift['id'];
                 break;
             }
         } else {
             if ($rand > 0 && $rand <= $gift['probalilty']) {
                 $awardid = $gift['id'];
                 break;
             }
         }
     }
     $title = '';
     $result['hasPrize'] = false;
     $result['message'] = '很遗憾,您没能中奖!';
     $data = array('open_id' => $openid, 'status' => 0, 'createtime' => TIMESTAMP);
     $credit = array('award' => (empty($awardid) ? '未' : '') . '中奖', 'open_id' => $openid, 'status' => 3, 'description' => empty($awardid) ? $xc_zjp['misscredit'] : $xc_zjp['hitcredit'], 'createtime' => TIMESTAMP);
     if (!empty($awardid)) {
         $gift = mysqld_select("SELECT * FROM " . table('xc_zjp_award') . " WHERE id = '{$awardid}'");
         if ($gift['total'] > 0) {
             $data['award'] = $gift['title'];
             $result['gift'] = $gift['title'];
             $result['giftimg'] = $gift['description'];
             $result['hasPrize'] = true;
             mysqld_query("UPDATE " . table('xc_zjp_award') . " SET total = total - 1 WHERE  id = '{$awardid}'");
             $data['description'] = '';
             $result['message'] = '恭喜您,得到“' . $data['award'] . '”!' . $desss;
             $result['status'] = 0;
         } else {
             $credit['description'] = $xc_zjp['misscredit'];
         }
         $data['gifturl'] = $gift['description'];
         $data['description'] = $gift['title'];
     }
     if ($useCredit) {
         member_credit($openid, intval($xc_zjp['basenum']), 'usecredit', '抓奖品消费积分');
     }
     if (empty($_SESSION['cachetime']) || $_SESSION['cachetime'] < time()) {
         $_SESSION['cachetime'] = time() + 3;
         mysqld_insert('xc_zjp_winner', $data);
     }
     $result['myaward'] = mysqld_selectall("SELECT * FROM " . table('xc_zjp_winner') . " WHERE open_id = '{$openid}'   AND award <> '' ORDER BY createtime DESC");
     $mycredit = mysqld_selectcolumn("SELECT SUM(description) FROM " . table('xc_zjp_winner') . " WHERE open_id = '{$openid}'   AND award <> '' ");
     $result['credit'] = $mycredit;
     $result['credit'] = !empty($result['credit']) ? $result['credit'] : '0';
     $vars = array();
     $vars['message'] = $result;
     $vars['redirect'] = refresh();
     $vars['type'] = 'ajax';
     exit(json_encode($vars));
 }
Пример #13
0
<?php

$operation = !empty($_GP['op']) ? $_GP['op'] : 'display';
$list = mysqld_selectall("SELECT * FROM " . table('xc_zjp_winner') . " where award <> '' ORDER BY createtime DESC");
foreach ($list as $id => $item) {
    $list[$id]['mobile'] = mysqld_selectcolumn("select mobile\tfrom" . table('member') . "  where istemplate=0 and openid=:openid ", array(':openid' => $item['open_id']));
}
if ($operation == 'post') {
    $id = intval($_GP['id']);
    mysqld_update('xc_zjp_winner', array('status' => 2), array('id' => $id));
    message('兑现成功!', web_url('awardlist'), 'success');
}
if ($operation == 'delete') {
    $id = intval($_GP['id']);
    mysqld_delete('xc_zjp_winner', array('id' => $id));
    message('删除成功!', web_url('awardlist'), 'success');
}
include addons_page('awardlist');
Пример #14
0
<?php

$operation = !empty($_GP['op']) ? $_GP['op'] : 'display';
if ($operation == 'display') {
    $pindex = max(1, intval($_GP['page']));
    $psize = 20;
    $condition = '';
    $id = intval($_GP['id']);
    $list = mysqld_selectall("SELECT comment.*,member.realname,member.mobile,shop_goods.title FROM " . table('shop_goods_comment') . " comment  left join " . table('member') . " member on comment.openid=member.openid   left join " . table('shop_goods') . " shop_goods on shop_goods.id=comment.goodsid  ORDER BY comment.createtime DESC LIMIT " . ($pindex - 1) * $psize . ',' . $psize);
    $total = mysqld_selectcolumn('SELECT COUNT(*) FROM ' . table('shop_goods_comment'));
    $pager = pagination($total, $pindex, $psize);
    include page('goods_comment');
} elseif ($operation == 'delete') {
    $id = intval($_GP['id']);
    $row = mysqld_select("SELECT * FROM " . table('shop_goods_comment') . " WHERE id = :id", array(':id' => $id));
    if (empty($row)) {
        message('抱歉,评论不存在或是已经被删除!');
    }
    //修改成不直接删除,而设置deleted=1
    mysqld_delete("shop_goods_comment", array('id' => $id));
    message('删除成功!', 'refresh', 'success');
}
Пример #15
0
<?php

$requestcount = mysqld_selectcolumn("select count(id) FROM " . table('addon7_request') . " where award_id=:id", array(":id" => intval($_GP['id'])));
if (empty($requestcount)) {
    mysqld_delete('addon7_award', array("id" => intval($_GP['id'])));
} else {
    mysqld_update('addon7_award', array("deleted" => 1), array("id" => intval($_GP['id'])));
}
message('删除成功!', 'refresh', 'success');
Пример #16
0
// +----------------------------------------------------------------------
// | WE CAN DO IT JUST FREE
// +----------------------------------------------------------------------
// | Copyright (c) 2015 http://www.baijiacms.com All rights reserved.
// +----------------------------------------------------------------------
// | Author: °Ù¼ÒÍþÐÅ <QQ:2752555327> <http://www.baijiacms.com>
// +----------------------------------------------------------------------
$condition = "";
$pindex = max(1, intval($_GP['page']));
$psize = 20;
if (!empty($_GP['start_time']) && !empty($_GP['end_time'])) {
    $start_time = strtotime($_GP['start_time'] . " 00:00:01");
    $end_time = strtotime($_GP['end_time'] . " 23:59:59");
} else {
    $start_time = strtotime(date('Y-m-01 00:00:01', time()));
    $end_time = strtotime(date('Y-m-t 23:59:59', time()));
}
$condition = " and orders.createtime>=" . $start_time . " and orders.createtime<=" . $end_time;
if (!empty($_GP['saledetailsEXP01'])) {
    $psize = 9999;
    $pindex = 1;
}
$list = mysqld_selectall("SELECT ordergoods.price,ordergoods.total,(select title from " . table('shop_goods') . " goods where ordergoods.goodsid=goods.id) titles,orders.createtime,orders.ordersn from  " . table('shop_order_goods') . " ordergoods left join " . table('shop_order') . " orders  on orders.id=ordergoods.orderid where 1=1 {$condition} order by orders.createtime  desc  LIMIT " . ($pindex - 1) * $psize . ',' . $psize);
$total = mysqld_selectcolumn("SELECT count(ordergoods.id) from  " . table('shop_order_goods') . " ordergoods left join " . table('shop_order') . " orders  on orders.id=ordergoods.orderid where 1=1 {$condition} order by orders.createtime desc");
$pager = pagination($total, $pindex, $psize);
if (!empty($_GP['saledetailsEXP01'])) {
    $report = "saledetails";
    require_once 'report.php';
    exit;
}
include addons_page('saledetails');
Пример #17
0
 $dispatchs = mysqld_selectall("SELECT * FROM " . table('shop_dispatch'));
 $dispatchdata = array();
 if (is_array($dispatchs)) {
     foreach ($dispatchs as $disitem) {
         $dispatchdata[$disitem['id']] = $disitem;
     }
 }
 $selectCondition = "LIMIT " . ($pindex - 1) * $psize . ',' . $psize;
 if (!empty($_GP['report'])) {
     $selectCondition = "";
 }
 $list = mysqld_selectall("SELECT * FROM " . table('shop_order') . " WHERE 1=1 {$condition} ORDER BY  createtime DESC " . $selectCondition);
 $total = mysqld_selectcolumn('SELECT COUNT(*) FROM ' . table('shop_order') . " WHERE 1=1  {$condition}");
 $pager = pagination($total, $pindex, $psize);
 foreach ($list as $id => $item) {
     $list[$id]['isguest'] = mysqld_selectcolumn("SELECT istemplate from " . table('member') . " where  openid=:openid ", array(':openid' => $item['openid']));
 }
 if (!empty($_GP['report'])) {
     foreach ($list as $id => $item) {
         $list[$id]['ordergoods'] = mysqld_selectall("SELECT (select category.name\tfrom" . table('shop_category') . " category where (0=goods.ccate and category.id=goods.pcate) or (0!=goods.ccate and category.id=goods.ccate) ) as categoryname,goods.thumb,ordersgoods.price,ordersgoods.total,goods.title,ordersgoods.optionname from " . table('shop_order_goods') . " ordersgoods left join " . table('shop_goods') . " goods on goods.id=ordersgoods.goodsid  where  ordersgoods.orderid=:oid order by ordersgoods.createtime  desc ", array(':oid' => $item['id']));
     }
     $report = 'orderreport';
     require_once 'report.php';
     exit;
 }
 $payments = mysqld_selectall("SELECT * FROM " . table('payment') . " WHERE enabled = 1");
 $hasaddon11 = false;
 $addon11 = mysqld_select("SELECT * FROM " . table('modules') . " WHERE name = 'addon11' limit 1");
 if (!empty($addon11['name'])) {
     if (is_file(ADDONS_ROOT . 'addon11/key.php')) {
         $hasaddon11 = true;
<?php

// +----------------------------------------------------------------------
// | WE CAN DO IT JUST FREE
// +----------------------------------------------------------------------
// | Copyright (c) 2015 http://www.baijiacms.com All rights reserved.
// +----------------------------------------------------------------------
// | Author: °Ù¼Òcms <QQ:1987884799> <http://www.baijiacms.com>
// +----------------------------------------------------------------------
$goodslist = mysqld_selectall("SELECT goods.id,goods.sales from  " . table('shop_goods') . " goods  ");
foreach ($goodslist as $gooditem) {
    $goodtotal = mysqld_selectcolumn("SELECT sum(goodorder.total) FROM " . table('shop_order_goods') . " goodorder left join " . table('shop_order') . " orders on orders.id=goodorder.orderid WHERE goodorder.goodsid = :id and orders.status>=1", array(':id' => $gooditem['id']));
    if ($goodtotal > 0 && $goodslist['sales'] != $goodtotal && !empty($goodtotal)) {
        mysqld_update('shop_goods', array('sales' => $goodtotal), array('id' => $gooditem['id']));
    }
}
$list = mysqld_selectall("SELECT goods.*,0 as cpersent,goods.sales salescount from " . table('shop_goods') . " goods order by salescount desc ");
foreach ($list as $id => $displayorder) {
    $list[$id]['cpersent'] = round($list[$id]['salescount'] / ($list[$id]['viewcount'] == 0 ? 1 : $list[$id]['viewcount']) * 100, 2);
    if (empty($list[$id]['viewcount'])) {
        $list[$id]['viewcount'] = 0;
    }
    if (empty($list[$id]['salescount'])) {
        $list[$id]['salescount'] = 0;
    }
    if (empty($list[$id]['cpersent'])) {
        $list[$id]['cpersent'] = 0;
    }
}
include addons_page('productsalestatistics');
Пример #19
0
if ($goods['totalcnf'] != 2 && empty($goods['total'])) {
    message('抱歉,商品库存不足!');
}
if ($goods['istime'] == 1) {
    if (time() < $goods['timestart']) {
        message('抱歉,还未到购买时间, 暂时无法购物哦~', refresh(), "error");
    }
    if (time() > $goods['timeend']) {
        message('抱歉,商品限购时间已到,不能购买了哦~', refresh(), "error");
    }
}
mysqld_update('shop_goods', array('viewcount' => $goods['viewcount'] + 1), array('id' => $goodsid));
//浏览量
$piclist = array(array("attachment" => $goods['thumb']));
$goods_piclist = mysqld_selectall("SELECT * FROM " . table('shop_goods_piclist') . " WHERE goodid = :goodid", array(':goodid' => $goodsid));
$goods_piclist_count = mysqld_selectcolumn("SELECT count(*) FROM " . table('shop_goods_piclist') . " WHERE goodid = :goodid", array(':goodid' => $goodsid));
if ($goods_piclist_count > 0) {
    $piclist = array();
    foreach ($goods_piclist as &$item) {
        $piclist[] = array("attachment" => $item['picurl']);
    }
}
$marketprice = $goods['marketprice'];
$productprice = $goods['productprice'];
$stock = $goods['total'];
//规格及规格项
$allspecs = mysqld_selectall("select * from " . table('shop_goods_spec') . " where goodsid=:id order by displayorder asc", array(':id' => $goodsid));
foreach ($allspecs as &$s) {
    $s['items'] = mysqld_selectall("select * from " . table('shop_goods_spec_item') . " where  `show`=1 and specid=:specid order by displayorder asc", array(":specid" => $s['id']));
}
unset($s);
Пример #20
0
        $datas[$index]['persent'] = round($datas[$index]['count'] / $allcount, 2) * 100;
    } else {
        $datas[$index]['persent'] = 0;
    }
}
$dayallcount = 0;
$daytopcount = 0;
$daydatas = array(array());
$dayindex = 0;
$lastday = date('t', strtotime($dropdayForYaer . "-" . $selectmonthSale . "-1"));
for ($day = 1; $day <= $lastday; $day++) {
    if ($radiodayForSaleType == '0') {
        $dayordercount = mysqld_selectcolumn("SELECT count(id) FROM " . table('shop_order') . " WHERE createtime >=" . strtotime($dropdayForYaer . "-" . $selectmonthSale . "-" . $day . " 00:00:01") . " and createtime <=" . strtotime($dropdayForYaer . "-" . $selectmonthSale . "-" . $day . " 23:59:59"));
    }
    if ($radiodayForSaleType == '1') {
        $dayordercount = mysqld_selectcolumn("SELECT sum(cast(price as decimal(8,2))) FROM " . table('shop_order') . " WHERE createtime >=" . strtotime($dropdayForYaer . "-" . $selectmonthSale . "-" . $day . " 00:00:01") . " and createtime <=" . strtotime($dropdayForYaer . "-" . $selectmonthSale . "-" . $day . " 23:59:59"));
    }
    if (empty($dayordercount)) {
        $dayordercount = 0;
    }
    $daydatas[$dayindex]['day'] = $day;
    $daydatas[$dayindex]['count'] = $dayordercount;
    $dayindex = $dayindex + 1;
    $dayallcount = $dayallcount + $dayordercount;
    if ($daytopcount < $dayordercount) {
        $daytopcount = $dayordercount;
    }
}
foreach ($daydatas as $index => $row) {
    if ($dayallcount > 0) {
        $daydatas[$index]['persent'] = round($daydatas[$index]['count'] / $dayallcount, 2) * 100;
Пример #21
0
 } else {
     $pindex = max(1, intval($_GP['page']));
     $psize = 20;
     $status = intval($_GP['status']);
     $where = "openid = '" . $openid . "'";
     if ($status == -5) {
         $where .= " and ( status=-2 or status=-3 or status=-4 )";
     } else {
         if ($status == 99) {
             // $where.=" and ( status=-5 or status=-6 or status=3 )";
         } else {
             $where .= " and status={$status}";
         }
     }
     $list = mysqld_selectall("SELECT * FROM " . table('shop_order') . " WHERE {$where} ORDER BY id DESC LIMIT " . ($pindex - 1) * $psize . ',' . $psize, array(), 'id');
     $total = mysqld_selectcolumn('SELECT COUNT(*) FROM ' . table('shop_order') . " WHERE  {$where} ");
     $pager = pagination($total, $pindex, $psize);
     if (!empty($list)) {
         foreach ($list as &$row) {
             $goods = mysqld_selectall("SELECT g.id, g.title, g.thumb, g.marketprice,o.total,o.optionid FROM " . table('shop_order_goods') . " o left join " . table('shop_goods') . " g on o.goodsid=g.id " . " WHERE o.orderid='{$row['id']}'");
             foreach ($goods as &$item) {
                 //属性
                 $option = mysqld_select("select title,marketprice,weight,stock from " . table("shop_goods_option") . " where id=:id limit 1", array(":id" => $item['optionid']));
                 if ($option) {
                     $item['title'] = "[" . $option['title'] . "]" . $item['title'];
                     $item['marketprice'] = $option['marketprice'];
                 }
             }
             unset($item);
             $row['goods'] = $goods;
             $row['total'] = $goodsid;
Пример #22
0
<?php

$operation = !empty($_GP['op']) ? $_GP['op'] : 'display';
if ($operation == 'display') {
    $status = 1;
    $condition .= " AND status = '" . intval($status) . "'";
    $list = mysqld_selectall("SELECT * FROM " . table('shop_order') . " WHERE 1=1 {$condition} ");
    $total = mysqld_selectcolumn("SELECT count(*) FROM " . table('shop_order') . " WHERE 1=1 {$condition} ");
    $dispatchs = mysqld_selectall("SELECT * FROM " . table('shop_dispatch'));
    $dispatchdata = array();
    if (is_array($dispatchs)) {
        foreach ($dispatchs as $disitem) {
            $dispatchdata[$disitem['id']] = $disitem;
        }
    }
    if (checksubmit('sendbatexpress')) {
        $index = 0;
        if (!empty($_GP['check'])) {
            foreach ($_GP['check'] as $k) {
                $item = mysqld_select("SELECT status,ordersn FROM " . table('shop_order') . " WHERE id = :id", array(':id' => $k));
                $isexpress = $_GP['express' . $k];
                if ($isexpress != '-1' && empty($_GP['expressno' . $k])) {
                    message('订单' . $item['ordersn'] . '没有快递单号,请填写完整!');
                }
                if ($item['status'] != 1) {
                    message('订单' . $item['ordersn'] . '状态不是待发货状态,请重新点击”批量发货“后进行操作。');
                }
            }
            foreach ($_GP['check'] as $k) {
                $item = mysqld_select("SELECT * FROM " . table('shop_order') . " WHERE id = :id", array(':id' => $k));
                $express = $_GP['express' . $k];
Пример #23
0
<?php

$member = mysqld_select('SELECT * FROM ' . table('member') . ' where openid=:openid', array(':openid' => $_GP['openid']));
$weixininfo = mysqld_select('SELECT * FROM ' . table('weixin_wxfans') . ' where openid=:openid', array(':openid' => $_GP['openid']));
$bonuscount = mysqld_selectcolumn("select count(bonus_user.bonus_id) from " . table("bonus_user") . " bonus_user left join  " . table("bonus_type") . " bonus_type on bonus_type.type_id=bonus_user.bonus_type_id where bonus_user.deleted=0  and `openid`=:openid order by isuse,bonus_type.send_type ", array(':openid' => $_GP['openid']));
if (checksubmit('submit')) {
    if (!empty($member['openid'])) {
    }
    if ($member['mobile'] != $_GP['mobile']) {
        $checkmember = mysqld_select('SELECT * FROM ' . table('member') . ' where mobile=:mobile', array(':mobile' => $_GP['mobile']));
        if (!empty($checkmember['openid'])) {
            message($_GP['mobile'] . "已被注册。");
        }
    }
    $datas = array('realname' => $_GP['realname'], 'mobile' => $_GP['mobile'], 'email' => $_GP['email']);
    if (!empty($_GP['password'])) {
        if ($_GP['password'] == $_GP['repassword']) {
            $datas['pwd'] = md5($_GP['password']);
        } else {
            message("两次密码不相同");
        }
    }
    mysqld_update('member', $datas, array('openid' => $_GP['openid']));
    message('操作成功!', 'refresh', 'success');
}
include page('detail');
Пример #24
0
<?php

// +----------------------------------------------------------------------
// | WE CAN DO IT JUST FREE
// +----------------------------------------------------------------------
// | Copyright (c) 2015 http://www.baijiacms.com All rights reserved.
// +----------------------------------------------------------------------
// | Author: 百家威信 <QQ:2752555327> <http://www.baijiacms.com>
// +----------------------------------------------------------------------
//订单总金额
$allorderprice = mysqld_selectcolumn("SELECT sum(cast(price as decimal(8,2))) FROM " . table('shop_order') . " WHERE status=3  ");
//总订单数
$allordercount = mysqld_selectcolumn("SELECT count(id) FROM " . table('shop_order') . " WHERE status=3  ");
//总会员数
$allmembercount = mysqld_selectcolumn("SELECT count(*) FROM " . table('member') . " where istemplate=0");
//总访问次数
$allorderviewcount = mysqld_selectcolumn("SELECT sum(cast(viewcount as decimal(8,0))) FROM " . table('shop_goods'));
//有过订单的会员
$haveordermembercount = mysqld_selectcolumn("select count(os.openid) from (SELECT orders.openid FROM " . table('shop_order') . " orders  group by orders.openid) as os");
if (empty($allorderprice)) {
    $allorderprice = 0;
}
include addons_page('saletargets');
Пример #25
0
if (empty($monthorderprice_re)) {
    $monthorderprice_re = "0.00";
} else {
    $monthorderprice_re = round($monthorderprice_re, 2);
}
if (empty($yearorderprice_re)) {
    $yearorderprice_re = "0.00";
} else {
    $yearorderprice_re = round($yearorderprice_re, 2);
}
$chartdata1 = array();
$index = 0;
for ($dateindex = 1; $dateindex <= 7; $dateindex++) {
    $time = $nowyear . "-" . $nowmonth . "-" . $dateindex;
    $datastr = date("Y-m-d", mktime(0, 0, 0, date("m"), date("d") - date("w") + $dateindex, date("Y")));
    $start_time = date("Y-m-d 00:00:01", mktime(0, 0, 0, date("m"), date("d") - date("w") + $dateindex, date("Y")));
    $end_time = date("Y-m-d 23:59:59", mktime(23, 59, 59, date("m"), date("d") - date("w") + $dateindex, date("Y")));
    $chart1data = mysqld_selectcolumn("SELECT sum(price) FROM " . table('shop_order') . " WHERE status>=1 and createtime >=" . strtotime($start_time) . " and createtime <=" . strtotime($end_time));
    if (empty($chart1data)) {
        $chart1data = "0.00";
    } else {
        $chart1data = round($chart1data, 2);
    }
    $tchartdata = array();
    $tchartdata['counts'] = $chart1data;
    $tchartdata['dates'] = $datastr;
    $tchartdata['index'] = $index;
    $chartdata1[] = $tchartdata;
    $index = $index + 1;
}
include page('center');
Пример #26
0
function refreshSetting($arrays)
{
    if (is_array($arrays)) {
        foreach ($arrays as $cid => $cate) {
            $config_data = mysqld_selectcolumn('SELECT `name` FROM ' . table('config') . " where `name`=:name", array(":name" => $cid));
            if (empty($config_data)) {
                mysqld_delete('config', array('name' => $cid));
                $data = array('name' => $cid, 'value' => $cate);
                mysqld_insert('config', $data);
            } else {
                mysqld_update('config', array('value' => $cate), array('name' => $cid));
            }
        }
        mysqld_update('config', array('value' => ''), array('name' => 'system_config_cache'));
    }
}
Пример #27
0
<?php

$operation = !empty($_GP['op']) ? $_GP['op'] : 'display';
if ($operation == 'delete') {
    if (checksubmit('submit')) {
        foreach ($_GP['check'] as $k) {
            mysqld_update('bonus_user', array('deleted' => 1), array('bonus_id' => intval($k)));
        }
        message("批量删除成功!", "refresh", "success");
    }
    mysqld_update('bonus_user', array('deleted' => 1), array('bonus_id' => intval($_GP['id'])));
    message("删除成功!", "refresh", "success");
}
$pindex = max(1, intval($_GP['page']));
$psize = 20;
$bonus_user_list = mysqld_selectall("SELECT user.*,member.mobile mobile,member.realname,orders.ordersn FROM " . table('bonus_user') . " user left join " . table('member') . " member on member.openid=user.openid left join " . table('shop_order') . " orders on orders.id=user.order_id where user.deleted=0 and user.bonus_type_id=:bonus_type_id order by user.bonus_id desc LIMIT " . ($pindex - 1) * $psize . ',' . $psize, array(":bonus_type_id" => $_GP['id']));
$total = mysqld_selectcolumn("SELECT count(user.bonus_id) FROM " . table('bonus_user') . " user left join " . table('member') . " member on member.openid=user.openid left join " . table('shop_order') . " orders on orders.id=user.order_id where user.deleted=0 and user.bonus_type_id=:bonus_type_id", array(":bonus_type_id" => $_GP['id']));
$pager = pagination($total, $pindex, $psize);
include page('bonus_view');
Пример #28
0
<?php

$operation = !empty($_GP['op']) ? $_GP['op'] : 'display';
if ($operation == 'delete') {
    mysqld_update('bonus_type', array('deleted' => 1), array('type_id' => intval($_GP['id'])));
    message("删除成功!", "refresh", "success");
}
if ($operation == 'post') {
    $bonus = mysqld_select("SELECT * FROM " . table('bonus_type') . " where type_id='" . intval($_GP['id']) . "' ");
    if (checksubmit('submit')) {
        if (empty($_GP['id'])) {
            $data = array('type_name' => $_GP['type_name'], 'type_money' => $_GP['type_money'], 'send_type' => $_GP['send_type'], 'min_amount' => $_GP['min_amount'], 'max_amount' => $_GP['max_amount'], 'send_start_date' => strtotime($_GP['send_start_date']), 'send_end_date' => strtotime($_GP['send_end_date']), 'use_start_date' => strtotime($_GP['use_start_date']), 'use_end_date' => strtotime($_GP['use_end_date']), 'min_goods_amount' => $_GP['min_goods_amount']);
            mysqld_insert('bonus_type', $data);
            message("添加成功", create_url('site', array('name' => 'bonus', 'do' => 'bonus', 'op' => 'display')), "success");
        } else {
            $data = array('type_name' => $_GP['type_name'], 'type_money' => $_GP['type_money'], 'send_type' => $_GP['send_type'], 'min_amount' => $_GP['min_amount'], 'max_amount' => $_GP['max_amount'], 'send_start_date' => strtotime($_GP['send_start_date']), 'send_end_date' => strtotime($_GP['send_end_date']), 'use_start_date' => strtotime($_GP['use_start_date']), 'use_end_date' => strtotime($_GP['use_end_date']), 'min_goods_amount' => $_GP['min_goods_amount']);
            mysqld_update('bonus_type', $data, array('type_id' => $_GP['id']));
            message("修改成功", "refresh", "success");
        }
    }
    include page('bonus');
    exit;
}
$bonus_list = mysqld_selectall("SELECT *,0 sendcount,0 usercount FROM " . table('bonus_type') . " where deleted=0");
foreach ($bonus_list as $index => $bonus) {
    $bonus_list[$index]['sendcount'] = mysqld_selectcolumn("SELECT count(*) FROM " . table('bonus_user') . " where deleted=0 and bonus_type_id=:bonus_type_id", array(":bonus_type_id" => $bonus['type_id']));
    $bonus_list[$index]['usercount'] = mysqld_selectcolumn("SELECT count(*) FROM " . table('bonus_user') . " where deleted=0 and isuse=1 and bonus_type_id=:bonus_type_id", array(":bonus_type_id" => $bonus['type_id']));
}
include page('bonus_list');