Пример #1
0
function updateOrderStock($id, $minus = true)
{
    $ordergoods = mysqld_selectall("SELECT * FROM " . table('shop_order_goods') . " WHERE orderid='{$id}'");
    foreach ($ordergoods as $item) {
        $goods = mysqld_select("SELECT * FROM " . table('shop_goods') . "  WHERE id='" . $item['goodsid'] . "'");
        if ($minus) {
            //属性
            if (!empty($item['optionid'])) {
                mysqld_query("update " . table('shop_goods_option') . " set stock=stock-:stock where id=:id", array(":stock" => $item['total'], ":id" => $item['optionid']));
            }
            $data = array();
            if ($goods['totalcnf'] != 1) {
                $data['total'] = $goods['total'] - $item['total'];
            }
            $data['sales'] = $goods['sales'] + $item['total'];
            mysqld_update('shop_goods', $data, array('id' => $item['goodsid']));
        } else {
            //属性
            if (!empty($item['optionid'])) {
                mysqld_query("update " . table('shop_goods_option') . " set stock=stock+:stock where id=:id", array(":stock" => $item['total'], ":id" => $item['optionid']));
            }
            $data = array();
            if ($goods['totalcnf'] != 1) {
                $data['total'] = $goods['total'] + $item['total'];
            }
            $data['sales'] = $goods['sales'] - $item['total'];
            mysqld_update('shop_goods', $data, array('id' => $item['goodsid']));
        }
    }
}
Пример #2
0
 public function setOrderCredit($openid, $id, $minus = true, $remark = '')
 {
     $order = mysqld_selectall("SELECT * FROM " . table('shop_order') . " WHERE id='{$id}'");
     if (!empty($order['credit'])) {
         if ($minus) {
             member_credit($openid, $order['credit'], 'addcredit', $remark);
         } else {
             member_credit($openid, $order['credit'], 'usecredit', $remark);
         }
     }
 }
Пример #3
0
            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;
            }
            mysqld_update('weixin_rule', $data, array('id' => $_GP['id']));
            message('修改成功!', 'refresh', 'success');
        }
    }
    include page('rule_detail');
    exit;
}
if ($operation == 'delete' && !empty($_GP['id'])) {
    mysqld_delete('weixin_rule', array('id' => $_GP['id']));
    message('删除成功!', 'refresh', 'success');
}
$list = mysqld_selectall('SELECT * FROM ' . table('weixin_rule'));
include page('rule');
Пример #4
0
<?php

