예제 #1
0
 public function login()
 {
     $pass = _get('pass');
     $name = I('get.name');
     $arr = array("xx" => $pass, "name" => $name);
     \GZ_Api::outPut($arr);
     //        $out= json_encode($arr);
     //        exit($out);
     //$this->show('<style type="text/css">*{ padding: 0; margin: 0; } div{ padding: 4px 48px;} body{ background: #fff; font-family: "微软雅黑"; color: #333;font-size:24px} h1{ font-size: 100px; font-weight: normal; margin-bottom: 12px; } p{ line-height: 1.8em; font-size: 36px } a,a:hover,{color:blue;}</style><div style="padding: 24px 48px;"> <h1>:)</h1><p>欢迎使用 <b>ThinkPHP</b>!</p><br/>版本 V{$Think.version}</div><script type="text/javascript" src="http://ad.topthink.com/Public/static/client.js"></script><thinkad id="ad_55e75dfae343f5a1"></thinkad><script type="text/javascript" src="http://tajs.qq.com/stats?sId=9347272" charset="UTF-8"></script>','utf-8');
 }
예제 #2
0
 public static function init()
 {
     if (!empty($_POST['json'])) {
         if (get_magic_quotes_gpc()) {
             $_POST['json'] = stripslashes($_POST['json']);
         }
         $_POST = json_decode($_POST['json'], true);
     }
     self::$session = _POST('session', array());
     self::$pagination = _POST('pagination', array('page' => 1, 'count' => 10));
 }
예제 #3
0
 function display()
 {
     if (empty($this->vars) && empty($this->_var)) {
         return false;
     }
     if (isset($this->vars)) {
         $this->_var = $this->vars;
     }
     switch ($this->apiName) {
         // case 'search':
         // 	$data = array();
         // 	$data['goods'] = API_DATA("SIMPLEGOODS", $this->_var['goods_list']);
         // 	if (!empty($this->_var['pager'])) {
         // 		$pager = array(
         // 				"total"  => $this->_var['pager']['record_count'],
         // 				"count"  => count($this->_var['goods_list']),
         // 				"more"   => empty($this->_var['pager']['page_next']) ? 0 : 1
         // 		);
         // 	} else {
         // 		$pager = NULL;
         // 	}
         // 	GZ_Api::outPut($data, $pager);
         // 	break;
         case 'list':
             print_r($this->_var);
             exit;
             GZ_Api::outPut(API_DATA("SIMPLEORDER", $this->_var['orders']));
             break;
         case 'goods':
             print_r($this->_var['goods']);
             exit;
             break;
         default:
             print_r($this->_var);
             break;
     }
 }
예제 #4
0
        //请求业务参数详细
        $req_data = '<direct_trade_create_req><notify_url>' . $notify_url . '</notify_url><call_back_url>' . $call_back_url . '</call_back_url><seller_account_name>' . $seller_email . '</seller_account_name><out_trade_no>' . $out_trade_no . '</out_trade_no><subject>' . $subject . '</subject><total_fee>' . $total_fee . '</total_fee><merchant_url>' . $merchant_url . '</merchant_url></direct_trade_create_req>';
        $para_token = array("service" => "alipay.wap.trade.create.direct", "partner" => trim($alipay_config['partner']), "sec_id" => trim($alipay_config['sign_type']), "format" => $format, "v" => $v, "req_id" => $req_id, "req_data" => $req_data, "_input_charset" => trim(strtolower($alipay_config['input_charset'])));
        //建立请求
        $alipaySubmit = new AlipaySubmit($alipay_config);
        $html_text = $alipaySubmit->buildRequestHttp($para_token);
        $html_text = urldecode($html_text);
        //解析远程模拟提交后返回的信息
        $para_html_text = $alipaySubmit->parseResponse($html_text);
        //获取request_token
        $request_token = $para_html_text['request_token'];
        //业务详细
        $req_data = '<auth_and_execute_req><request_token>' . $request_token . '</request_token></auth_and_execute_req>';
        //构造要请求的参数数组,无需改动
        $parameter = array("service" => "alipay.wap.auth.authAndExecute", "partner" => trim($alipay_config['partner']), "sec_id" => trim($alipay_config['sign_type']), "format" => $format, "v" => $v, "req_id" => $req_id, "req_data" => $req_data, "_input_charset" => trim(strtolower($alipay_config['input_charset'])));
        //建立请求
        $alipaySubmit = new AlipaySubmit($alipay_config);
        $url = $alipaySubmit->alipay_gateway_new . $alipaySubmit->buildRequestParaToString($parameter);
        header("Location: {$url}");
        //$html_text = $alipaySubmit->buildRequestForm($parameter, 'get', '确认');
        //echo $html_text;
        break;
    default:
        GZ_Api::outPut(101);
        break;
}
function modify_config_path($alipay_config)
{
    $alipay_config['cacert'] = str_replace('/alipay', '/payment/alipay', $alipay_config['cacert']);
    return $alipay_config;
}
예제 #5
0
 *    One Park Place, Elmira College, NY, 14901, USA
 *
 *  QQ Group:   329673575
 *  BBS:        bbs.ecmobile.cn
 *  Fax:        +86-10-6561-5510
 *  Mail:       info@geek-zoo.com
 */
