Example #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']));
        }
    }
}
Example #2
0
 function member_create_qq($qq_openid, $avatar = '', $nickname = '', $gender = 0)
 {
     if (!empty($qq_openid)) {
         $qq_fans = mysqld_select("SELECT * FROM " . table('qq_qqfans') . " WHERE qq_openid=:qq_openid ", array(':qq_openid' => $qq_openid));
         if (empty($qq_fans['qq_openid'])) {
             $row = array('nickname' => $nickname, 'gender' => intval($gender), 'qq_openid' => $qq_openid, 'avatar' => $avatar, 'createtime' => TIMESTAMP);
             mysqld_insert('qq_qqfans', $row);
         } else {
             $row = array('nickname' => $nickname, 'gender' => intval($gender), 'avatar' => $avatar);
             mysqld_update('qq_qqfans', $row, array('qq_openid' => $qq_openid));
         }
     }
 }
Example #3
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');
Example #4
0
<?php

$code = $_GP['code'];
require WEB_ROOT . '/system/modules/plugin/dispatch/' . $code . '/lang.php';
$item = mysqld_select("SELECT * FROM " . table('dispatch') . " WHERE code = :code", array(':code' => $code));
if (empty($item['id'])) {
    $data = array('code' => $code, 'name' => $_LANG['dispatch_' . $code . '_name'], 'desc' => $_LANG['dispatch_' . $code . '_desc'], 'enabled' => '1', 'sendtype' => $_LANG['dispatch_' . $code . '_sendtype']);
    mysqld_insert('dispatch', $data);
} else {
    $data = array('name' => $_LANG['dispatch_' . $code . '_name'], 'desc' => $_LANG['dispatch_' . $code . '_desc'], 'enabled' => '1', 'sendtype' => $_LANG['dispatch_' . $code . '_sendtype']);
    mysqld_update('dispatch', $data, array('code' => $code));
}
message("操作成功", create_url('site', array('name' => 'modules', 'do' => 'dispatch', 'op' => 'display')));
Example #5
0
<?php

$member_account = get_member_account();
$openid = $member['openid'];
$order = mysqld_select("SELECT * FROM " . table('shop_order') . " WHERE  id=:id limit 1", array(':id' => $orderid));
$getmember = member_get($openid);
if ($getmember['gold'] >= $order['price']) {
    $usegold = member_gold($openid, $order['price'], 'usegold', "消费金额:" . $order['price'] . ",订单编号:" . $order['ordersn']);
    if ($usegold) {
        mysqld_update('shop_order', array('status' => '1', 'paytype' => '1'), array('id' => $orderid));
        message('订单提交成功,收货后请验货!', WEBSITE_ROOT . mobile_url('myorder'), 'success');
    } else {
        message('付款失败!', WEBSITE_ROOT . mobile_url('myorder'), 'error');
    }
} else {
    message('余额不足,无法完成付款!', WEBSITE_ROOT . mobile_url('myorder'), 'error');
}
Example #6
0
<?php