$list = mysqld_selectall("select * from " . table('user'));
include page('listuser');
Пример #5
0
    $sql = $sql . "ALTER TABLE " . table('shop_goods') . " ADD COLUMN `isjingping` int(1) DEFAULT '0' COMMENT '精品';";
}
if (!mysqld_fieldexists('shop_order', 'hasbonus')) {
    $sql = $sql . "ALTER TABLE " . table('shop_order') . " ADD COLUMN `hasbonus` int(1) DEFAULT '0' COMMENT '是否使用优惠券';";
}
if (!mysqld_fieldexists('shop_order', 'bonusprice')) {
    $sql = $sql . "ALTER TABLE " . table('shop_order') . " ADD COLUMN `bonusprice` decimal(10,2) DEFAULT '0.00' COMMENT '优惠券抵消金额';";
}
if (!mysqld_fieldexists('member_paylog', 'account_fee')) {
    $sql = $sql . "ALTER TABLE " . table('member_paylog') . " ADD COLUMN `account_fee` decimal(10,2) NOT NULL COMMENT '账户剩余积分或余额';";
}
mysqld_batch($sql);
clear_theme_cache();
if (intval(SYSTEM_VERSION) <= 20150724) {
    mysqld_update('shop_dispatch', array('express' => 'cac'), array('sendtype' => 1, 'express' => ''));
    $shop_dispatchs = mysqld_selectall("select * from " . table('shop_dispatch') . "  group by express");
    foreach ($shop_dispatchs as $shop_dispatch) {
        $express_code = $shop_dispatch['express'];
        $shop_dispatch_area = mysqld_select("SELECT * FROM " . table('shop_dispatch_area') . " WHERE  dispatchid=:dispatchid and provance=:provance and city=:city and area=:area  limit 1", array('dispatchid' => $shop_dispatch['id'], 'country' => '中国', 'provance' => $shop_dispatch['provance'], 'city' => $shop_dispatch['city'], 'area' => $shop_dispatch['area']));
        if (empty($shop_dispatch_area['id'])) {
            mysqld_insert("shop_dispatch_area", array('dispatchid' => $shop_dispatch['id'], 'country' => '中国', 'provance' => $shop_dispatch['provance'], 'city' => $shop_dispatch['city'], 'area' => $shop_dispatch['area']));
        }
        $dispatch = mysqld_select("SELECT * FROM " . table('dispatch') . " WHERE  code=:code limit 1", array(':code' => $express_code));
        if (empty($dispatch['id'])) {
            if (file_exists(WEB_ROOT . '/system/modules/plugin/dispatch/' . $express_code . '/lang.php')) {
                require WEB_ROOT . '/system/modules/plugin/dispatch/' . $express_code . '/lang.php';
                $data = array('code' => $express_code, 'name' => $_LANG['dispatch_' . $express_code . '_name'], 'desc' => $_LANG['dispatch_' . $express_code . '_desc'], 'enabled' => '1', 'sendtype' => $_LANG['dispatch_' . $express_code . '_sendtype']);
                mysqld_insert('dispatch', $data);
            }
        }
    }
Пример #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
<?php

$op = $_GP['op'] ? $_GP['op'] : 'display';
$status = intval($_GP['status']);
if ($op == 'display') {
    $list = mysqld_selectall("SELECT teller.*,member.realname,member.mobile,member.outgoldinfo FROM " . table('gold_teller') . " teller  left join " . table('member') . " member on teller.openid=member.openid where teller.status=:status order by teller.createtime desc", array('status' => $status));
    include page('outchargegold');
    exit;
}
if ($op == 'post') {
    $id = intval($_GP['id']);
    if (intval($_GP['tostatus']) == -1) {
        $gold_teller = mysqld_select("SELECT teller.* FROM " . table('gold_teller') . " teller where teller.status=0 and id=:id", array(':id' => $id));
        if (!empty($gold_teller['openid'])) {
            member_gold($gold_teller['openid'], $gold_teller['fee'], 'addgold', '余额审核拒绝后返回账户' . $gold_teller['fee'] . '元');
        }
    }
    mysqld_update('gold_teller', array('status' => intval($_GP['tostatus'])), array('id' => $id));
    message("审核完成!", 'refresh', 'success');
}
Пример #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
    $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');
Пример #10
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>
// +----------------------------------------------------------------------
$allrule = mysqld_selectall('SELECT * FROM ' . table('rule'));
$account = mysqld_select('SELECT * FROM ' . table('user') . " WHERE  id=:id", array(':id' => $_CMS['account']['id']));
$menurule = array();
$userRule = mysqld_selectall('SELECT * FROM ' . table('user_rule') . " WHERE  uid=:uid", array(':uid' => $_CMS['account']['id']));
foreach ($allrule as $item) {
    foreach ($userRule as $rule) {
        if ($item['modname'] == $rule['modname'] && $item['moddo'] == $rule['moddo']) {
            $menurule[] = $item['modname'] . "-" . $item['moddo'];
        }
    }
}
$username = $_CMS['account']['username'];
$settings = globaSetting();
$modulelist = mysqld_selectall("SELECT *,'' as menus FROM " . table('modules') . "   order by displayorder");
foreach ($modulelist as $index => $module) {
    $modulelist[$index]['menus'] = mysqld_selectall("SELECT * FROM " . table('modules_menu') . " WHERE `module`=:module ", array(':module' => $module['name']));
}
include page('main');
Пример #11
0
if (empty($order['id'])) {
    message("未找到相关订单");
}
if ($_GP['isok'] == '1' && $order['paytypecode'] == 'weixin') {
    message('支付成功!', WEBSITE_ROOT . mobile_url('myorder'), 'success');
}
if ($order['paytype'] != 3 && $order['status'] > 0 && !($order['paytype'] == 3 && $order['status'] == 1)) {
    message('抱歉,您的订单已经付款或是被关闭,请重新进入付款!', mobile_url('myorder'), 'error');
}
$ordergoods = mysqld_selectall("SELECT goodsid,optionid,total FROM " . table('shop_order_goods') . " WHERE orderid = '{$orderid}'");
if (!empty($ordergoods)) {
    $goodsids = array();
    foreach ($ordergoods as $gooditem) {
        $goodsids[] = $gooditem['goodsid'];
    }
    $goods = mysqld_selectall("SELECT id, title, thumb, marketprice, total,credit FROM " . table('shop_goods') . " WHERE id IN ('" . implode("','", $goodsids) . "')");
}
$goodtitle = '';
if (!empty($goods)) {
    foreach ($goods as $row) {
        if (empty($goodtitle)) {
            $goodtitle = $row['title'];
        }
        $_optionid = $ordergoods[$row['id']]['optionid'];
        $optionidtitle = '';
        if (!empty($_optionid)) {
            $optionidtitle = mysqld_select("select title from " . table("shop_goods_option") . " where id=:id", array('id' => $_optionid));
            $optionidtitle = $optionidtitle['title'];
        }
        $goodsstr .= "{$row['title']} {$optionidtitle} X{$ordergoods[$row['id']]['total']}\n";
    }
Пример #12
0
 public function indexexists($tablename, $indexname)
 {
     if (!empty($indexname)) {
         $indexs = mysqld_selectall("SHOW INDEX FROM " . $this->table($tablename));
         if (!empty($indexs) && is_array($indexs)) {
             foreach ($indexs as $row) {
                 if ($row['Key_name'] == $indexname) {
                     return true;
                 }
             }
         }
     }
     return false;
 }
Пример #13
0
<?php

$operation = !empty($_GP['op']) ? $_GP['op'] : 'display';
if ($operation == 'delete') {
    mysqld_delete('addon10_scene_page', array("id" => intval($_GP['id'])));
    message("删除成功!", "refresh", "success");
}
$scene_page_list = mysqld_selectall("SELECT * FROM " . table('addon10_scene_page') . " where list_id=:list_id", array("list_id" => intval($_GP['listid'])));
$scene = mysqld_select("SELECT * FROM " . table('addon10_scene_list') . " where id='" . intval($_GP['listid']) . "' ");
if (!empty($scene['id'])) {
    $theme = $scene['theme'];
}
$list_id = intval($_GP['listid']);
include addons_page('themes/' . $theme . '/scene_page_list');
Пример #14
0
                if (is_error($upload)) {
                    message($upload['message'], '', 'error');
                }
                $data['thumb'] = $upload['path'];
            }
            mysqld_insert('addon8_article', $data);
            message("添加成功", create_url('site', array('name' => 'addon8', 'do' => 'article', 'op' => 'post', 'id' => mysqld_insertid())), "success");
        } else {
            $data = array('createtime' => time(), 'pcate' => intval($_GP['pcate']), 'ccate' => intval($_GP['ccate']), 'iscommend' => intval($_GP['iscommend']), 'ishot' => intval($_GP['ishot']), 'mobileTheme' => intval($_GP['mobileTheme']), 'title' => $_GP['title'], 'readcount' => intval($_GP['readcount']), 'description' => $_GP['description'], 'content' => htmlspecialchars_decode($_GP['content']), 'displayorder' => intval($_GP['displayorder']));
            if (!empty($_GP['thumb_del'])) {
                $data['thumb'] = '';
            }
            if (!empty($_FILES['thumb']['tmp_name'])) {
                file_delete($_GP['thumb_old']);
                $upload = file_upload($_FILES['thumb']);
                if (is_error($upload)) {
                    message($upload['message'], '', 'error');
                }
                $data['thumb'] = $upload['path'];
            }
            mysqld_update('addon8_article', $data, array('id' => $_GP['id']));
            message("修改成功", "refresh", "success");
        }
    }
    include addons_page('article');
    exit;
}
$article_list = mysqld_selectall("SELECT * FROM " . table('addon8_article') . " order by displayorder desc");
$category_pcate = mysqld_selectall("SELECT * FROM " . table('addon8_article_category') . "  where parentid=0 ", array(), 'id');
$category_ccate = mysqld_selectall("SELECT * FROM " . table('addon8_article_category') . "  where parentid!=0 ", array(), 'id');
include addons_page('article_list');
Пример #15
0
            if ($rule['keywords'] != $_GP['keywords']) {
                $count = mysqld_selectcolumn('SELECT count(id) FROM ' . table('alipay_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;
            }
            mysqld_update('alipay_rule', $data, array('id' => $_GP['id']));
            message('修改成功!', 'refresh', 'success');
        }
    }
    include page('rule_detail');
    exit;
}
if ($operation == 'delete' && !empty($_GP['id'])) {
    mysqld_delete('alipay_rule', array('id' => $_GP['id']));
    message('删除成功!', 'refresh', 'success');
}
$list = mysqld_selectall('SELECT * FROM ' . table('alipay_rule'));
include page('rule');
Пример #16
0
<?php

