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
 public function getSignPackage($listid)
 {
     $configs = globaSetting(array("weixin_appId", "shop_logo"));
     $appid = $configs['weixin_appId'];
     $scene_list = mysqld_select('SELECT * FROM' . table('addon10_scene_list') . ' WHERE `id`=:id  ', array(':id' => $listid));
     $protocol = !empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' || $_SERVER['SERVER_PORT'] == 443 ? "https://" : "http://";
     $url = "{$protocol}{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}";
     $jsapiTicket = $this->addon_get_js_ticket();
     $timestamp = time();
     $nonceStr = $this->createNonceStr();
     $string = "jsapi_ticket={$jsapiTicket}&noncestr={$nonceStr}&timestamp={$timestamp}&url={$url}";
     $signature = sha1($string);
     $title = $scene_list['share_title'];
     $imgUrl = WEBSITE_ROOT . "attachment/" . $scene_list['share_thumb'];
     $description = $scene_list['share_content'];
     if (empty($imgUrl)) {
         $imgUrl = WEBSITE_ROOT . "attachment/" . $configs['shop_logo'];
     }
     if (empty($description)) {
         $description = $configs['shop_title'];
     }
     if (empty($title)) {
         $title = $configs['shop_title'];
     }
     $signPackage = array("appId" => $appid, "nonceStr" => $nonceStr, "timestamp" => $timestamp, "url" => $url, "title" => $title, "imgUrl" => $imgUrl, "link" => WEBSITE_ROOT . mobile_url('show', array('id' => $listid)), "signature" => $signature, "description" => $description, "rawString" => $string);
     return $signPackage;
 }
Example #3
0
File: rank.php Project: skystar/cms
function member_rank_model($experience)
{
    $rank = mysqld_select("SELECT * FROM " . table('rank_model') . " where experience<='" . intval($experience) . "' order by rank_level desc limit 1 ");
    if (empty($rank)) {
        return array('rank_name' => '普通会员', 'rank_level' => '', 'experience' => '');
    } else {
        return $rank;
    }
}
Example #4
0
 public function setOrderCredit($openid, $id, $minus = true, $remark = '')
 {
     $order = mysqld_select("SELECT * FROM " . table('shop_order') . " WHERE id=:id", array(":id" => $id));
     if (!empty($order['credit'])) {
         if ($minus) {
             member_credit($openid, $order['credit'], 'addcredit', $remark);
         } else {
             member_credit($openid, $order['credit'], 'usecredit', $remark);
         }
     }
 }