$pay_submit_data = array('delivery_pay_desc' => htmlspecialchars_decode($_GP['delivery_pay_desc']));
mysqld_update('payment', array('order' => $_GP['pay_order'], 'configs' => serialize($pay_submit_data)), array('code' => 'delivery'));
mysqld_update('payment', array('enabled' => '1'), array('code' => 'delivery'));
Example #7
0
        $this->setOrderCredit($openid, $order['id'], true, '订单:' . $order['ordersn'] . '收货新增积分');
    }
    mysqld_update('shop_order', array('status' => 3, 'updatetime' => time()), array('id' => $orderid, 'openid' => $openid));
    message('确认收货完成!', mobile_url('myorder', array('status' => intval($_GP['fromstatus']))), 'success');
} else {
    if ($op == 'detail') {
        $orderid = intval($_GP['orderid']);
        $item = mysqld_select("SELECT * FROM " . table('shop_order') . " WHERE openid = '" . $openid . "' and id='{$orderid}' limit 1");
        if (empty($item)) {
            message('抱歉,您的订单不存或是已经被取消!', mobile_url('myorder'), 'error');
        }
        if ($item['hasbonus']) {
            $bonuslist = mysqld_selectall("SELECT bonus_user.*,bonus_type.type_name 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.order_id=:order_id", array(":order_id" => $orderid));
        }
        if ($item['paytype'] != $this->getPaytypebycode($item['paytypecode'])) {
            mysqld_update('shop_order', array('paytype' => $this->getPaytypebycode($item['paytypecode'])), array('id' => $orderid, 'openid' => $openid));
            $item = mysqld_select("SELECT * FROM " . table('shop_order') . " WHERE openid = '" . $openid . "' and id='{$orderid}' limit 1");
        }
        $goodsid = mysqld_selectall("SELECT goodsid,total FROM " . table('shop_order_goods') . " WHERE orderid = '{$orderid}'", array(), 'goodsid');
        $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='{$orderid}'");
        foreach ($goods as &$g) {
            //属性
            $option = mysqld_select("select * from " . table("shop_goods_option") . " where id=:id limit 1", array(":id" => $g['optionid']));
            if ($option) {
                $g['title'] = "[" . $option['title'] . "]" . $g['title'];
                $g['marketprice'] = $option['marketprice'];
            }
        }
        unset($g);
        $dispatch = mysqld_select("select id,dispatchname,sendtype from " . table('shop_dispatch') . " where id=:id limit 1", array(":id" => $item['dispatch']));
        $payments = mysqld_selectall("select * from " . table("payment") . " where enabled=1 order by `order` desc");
Example #8
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');
}
Example #9
0
<?php

//	if(empty($_GP['weixin_appId'])||empty($_GP['weixin_appSecret']))
//	{
//	message("微信公众号appid或者appsecret不能空!");
//	}
//   $cfg = array(
//				  	'weixin_appId' => $_GP['weixin_appId'],
//		   		  'weixin_appSecret' => $_GP['weixin_appSecret']
//         );
//       refreshSetting($cfg);
mysqld_update('thirdlogin', array('enabled' => 1), array('code' => 'weixin'));
Example #10
0
<?php

mysqld_update('thirdlogin', array('enabled' => 0), array('code' => 'weixin'));
mysqld_update('payment', array('enabled' => 0), array('code' => 'weixin'));
?>


Example #11
0
File: pay.php Project: skystar/cms
    $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";
    }
}
$paytypecode = $order['paytypecode'];
if (!empty($_GP['paymentcode'])) {
    $paytypecode = $_GP['paymentcode'];
}
$payment = mysqld_select("select * from " . table("payment") . " where enabled=1 and `code`=:code ", array('code' => $paytypecode));
if (empty($payment['id'])) {
    message("未找到付款方式,付款失败");
}
if ($order['paytypecode'] != $paytypecode) {
    $paytype = $this->getPaytypebycode($paytypecode);
    mysqld_update('shop_order', array('paytypecode' => $payment['code'], 'paytypename' => $payment['name'], 'paytype' => $paytype), array('id' => $orderid));
}
require WEB_ROOT . '/system/modules/plugin/payment/' . $paytypecode . '/payaction.php';
exit;
Example #12
0
<?php