$member = get_member_account(false);
$member = member_get($member['openid']);
if (empty($member['openid'])) {
    $member = get_member_account(false);
    $member['createtime'] = time();
}
$is_login = is_login_account();
$weixinfans = get_weixin_fans_byopenid($member['openid'], $member['openid']);
if (!empty($weixinfans) && !empty($weixinfans['avatar'])) {
    $avatar = $weixinfans['avatar'];
}
if ($is_login) {
    $fansindex_menu_list = mysqld_selectall("SELECT * FROM " . table('shop_diymenu') . " where menu_type='fansindex' order by torder desc");
}
include themePage('fansindex');
Пример #17
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>
// +----------------------------------------------------------------------
$sortname = $_GP['sortname'] ? $_GP['sortname'] : 'ordermoney';
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()));
}
$condition1 = "";
$condition2 = "";
if (!empty($start_time) && !empty($end_time) && !empty($_GP['start_time']) && !empty($_GP['end_time'])) {
    $condition1 = " and orders.createtime>=" . $start_time . " and " . "orders.createtime<=" . $end_time;
    $condition2 = " and orders2.createtime>=" . $start_time . " and " . "orders2.createtime<=" . $end_time;
}
$list = mysqld_selectall("SELECT member.realname,member.mobile,(" . "SELECT count(orders.id) FROM " . table('shop_order') . " orders where orders.openid=member.openid  " . $condition1 . ") as ordercount,(" . "SELECT sum(cast(orders2.price as decimal(8,2))) FROM " . table('shop_order') . " orders2 where orders2.openid=member.openid " . $condition2 . ") ordermoney FROM " . table('member') . " member where  member.istemplate=0 ORDER BY " . $sortname . "  DESC limit 100");
if (!empty($_GP['memberrankingEXP01'])) {
    $report = "memberranking";
    require_once 'report.php';
    exit;
}
include addons_page('memberranking');
Пример #18
0
<?php