require EC_PATH . '/includes/init.php';
include_once EC_PATH . '/includes/lib_transaction.php';
$categoryGoods = array();
$category = get_categories_tree();
$category = array_merge($category);
//print_r($category);exit;
if (!empty($category)) {
    foreach ($category as $key => $val) {
        //$categoryGoods[$key][] = array(
        $categoryGoods[$key]['id'] = $val['id'];
        $categoryGoods[$key]['name'] = $val['name'];
        //);
        if (!empty($val['cat_id'])) {
            foreach ($val['cat_id'] as $k => $v) {
                $categoryGoods[$key]['children'][] = array('id' => $v['id'], 'name' => $v['name']);
            }
        } else {
            $categoryGoods[$key]['children'] = array();
        }
    }
}
// print_r($categoryGoods);exit;
GZ_Api::outPut($categoryGoods);
예제 #6
0
 *    _/          _/_/      _/_/    _/  _/          _/      _/_/      _/_/    
 *   _/  _/_/  _/_/_/_/  _/_/_/_/  _/_/          _/      _/    _/  _/    _/   
 *  _/    _/  _/        _/        _/  _/      _/        _/    _/  _/    _/    
 *   _/_/_/    _/_/_/    _/_/_/  _/    _/  _/_/_/_/_/    _/_/      _/_/       
 *                                                                          
 *
 *  Copyright 2013-2014, Geek Zoo Studio
 *  http://www.ecmobile.cn/license.html
 *
 *  HQ China:
 *    2319 Est.Tower Van Palace 
 *    No.2 Guandongdian South Street 
 *    Beijing , China
 *
 *  U.S. Office:
 *    One Park Place, Elmira College, NY, 14901, USA
 *
 *  QQ Group:   329673575
 *  BBS:        bbs.ecmobile.cn
 *  Fax:        +86-10-6561-5510
 *  Mail:       info@geek-zoo.com
 */
require EC_PATH . '/includes/init.php';
$sql = 'SELECT tag_words, COUNT(tag_id) AS tag_count' . ' FROM ' . $GLOBALS['ecs']->table('tag') . " GROUP BY tag_words ORDER BY tag_count DESC LIMIT 20";
$tags = $GLOBALS['db']->getAll($sql);
$data = array();
foreach ($tags as $val) {
    $data[] = $val['tag_words'];
}
GZ_Api::outPut($data);
예제 #7
0
 *
 *       _/_/_/                      _/        _/_/_/_/_/                     
 *    _/          _/_/      _/_/    _/  _/          _/      _/_/      _/_/    
 *   _/  _/_/  _/_/_/_/  _/_/_/_/  _/_/          _/      _/    _/  _/    _/   
 *  _/    _/  _/        _/        _/  _/      _/        _/    _/  _/    _/    
 *   _/_/_/    _/_/_/    _/_/_/  _/    _/  _/_/_/_/_/    _/_/      _/_/       
 *                                                                          
 *
 *  Copyright 2013-2014, Geek Zoo Studio
 *  http://www.ecmobile.cn/license.html
 *
 *  HQ China:
 *    2319 Est.Tower Van Palace 
 *    No.2 Guandongdian South Street 
 *    Beijing , China
 *
 *  U.S. Office:
 *    One Park Place, Elmira College, NY, 14901, USA
 *
 *  QQ Group:   329673575
 *  BBS:        bbs.ecmobile.cn
 *  Fax:        +86-10-6561-5510
 *  Mail:       info@geek-zoo.com
 */
define('INIT_NO_USERS', true);
require EC_PATH . '/includes/init.php';
GZ_Api::authSession();
include_once EC_PATH . '/includes/lib_order.php';
$user_info = GZ_user_info($_SESSION['user_id']);
GZ_Api::outPut($user_info);
예제 #8
0
 *    Beijing , China
 *
 *  U.S. Office:
 *    One Park Place, Elmira College, NY, 14901, USA
 *
 *  QQ Group:   329673575
 *  BBS:        bbs.ecmobile.cn
 *  Fax:        +86-10-6561-5510
 *  Mail:       info@geek-zoo.com
 */