$code = $_GP['code'];
mysqld_update('dispatch', array('enabled' => 0), array('code' => $code));
message('关闭成功!', 'refresh', 'success');
Example #13
0
function member_gold($openid, $fee, $type, $remark)
{
    $member = member_get($openid);
    if (!empty($member['openid'])) {
        if (!is_numeric($fee) || $fee < 0) {
            message("输入数字非法,请重新输入");
        }
        if ($type == 'addgold') {
            $data = array('remark' => $remark, 'type' => $type, 'fee' => $fee, 'account_fee' => $member['gold'] + $fee, 'createtime' => TIMESTAMP, 'openid' => $openid);
            mysqld_insert('member_paylog', $data);
            mysqld_update('member', array('gold' => $member['gold'] + $fee), array('openid' => $openid));
            return true;
        }
        if ($type == 'usegold') {
            if ($member['gold'] >= $fee) {
                $data = array('remark' => $remark, 'type' => $type, 'fee' => $fee, 'account_fee' => $member['gold'] - $fee, 'createtime' => TIMESTAMP, 'openid' => $openid);
                mysqld_insert('member_paylog', $data);
                mysqld_update('member', array('gold' => $member['gold'] - $fee), array('openid' => $openid));
                return true;
            }
        }
    }
    return false;
}
Example #14
0
 public function do_process()
 {
     global $_GP, $_CMS;
     $settings = globaSetting();
     $configdata = $settings['weixintoken'];
     $token = $configdata;
     if (!$this->checkSign($token)) {
         exit('Access Denied');
     }
     if (strtolower($_SERVER['REQUEST_METHOD']) == 'get') {
         ob_clean();
         ob_start();
         exit($_GET['echostr']);
     }
     if (strtolower($_SERVER['REQUEST_METHOD']) == 'post') {
         $postStr = $GLOBALS["HTTP_RAW_POST_DATA"];
         $message = $this->requestParse($postStr);
         if (empty($message)) {
             exit('Request Failed');
         }
         if ($message['type'] == 'text' || $message['type'] == 'CLICK') {
             $key = $message['content'];
             if ($message['type'] == 'CLICK') {
                 $key = $message['eventkey'];
             }
             if (!empty($key)) {
                 $reply = mysqld_select('SELECT * FROM ' . table('weixin_rule') . "   WHERE  keywords = :keywords", array(':keywords' => $key));
             }
             if (empty($reply['id']) && !empty($key) && strpos($key, 'hx') == 0 && strpos($key, 'x') == 1 && !empty(strstr($key, 'hx'))) {
                 if ($_CMS['addons_bj_hx']) {
                     //扩展模块代码
                     $newkey = str_replace('hx', '', $key);
                     $item = mysqld_select("SELECT * FROM " . table('shop_order') . " WHERE ordersn = :ordersn\t", array(':ordersn' => $newkey));
                     if (empty($item)) {
                         return $this->respText('抱歉,核销订单不存在或被取消', $message);
                     }
                     if ($item['status'] == 3) {
                         return $this->respText('抱歉,核销订单已核销完成,不能重复核销!', $message);
                     }
                     $from_user = $message['from'];
                     $weixin_wxfans = mysqld_select('SELECT * FROM ' . table('weixin_wxfans') . " WHERE weixin_openid = :weixin_openid", array(':weixin_openid' => $from_user));
                     $str = $this->verifyorder($weixin_wxfans['openid'], $newkey);
                     return $this->respText($str, $message);
                 }
             } else {
                 if ($_CMS['addons_bj_tbk']) {
                     //扩展模块代码
                     if (empty($reply['id']) && !empty($key)) {
                         $from_user = $message['from'];
                         $spread = mysqld_select("SELECT * FROM " . table('bj_tbk_qrcode') . " where weixinkey=:weixinkey limit 1", array(':weixinkey' => $key));
                         if (!empty($spread['id'])) {
                             $weixin_wxfans = mysqld_select('SELECT * FROM ' . table('weixin_wxfans') . " WHERE weixin_openid = :weixin_openid", array(':weixin_openid' => $from_user));
                             if (!empty($weixin_wxfans['openid'])) {
                                 $bj_tbk_member_relect = mysqld_select('SELECT * FROM ' . table('bj_tbk_member_relect') . " WHERE openid = :openid", array(':openid' => $weixin_wxfans['openid']));
                                 //if(empty($bj_tbk_member_relect['isagent']))
                                 //{
                                 //		return $this->respText('您还不是代理无法生成二维码',$message);
                                 //}
                                 $qrcodecache = mysqld_select("SELECT * FROM " . table('bj_tbk_qrcode_cache') . " where qrcodeid=:qrcodeid and from_user=:from_user limit 1", array(':qrcodeid' => $spread['id'], ':from_user' => $from_user));
                                 if (empty($qrcodecache['id']) || empty($qrcodecache['qr_url']) || empty($qrcodecache['media_id']) || empty($qrcodecache['id']) || !empty($qrcodecache['expiretime']) && $qrcodecache['expiretime'] <= TIMESTAMP) {
                                     $media_id = bj_tbk_qrcode($qrcodecache, $spread, $from_user, $weixin_wxfans['openid'], true, 'media_id');
                                     return $this->respImage($media_id, $message);
                                     // $this->sendcustomIMG($from_user,$media_id);
                                     exit;
                                 } else {
                                     return $this->respImage($qrcodecache['media_id'], $message);
                                 }
                             } else {
                                 return $this->respText('您还不是会员无法生成二维码', $message);
                             }
                         }
                     }
                 }
             }
         }
         if ($message['type'] == 'subscribe') {
             $reply = mysqld_select('SELECT * FROM ' . table('weixin_rule') . "   WHERE  keywords = :keywords", array(':keywords' => subscribe_key));
             if (!empty($message['eventkey']) && strlen($message['eventkey']) > 8) {
                 $eventkey = substr($message['eventkey'], 8);
             } else {
                 $eventkey = $message['eventkey'];
             }
             if (!empty($message['from']) && !empty($eventkey)) {
                 bj_tbk_base_shareinfo('', $eventkey, $message['from'], '', 1);
             }
             mysqld_update('weixin_wxfans', array('follow' => 1), array('weixin_openid' => $message['from']));
         }
         if ($message['type'] == 'unsubscribe') {
             mysqld_update('weixin_wxfans', array('follow' => 0), array('weixin_openid' => $message['from']));
         }
         if (empty($reply['id'])) {
             $reply = mysqld_select('SELECT * FROM ' . table('weixin_rule') . "   WHERE  keywords = :keywords", array(':keywords' => default_key));
         }
         if ($reply['ruletype'] == 1) {
             $reply['content'] = htmlspecialchars_decode($reply['description']);
             $reply['content'] = str_replace(array('<br>', '&nbsp;'), array("\n", ' '), $reply['content']);
             $reply['content'] = strip_tags($reply['content'], '<a>');
             return $this->respText($reply['content'], $message);
         }
         if ($reply['ruletype'] == 2) {
             $news = array();
             $news = array('title' => $reply['title'], 'description' => $reply['description'], 'picurl' => $reply['thumb'], 'url' => $reply['url']);
             return $this->respNews($news, $message);
         }
         exit('');
     }
 }
