Example #1
0
}
if (isset($_REQUEST['act']) && $_REQUEST['act'] == 'insert_dianpu') {
    $GLOBALS['db']->query("DELETE FROM " . $GLOBALS['ecs']->table('dianpu') . " WHERE user_id = '" . $_SESSION['user_id'] . "'");
    $dianpu_name = isset($_POST['dianpu_name']) ? $_POST['dianpu_name'] : '';
    $phone = isset($_POST['phone']) ? $_POST['phone'] : '';
    $sql = "INSERT INTO " . $GLOBALS['ecs']->table('dianpu') . "(`dianpu_name`,`phone`,`user_id`) values('{$dianpu_name}','{$phone}','" . $_SESSION['user_id'] . "')";
    $num = $GLOBALS['db']->query($sql);
    if ($num > 0) {
        show_message('店铺设置成功!', '返回分销中心', 'v_user.php');
    } else {
        ecs_header("Location: v_user_dianpu.php\n");
        exit;
    }
}
if (!$smarty->is_cached('v_user_dianpu.dwt', $cache_id)) {
    assign_template();
    $position = assign_ur_here();
    $smarty->assign('page_title', $position['title']);
    // 页面标题
    $smarty->assign('ur_here', $position['ur_here']);
    // 当前位置
    /* meta information */
    $smarty->assign('keywords', htmlspecialchars($_CFG['shop_keywords']));
    $smarty->assign('description', htmlspecialchars($_CFG['shop_desc']));
    $smarty->assign('user_info', get_user_info_by_user_id($_SESSION['user_id']));
    $smarty->assign('dianpu', get_dianpu_by_user_id($_SESSION['user_id']));
    $smarty->assign('user_id', $_SESSION['user_id']);
    /* 页面中的动态内容 */
    assign_dynamic('v_user_dianpu');
}
$smarty->display('v_user_dianpu.dwt', $cache_id);
Example #2
0
if (!$smarty->is_cached('v_shop.dwt', $cache_id)) {
    assign_template();
    $position = assign_ur_here();
    $smarty->assign('page_title', $position['title']);
    // 页面标题
    $smarty->assign('ur_here', $position['ur_here']);
    // 当前位置
    /* meta information */
    $smarty->assign('keywords', htmlspecialchars($_CFG['shop_keywords']));
    $smarty->assign('description', htmlspecialchars($_CFG['shop_desc']));
    $smarty->assign('user_info', get_user_info_by_user_id($user_id));
    $smarty->assign('goods_count', get_goods_count());
    $smarty->assign('cat_list', get_cat());
    $smarty->assign('goods_list', get_all_distrib_goods());
    $smarty->assign('user_id', $user_id);
    $smarty->assign('dp_info', get_dianpu_by_user_id($user_id));
    /* 页面中的动态内容 */
    assign_dynamic('v_shop');
}
$smarty->display('v_shop.dwt', $cache_id);
//获取分销商品数量
function get_goods_count()
{
    $sql = "SELECT COUNT(*) FROM " . $GLOBALS['ecs']->table('ecsmart_distrib_goods') . " WHERE distrib_time = 0 OR (start_time <= '" . gmtime() . "' AND end_time >= '" . gmtime() . "')";
    return $GLOBALS['db']->getOne($sql);
}
//获取所有分销商品
function get_all_distrib_goods()
{
    $sql = "SELECT g.goods_id,g.goods_name,g.goods_thumb,g.shop_price,g.market_price FROM " . $GLOBALS['ecs']->table('ecsmart_distrib_goods') . " as dg," . $GLOBALS['ecs']->table('goods') . " as g WHERE dg.goods_id = g.goods_id AND (dg.distrib_time = 0 OR (dg.start_time <='" . gmtime() . "' AND dg.end_time >= '" . gmtime() . "')) limit 10";
    $list = $GLOBALS['db']->getAll($sql);