Example #5
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 #6
0
 public function do_process()
 {
     global $_GP;
     $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 ($message['type'] == 'subscribe') {
             $reply = mysqld_select('SELECT * FROM ' . table('weixin_rule') . "   WHERE  keywords = :keywords", array(':keywords' => subscribe_key));
         }
         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 #7
0
File: rule.php Project: skystar/cms
<?php

defined('SYSTEM_IN') or exit('Access Denied');
hasrule('weixin', 'weixin');
$operation = !empty($_GP['op']) ? $_GP['op'] : 'display';
if ($operation == 'detail') {
    if (!empty($_GP['id'])) {
        $rule = mysqld_select('SELECT * FROM ' . table('weixin_rule') . " WHERE  id = :id", array(':id' => intval($_GP['id'])));
    }
    if (checksubmit()) {
        if (empty($_GP['id'])) {
            $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'], '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'] . "已存在!");
Example #8
0
<?php

$operation = !empty($_GP['op']) ? $_GP['op'] : 'list';
$addons = dir(WEB_ROOT . '/system/modules/plugin/thirdlogin/');
$modules = array();
$index = 0;
while ($file = $addons->read()) {
    if ($file != "." and $file != "..") {
        $modules[$index]['code'] = $file;
        $item = mysqld_select("SELECT * FROM " . table('thirdlogin') . " WHERE enabled=1 and code = :code", array(':code' => $file));
        require WEB_ROOT . '/system/modules/plugin/thirdlogin/' . $file . '/lang.php';
        if (empty($item['id'])) {
            $modules[$index]['enable'] = 0;
        } else {
            $modules[$index]['enable'] = 1;
        }
        $index = $index + 1;
    }
}
include page('thirdlogin');
Example #9
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 #10
0
}
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 #11
0
 public function do_process()
 {
     global $_GP;
     $settings = globaSetting();
     $sign = $_REQUEST["sign"];
     $sign_type = $_REQUEST["sign_type"];
     $biz_content = stripslashes($_REQUEST["biz_content"]);
     $service = $_REQUEST["service"];
     $charset = $_REQUEST["charset"];
     if (empty($sign) || empty($sign_type) || empty($biz_content) || empty($service) || empty($charset)) {
         echo "some parameter is empty.";
         exit;
     }
     $as = new AlipaySign();
     $sign_verify = $as->rsaCheckV2($_REQUEST, $_GP['alipay_config']['alipay_public_key_file']);
     if (!$sign_verify) {
         if ($service == "alipay.service.check") {
             $EventType = $this->getNode2($biz_content, "EventType");
             if ($EventType == "verifygw") {
                 $as = new AlipaySign();
                 $response_xml = "<success>true</success><biz_content>" . $as->getPublicKeyStr($_GP['alipay_config']['merchant_public_key_file']) . "</biz_content>";
                 $return_xml = $as->sign_response($response_xml, $_GP['alipay_config']['charset'], $_GP['alipay_config']['merchant_private_key_file']);
                 echo $return_xml;
                 exit;
             }
         } else {
             echo "sign verfiy fail.";
             exit;
         }
     }
     if ($service == "alipay.service.check") {
         $EventType = $this->getNode2($biz_content, "EventType");
         if ($EventType == "verifygw") {
             $as = new AlipaySign();
             $response_xml = "<success>true</success><biz_content>" . $as->getPublicKeyStr($_GP['alipay_config']['merchant_public_key_file']) . "</biz_content>";
             $return_xml = $as->sign_response($response_xml, 'GBK', $_GP['alipay_config']['merchant_private_key_file']);
             file_put_contents(WEB_ROOT . "/cache/1.log", $return_xml, FILE_APPEND);
             echo $return_xml;
             exit;
         }
     }
     if ($service == "alipay.mobile.public.message.notify") {
         $UserInfo = $this->getNode($biz_content, "UserInfo");
         $FromUserId = $this->getNode($biz_content, "FromUserId");
         $AppId = $this->getNode($biz_content, "AppId");
         $CreateTime = $this->getNode($biz_content, "CreateTime");
         $MsgType = $this->getNode($biz_content, "MsgType");
         $EventType = $this->getNode($biz_content, "EventType");
         $AgreementId = $this->getNode($biz_content, "AgreementId");
         $ActionParam = $this->getNode($biz_content, "ActionParam");
         $AccountNo = $this->getNode($biz_content, "AccountNo");
         $text = $this->getNode($biz_content, "Text");
         $push = new PushMsg();
         if ($MsgType == "text" || $MsgType == "text" || $EventType == 'click') {
             $key = $text;
             if ($EventType == 'click') {
                 $key = $ActionParam;
             }
             if (!empty($key)) {
                 $reply = mysqld_select('SELECT * FROM ' . table('alipay_rule') . "   WHERE  keywords = :keywords", array(':keywords' => $key));
             }
         }
         if ($EventType == 'follow') {
             $reply = mysqld_select('SELECT * FROM ' . table('alipay_rule') . "   WHERE  keywords = :keywords", array(':keywords' => subscribe_key));
         }
         if (empty($reply['id'])) {
             $reply = mysqld_select('SELECT * FROM ' . table('alipay_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>');
             $text_msg = $push->mkTextMsg($reply['content']);
             $biz_content = $push->mkTextBizContent($FromUserId, $text_msg);
             $return_msg = $push->sendRequest($biz_content);
             file_put_contents(WEB_ROOT . "/cache/2.log", $biz_content . '|' . $return_msg, FILE_APPEND);
         }
         if ($reply['ruletype'] == 2) {
             $reply['content'] = htmlspecialchars_decode($reply['description']);
             $reply['content'] = str_replace(array('<br>', '&nbsp;'), array("\n", ' '), $reply['content']);
             $reply['content'] = strip_tags($reply['content'], '<a>');
             //WEBSITE_ROOT.'attachment/'.$reply['thumb']
             $image_text_msg1 = $push->mkImageTextMsg($reply['title'], $reply['content'], $reply['url'], WEBSITE_ROOT . 'attachment/' . $reply['thumb'], "loginAuth");
             $image_text_msg = array($image_text_msg1);
             $biz_content = $push->mkImageTextBizContent($FromUserId, $image_text_msg);
             $return_msg = $push->sendRequest($biz_content);
             file_put_contents(WEB_ROOT . "/cache/1.log", $biz_content, FILE_APPEND);
         }
         echo $this->mkAckMsg($FromUserId);
         exit;
         //	file_put_contents ( WEB_ROOT . "/cache/1.log",$x , FILE_APPEND );
     }
 }
Example #12
0
        } 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');
        exit;
    }
}
Example #13
0
<?php

defined('SYSTEM_IN') or exit('Access Denied');
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'])) {
Example #14
0
<?php

$op = $_GP['op'];
$id = intval($_GP['id']);
if ($id > 0) {
    $item = mysqld_select('select * from ' . table('addon10_scene_page') . ' where id=:id AND list_id=:list_id ', array(':list_id' => $list_id, ':id' => $id));
}
if ($_GP['op'] == 'del') {
    if ($item != false) {
        $temp = mysqld_delete('addon10_scene_page', array('id' => $item['id']));
    }
    if ($temp == false) {
        $this->ajaxmessage('数据提交失败');
    } else {
        $this->ajaxmessage('数据提交成功', web_url('scene_page', array('listid' => $list_id, 'op' => 'display')), 'success');
    }
}
//保存数据
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    $insert = array('list_id' => $list_id, 'listorder' => intval($_GP['listorder']), 'm_type' => intval($_GP['m_type']), 'thumb' => $_GP['thumb']);
    if ($insert['m_type'] == 1) {
        $data = $_GP['first'];
    } elseif ($insert['m_type'] == 2) {
        $data = $_GP['second'];
    } elseif ($insert['m_type'] == 3) {
        $data = $_GP['third'];
    } elseif ($insert['m_type'] == 4) {
        $data = $_GP['fourth'];
    } elseif ($insert['m_type'] == 5) {
        $data = $_GP['fifth'];
    } elseif ($insert['m_type'] == 6) {
Example #15
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 #16
0
<?php

$goodsid = intval($_GP['id']);
$goods = mysqld_select("SELECT * FROM " . table('shop_goods') . " WHERE id = :id", array(':id' => $goodsid));
$arr = $this->time_tran($goods['timeend']);
$goods['timelaststr'] = $arr[0];
$goods['timelast'] = $arr[1];
$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']);
Example #17
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');
}
    $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);
    $chartdata2[$index]['counts'] = $chart1data['counts'];
    $chartdata2[$index]['dates'] = $dateindex;
    $chartdata2[$index]['index'] = $index;
    $index = $index + 1;
}
$index = 0;
$chartdata3 = array();
$dropMonthForYaer2 = $_GP['dropMonthForYaer2'] ? $_GP['dropMonthForYaer2'] : $nowyear;
$dropMonthForYaer2 = intval($dropMonthForYaer2);
$years2 = array(array('year' => $nowyear - 3, 'checked' => 0), array('year' => $nowyear - 2, 'checked' => 0), array('year' => $nowyear - 1, 'checked' => 0), array('year' => $nowyear, 'checked' => 1));
foreach ($years2 as $id => $displayorder) {
    if ($years2[$id]['year'] == $dropMonthForYaer2) {
        $years2[$id]['checked'] = 1;
    } else {
        $years2[$id]['checked'] = 0;
    }
}
for ($dateindex = 1; $dateindex <= 12; $dateindex++) {
    $lastday = date('t', strtotime($dropMonthForYaer2 . "-" . $dateindex . "-1"));
    $time = $dropMonthForYaer2 . "-" . $dateindex;
    $start_time = strtotime($time . "-1" . " 00:00:01");
    $end_time = strtotime($time . "-" . $lastday . " 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);
    $chartdata3[$index]['counts'] = $chart1data['counts'];
    $chartdata3[$index]['dates'] = $chart1data['dates'];
    $chartdata3[$index]['index'] = $index;
    $index = $index + 1;
}
include addons_page('userincreasestatistics');
Example #19
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 #20
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 #21
0
}
$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'] . "元";
    $ordersn = 'bg' . date('Ymd') . random(6, 1);
    $gold_order = mysqld_select("SELECT * FROM " . table('gold_order') . " WHERE ordersn = '{$ordersn}'");
    if (!empty($gold_order['ordersn'])) {
        $ordersn = 'bg' . date('Ymd') . random(6, 1);
    }
    $insert = array('openid' => $openid, 'ordersn' => $ordersn, 'price' => $_GP['charge'], 'status' => 0, 'createtime' => TIMESTAMP);
    mysqld_insert('gold_order', $insert);
    $order = mysqld_select("SELECT * FROM " . table('gold_order') . " WHERE ordersn = '{$ordersn}' and openid='{$openid}'");
    require WEB_ROOT . '/system/modules/plugin/payment/' . $paytypecode . '/gold_payaction.php';
    exit;
}
include themePage('rechargegold');
Example #22
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 #23
0
<?php