Example #15
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');
Example #16
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');
}
Example #17
0
$ccate = intval($goods['ccate']);
if (empty($goods)) {
    message('抱歉,商品不存在或是已经被删除!');
}
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));
Example #18
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');
}
Example #19
0
        mysqld_update('shop_order', array('status' => -2, 'rsreson' => $_GP['rsreson']), array('id' => $orderid, 'openid' => $openid));
        message('申请退款成功,请等待审核!', mobile_url('myorder', array('status' => intval($_GP['fromstatus']))), 'success');
    }
    include themePage('order_detail_return');
    exit;
} elseif ($op == 'confirm') {
    $orderid = intval($_GP['orderid']);
    $order = mysqld_select("SELECT * FROM " . table('shop_order') . " WHERE id = :id AND openid = :openid", array(':id' => $orderid, ':openid' => $openid));
    if (empty($order)) {
        message('抱歉,您的订单不存在或是已经被取消!', mobile_url('myorder'), 'error');
    }
    if (empty($order['isrest'])) {
        //不是换货
        $this->setOrderCredit($openid, $order['id'], true, '订单:' . $order['ordersn'] . '收货新增积分');
    }
    mysqld_update('shop_order', array('status' => 3, 'updatetime' => time()), array('id' => $orderid, 'openid' => $openid));
    message('确认收货完成!', mobile_url('myorder', array('status' => intval($_GP['fromstatus']))), 'success');
} else {
    if ($op == 'detail') {
        $orderid = intval($_GP['orderid']);
        $item = mysqld_select("SELECT * FROM " . table('shop_order') . " WHERE openid = '" . $openid . "' and id='{$orderid}' limit 1");
        if (empty($item)) {
            message('抱歉,您的订单不存或是已经被取消!', mobile_url('myorder'), 'error');
        }
        $goodsid = mysqld_selectall("SELECT goodsid,total FROM " . table('shop_order_goods') . " WHERE orderid = '{$orderid}'", array(), 'goodsid');
        $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='{$orderid}'");
        foreach ($goods as &$g) {
            //属性
            $option = mysqld_select("select * from " . table("shop_goods_option") . " where id=:id limit 1", array(":id" => $g['optionid']));
            if ($option) {
                $g['title'] = "[" . $option['title'] . "]" . $g['title'];
Example #20
0
    } elseif ($insert['m_type'] == 8) {
        $data = $_GP['eighth'];
    } elseif ($insert['m_type'] == 9) {
        $data = $_GP['ninth'];
    } elseif ($insert['m_type'] == 10) {
        $data = $_GP['tenth'];
    }
    if (!empty($data)) {
        $insert['param'] = serialize($data);
    } else {
        $insert['param'] = '';
    }
    if ($item == false) {
        $temp = mysqld_insert('addon10_scene_page', $insert);
    } else {
        $temp = mysqld_update('addon10_scene_page', $insert, array('id' => $item['id']));
    }
    if ($temp == false) {
        $this->ajaxmessage('数据提交失败');
    } else {
        $this->ajaxmessage('数据提交成功', web_url('scene_page', array('listid' => $list_id, 'op' => 'display')), 'success');
    }
}
$uploadfolder = WEB_ROOT . '/attachment/image/addon10/';
mkdirs($uploadfolder);
$tmpfoldername = random(15);
copy(ADDONS_ROOT . 'addon10/style/img/default_bg.jpg', $uploadfolder . $tmpfoldername . 'jpg');
$tmpfoldername2 = random(15);
copy(ADDONS_ROOT . 'addon10/style/img/default_btn.png', $uploadfolder . $tmpfoldername2 . 'png');
if ($item == false) {
    $item = array('listorder' => 0, 'thumb' => 'image/addon10/' . $tmpfoldername . 'jpg');
Example #21
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');
Example #22
0
hasrule('weixin', 'weixin');
$settings = globaSetting();
$payment = mysqld_select("SELECT * FROM " . table('payment') . " WHERE code = :code", array(':code' => 'weixin'));
if (!empty($payment['configs'])) {
    $paymentconfig = unserialize($payment['configs']);
}
$thirdlogin = mysqld_select("SELECT * FROM " . table('thirdlogin') . " WHERE code = :code", array(':code' => 'weixin'));
if (checksubmit()) {
    $cfg = array('weixinname' => $_GP['weixinname'], 'weixintoken' => $_GP['weixintoken'], 'EncodingAESKey' => $_GP['EncodingAESKey'], 'weixin_appId' => $_GP['weixin_appId'], 'weixin_appSecret' => $_GP['weixin_appSecret'], 'weixin_autoreg' => $_GP['weixin_autoreg']);
    refreshSetting($cfg);
    mysqld_delete('config', array('name' => 'weixin_access_token'));
    $settings = globaSetting();
    $thirdlogin = mysqld_select("SELECT * FROM " . table('thirdlogin') . " WHERE code = :code", array(':code' => 'weixin'));
    require WEB_ROOT . '/system/modules/plugin/thirdlogin/weixin/lang.php';
    if (empty($thirdlogin['id'])) {
        $data = array('code' => 'weixin', 'enabled' => intval($_GP['thirdlogin_weixin']), 'name' => $_LANG['thirdlogin_weixin_name']);
        mysqld_insert('thirdlogin', $data);
    } else {
        $data = array('enabled' => intval($_GP['thirdlogin_weixin']), 'name' => $_LANG['thirdlogin_weixin_name']);
        mysqld_update('thirdlogin', $data, array('code' => 'weixin'));
    }
    if (empty($settings['weixintoken']) && !empty($_GP['weixintoken'])) {
        header("location:" . create_url('site', array('name' => 'weixin', 'do' => 'setting')));
    } else {
        message('保存成功', 'refresh', 'success');
    }
}
if (empty($settings['weixintoken'])) {
    $isfirst = true;
}
include page('setting');
Example #23
0
if (!mysqld_fieldexists('shop_goods', 'isjingping')) {
    $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);
            }
        }
Example #24
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');
        }
    }
    if (checksubmit('submit')) {
        if (empty($_GP['catename'])) {
            message('抱歉,请输入分类名称!');
        }
        $data = array('name' => $_GP['catename'], 'deleted' => 0, 'displayorder' => intval($_GP['displayorder']), 'icon' => $_GP['icon'], 'parentid' => intval($parentid));
        if (!empty($id)) {
            unset($data['parentid']);
            mysqld_update('addon8_article_category', $data, array('id' => $id));
        } else {
            mysqld_insert('addon8_article_category', $data);
            $id = mysqld_insertid();
        }
        message('更新分类成功!', web_url('category', array('op' => 'display')), 'success');
    }
    include addons_page('category');
} elseif ($operation == 'delete') {
    $id = intval($_GP['id']);
    $category = mysqld_select("SELECT id, parentid FROM " . table('addon8_article_category') . " WHERE id = '{$id}' and deleted=0 ");
    if (empty($category)) {
        message('抱歉,分类不存在或是已经被删除!', web_url('category', array('op' => 'display')), 'error');
    }
    mysqld_update('addon8_article_category', array('deleted' => 1), array('id' => $id, 'parentid' => $id), 'OR');
    message('分类删除成功!', web_url('category', array('op' => 'display')), 'success');
}
Example #25
0
<?php