$bonuslist = mysqld_selectall("select bonus_user.*,bonus_type.type_name,bonus_type.type_money,bonus_type.use_start_date,bonus_type.use_end_date 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']));
include page('userbonuslist');
Пример #19
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);
//处理规格项
$options = mysqld_selectall("select id,title,thumb,marketprice,productprice, stock,weight,specs from " . table('shop_goods_option') . " where goodsid=:id order by id asc", array(':id' => $goodsid));
//排序好的specs
$specs = array();
//找出数据库存储的排列顺序
if (count($options) > 0) {
    $specitemids = explode("_", $options[0]['specs']);
    foreach ($specitemids as $itemid) {
        foreach ($allspecs as $ss) {
            $items = $ss['items'];
            foreach ($items as $it) {
                if ($it['id'] == $itemid) {
                    $specs[] = $ss;
                    break;
                }
            }
        }
Пример #20
0
<?php

$awardlist = mysqld_selectall("select award.awardtype,award.gold,request.id,request.realname,request.mobile,request.address,award.title,award.credit_cost,award.price,request.createtime FROM " . table('addon7_request') . " request left join " . table('addon7_award') . " award on award.id=request.award_id where status=0");
include addons_page('applyed');
Пример #21
0
 $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;
         $row['dispatch'] = mysqld_select("select id,dispatchname from " . table('shop_dispatch') . " where id=:id limit 1", array(":id" => $row['dispatch']));
     }
 }
 include themePage('order');