if (strpos($_SERVER['HTTP_USER_AGENT'], 'MicroMessenger') == false) {
    message('暂不支持非微信上进行微支付');
}
$weixinthirdlogin = mysqld_select("SELECT * FROM " . table('thirdlogin') . " WHERE enabled=1 and `code`='weixin'");
if (empty($weixinthirdlogin) || empty($weixinthirdlogin['id'])) {
    message('需开启微信登录功能!');
}
if ($_GP['isok'] == '1') {
    message('支付成功!', WEBSITE_ROOT . mobile_url('myorder'), 'success');
}
$payment = mysqld_select("SELECT * FROM " . table('payment') . " WHERE  enabled=1 and code='weixin' limit 1");
$configs = unserialize($payment['configs']);
$settings = globaSetting(array("weixin_appId", "weixin_appSecret"));
$_CMS['weixin_pay_appid'] = $settings['weixin_appId'];
//受理商ID,身份标识
$_CMS['weixin_pay_mchId'] = $configs['weixin_pay_mchId'];
//商户支付密钥Key。审核通过后,在微信发送的邮件中查看
$_CMS['weixin_pay_paySignKey'] = $configs['weixin_pay_paySignKey'];
//JSAPI接口中获取openid,审核后在公众平台开启开发模式后可查看
$_CMS['weixin_pay_appSecret'] = $settings['weixin_appSecret'];
include_once "WxPayPubHelper/WxPayPubHelper.php";
$weixin_openid = get_weixin_openid();
//=========步骤2:使用统一支付接口,获取prepay_id============
//使用统一支付接口
$unifiedOrder = new UnifiedOrder_pub();
//设置统一支付接口参数
//设置必填参数
//appid已填,商户无需重复填写
//mch_id已填,商户无需重复填写
Example #24
0
 require_once WEB_ROOT . '/includes/lib/alipaySDK/config.php';
 require_once WEB_ROOT . '/includes/lib/alipaySDK/AopSdk.php';
 if (!empty($_GP["auth_code"])) {
     $auth_code = $_GP["auth_code"];
     require_once WEB_ROOT . '/includes/lib/alipaySDK/UserInfo.php';
     $userinfo = new UserInfo();
     $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);