define('INIT_NO_USERS', true);
require EC_PATH . '/includes/init.php';
GZ_Api::authSession();
include_once EC_PATH . '/includes/lib_transaction.php';
include_once EC_PATH . '/includes/lib_payment.php';
include_once EC_PATH . '/includes/lib_order.php';
include_once EC_PATH . '/includes/lib_clips.php';
$order_id = _POST('order_id', 0);
if (!$order_id) {
    GZ_Api::outPut(101);
}
$user_id = $_SESSION['user_id'];
/* 订单详情 */
$order = get_order_detail($order_id, $user_id);
if ($order === false) {
    GZ_Api::outPut(8);
}
$base = sprintf('<base href="%s/" />', dirname($GLOBALS['ecs']->url()));
$html = '<!DOCTYPE html><html><head><title></title><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><meta name="viewport" content="width=device-width, initial-scale=1.0">' . $base . '</head><body>%s</body></html>';
GZ_Api::outPut(array('data' => sprintf($html, $order['pay_online'])));
예제 #9
0
    $num = get_library_number("recommend_promotion");
    $sql = 'SELECT g.goods_id, g.goods_name, g.goods_name_style, g.market_price, g.shop_price AS org_price, g.promote_price, ' . "IFNULL(mp.user_price, g.shop_price * '{$_SESSION['discount']}') AS shop_price, " . "promote_start_date, promote_end_date, g.goods_brief, g.goods_thumb, goods_img, g.original_img, b.brand_name, " . "g.is_best, g.is_new, g.is_hot, g.is_promote, RAND() AS rnd " . 'FROM ' . $GLOBALS['ecs']->table('goods') . ' AS g ' . 'LEFT JOIN ' . $GLOBALS['ecs']->table('brand') . ' AS b ON b.brand_id = g.brand_id ' . "LEFT JOIN " . $GLOBALS['ecs']->table('member_price') . " AS mp " . "ON mp.goods_id = g.goods_id AND mp.user_rank = '{$_SESSION['user_rank']}' " . 'WHERE g.is_on_sale = 1 AND g.is_alone_sale = 1 AND g.is_delete = 0 ' . " AND g.is_promote = 1 AND promote_start_date <= '{$time}' AND promote_end_date >= '{$time}' ";
    $sql .= $order_type == 0 ? ' ORDER BY g.sort_order, g.last_update DESC' : ' ORDER BY rnd';
    $sql .= " LIMIT {$num} ";
    $result = $GLOBALS['db']->getAll($sql);
    $goods = array();
    foreach ($result as $idx => $row) {
        if ($row['promote_price'] > 0) {
            $promote_price = bargain_price($row['promote_price'], $row['promote_start_date'], $row['promote_end_date']);
            $goods[$idx]['promote_price'] = $promote_price > 0 ? price_format($promote_price) : '';
        } else {
            $goods[$idx]['promote_price'] = '';
        }
        $goods[$idx]['id'] = $row['goods_id'];
        $goods[$idx]['name'] = $row['goods_name'];
        $goods[$idx]['brief'] = $row['goods_brief'];
        $goods[$idx]['brand_name'] = $row['brand_name'];
        $goods[$idx]['goods_style_name'] = add_style($row['goods_name'], $row['goods_name_style']);
        $goods[$idx]['short_name'] = $GLOBALS['_CFG']['goods_name_length'] > 0 ? sub_str($row['goods_name'], $GLOBALS['_CFG']['goods_name_length']) : $row['goods_name'];
        $goods[$idx]['short_style_name'] = add_style($goods[$idx]['short_name'], $row['goods_name_style']);
        $goods[$idx]['market_price'] = price_format($row['market_price']);
        $goods[$idx]['shop_price'] = price_format($row['shop_price']);
        $goods[$idx]['goods_thumb'] = get_image_path($row['goods_id'], $row['goods_thumb'], true);
        $goods[$idx]['goods_img'] = get_image_path($row['goods_id'], $row['goods_img']);
        $goods[$idx]['original_img'] = get_image_path($row['goods_id'], $row['original_img']);
        $goods[$idx]['url'] = build_uri('goods', array('gid' => $row['goods_id']), $row['goods_name']);
    }
    return $goods;
}
GZ_Api::outPut($flash_arr);
예제 #10
0
$url_format .= "&amp;min_price=" . $_REQUEST['min_price'] . "&amp;max_price=" . $_REQUEST['max_price'] . "&amp;sort={$sort}";
$url_format .= "{$attr_url}&amp;order={$order}&amp;page=";
$pager['search'] = array('keywords' => stripslashes(urlencode($_REQUEST['keywords'])), 'category' => $category, 'brand' => $brand, 'sort' => $sort, 'order' => $order, 'min_price' => $_REQUEST['min_price'], 'max_price' => $_REQUEST['max_price'], 'action' => $action, 'intro' => empty($intromode) ? '' : trim($intromode), 'goods_type' => $_REQUEST['goods_type'], 'sc_ds' => $_REQUEST['sc_ds'], 'outstock' => $_REQUEST['outstock']);
$pager['search'] = array_merge($pager['search'], $attr_arg);
$pager = get_pager('search.php', $pager['search'], $count, $page, $size);
$pager['display'] = $display;
$smarty->assign('url_format', $url_format);
$smarty->assign('pager', $pager);
assign_template();
assign_dynamic('search');
$position = assign_ur_here(0, $ur_here . ($_REQUEST['keywords'] ? '_' . $_REQUEST['keywords'] : ''));
$smarty->assign('page_title', $position['title']);
// 页面标题
$smarty->assign('ur_here', $position['ur_here']);
// 当前位置
$smarty->assign('intromode', $intromode);
$smarty->assign('categories', get_categories_tree());
// 分类树
$smarty->assign('helps', get_shop_help());
// 网店帮助
$smarty->assign('top_goods', get_top10());
// 销售排行
$smarty->assign('promotion_info', get_promotion_info());
$data = API_DATA("SIMPLEGOODS", $smarty->_var['goods_list']);
if (!empty($smarty->_var['pager'])) {
    $pager = array("total" => $smarty->_var['pager']['record_count'], "count" => count($smarty->_var['goods_list']), "more" => empty($smarty->_var['pager']['page_next']) ? 0 : 1);
} else {
    $pager = NULL;
}
GZ_Api::outPut($data, $pager);
예제 #11
0
/**
 * 检查订单中商品库存
 *
 * @access  public
 * @param   array   $arr
 *
 * @return  void
 */
