Beispiel #1
0
		<ul class="nav navbar-nav">
			<li class="divider"></li>
			<li><a href="#hall" title="大厅">大厅</a></li>
			<li><a href="#mywall" title="我的墙">我的墙</a></li>
			<li><a href="#inprogress" title="动态(建设中)" class="unimplemented">动态</a></li>
			<li><a href="#inprogress" title="消息(建设中)" class="unimplemented">消息</a></li>
		</ul>
		<ul class="nav navbar-nav navbar-right">
			<?php 
    global $loginUser;
    if ($loginUser) {
        ?>
			<li> <a href="#inprogress" title="我的资料(建设中)" class="unimplemented" style="text-decoration:none">
				<?php 
        $info = WaUser::GetUserInfo($loginUser);
        $data = WaUser::GetUserData($loginUser);
        if ($info) {
            echo '您好,' . $info['user_name'];
        }
        ?>
				</a></li>
			<?php 
        if (!signedIn($loginUser)) {
            ?>
			<li>
				<button id="sign-btn" class="btn btn-warning navbar-btn">点击签到</button>
			</li>
			<?php 
        } else {
            ?>
			<li>
Beispiel #2
0
function createPost($wall, $title, $content)
{
    global $loginUser;
    if (!$loginUser) {
        returnError('请先登录');
        return;
    }
    try {
        $userData = WaUser::GetUserData($loginUser);
        if (!$userData) {
            throw new Exception('获取用户失败。');
        }
    } catch (Exception $e) {
        returnError($e->getMessage());
        return;
    }
    $wealth = $userData['user_wealth'];
    if ($wealth < 1) {
        returnError('墙砖不够。');
        return;
    }
    $userData['user_wealth'] -= 1;
    $userData['user_exp'] += 1;
    try {
        $ret = WaPost::CreatePost($wall, $title, $content, $loginUser);
        if (!$ret) {
            throw new Exception('创建帖子失败。');
        }
        $ret = WaUser::SetUserData($loginUser, $userData);
        if (!$ret) {
            throw new Exception('扣墙砖失败。');
        }
    } catch (Exception $e) {
        returnError($e->getMessage());
        return;
    }
    $ret = array('post_id', $ret);
    echo json_encode($ret);
}