if ($is_add) { $links = array(array('href' => 'auction.php?act=add', 'text' => $_LANG['continue_add_auction']), array('href' => 'auction.php?act=list', 'text' => $_LANG['back_auction_list'])); sys_msg($_LANG['add_auction_ok'], 0, $links); } else { $links = array(array('href' => 'auction.php?act=list&' . list_link_postfix(), 'text' => $_LANG['back_auction_list'])); sys_msg($_LANG['edit_auction_ok'], 0, $links); } } elseif ($_REQUEST['act'] == 'settle_money') { /* 检查权限 */ admin_priv('auction'); /* 检查参数 */ if (empty($_POST['id'])) { sys_msg('invalid param'); } $id = intval($_POST['id']); $auction = auction_info($id); if (empty($auction)) { sys_msg($_LANG['auction_not_exist']); } if ($auction['status_no'] != FINISHED) { sys_msg($_LANG['invalid_status']); } if ($auction['deposit'] <= 0) { sys_msg($_LANG['no_deposit']); } /* 处理保证金 */ $exc->edit("is_finished = 2", $id); // 修改状态 if (isset($_POST['unfreeze'])) { /* 解冻 */ log_account_change($auction['last_bid']['bid_user'], $auction['deposit'], -1 * $auction['deposit'], 0, 0, sprintf($_LANG['unfreeze_auction_deposit'], $auction['act_name']));
/** * 获取用户参与活动信息. * * @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; }