Example #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);
Example #26
0
    }
    if (empty($_GP['third_login'])) {
        if (empty($_GP['pwd'])) {
            message("请输入密码!");
        }
        $pwd = md5($_GP['pwd']);
    } else {
        $pwd = '';
    }
    $shop_regcredit = intval($cfg['shop_regcredit']);
    $openid = date("YmdH", time()) . rand(100, 999);
    $hasmember = mysqld_select("SELECT * FROM " . table('member') . " WHERE openid = :openid ", array(':openid' => $openid));
    if (!empty($hasmember['openid'])) {
        $openid = date("YmdH", time()) . rand(100, 999);
    }
    $data = array('mobile' => $_GP['mobile'], 'pwd' => $pwd, 'createtime' => time(), 'status' => 1, 'istemplate' => 0, 'experience' => 0, 'openid' => $openid);
    mysqld_insert('member', $data);
    if (!empty($shop_regcredit)) {
        member_credit($openid, $shop_regcredit, "addcredit", "注册系统赠送积分");
    }
    $member = get_session_account();
    $oldsessionid = $member['openid'];
    $loginid = save_member_login('', $openid);
    integration_session_account($loginid, $oldsessionid);
    message('注册成功!', to_member_loginfromurl(), 'success');
}
$qqlogin = mysqld_select("SELECT * FROM " . table('thirdlogin') . " WHERE enabled=1 and `code`='qq'");
if (!empty($qqlogin) && !empty($qqlogin['id'])) {
    $showqqlogin = true;
}
include themePage('regedit');
Example #27
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 #28
0
            message(0, '', 'ajax');
        }
    }
} 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 {
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

$orderid = intval($_GP['id']);
$orders = mysqld_select("SELECT * FROM " . table('gold_order') . " WHERE id = :id", array(':id' => $orderid));
echo json_encode($orders);