function flow_cart_stock($arr)
{
    foreach ($arr as $key => $val) {
        $val = intval(make_semiangle($val));
        if ($val <= 0 || !is_numeric($key)) {
            continue;
        }
        $sql = "SELECT `goods_id`, `goods_attr_id`, `extension_code` FROM" . $GLOBALS['ecs']->table('cart') . " WHERE rec_id='{$key}' AND session_id='" . SESS_ID . "'";
        $goods = $GLOBALS['db']->getRow($sql);
        $sql = "SELECT g.goods_name, g.goods_number, c.product_id " . "FROM " . $GLOBALS['ecs']->table('goods') . " AS g, " . $GLOBALS['ecs']->table('cart') . " AS c " . "WHERE g.goods_id = c.goods_id AND c.rec_id = '{$key}'";
        $row = $GLOBALS['db']->getRow($sql);
        //系统启用了库存,检查输入的商品数量是否有效
        if (intval($GLOBALS['_CFG']['use_storage']) > 0 && $goods['extension_code'] != 'package_buy') {
            if ($row['goods_number'] < $val) {
                GZ_Api::outPut(10008);
                exit;
            }
            /* 是货品 */
            $row['product_id'] = trim($row['product_id']);
            if (!empty($row['product_id'])) {
                $sql = "SELECT product_number FROM " . $GLOBALS['ecs']->table('products') . " WHERE goods_id = '" . $goods['goods_id'] . "' AND product_id = '" . $row['product_id'] . "'";
                $product_number = $GLOBALS['db']->getOne($sql);
                if ($product_number < $val) {
                    GZ_Api::outPut(10005);
                    exit;
                }
            }
        } elseif (intval($GLOBALS['_CFG']['use_storage']) > 0 && $goods['extension_code'] == 'package_buy') {
            if (judge_package_stock($goods['goods_id'], $val)) {
                GZ_Api::outPut(10005);
                exit;
            }
        }
    }
}
예제 #12
0
 *    2319 Est.Tower Van Palace 
 *    No.2 Guandongdian South Street 
 *    Beijing , China
 *
 *  U.S. Office:
 *    One Park Place, Elmira College, NY, 14901, USA
 *
 *  QQ Group:   329673575
 *  BBS:        bbs.ecmobile.cn
 *  Fax:        +86-10-6561-5510
 *  Mail:       info@geek-zoo.com
 */
require EC_PATH . '/includes/init.php';
$id = _POST('article_id', 0);
if (empty($id)) {
    GZ_Api::outPut(101);
}
if (!($article = get_article_info($id))) {
    GZ_Api::outPut(13);
}
function get_article_info($article_id)
{
    /* 获得文章的信息 */
    $sql = "SELECT a.article_id as id, a.title, a.content " . "FROM " . $GLOBALS['ecs']->table('article') . " AS a " . "WHERE a.is_open = 1 AND a.article_id = '{$article_id}'";
    $row = $GLOBALS['db']->getRow($sql);
    return $row;
}
$base = sprintf('<base href="%s/" />', dirname($GLOBALS['ecs']->url()));
$html = '<!DOCTYPE html><html><head><title>' . $article['title'] . '</title><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><meta name="viewport" content="width=device-width, initial-scale=1.0"><style>img {width: auto\\9;height: auto;vertical-align: middle;border: 0;-ms-interpolation-mode: bicubic;max-width: 100%; }html { font-size:100%; } </style>' . $base . '</head><body>' . $article['content'] . '</body></html>';
GZ_Api::outPut(array('data' => $html));
예제 #13
0
 *
 *  U.S. Office:
 *    One Park Place, Elmira College, NY, 14901, USA
 *
 *  QQ Group:   329673575
 *  BBS:        bbs.ecmobile.cn
 *  Fax:        +86-10-6561-5510
 *  Mail:       info@geek-zoo.com
 */
define('INIT_NO_USERS', true);
require EC_PATH . '/includes/init.php';
GZ_Api::authSession();
include_once EC_PATH . '/includes/lib_transaction.php';
include_once EC_PATH . '/includes/lib_order.php';
$order_id = _POST('order_id', 0);
if (!$order_id) {
    GZ_Api::outPut(101);
}
$user_id = $_SESSION['user_id'];
/* 订单详情 */
$order = get_order_detail($order_id, $user_id);
$order_time = _POST('order_time');
if ($order['pay_id'] > 0) {
    $payment = payment_info($order['pay_id']);
}
if ($payment['pay_code'] == "upop") {
    include_once GZ_PATH . '/payment/UPMP/upop_mobile.php';
    $upop = new UPOP_MOBILE();
    $pay_result = $upop->query($order, $payment, $order_time);
    GZ_Api::outPut($pay_result);
}
예제 #14
0
<?php

