本文整理汇总了PHP中get_snatch_result函数的典型用法代码示例。如果您正苦于以下问题:PHP get_snatch_result函数的具体用法?PHP get_snatch_result怎么用?PHP get_snatch_result使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_snatch_result函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: show_message
}
if (empty($_SESSION['user_id'])) {
show_message($_LANG['not_login']);
}
$snatch = get_snatch($id);
if (empty($snatch)) {
ecs_header("Location: ./\n");
exit;
}
/* 未结束,不能购买 */
if (empty($snatch['is_end'])) {
$page = build_uri('snatch', array('sid' => $id));
ecs_header("Location: {$page}\n");
exit;
}
$result = get_snatch_result($id);
if ($_SESSION['user_id'] != $result['user_id']) {
show_message($_LANG['not_for_you']);
}
//检查是否已经购买过
if ($result['order_count'] > 0) {
show_message($_LANG['order_placed']);
}
/* 处理规格属性 */
$goods_attr = '';
$goods_attr_id = '';
if ($snatch['product_id'] > 0) {
$product_info = get_good_products($snatch['goods_id'], 'AND product_id = ' . $snatch['product_id']);
$goods_attr_id = str_replace('|', ',', $product_info[0]['goods_attr']);
$attr_list = array();
$sql = "SELECT a.attr_name, g.attr_value " . "FROM " . $ecs->table('goods_attr') . " AS g, " . $ecs->table('attribute') . " AS a " . "WHERE g.attr_id = a.attr_id " . "AND g.goods_attr_id " . db_create_in($goods_attr_id);
示例2: get_user_prompt
/**
* 获取用户参与活动信息.
*
* @param int $user_id 用户id
*
* @return array
*/
function get_user_prompt($user_id)
{
$prompt = array();
$now = gmtime();
/* 夺宝奇兵 */
$sql = 'SELECT act_id, goods_name, end_time ' . 'FROM ' . $GLOBALS['ecs']->table('goods_activity') . " WHERE act_type = '" . GAT_SNATCH . "'" . " AND (is_finished = 1 OR (is_finished = 0 AND end_time <= '{$now}'))";
$res = $GLOBALS['db']->query($sql);
while ($row = $GLOBALS['db']->fetchRow($res)) {
$act_id = $row['act_id'];
$result = get_snatch_result($act_id);
if (isset($result['order_count']) && $result['order_count'] == 0 && $result['user_id'] == $user_id) {
$prompt[] = array('text' => sprintf($GLOBALS['_LANG']['your_snatch'], $row['goods_name'], $row['act_id']), 'add_time' => $row['end_time']);
}
if (isset($auction['last_bid']) && $auction['last_bid']['bid_user'] == $user_id && $auction['order_count'] == 0) {
$prompt[] = array('text' => sprintf($GLOBALS['_LANG']['your_auction'], $row['goods_name'], $row['act_id']), 'add_time' => $row['end_time']);
}
}
/* 竞拍 */
$sql = 'SELECT act_id, goods_name, end_time ' . 'FROM ' . $GLOBALS['ecs']->table('goods_activity') . " WHERE act_type = '" . GAT_AUCTION . "'" . " AND (is_finished = 1 OR (is_finished = 0 AND end_time <= '{$now}'))";
$res = $GLOBALS['db']->query($sql);
while ($row = $GLOBALS['db']->fetchRow($res)) {
$act_id = $row['act_id'];
$auction = auction_info($act_id);
if (isset($auction['last_bid']) && $auction['last_bid']['bid_user'] == $user_id && $auction['order_count'] == 0) {
$prompt[] = array('text' => sprintf($GLOBALS['_LANG']['your_auction'], $row['goods_name'], $row['act_id']), 'add_time' => $row['end_time']);
}
}
/* 排序 */
$cmp = create_function('$a, $b', 'if($a["add_time"] == $b["add_time"]){return 0;};return $a["add_time"] < $b["add_time"] ? 1 : -1;');
usort($prompt, $cmp);
/* 格式化时间 */
foreach ($prompt as $key => $val) {
$prompt[$key]['formated_time'] = local_date($GLOBALS['_CFG']['time_format'], $val['add_time']);
}
return $prompt;
}
示例3: sys_msg
sys_msg($_LANG['edit_succeed'], 0, $link);
} elseif ($_REQUEST['act'] == 'view') {
/* 权限判断 */
admin_priv('snatch_manage');
$id = empty($_REQUEST['snatch_id']) ? 0 : intval($_REQUEST['snatch_id']);
$bid_list = get_snatch_detail();
$smarty->assign('bid_list', $bid_list['bid']);
$smarty->assign('filter', $bid_list['filter']);
$smarty->assign('record_count', $bid_list['record_count']);
$smarty->assign('page_count', $bid_list['page_count']);
$sort_flag = sort_flag($bid_list['filter']);
$smarty->assign($sort_flag['tag'], $sort_flag['img']);
/* 赋值 */
$smarty->assign('info', get_snatch_info($id));
$smarty->assign('full_page', 1);
$smarty->assign('result', get_snatch_result($id));
$smarty->assign('ur_here', $_LANG['view_detail']);
$smarty->assign('action_link', array('text' => $_LANG['02_snatch_list'], 'href' => 'snatch.php?act=list'));
$smarty->display('snatch_view.htm');
} elseif ($_REQUEST['act'] == 'query_bid') {
$bid_list = get_snatch_detail();
$smarty->assign('bid_list', $bid_list['bid']);
$smarty->assign('filter', $bid_list['filter']);
$smarty->assign('record_count', $bid_list['record_count']);
$smarty->assign('page_count', $bid_list['page_count']);
$sort_flag = sort_flag($bid_list['filter']);
$smarty->assign($sort_flag['tag'], $sort_flag['img']);
make_json_result($smarty->fetch('snatch_view.htm'), '', array('filter' => $bid_list['filter'], 'page_count' => $bid_list['page_count']));
} elseif ($_REQUEST['act'] == 'search_goods') {
include_once ROOT_PATH . 'includes/cls_json.php';
$json = new JSON();