mysqld_update('thirdlogin', array('enabled' => 0), array('code' => 'alipay'));
?>


Example #26
0
<?php

$code = $_GP['code'];
require WEB_ROOT . '/system/modules/plugin/thirdlogin/' . $code . '/lang.php';
$item = mysqld_select("SELECT * FROM " . table('thirdlogin') . " WHERE code = :code", array(':code' => $code));
if (empty($item['id'])) {
    $data = array('code' => $code, 'name' => $_LANG['thirdlogin_' . $code . '_name'], 'enabled' => '0');
    mysqld_insert('thirdlogin', $data);
} else {
    $data = array('name' => $_LANG['thirdlogin_' . $code . '_name']);
    mysqld_update('thirdlogin', $data, array('code' => $code));
}
$this->do_thirdlogin_config();
Example #27
0
File: rule.php Project: skystar/cms
            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');
Example #28
0
        $alipay_user = $userinfo->getUserInfo($auth_code);
        if (!empty($alipay_user)) {
            $alipay_openid = $user_info_resp->user_id;
            if (!empty($alipay_openid) && (!empty($_SESSION[MOBILE_ALIPAY_OPENID]) && $_SESSION[MOBILE_ALIPAY_OPENID] != $alipay_openid) || empty($_SESSION[MOBILE_ALIPAY_OPENID])) {
                $nickname = characet($user_info_resp->deliver_fullname);
                $follow = 1;
                $avatar = $user_info_resp->avatar;
                $gender = $user_info_resp->gender;
                $gender = $gender == 'F' ? 2 : ($gender == 'M' ? 1 : 0);
                $fans = mysqld_select("SELECT * FROM " . table('alipay_alifans') . " WHERE alipay_openid=:alipay_openid ", array(':alipay_openid' => $alipay_openid));
                if (empty($fans['alipay_openid'])) {
                    $row = array('nickname' => $nickname, 'follow' => $follow, 'gender' => intval($gender), 'alipay_openid' => $alipay_openid, 'avatar' => '', 'createtime' => TIMESTAMP);
                    mysqld_insert('alipay_alifans', $row);
                    if (!empty($avatar)) {
                        mysqld_update('alipay_alifans', array('avatar' => $avatar), array('alipay_openid' => $alipay_openid));
                    }
                } else {
                    $row = array('nickname' => $nickname, 'follow' => $follow, 'gender' => intval($gender), 'avatar' => '');
                    mysqld_update('alipay_alifans', $row, array('alipay_openid' => $alipay_openid));
                    if (!empty($avatar)) {
                        mysqld_update('alipay_alifans', array('avatar' => $avatar), array('alipay_openid' => $alipay_openid));
                    }
                }
                $_SESSION[MOBILE_ALIPAY_OPENID] = $alipay_openid;
                $sessionAccount = array('openid' => $alipay_openid);
                $_SESSION[MOBILE_SESSION_ACCOUNT] = $sessionAccount;
                member_login_alipay($alipay_openid);
            }
        }
    }
}
Example #29
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>
// +----------------------------------------------------------------------
$id = $_CMS[WEB_SESSION_ACCOUNT]['id'];
$username = $_CMS[WEB_SESSION_ACCOUNT]['username'];
if (checksubmit('submit')) {
    $account = mysqld_select('SELECT * FROM ' . table('user') . " WHERE  id = :id and password=:password", array(':id' => $id, ':password' => md5($_GP['oldpassword'])));
    if (!empty($account['id'])) {
        if (empty($_GP['newpassword'])) {
            message('新密码不能为空!', 'refresh', 'error');
        }
        if ($_GP['newpassword'] != $_GP['confirmpassword']) {
            message('两次密码不一致!', 'refresh', 'error');
        }
        $data = array('password' => md5($_GP['newpassword']));
        mysqld_update('user', $data, array('id' => $account['id']));
        message('密码修改成功!', create_url('site', array('name' => 'index', 'do' => 'changepwd')), 'succes');
    } else {
        message('密码错误!', 'refresh', 'error');
    }
}
include page('changepwd');
Example #30
0
<?php

mysqld_update('payment', array('enabled' => 0), array('code' => 'bank'));
?>