error_reporting(E_ALL);
define('GZ_PATH', dirname(__FILE__));
define('EC_PATH', dirname(GZ_PATH));
// define('INIT_NO_SMARTY', true);
require GZ_PATH . '/library/function.php';
spl_autoload_register('gz_autoload');
GZ_Api::init();
$url = _GET('url');
$controller = 'index';
$tmp = $url ? array_filter(explode('/', $url)) : array();
$path = GZ_PATH . '/controller';
$payment = _GET('payment');
if ($payment) {
    $path = GZ_PATH . '/payment';
    $tmp = $payment ? array_filter(explode('/', $payment)) : array();
}
$tmp = array_values($tmp);
//reset($tmp);
$count = count($tmp);
for ($i = 0; $i < $count; $i++) {
    if (!is_dir($path . '/' . $tmp[$i])) {
        break;
    }
    $path .= '/' . $tmp[$i];
}
if (isset($tmp[$i])) {
    $controller = $tmp[$i];
    $i++;
}
예제 #15
0
    $order_detail = get_order_detail($value['order_id'], $user_id);
    $orders[$key]['formated_integral_money'] = $order_detail['formated_integral_money'];
    //积分 钱
    $orders[$key]['formated_bonus'] = $order_detail['formated_bonus'];
    //红包 钱
    $orders[$key]['formated_shipping_fee'] = $order_detail['formated_shipping_fee'];
    //运送费
    if ($order_detail['pay_id'] > 0) {
        $payment = payment_info($order_detail['pay_id']);
    }
    $subject = $orders[$key]['goods_list'][0]['name'] . '等' . count($orders[$key]['goods_list']) . '种商品';
    $orders[$key]['order_info'] = array('pay_code' => $payment['pay_code'], 'order_amount' => $order_detail['order_amount'], 'order_id' => $order_detail['order_id'], 'subject' => $subject, 'desc' => $subject, 'order_sn' => $order_detail['order_sn']);
}
// print_r($orders);exit;
$pagero = array("total" => $pager['record_count'], "count" => count($orders), "more" => empty($pager['page_next']) ? 0 : 1);
GZ_Api::outPut($orders, $pagero);
////function
/**
 *  获取用户指定范围的订单列表
 *
 * @access  public
 * @param   int         $user_id        用户ID号
 * @param   int         $num            列表最大数量
 * @param   int         $start          列表起始位置
 * @return  array       $order_list     订单列表
 */