Пример #22
0
} elseif ($operation == 'display') {
    $pindex = max(1, intval($_GP['page']));
    $psize = 10;
    $condition = '';
    if (!empty($_GP['keyword'])) {
        $condition .= " AND title LIKE '%{$_GP['keyword']}%'";
    }
    if (!empty($_GP['cate_2'])) {
        $cid = intval($_GP['cate_2']);
        $condition .= " AND ccate = '{$cid}'";
    } elseif (!empty($_GP['cate_1'])) {
        $cid = intval($_GP['cate_1']);
        $condition .= " AND pcate = '{$cid}'";
    }
    if (isset($_GP['status'])) {
        $condition .= " AND status = '" . intval($_GP['status']) . "'";
    }
    $list = mysqld_selectall("SELECT * FROM " . table('shop_goods') . " WHERE  deleted=0 {$condition} ORDER BY status DESC, displayorder DESC, id DESC LIMIT " . ($pindex - 1) * $psize . ',' . $psize);
    $total = mysqld_selectcolumn('SELECT COUNT(*) FROM ' . table('shop_goods') . " WHERE deleted=0 {$condition}");
    $pager = pagination($total, $pindex, $psize);
    include page('goods_list');
} elseif ($operation == 'delete') {
    $id = intval($_GP['id']);
    $row = mysqld_select("SELECT id, thumb FROM " . table('shop_goods') . " WHERE id = :id", array(':id' => $id));
    if (empty($row)) {
        message('抱歉,商品不存在或是已经被删除!');
    }
    //修改成不直接删除,而设置deleted=1
    mysqld_update("shop_goods", array("deleted" => 1), array('id' => $id));
    message('删除成功!', 'refresh', 'success');
}
Пример #23
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'] . "元";
Пример #24
0
<?php

if ($_CMS['addons_bj_hx']) {
    $bj_hx_verify_goods = mysqld_selectall("SELECT bj_hx_verify_goods.*,bj_hx_verify.vname FROM " . table('bj_hx_verify_goods') . " bj_hx_verify_goods left join " . table('bj_hx_verify') . " bj_hx_verify on bj_hx_verify_goods.verifyid=bj_hx_verify.id WHERE bj_hx_verify_goods.goodsid = :goodsid", array(':goodsid' => $id));
}
Пример #25
0
<?php

$op = $_GP['op'];
if ($op == 'credit') {
    $condition = "  (`type`='usecredit' or `type`='addcredit')";
}
if ($op == 'gold') {
    $condition = " (`type`='usegold' or `type`='addgold')";
}
$member = mysqld_select("SELECT * FROM " . table('member') . " where openid=:openid ", array(':openid' => $_GP['openid']));
$list = mysqld_selectall("SELECT * FROM " . table('member_paylog') . " where openid=:openid  and {$condition} order by createtime desc", array(':openid' => $_GP['openid']));
if (checksubmit('submit')) {
    if (!is_numeric($_GP['fee']) || $_GP['fee'] < 0) {
        message("输入的数字非法请重新输入");
    }
    if (!empty($member['openid'])) {
        if ($op == 'credit') {
            member_credit($_GP['openid'], $_GP['fee'], 'addcredit', $_GP['remark']);
            message('积分充值成功', 'refresh', 'success');
        }
        if ($op == 'gold') {
            member_gold($_GP['openid'], $_GP['fee'], 'addgold', $_GP['remark']);
            message('余额充值成功', 'refresh', 'success');
        }
    }
}
include page($op);
Пример #26
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');
Пример #27
0
<?php

$operation = !empty($_GP['op']) ? $_GP['op'] : 'display';
if ($operation == 'delete') {
    mysqld_delete('addon10_scene_subscribe', array("id" => intval($_GP['id'])));
    message("删除成功!", "refresh", "success");
}
$subscribe_list = mysqld_selectall("SELECT subscribe.*,sl.title FROM " . table('addon10_scene_subscribe') . " subscribe left join " . table('addon10_scene_list') . "  sl on sl.id=subscribe.list_id ");
include addons_page('subscribe');
Пример #28
0
// | WE CAN DO IT JUST FREE
// +----------------------------------------------------------------------
// | Copyright (c) 2015 http://www.baijiacms.com All rights reserved.
// +----------------------------------------------------------------------
// | Author: °Ù¼ÒÍþÐÅ <QQ:2752555327> <http://www.baijiacms.com>
// +----------------------------------------------------------------------
$usertype = $_GP['usertype'] ? $_GP['usertype'] : 'user';
$condtitiontime = '';
$conditionflag = '';
if ($usertype == 'agent') {
    $conditionflag = ' and flag=1';
    $condtitiontime = 'flagtime';
} else {
    $condtitiontime = 'createtime';
}
$list = mysqld_selectall("SELECT * FROM " . table('member') . "   WHERE istemplate = 0 ");
$nowyear = intval(date('Y', time()));
$nowmonth = intval(date('m', time()));
$years = array(array('year' => $nowyear - 3, 'checked' => 0), array('year' => $nowyear - 2, 'checked' => 0), array('year' => $nowyear - 1, 'checked' => 0), array('year' => $nowyear, 'checked' => 1));
$nowday = date('t', time());
$chartdata1 = array();
$index = 0;
for ($dateindex = 7; $dateindex >= 0; $dateindex--) {
    if ($dateindex == 0) {
        $time = date("Y-m-d", time());
    } else {
        $time = date("Y-m-d", strtotime("-" . $dateindex . " day"));
    }
    $start_time = strtotime($time . " 00:00:01");
    $end_time = strtotime($time . " 23:59:59");
    $chart1data = mysqld_select("SELECT count(*) as counts,'" . $time . "' as dates FROM " . table('member') . "   WHERE istemplate = 0 {$conditionflag} and " . $condtitiontime . ">=" . $start_time . " and  " . $condtitiontime . "<=" . $end_time);
Пример #29
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');
Пример #30
0
<?php

$operation = !empty($_GP['op']) ? $_GP['op'] : 'display';
if ($operation == 'display') {
    if (!empty($_GP['displayorder'])) {
        foreach ($_GP['displayorder'] as $id => $displayorder) {
            mysqld_update('addon8_article_category', array('displayorder' => $displayorder), array('id' => $id));
        }
        message('分类排序更新成功!', web_url('category', array('op' => 'display')), 'success');
    }
    $children = array();
    $category = mysqld_selectall("SELECT * FROM " . table('addon8_article_category') . "  where deleted=0  ORDER BY parentid ASC, displayorder DESC");
    foreach ($category as $index => $row) {
        if (!empty($row['parentid'])) {
            $children[$row['parentid']][] = $row;
            unset($category[$index]);
        }
    }
    include addons_page('category_list');
} elseif ($operation == 'post') {
    $parentid = intval($_GP['parentid']);
    $id = intval($_GP['id']);
    if (!empty($id)) {
        $category = mysqld_select("SELECT * FROM " . table('addon8_article_category') . " WHERE id = '{$id}'");
    } else {
        $category = array('displayorder' => 0);
    }
    if (!empty($parentid)) {
        $parent = mysqld_select("SELECT id, name FROM " . table('addon8_article_category') . " WHERE id = '{$parentid}'");
        if (empty($parent)) {
            message('抱歉,上级分类不存在或是已经被删除!', web_url('post'), 'error');