function GZ_get_user_orders($user_id, $num = 10, $start = 0, $type = 'await_pay')
{
    /* 取得订单列表 */
    $arr = array();
    $sql = "SELECT order_id, order_sn, order_status, shipping_status, pay_status, add_time, " . "(goods_amount + shipping_fee + insure_fee + pay_fee + pack_fee + card_fee + tax - discount) AS total_fee " . " FROM " . $GLOBALS['ecs']->table('order_info') . " WHERE user_id = '{$user_id}' " . GZ_order_query_sql($type) . " ORDER BY add_time DESC";
예제 #16
0
파일: function.php 프로젝트: u0mo5/app
/**
 * 注册手机号用户
 */
function GZ_signup($mobile)
{
    $username = $mobile;
    $password = $mobile;
    $email = $mobile . "@chanmaott.com";
    $fileld = array();
    if ($_CFG['shop_reg_closed']) {
        GZ_Api::outPut(11);
    }
    $other = array();
    $filelds = array();
    foreach ($fileld as $val) {
        $filelds[$val['id']] = $val['value'];
    }
    $other['msn'] = isset($filelds[1]) ? $filelds[1] : '';
    $other['qq'] = isset($filelds[2]) ? $filelds[2] : '';
    $other['office_phone'] = isset($filelds[3]) ? $filelds[3] : '';
    $other['home_phone'] = isset($filelds[4]) ? $filelds[4] : '';
    $other['mobile_phone'] = isset($filelds[5]) ? $mobile : $mobile;
    //先不要邮箱
    if (register($username, $password, $email, $other) === false) {
        GZ_Api::outPut(11);
    }
    /*把新注册用户的扩展信息插入数据库*/
    $sql = 'SELECT id FROM ' . $GLOBALS['ecs']->table('reg_fields') . ' WHERE type = 0 AND display = 1 ORDER BY dis_order, id';
    //读出所有自定义扩展字段的id
    $fields_arr = $GLOBALS['db']->getAll($sql);
    $extend_field_str = '';
    //生成扩展字段的内容字符串
    foreach ($fields_arr as $val) {
        $extend_field_index = $val['id'];
        if (!empty($filelds[$extend_field_index])) {
            $temp_field_content = strlen($filelds[$extend_field_index]) > 100 ? mb_substr($filelds[$extend_field_index], 0, 99) : $filelds[$extend_field_index];
            $extend_field_str .= " ('" . $_SESSION['user_id'] . "', '" . $val['id'] . "', '" . $temp_field_content . "'),";
        }
    }
    $extend_field_str = substr($extend_field_str, 0, -1);
    if ($extend_field_str) {
        $sql = 'INSERT INTO ' . $GLOBALS['ecs']->table('reg_extend_info') . ' (`user_id`, `reg_field_id`, `content`) VALUES' . $extend_field_str;
        $GLOBALS['db']->query($sql);
    }
    //app帐号初次登录 去掉密码
    $field_password = array("password" => "");
    $GLOBALS['db']->autoExecute($GLOBALS['ecs']->table('users'), $field_password, 'UPDATE', 'user_id = ' . $_SESSION['user_id']);
    // 		$user_info = GZ_user_info($_SESSION['user_id']);
    $out = array('session' => array('sid' => SESS_ID . $GLOBALS['sess']->gen_session_key(SESS_ID), 'uid' => $_SESSION['user_id']));
    return $out;
}
예제 #17
0
 *    _/          _/_/      _/_/    _/  _/          _/      _/_/      _/_/    
 *   _/  _/_/  _/_/_/_/  _/_/_/_/  _/_/          _/      _/    _/  _/    _/   
 *  _/    _/  _/        _/        _/  _/      _/        _/    _/  _/    _/    
 *   _/_/_/    _/_/_/    _/_/_/  _/    _/  _/_/_/_/_/    _/_/      _/_/       
 *                                                                          
 *
 *  Copyright 2013-2014, Geek Zoo Studio
 *  http://www.ecmobile.cn/license.html
 *
 *  HQ China:
 *    2319 Est.Tower Van Palace 
 *    No.2 Guandongdian South Street 
 *    Beijing , China
 *
 *  U.S. Office:
 *    One Park Place, Elmira College, NY, 14901, USA
 *
 *  QQ Group:   329673575
 *  BBS:        bbs.ecmobile.cn
 *  Fax:        +86-10-6561-5510
 *  Mail:       info@geek-zoo.com
 */
require EC_PATH . '/includes/init.php';
$sql = 'SELECT * FROM ' . $ecs->table('reg_fields') . ' WHERE type < 2 AND display = 1 AND id != 6 ORDER BY dis_order, id';
$extend_info_list = $db->getAll($sql);
$out = array();
foreach ($extend_info_list as $val) {
    $out[] = array('id' => $val['id'], 'name' => $val['reg_field_name'], 'need' => $val['is_need']);
}
GZ_Api::outPut($out);
예제 #18
0
 *
 *  QQ Group:   329673575
 *  BBS:        bbs.ecmobile.cn
 *  Fax:        +86-10-6561-5510
 *  Mail:       info@geek-zoo.com
 */
require EC_PATH . '/includes/init.php';
$goods_id = _POST('goods_id', 0);
if (!$goods_id) {
    GZ_Api::outPut(101);
}
$page_size = GZ_Api::$pagination['count'];
$page = GZ_Api::$pagination['page'];
//0评论的是商品,1评论的是文章
$out = GZ_assign_comment($goods_id, 0, $page, $page_size);
GZ_Api::outPut($out['comments'], $out['pager']);
/**
 * 查询评论内容
 *
 * @access  public
 * @params  integer     $id
 * @params  integer     $type
 * @params  integer     $page
 * @return  array
 */
function GZ_assign_comment($id, $type, $page = 1, $page_size = 10)
{
    /* 取得评论列表 */
    $count = $GLOBALS['db']->getOne('SELECT COUNT(*) FROM ' . $GLOBALS['ecs']->table('comment') . " WHERE id_value = '{$id}' AND comment_type = '{$type}' AND status = 1 AND parent_id = 0");
    $page_count = $count > 0 ? intval(ceil($count / $page_size)) : 1;
    $sql = 'SELECT * FROM ' . $GLOBALS['ecs']->table('comment') . " WHERE id_value = '{$id}' AND comment_type = '{$type}' AND status = 1 AND parent_id = 0" . ' ORDER BY comment_id DESC';
예제 #19
0
 *   _/_/_/    _/_/_/    _/_/_/  _/    _/  _/_/_/_/_/    _/_/      _/_/       
 *                                                                          
 *
 *  Copyright 2013-2014, Geek Zoo Studio
 *  http://www.ecmobile.cn/license.html
 *
 *  HQ China:
 *    2319 Est.Tower Van Palace 
 *    No.2 Guandongdian South Street 
 *    Beijing , China
 *
 *  U.S. Office:
 *    One Park Place, Elmira College, NY, 14901, USA
 *
 *  QQ Group:   329673575
 *  BBS:        bbs.ecmobile.cn
 *  Fax:        +86-10-6561-5510
 *  Mail:       info@geek-zoo.com
 */
define('INIT_NO_USERS', true);
require EC_PATH . '/includes/init.php';
GZ_Api::authSession();
include_once EC_PATH . '/includes/lib_transaction.php';
include_once EC_PATH . '/includes/lib_order.php';
$user_id = $_SESSION['user_id'];
$order_id = _POST('order_id', 0);
if (cancel_order($order_id, $user_id)) {
    GZ_Api::outPut(array());
} else {
    GZ_Api::outPut(8);
}
예제 #20
0
define('PHP_SELF', $php_self);
// 通用包含文件
require ROOT_PATH . 'data/config.php';
require ROOT_PATH . 'includes/lib_common.php';
require ROOT_PATH . 'includes/cls_mysql.php';
/* 兼容ECShopV2.5.1版本载入库文件 */
if (!function_exists('addslashes_deep')) {
    require ROOT_PATH . 'includes/lib_base.php';
}
/* 兼容ECShopV2.5.1版本 */
if (!defined('EC_CHARSET')) {
    define('EC_CHARSET', 'utf-8');
}
/* 初始化包含文件 */
require ROOT_PATH . 'includes/inc_constant.php';
require ROOT_PATH . 'includes/cls_ecshop.php';
require ROOT_PATH . 'includes/lib_time.php';
require ROOT_PATH . 'includes/lib_main.php';
require ROOT_PATH . 'includes/lib_insert.php';
require ROOT_PATH . 'includes/lib_goods.php';
/* 创建 ECSHOP 对象 */
$ecs = new ECS($db_name, $prefix);
/* 初始化数据库类 */
$db = new cls_mysql($db_host, $db_user, $db_pass, $db_name);
$db->set_disable_cache_tables(array($ecs->table('sessions'), $ecs->table('sessions_data'), $ecs->table('cart')));
$db_host = $db_user = $db_pass = $db_name = NULL;
/* 载入系统参数 */
$_CFG = load_config();
$data = array('service_phone' => $_CFG['service_phone'], 'site_url' => dirname($GLOBALS['ecs']->url()), 'goods_url' => dirname($GLOBALS['ecs']->url()) . '/goods.php?id=', 'shop_closed' => $_CFG['shop_closed'], 'close_comment' => $_CFG['close_comment'], 'shop_reg_closed' => $_CFG['shop_reg_closed'], 'shop_desc' => $_CFG['shop_desc'], 'currency_format' => $_CFG['currency_format'], "time_format" => $_CFG['time_format']);
GZ_Api::outPut(array('data' => $data));
예제 #21
0
 *    No.2 Guandongdian South Street 
 *    Beijing , China
 *
 *  U.S. Office:
 *    One Park Place, Elmira College, NY, 14901, USA
 *
 *  QQ Group:   329673575
 *  BBS:        bbs.ecmobile.cn
 *  Fax:        +86-10-6561-5510
 *  Mail:       info@geek-zoo.com
 */
define('INIT_NO_USERS', true);
require EC_PATH . '/includes/init.php';
GZ_Api::authSession();
include_once EC_PATH . '/includes/lib_transaction.php';
$address_id = _POST('address_id', 0);
if (empty($address_id)) {
    GZ_Api::outPut(101);
}
$sql = "SELECT * FROM " . $GLOBALS['ecs']->table('user_address') . " WHERE address_id = '{$address_id}'";
$arr = $GLOBALS['db']->getRow($sql);
if (empty($arr)) {
    GZ_Api::outPut(8);
}
/* 保存到session */
$_SESSION['flow_consignee'] = stripslashes_deep($arr);
$address = array('address_id' => $address_id);
$sql = "UPDATE " . $GLOBALS['ecs']->table('users') . " SET address_id = '{$address_id}' WHERE user_id = '{$_SESSION['user_id']}'";
$res = $GLOBALS['db']->query($sql);
GZ_Api::outPut(array());
예제 #22
0
/**
 * 更新购物车中的商品数量
 *
 * @access  public
 * @param   array   $arr
 * @return  void
 */
function flow_update_cart($arr)
{
    /* 处理 */
    foreach ($arr as $key => $val) {
        $val = intval(make_semiangle($val));
        if ($val <= 0 || !is_numeric($key)) {
            continue;
        }
        //查询:
        $sql = "SELECT `goods_id`, `goods_attr_id`, `product_id`, `extension_code` FROM" . $GLOBALS['ecs']->table('cart') . " WHERE rec_id='{$key}' AND session_id='" . SESS_ID . "'";
        $goods = $GLOBALS['db']->getRow($sql);
        $sql = "SELECT g.goods_name, g.goods_number " . "FROM " . $GLOBALS['ecs']->table('goods') . " AS g, " . $GLOBALS['ecs']->table('cart') . " AS c " . "WHERE g.goods_id = c.goods_id AND c.rec_id = '{$key}'";
        $row = $GLOBALS['db']->getRow($sql);
        //查询:系统启用了库存,检查输入的商品数量是否有效
        if (intval($GLOBALS['_CFG']['use_storage']) > 0 && $goods['extension_code'] != 'package_buy') {
            if ($row['goods_number'] < $val) {
                GZ_Api::outPut(10008);
                exit;
            }
            /* 是货品 */
            $goods['product_id'] = trim($goods['product_id']);
            if (!empty($goods['product_id'])) {
                $sql = "SELECT product_number FROM " . $GLOBALS['ecs']->table('products') . " WHERE goods_id = '" . $goods['goods_id'] . "' AND product_id = '" . $goods['product_id'] . "'";
                $product_number = $GLOBALS['db']->getOne($sql);
                if ($product_number < $val) {
                    GZ_Api::outPut(10008);
                    exit;
                }
            }
        } elseif (intval($GLOBALS['_CFG']['use_storage']) > 0 && $goods['extension_code'] == 'package_buy') {
            if (judge_package_stock($goods['goods_id'], $val)) {
                GZ_Api::outPut(10008);
                exit;
            }
        }
        /* 查询:检查该项是否为基本件 以及是否存在配件 */
        /* 此处配件是指添加商品时附加的并且是设置了优惠价格的配件 此类配件都有parent_id goods_number为1 */
        $sql = "SELECT b.goods_number, b.rec_id\n                FROM " . $GLOBALS['ecs']->table('cart') . " a, " . $GLOBALS['ecs']->table('cart') . " b\n                WHERE a.rec_id = '{$key}'\n                AND a.session_id = '" . SESS_ID . "'\n                AND a.extension_code <> 'package_buy'\n                AND b.parent_id = a.goods_id\n                AND b.session_id = '" . SESS_ID . "'";
        $offers_accessories_res = $GLOBALS['db']->query($sql);
        //订货数量大于0
        if ($val > 0) {
            /* 判断是否为超出数量的优惠价格的配件 删除*/
            $row_num = 1;
            while ($offers_accessories_row = $GLOBALS['db']->fetchRow($offers_accessories_res)) {
                if ($row_num > $val) {
                    $sql = "DELETE FROM " . $GLOBALS['ecs']->table('cart') . " WHERE session_id = '" . SESS_ID . "' " . "AND rec_id = '" . $offers_accessories_row['rec_id'] . "' LIMIT 1";
                    $GLOBALS['db']->query($sql);
                }
                $row_num++;
            }
            /* 处理超值礼包 */
            if ($goods['extension_code'] == 'package_buy') {
                //更新购物车中的商品数量
                $sql = "UPDATE " . $GLOBALS['ecs']->table('cart') . " SET goods_number = '{$val}' WHERE rec_id='{$key}' AND session_id='" . SESS_ID . "'";
            } else {
                $attr_id = empty($goods['goods_attr_id']) ? array() : explode(',', $goods['goods_attr_id']);
                $goods_price = get_final_price($goods['goods_id'], $val, true, $attr_id);
                //更新购物车中的商品数量
                $sql = "UPDATE " . $GLOBALS['ecs']->table('cart') . " SET goods_number = '{$val}', goods_price = '{$goods_price}' WHERE rec_id='{$key}' AND session_id='" . SESS_ID . "'";
            }
        } else {
            /* 如果是基本件并且有优惠价格的配件则删除优惠价格的配件 */
            while ($offers_accessories_row = $GLOBALS['db']->fetchRow($offers_accessories_res)) {
                $sql = "DELETE FROM " . $GLOBALS['ecs']->table('cart') . " WHERE session_id = '" . SESS_ID . "' " . "AND rec_id = '" . $offers_accessories_row['rec_id'] . "' LIMIT 1";
                $GLOBALS['db']->query($sql);
            }
            $sql = "DELETE FROM " . $GLOBALS['ecs']->table('cart') . " WHERE rec_id='{$key}' AND session_id='" . SESS_ID . "'";
        }
        $GLOBALS['db']->query($sql);
    }
    /* 删除所有赠品 */
    $sql = "DELETE FROM " . $GLOBALS['ecs']->table('cart') . " WHERE session_id = '" . SESS_ID . "' AND is_gift <> 0";
    $GLOBALS['db']->query($sql);
}
예제 #23
0
$consignee = get_consignee($user_id);
// 取得默认地址
$result = array();
foreach ($consignee_list as $key => $value) {
    $result[$key]['id'] = $value['address_id'];
    $result[$key]['consignee'] = $value['consignee'];
    $result[$key]['address'] = $value['address'];
    $country = $value['country'];
    $sql1 = "SELECT * FROM " . $GLOBALS['ecs']->table('region') . " WHERE region_id = '{$country}'";
    $country = $GLOBALS['db']->getAll($sql1);
    $result[$key]['country_name'] = $country[0]['region_name'];
    $province = $value['province'];
    $sql2 = "SELECT * FROM " . $GLOBALS['ecs']->table('region') . " WHERE region_id = '{$province}'";
    $province = $GLOBALS['db']->getAll($sql2);
    $result[$key]['province_name'] = $province[0]['region_name'];
    $city = $value['city'];
    $sql3 = "SELECT * FROM " . $GLOBALS['ecs']->table('region') . " WHERE region_id = '{$city}'";
    $city = $GLOBALS['db']->getAll($sql3);
    $result[$key]['city_name'] = $city[0]['region_name'];
    $district = $value['district'];
    $sql4 = "SELECT * FROM " . $GLOBALS['ecs']->table('region') . " WHERE region_id = '{$district}'";
    $district = $GLOBALS['db']->getAll($sql4);
    $result[$key]['district_name'] = $district[0]['region_name'];
    if ($value['address_id'] == $consignee['address_id']) {
        $result[$key]['default_address'] = 1;
    } else {
        $result[$key]['default_address'] = 0;
    }
}
GZ_Api::outPut($result);
예제 #24
0
$data['collected'] = 0;
if (!empty($tmp[0]) && $tmp[0] == 'desc') {
    $base = sprintf('<base href="%s/" />', dirname($GLOBALS['ecs']->url()));
    $html = '<!DOCTYPE html><html><head><title>' . $data['goods_name'] . '</title><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><meta name="viewport" content="width=device-width, initial-scale=0.4"><meta name="viewport" content="initial-scale = 0.4 , minimum-scale = 0.4 , maximum-scale = 1.0" /><style>img {width: auto\\9;height: auto;vertical-align: middle;border: 0;-ms-interpolation-mode: bicubic;max-width: 100%; }html { font-size:100%; } </style>' . $base . '</head><body>' . $data['goods_desc'] . '</body></html>';
    // print_r($html);exit;
    GZ_Api::outPut(array('data' => $html));
} else {
    if (GZ_Api::$session['uid']) {
        // 查询收藏夹状态
        $sql = "SELECT COUNT(*) FROM " . $GLOBALS['ecs']->table('collect_goods') . " WHERE user_id='{$_SESSION['user_id']}' AND goods_id = '{$goods_id}'";
        if ($GLOBALS['db']->GetOne($sql) > 0) {
            $data['collected'] = 1;
        }
    }
    // print_r($data);exit;
    GZ_Api::outPut(API_DATA('GOODS', $data));
}
function gz_get_goods_gallery($goods_id)
{
    $sql = 'SELECT img_id, img_url, thumb_url, img_desc, img_original' . ' FROM ' . $GLOBALS['ecs']->table('goods_gallery') . " WHERE goods_id = '{$goods_id}' LIMIT " . $GLOBALS['_CFG']['goods_gallery_number'];
    $row = $GLOBALS['db']->getAll($sql);
    /* 格式化相册图片路径 */
    foreach ($row as $key => $gallery_img) {
        $row[$key]['img_url'] = get_image_path($goods_id, $gallery_img['img_original'], false, 'gallery');
        $row[$key]['thumb_url'] = get_image_path($goods_id, $gallery_img['img_url'], true, 'gallery');
    }
    return $row;
}
/**
 * 获得指定商品的关联文章
 *